Hi,
I have a project where I need to send an Text Message (SMS) to any mobile number using itegno 3800 GSM modem attached to a USB cable.
I can send SMS for only ordinary message like alphabet and numbers.
my problem is when i used to send a message containing (~) character it doesn't appear on the receiving mobile/device.
here is my code on sending:
port.PortName = p_strPortName;
port.BaudRate = p_uBaudRate;
port.DataBits = p_uDataBits;
port.StopBits = StopBits.One;
port.Parity = Parity.None;
port.ReadTimeout = p_uReadTimeout;
port.WriteTimeout = p_uWriteTimeout;
port.Encoding = Encoding.GetEncoding("iso-8859-1");
port.Handshake = Handshake.None;
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
System.Threading.Thread.Sleep(50);
port.Open();
port.DtrEnable = true;
port.RtsEnable = true;
string recievedData = ExecCommand(port, "AT", 300, "No phone connected");
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");
if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
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"))))
{
return input;
}
else
{
return input;
}
please don't mind some missing scripts as I only included some major codes.
my intent is to send SMS completely even it has a special character like (~).
Your feedback and comments are highly appreciated.
Thank you.
Michael John Bernarte