Friday, June 10, 2005

My Favorite Nokia AT commands

#/bin/sh
#make the rfcomm device files
c=0;
while [ $c -lt 256 ]; do
echo c=$c
if [ ! -c /dev/rfcomm$c ]; then
mknod -m 666 /dev/rfcomm$c c 216 $c
fi
c=`expr $c + 1 `
done

service bluetooth status
service bluetooth start
service bluetooth status
hciconfig hci0 down && hciconfig hci0 up
rfcomm bind 1 00:60:57:4D:D3:32 1
rfcomm show
rfcomm1: 00:60:57:4D:D3:32 channel 1 closed
rfcomm release 1
rfcomm bind 1 00:60:57:4D:D3:32 1
rfcomm show
rfcomm1: 00:60:57:4D:D3:32 channel 1 clean

[root@a1a peers]# hcitool scan
Scanning ...
00:60:57:4D:D3:32 Nokia3650



hcitool rssi 00:60:57:4D:D3:32; echo -e "at+csq\r" >/dev/modem
RSSI return value: 0
echo -e 'AT+CSCA?\r' >/dev/modem #to get the message center number from the phone
AT+CMGF=?
echo -e 'at+cmgs="9543367628"\r' >/dev/modem; echo -e 'Hi Bonita^Z' >/dev/modem
echo -e 'at+cmgl="ALL"\r' >/dev/modem
echo -e 'at+cbc\r' >/dev/modem #check battery
at+cbc

+CBC: 0,45

OK