I'm trying to handle STK from my c# application. But facing problem with Ctrl z key.

When I'm sending an SMS using the following code it is OK.

char ctrlZ = (char)26;
char enter= (char)13;

serialPort.WriteLine("AT" + enter);
Thread.Sleep(120);
serialPort.WriteLine("AT+CMGF=1" + enter);
Thread.Sleep(120);
serialPort.WriteLine("AT+CMGS=""" + cellNo + @"""" + enter);
Thread.Sleep(120);
serialPort.WriteLine(messages + ctrlZ);

But when I'm trying with the following code to handling STK getting error:

serialPort.WriteLine("AT" + enter);
Thread.Sleep(120);
serialPort.WriteLine("AT+STGI=0" + enter);
Thread.Sleep(500);
serialPort.WriteLine("AT+STGR=0,1,1" + enter);
Thread.Sleep(500);
serialPort.WriteLine("AT+STGI=3" + enter);
Thread.Sleep(500);
serialPort.WriteLine("AT+STGR=3,1" + enter);
Thread.Sleep(500);
// After this line I'm getting > to input text.
serialPort.WriteLine("1818016400" + ctrlZ);

I tried with all possible key code for ctrlZ. Like (char)26, \x001a, \u001a, \x001A, \u001A

Here is the serial port property:

serialPort.PortName = "COM8";
serialPort.BaudRate = 9600;
serialPort.Parity = Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = StopBits.One;
serialPort.Handshake = Handshake.None;
serialPort.Encoding = Encoding.ASCII;
serialPort.DtrEnable = true;
serialPort.RtsEnable = true;
serialPort.ReadBufferSize = 1024;
serialPort.WriteBufferSize = 1024;
serialPort.DiscardNull = true;

For your information I'm using Wavecom GSM model.

Anybody have any idea about it?

Thanks


« Last edit by shohelic on Tue Oct 11, 2011 04:39, 154 months ago. »