The concept of Short Message class: according to the specified storage location, short messages are divided into four categories: Class 0-3. You can also choose not to specify a class (no class), which is processed by me according to the default settings and stored in the memory or SIM card. In the TP-DCS bytes of the tpdu, when the bit7-bit4 is 00x1, 01x1, 1111, The bit1-bit0 points out the message's class: 00-Class 0: display only, not store 01-Class 1: stored in me memory 02-Class 2: stored in SIM card 03-Class 3: directly transmitted to te Generally, GSM Modem supports an "at + cnmi" command, which can be used to set how to handle a short message when it arrives: it is only stored in the specified memory (easy to lose/non-easy). It is stored first and then notified to the Te, or directly forwarded to the Te. The "at + cnmi" command syntax is At + cnmi = [<mode> [, <Mt> [, <BM> [, <DS> [, <BFR>] Mode-notification method: 0-Te is not notified. 1-only notify the Te when the data line is idle; otherwise, the Te is not notified. 2-Notification te. When the data line is occupied, it is buffered first, and then notified when the data line is idle. 3-Notification te. When the data line is occupied, the notification is sent together. MT-message storage or direct forwarding to te: 0-store to the default memory location (including class 3) 1-store it in the default memory location and send a notification to te (including class 3) 2-for Class 2, store the message to the SIM card and send a notification to te; for other classes, directly forward the message to te 3-for Class 3, messages are directly forwarded to te; for other classes, the same as Mt = 1 For the meanings of BM, DS, and BFR, see the relevant standard documentation. Generally, you do not need to care about them. In the specific implementation of the program, it is relatively simple to use mode = 2, MT = 1. For all types of short messages, you only need to use the "at + cmgr" command to read the message content after receiving the "+ cmti" notification sent by me. The communication process between TE and me is as follows: (Initialization) At + cnmi =? (View the supported settings) + Cnmi: (0-2), (0-3), (, 3) OK At + cnmi? (View current settings) + Cnmi: 0, 0, 0, 0 OK At + cnmi = 2, 1 (set to mode = 2, MT = 1) OK At + cnmi? (View the current settings) + Cnmi: 2, 1, 0, 0 OK (After a while, a message arrives) + Cmti "Me", 8 (Notification: the message is already stored in the me memory and the serial number is 8) At + cmgr = 8 (read 8th messages) + Cmgr: 8, 27 08916830000200505f0240d916831588000064f80000402052110373800741e000058341e01 OK At + cmgd = 8 (delete 8th messages) OK From: http://hi.baidu.com/dtzw/blog/item/d238ef11f5d186c7a6ef3f41.html |