+CMGS | Send message |
+CMSS | Send message from storage |
+CMGW | Write message to memory |
+CMGD | Delete message |
+CMGC | Send command |
+CMMS | More messages to send |
To send SMS’s you need to put the device in “Text” mode. This is done by sending the following command:
AT+CMGF=1 # Puts the mode in text modeTo send an SMS do the following:
AT+CMGS=”+35386827XXXX”When you type in the line with the phone number the “>” will come up automatically. Type in your message and when you are finished type in CTRLZ (as in ctrl key and z at the same time).
> 3G Rocks!!!!
CTRL-Z
Good so far? But how about incoming messages. Have no fear, DBTR is here!!!
AT+CMGL=”all” #To get a list of SMS’s type in :There are quite a few other commands that the Huawei understands. I’ll post them later.
AT+CMGR=0 #get an individual message
AT+CMGD=n #Delete a message where n is the number returned by the list above.
To hangup just do CTRLA x.
-----------------
AT
OK
AT+CMGF=1
OK
AT+CMGW="+85291234567"
> A simple demo of SMS text messaging.
+CMGW: 1
OK
AT+CMSS=1
+CMSS: 20
OK
------------------------
Sending SMS
First of all, the simplest option is to put the device into text mode. This is done with the following command:
chat TIMEOUT 1 "" "AT+CMGF=1" "OK" > /dev/tts/USB2
The terminal on which you are running cat should come back wtih the result:
AT+CMGF=1
OK
If it doesn’t, then either you are not watching the correct device, or your USB dongle’s firmware does not support SMS.
The next step is to tell the modem what number to send the text message to. Note the escaped quotes in the following command. When nesting similar quotes in such a manner, we must tell the terminal to treat the inner quotes as plain text to avoid the command trying to process them as part of the command line. Replace the xxxxxxxxxxx with the telephone number you wish to send the SMS to.
chat TIMEOUT 1 "" "AT+CMGS=\"xxxxxxxxxxx\"" "OK" > /dev/tts/USB2
On your second terminal, you should see the response:
AT+CMGS="xxxxxxxxxxx"
>
This is a prompt to enter the SMS’s text in plaintext format. The command is simply:
chat TIMEOUT 1 "" "Message text goes here" "OK" > /dev/tts/USB2
To insert a new line of text, just repeat this command.
To finalise the message, normally you would press . To emulate this, we use the ^ character. This will cause the terminal to treat it as if you have pressed the CTRL key followed by the next character. The command reads as follows:
chat TIMEOUT 1 "" "^Z" "OK" > /dev/tts/USB2
After a couple of seconds, your watching terminal should respond with:
+CMGS: n
n will be a number corresponding to the number of sent messages from the device.
You should now have the text message arrive at the destination telephone number.
Simples.
Receiving SMS
First step, as with sending SMS, is to put the device into text mode. This is exactly the same command used before:chat TIMEOUT 1 "" "AT+CMGF=1" "OK" > /dev/tts/USB2
As an optional step, you can list all of the SMS stored on the SIM like so:
chat TIMEOUT 1 "" "AT+CMGL" "OK" > /dev/tts/USB2
The only real requirement for reading SMS, however, is to choose the index number of the SMS you wish to read. This is done with this command:
chat TIMEOUT 1 "" "AT+CMGR=n" "OK" > /dev/tts/USB2
In order to delete a SMS, should you so wish, it is done via a very similar command:
chat TIMEOUT 1 "" "AT+CMGD=n" "OK" > /dev/tts/USB2
That’s all I’m gonna talk you through, but there are countless resources online for finding out what some other AT commands are, and it’s quite interesting just firing them at the device to see what the response is, and I encourage you to have a mess about… Be careful when messing around with the SIM PIN codes, though, and it’s not my fault if you lock yourself out of your kit!
Hope I’ve been of use!
As always… Any questions/mistakes I’ve made, just leave a comment.
n00b
Comments : Leave a Comment »
Categories : Uncategorized
Комментариев нет:
Отправить комментарий