Ver Mensaje Individual
  #2  
Antiguo 13-06-2011
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.734
Reputación: 20
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
Quizás tengas que esperar un ">" después de cada línea que envías.

Código Delphi [-]
procedure TForm1.BEnviarClick(Sender: TObject);
var
  strnumero:string;
  rec: string;
begin
  SdpCel.Active:= True;
  strnumero:= EArea.text + ENumero.text;
  //agregar al final ctrl+z (ascii 26)

  SdpCel.WriteData('AT+CMGS="' + strnumero +'"' + #13);
  // Si recibio el comando con el nro. de telefono debe responder ">". 
  rec:= SdpCel.ReadData;
  if (rec <> '>') then
     raise exception "ERROR enviando primera linea. "+rec

  SdpCel.WriteData(MMensaje.Text + #13);
  // Si recibio el texto del mensaje debe responder ">". 
  rec:= SdpCel.ReadData;
  if (rec <> '>') then
     raise exception "ERROR enviando segunda linea. "+rec

  SdpCel.WriteData(#26);
  // Aqui no se si se espera un ">" o un "Ok"
  rec:= SdpCel.ReadData;
  if (rec <> '>') then
     raise exception "ERROR enviando tercera linea. "+rec

  rec:= SdpCel.ReadData;
  if (UpperCase(rec) = 'OK') then 
     ShowMessage('Mensaje enviado correctamente')
end;
Responder Con Cita