问题
i want to use GSM Modem in an application for some purpose.
what i want is handling SMS delivery report for list of sent sms.
GSM Modem inbox & outbox are limited to 15 items. every time i read the inbox the gsm modem return a list an clear the list.
how to check delivery status of sms that had been deleted from GSM Modem inbox ?
i need something unique that enables me to identify each message.
回答1:
every time i read the inbox the gsm modem return a list an clear the list.
Messages that are stored in modem's memory will not be removed after you read them. You just read message with at+cmgl={message id in storage}
command and then remove it using at+cmgd={message id in storage}
command (or not, as you wish. You can clear all modem's storages using at+cmgd=1,4
command).
Back to the question: after sending SMS, you'll get a response from modem, smth like this: +cmgs: {sms id, 0 to 255} OK
. In case, if Service Center has delivered the SMS successfully, modem will return this response: +cds: {some id which does not matter} {PDU status report}
. You need just decode this PDU to obtain status report, id of original SMS and other useful data. If sent sms's ID and ID from status report are equal, you have status report exactly for your message. Note, if you remove message from modem's storage before receiving of delivery report, you'll get report which will be containing all usual information, but status of delivery will be most likely 71 instead of 0.
来源:https://stackoverflow.com/questions/18251903/how-to-handle-delivery-report-in-gsm-modem