Sending an SMS Message
Ricky
arcanericky at gmail.com
Fri Aug 3 04:32:09 CEST 2007
Someone here was talking about sending / receiving SMS messages. My motive
to figure out how to do this on my Neo was that I needed to activate an
online account and add more minutes. They wanted to send me an SMS message
with my initial password. Necessity being the mother of learning...
I had trouble getting this to work and getting all the text returned using
libgsmd-tool. It seems gsmd doesn't care for "unsolicited messages" and
when I ask to retrieve all my messages, a lot of data is returned which gsmd
doesn't like, and therefore drops it instead of sending it back to
libgsmd-tool.
That's ok. cu is pretty easy to use - I just used it instead.
To get into an SMS mode (there are two modes - PDU and text mode). I think
gsmd prefers PDU mode, but I learned to do it text mode. Switching over is
easy. You can read up on it here:
http://www.developershome.com/sms/operatingMode.asp
I think the following will turn off, then on, the gsm modem. I do it in an
attempt to reset the modem and start from a known state. If anyone knows
anything about this, please elaborate.
Turn gsm off:
echo 0 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on
Turn gsm back on:
echo 1 > /sys/bus/platform/devices/gta01-pm-gsm.0/power_on
And fire up cu:
cu -l /dev/ttySAC0
Once you get the "Connected." line hit [Enter] a few times or "AT" followed
by [ENTER] and you should get an "OK". Now go at it...
Turn on echoing so you can see what you're doing (use control-H to backspace
on mistakes):
ATE1
Then register or "turn on" the network. Can't remember exactly what these
commands mean:
AT+CFUN=1
AT+COPS
Then go into SMS mode:
AT+CMGF=1
Now you can play. If you've already sent yourself an SMS message to your
phone, you can now retrieve it - and all the others with:
AT+CMGL="ALL"
+CMGL: 1,"REC READ","907",,"07/07/30,18:21:45-20",129,156
Welcome to T-Mobile! To check your balance and refill your account, go to
my.t-mobile.com or visit t-zones on your phone. Your T-Mobile number is
XXXXXXXXXX
+CMGL: 2,"REC READ","907",,"07/07/30,18:59:33-20",129,156
Welcome to T-Mobile! To check your balance and refill your account, go to
my.t-mobile.com or visit t-zones on your phone. Your T-Mobile number is
XXXXXXXXXX
+CMGL: 3,"REC READ","XXXXXXXXXXX",,"07/08/02,15:01:51-20",145,5
Hello
+CMGL: 4,"REC READ","501",,"07/08/02,15:14:43-20",129,92
tselfcare at t-mobile.com /Temporary Password /Dear Customer, Your temporary
password is XXXXXX
+CMGL: 5,"REC READ","724",,"07/08/02,15:18:42-20",129,150
Your balance is 140 minutes ($28.04). You are $75 from Gold Rewards where
you get 15% more minutes on subsequent refills & unused minutes last a year.
+CMGL: 6,"REC READ","724",,"07/08/02,15:18:42-20",129,145
Free MSG: $25.00 has been added to your account. Your new balance is 140
minutes and the new expiration date is 10-31-2007. Thanks for refilling!
OK
And to send a message, it's:
AT+CMGS="Phone #"
Then press the [Enter] key and you'll get a ">" prompt. Enter your message
and press control-Z.
For example:
AT+CMGS="1234567890"
> HOWDY
Then hit control-Z
You should get an "OK" and the message should be on its way.
I'm sure someone here can go through and make these directions a little
better. Just wanted to get things started - then maybe we can get them
added to the wiki.
Again - you can learn a lot more about SMS at the above web page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/device-owners/attachments/20070802/2c61aaba/attachment.html
More information about the device-owners
mailing list