I have written a code to send data to serial port /dev/ttyACM0. Basically this is used with the GSM modem to send an SMS. The AT command to set the sms in memory and send it are
First I need to write the following in serial port "AT+CMGW=16\r"
Then write the following pdu converted message 069110090000F111000A9210299232900000AA03C8F40F and then send ctrl-z
I have issues with sending ctrl-z
say message = "069110090000F111000A9210299232900000AA03C8F40F" I have tried
strcat(message,"\x1A"); //Does not work
strcat(message,"\032"); //Does not work
I have even tried my hand at a function which adds a char to char*
void append(char *s,char c)
{
int len = strlen(s);
s[len] = c;
s[len+1] = '\0';
}
append(message, '\032'); //Does not work
append(message, '\x1A'); //Does not work
I need to read the receive buffer of the port to check for the count Example +CMGW:4
And then write AT+CMSS=3\r to send the message.
Typing the above AT commands on minicom sends the SMS. But in C code I just cannot type ctrl-z.
Does anyone know how to go about it?
Any help is appreciated Thank you