I am using QextSerialPort
to access ports
#include
#include
#include
int main(int
Your problem is the following:
port->write("AT+CFUN=1");
port->write("AT+CMGF=1 ");
port->write("AT+CMGS=1234567");
port->write("Hello Test SMS");
Always after sending a AT command line to the modem, you MUST wait for the final result code (e.g. typically OK
or ERROR
although there are some more, and you must be prepared to handle all of them. For an example of how to wait for final result codes, you can look at the source code of atinout, which is a tiny program for reading a list of AT commands, send them to the modem and print the responses).
Because without waiting the following command will abort the currently executing command. Abortion of AT commands is defined in section "5.6.1 Aborting commands" in V.250. If you have little experience with handling AT commands, that specification is a must read. Also you would do well in reading 27.005 for the +CMG... commands you use. You find links to the specifications on the at-command tag information.
For AT+CMGS
specifically you must also wait for "\r\n> " before sending the text, see my other answer.