I’m currently developping a Java application to send SMS messages stored in a database.
I can already send SMS messages (PDU mode) but not all messages are received (around 50%). When I get the messages from the database and send them to the fastrack modem, it can’t handle them so fast after each other.
I first use this command: AT+CMMS=2
This will keep the link open while messages are sent.
After that, I switch on the PDU mode: AT+CMGF=0
Now I start with sending the messages:
First (In java, pdu length has been calculated): “AT+CMGS=” + pdu.length // set length of PDU
After that, the message itself:
Port.write(“00”); // prepare for the PDU
Port.write(SMSTools.toHexString(pdu)); // set PDU
Port.write("\u001A"); // set Ctrl-Z = indicates end of PDU
All these steps of course work fine.
The log (4 messages have to be sent):
As you can see, the error +CME ERROR: 515 comes up which means that the modem is still busy with previous commands.
I can catch these error messages and put my loop in Java to -1 to send the previous message again, but this is not a good way to do (Are the messages send to the provider? So does it cost money?). I can also sleep the application for a few seconds but it will happen that I need to send more than 500 messages. This will take way too long.
Anybody has an idea how I can send a lot off messages the fastest way without the modem still being busy? (Like putting it into a “waiting to be sent” group)