Thursday, June 23, 2005

AT Commands - Part 2

ln -s /dev/rfcomm1 /dev/modem

rfcomm1: 00:60:57:4D:D3:32 channel 1 closed

stty -a < /dev/modem speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

ln -s /dev/ttyACM0 /dev/modem #motorola v188 usb

cat /dev/modem &
echo > /dev/modem #for some reason the first echo gets ignored so we send a dummy
echo -ne "at+cmgf=1\r" >/dev/modem
echo -ne 'at+cmgl="ALL"\r' >/dev/modem #get messages in ASCII

+CMGL: 4,"STO UNSENT","+9545577504",,

How are you?


If you are operating in Text mode AT+CMGF=1 then the command is

This will list all the SMS in the SIM

If you are in PDU mode then you should use


>>3) Delete messages from sim

AT+CMGD= is the command to delete the message at position

echo -ne "at+cmgf=0\r" >/dev/modem #read messages in binary
echo -ne 'at+cmgl=4\r' >/dev/modem #ALL does not work in binary mode

+CMGL: 4,2,,24


#hello word in 7 bin binary
echo -ne "at+cmgs=23\r" >/dev/modem;sleep 1
echo -ne "07913121139418F011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

+CMGS: 59


#10 digit number beginning with area code "hello world"
echo -ne "at+cmgs=23\r" >/dev/modem;sleep 1;echo -ne "0011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

#11 digit number including country code
echo -ne "at+cmgs=24\r" >/dev/modem;sleep 1;echo -ne "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" >/dev/modem

[root@a1a ~]# echo -ne "at+cmgf=0\r" >/dev/ttyACM0
[root@a1a ~]# at+cmgf=0

[root@a1a ~]# echo -ne "at+cmgs=24\r" >/dev/ttyACM0
[root@a1a ~]# at+cmgs=24
[root@a1a ~]# echo -ne "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" >/dev/ttyACM0[root@a1a ~]# 0011000B919145337626F80000AA0BE8329BFD06DDDF723619
+CMGS: 3

send a binary message to 9546638946 "hello world" (please change number before trying this)
echo -ne "at+cmgf=0\r" >/dev/ttyS0
echo -ne "at+cmgs=24\r" >/dev/ttyS0; sleep 1;
echo -ne "0011000B919145668349F60000AA0BE8329BFD06DDDF723619^Z" >/dev/ttyS0

echo -ne "at+cmgs=15\r" >/dev/modem;sleep 1;echo -ne "0011000B919145337626F80004AA0122^Z" >/dev/modem #send ok but phone gets a "message could not be displayed"

Post a Comment