Post by dongtrieni'm us
A
O
AT+CMGF=
O
AT+CMGS="0902563xxx
OK
you sent something..
return OK, but why i not found Incoming message to the phone numbe
0902563xxx ?
When you enter the command
AT+CMGS="0902563xxx
the E63 should reply with a "" prompt. At that point, you typ
the text to be sent, but you don't press the Enter key
Instead, you give the E63 the ctrl-Z character. This i
character 26 decimal
The E63 should then respond by sending the text and giving you
message reference number, like this
+CMGS: 4
Unless you get that reference number, you should assume that th
SMS was not sent
What preference have you got set for the SMS carrier moce
circuit-switched or packet-switched? The command
AT+CGSMS
will tell us
thank you, I forgot to type Ctrl-Z character, I now It send good wit
hyperterminal but I changed to language C#.net, it was error "Respons
received is incomplete," you see my code committee know why ? note: E6
modem connected to very goo
Code
-------------------
public bool sendMsg(SerialPort port, string PhoneNo, string Message
bool isSend = false
tr
{
string recievedData = ExecCommand(port,"AT", 300, "No phone connected"); // Error here: recievedData = "Response received is incomplete
recievedData = ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.")
String command = "AT+CMGS=\"" + PhoneNo + "\""
recievedData = ExecCommand(port,command, 300, "Failed to accept phoneNo");
command = Message + char.ConvertFromUtf32(26) + "\r"
recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 second
if (recievedData.EndsWith("\r\nOK\r\n")
isSend = true
else if (recievedData.Contains("ERROR")
isSend = false
return isSend
catch (Exception ex
throw ex;
}
public string ExecCommand(SerialPort port,string command, int responseTimeout, string errorMessage
tr
port.DiscardOutBuffer()
port.DiscardInBuffer()
receiveNow.Reset()
port.Write(command + "\r")
string input = ReadResponse(port, responseTimeout)
if ((input.Length == 0) || ((!input.EndsWith("\r\n> ")) && (!input.EndsWith("\r\nOK\r\n")))
throw new ApplicationException("No success message was received.")
return input
catch (Exception ex
throw ex
}
public string ReadResponse(SerialPort port,int timeout
string buffer = string.Empty
tr
{
d
if (receiveNow.WaitOne(timeout, false)
string t = port.ReadExisting()
buffer += t
els
if (buffer.Length > 0
throw new ApplicationException("Response received is incomplete.")
els
throw new ApplicationException("No data received from phone.")
while (!buffer.EndsWith("\r\nOK\r\n") && !buffer.EndsWith("\r\n> ") && !buffer.EndsWith("\r\nERROR\r\n"))
catch (Exception ex
throw ex
return buffer
-------------------
--
dongtrien