I wanted to create an SMS application using Nokia 3310 with
DAU-9P(data cable), I am now able to get some data from the cell
phone. I'm using Pyserial and Siomodule. I use pyserial in my linux
system. Out of curiosity I've even tested the pyserial on my mouse to
prove that I'm really reading data from the external device connected
on my com2 or /dev/ttyS1 on linux. From this you would perhaps believe
that I've done the first phase of my plan.
The Problem:
I tried almost three weeks writing or sending a command to the
cell-phone but this gives me no response. I'm talking here about the
nokia 3310 connected to my serial port. The command that I send is the
AT command. From my pyserial I made an initialization like this
ser=serial.Serial('/dev/ttyS1',19200)
ser.readline()
ser.write()
ser.read()
When I connect to the port for the first time I get the ser.read()
output like this \x00\x0c I think. But that's two response is what I
get on my first connect. After that when I envoke ser.read() again, I
get nothing.
Now I've tried sending commands using the Nokia AT Command which was
taken from
this link here -> http://3ton.com/besik/ATNOKIA.pdf
The problem is, this still gives no response, when I type
ser.write('ATCGMI') or any other command, I get no response. Please
correct me if I'm wrong for using the Nokia At command on 3310, I
doubt that this At command applies only to some device of nokia
products like 6110 series, 71.. etc.
Thus, ser.read() would not give me anything. And that's my problem.
I tried installing SMS application that runs on windows
http://www.oxygensoftware.com/download/O2SMS_AX.zip because I doubt
that my cell phone is not woking on my sockets. But I found that it
works fine. I've tested that software, sending and receiving messages
and that works very ok.
I hope my explanation gives you enough information. I hope you could
help me with this because I plan to integrate this application on my
online/sms borrowing of books project part of my undergraduate
research.
I also tried writing to Mr. Frank Stajano, but it's already 2 weeks
and still I get no response. Perhaps his busy or doesn't want to talk
about this matter. Frank Stajano had already created an application
like this for his research and I think he even asks for help in this
group. His output an SMS python scripts is also not available.
The Thing that I really want to know is what kind of command will I
use to get some response from the nokia 3310? Is it also a hex
commands in which I will envoke \x00,.. etc commands. Or is it a flat
ASCII file also. I hope you could share some idea which regards to
this. Any idea regarding this would be of great help to me, I hope you
could give me one. Thanks
Polerio
I know nothing about Nokia but have had experience (and battle scars)
programming serial i/o. Two suggestions.
First: make *sure* you have serial protocol set right -- baud rate,
data bits, stop bits, parity, handshaking? Also make sure you have
proper pins active and properly connected. It is easy to be off.
Second: if you do not have one, get a breakout box that lets you see
activity at the port. Its the equivalent of having a
volt-ohm-ammeter. You plug cable into box and run another cable from
box to port. A simple one just has lights that flash when a signal
passes thru. More complicated one allows some signal patching. I got
mine long ago from Inmac. Would check google for source now.
That you *seem* to be getting response from Nokia and then not is
puzzling. Breakout box would give you better idea of what is
happening when.
Terry J. Reedy
Third: almost anything you can do from Python you could do using
something like Hyperterminal (ugh) under Windows, or miniterm
under Linux. If you can't get it working that way, you're probably
dealing with a non-Python issue. If you *can*, then duplicating the
configuration carefully as Terry advises above in "First:" will
almost certainly leading to better results.
-Peter
<< hack hack hack >>
> Now I've tried sending commands using the Nokia AT Command
> which was taken from this link here ->
> http://3ton.com/besik/ATNOKIA.pdf
>
> The problem is, this still gives no response, when I type
> ser.write('ATCGMI') or any other command, I get no response.
<< hack hack hack >>
Ah... shouldn't that be:
ser.write('ATCGMI\r')
... as in, don't you need the command-line-terminator?
Chris Gonnerman -- chris.g...@newcenturycomputers.net
http://newcenturycomputers.net
>I tried almost three weeks writing or sending a command to the
>cell-phone but this gives me no response. I'm talking here about the
>nokia 3310 connected to my serial port. The command that I send is the
>AT command. From my pyserial I made an initialization like this
>ser=serial.Serial('/dev/ttyS1',19200)
>ser.readline()
>ser.write()
>ser.read()
>
>When I connect to the port for the first time I get the ser.read()
>output like this \x00\x0c I think. But that's two response is what I
>get on my first connect. After that when I envoke ser.read() again, I
>get nothing.
Something like
import serial
ser=serial.Serial(0,19200,timeout=3)
print ser.portstr
ser.write("ATZ\r")
print "got"
line=ser.read(10)
print line
ser.close()
worked on the first try on my w2k box, when connected to a Siemes S25
via COM1. I bet it will would with the Nokia, too, because "ATZ" is
almost universally understood. :-)
My wife had asked me to dump all her phonebook numbers from her handy
for backup purposes. Siemens only sold an somewhat expensive program
for the S25, which I didn't buy. A program that I've got with a newer
S45 unfortunately didn't even recognize the S25.
The following qick&dirty snippet did the trick, and it works with both
the s25 and the s45.
# Strobl 19.9.2002 $Id: s25.py,v 1.3 2002/09/21 07:16:12 cvsroot Exp $
# read phonebooks from Siemens S25 or S45
import serial,re
def readuntilok(s):
ol=[]
while 1:
c=s.read()
if not c:
break
ol.append(c)
ostring="".join(ol)
if len(ol)>3 and ostring[-4:]=="OK\r\n":
break
return ostring
def cmd(s,cmd):
s.write(cmd+"\r")
r=readuntilok(s)
r=r.split("\n")
for i in range(len(r)):
r[i]=r[i][:-1]
return r
def showbook(ser,book):
select= cmd(ser,'AT+CPBS='+book)
if select[1]=="ERROR":
print "Error in showbook"
print
return
booksize=cmd(ser,"AT+CPBR=?")[1]
print booksize
siz=re.compile(r"\+CPBR: \((\d+)-(\d+)\)")
von,bis= siz.match(booksize).groups()
von=int(von)
bis=int(bis)
print "Phonebook",book
for i in range(von,bis+1):
buch=cmd(ser,"AT+CPBR=%d,%d"%(i,i))
if buch[1]!="OK": print repr(buch[1])
print
ser=serial.Serial(0,19200,timeout=3)
print ser.portstr
ser.write("ATZ\r")
print "sent"
line=ser.read(10)
print line
typ=cmd(ser,"AT+CGMI")[1]
print typ,
typ=cmd(ser,"AT+CGMM")[1]
print typ,
typ=cmd(ser,"AT+CGMR")[1]
print "Model",typ
print "IMSI",cmd(ser,"AT+CIMI")[1]
print "IMEI",cmd(ser,"AT+CGSN")[1]
uhrzeit=cmd(ser,"AT+CCLK?")
print "Uhrzeit",uhrzeit[1]
booksstring= cmd(ser,"AT+CPBS=?")[1]
print "Phonebooks",booksstring
for b in re.compile(r'"\w\w"').findall(booksstring):
print "----Now reading book",b
showbook(ser,b[1:-1])
print cmd(ser,"ATZ")
print cmd(ser,'AT+CPBS=SM')
print "writable",cmd(ser,"AT+CPBW=?")
print "Done"
ser.close()
------------------------
>pythonw -u s25.py
COM1
sent
ATZ
OK
SIEMENS S45 Model 23
IMSI xxxxxxxxxxxxxxxxxx
IMEI xxxxxxxxxxxxxxxxxx
Uhrzeit +CCLK: "02/09/21,09:11:57"
Phonebooks +CPBS: ("FD","SM","ON","ME","LD","MC","RC")
----Now reading book "FD"
+CPBR: (1-10),20,16
Phonebook FD
----Now reading book "SM"
+CPBR: (1-125),20,16
Phonebook SM
'+CPBR: 1,"xxxxxxxxxxxxxx",129,"xxxxx!"'
'+CPBR: 2,"xxxxxxxxxxxxxxxx",145,"xxxxx"'
etc.
['ATZ\r', 'OK', '']
['AT+CPBS=SM\r', 'OK', '']
writable ['AT+CPBW=?\r', '+CPBW: (1-125),20,(128-255),16', '', 'OK',
'']
Done
>Exit code: 0
--
Wir danken für die Beachtung aller Sicherheitsbestimmungen
had those too, that comes from the port opening
> The problem is, this still gives no response, when I type
> ser.write('ATCGMI') or any other command, I get no response. Please
> correct me if I'm wrong for using the Nokia At command on 3310, I
> doubt that this At command applies only to some device of nokia
> products like 6110 series, 71.. etc.
1st of all, i don't think that your phone understand AT commands at all...
my 3210 doesn't. instead there are two other protocolls: fbus and mbus
both protocols are binary. and to be able to talk to the phone i had to set
RTS to low! complely counter intuitive...
i have played around with fbus. i can send the sources to anyone
interested. i was able to read out the phone book and encoded (7bit
compressed or so) SMS, but it was some months ago. the sources are not
cleaned up but the low level part is usable.
> I also tried writing to Mr. Frank Stajano, but it's already 2 weeks
> and still I get no response. Perhaps his busy or doesn't want to talk
> about this matter. Frank Stajano had already created an application
> like this for his research and I think he even asks for help in this
> group. His output an SMS python scripts is also not available.
i'd be interested too, if you hear something.
> The Thing that I really want to know is what kind of command will I
> use to get some response from the nokia 3310? Is it also a hex
> commands in which I will envoke \x00,.. etc commands. Or is it a flat
> ASCII file also. I hope you could share some idea which regards to
> this. Any idea regarding this would be of great help to me, I hope you
> could give me one. Thanks
search for gnokii and you can have my sources for a start. the protocols
are not published, but the people at that project did some reverse
engineering.
sorry for the late response, but i completely missed that thread, just saw
it in the weekly summary.
chris
--
Chris <clie...@gmx.net>