python - How can I send an SMS via AT command with Zoom 7.2m Tri-Band USB Modem? -
i trying make simple python 2.6 application on osx 10.6.6 can send , receive sms on zoom 7.2m (3g) usb modem.
on plugging usb modem, no tty or cu sessions seem created. have run modem software initiate following sessions;
cu.ljadeviceinterface2621 cu.ljadiagconnector2620 cu.ljamobileconnector2622 tty.ljadeviceinterface2621 tty.ljadiagconnector2620 tty.ljamobileconnector2622
after "fun", seems session can read , write "cu.ljadeviceinterface2621". on attempting connect tty instance of this, error -
serial.serialutil.serialexception: not open port /dev/tty.ljadeviceinterface2621: [errno 16] resource busy: '/dev/tty.ljadeviceinterface2621'
thats fine though - @ least have work with, cu equivalent.
my script follows;
ser = serial.serial("/dev/cu.ljadeviceinterface2621", 9600, timeout=1) print "setting dtr..." ser.setdtr(true) sleep(3) print "turning off dtr..." ser.setdtr(false) searching = true ser.setdtr(true) while searching: print "write instruction..." txt=raw_input() if txt.find("zz")>-1: txt=txt.replace("zz",chr(13)) ser.write(txt) ser.close()
now, have script monitoring messages on "cu.ljadeviceinterface2621". script follows;
ser = serial.serial("/dev/cu.ljadeviceinterface2621", 9600, timeout=1) print "attempting search." while true: line = ser.readline() print ">", line
with these scripts both running, in write code, enter following lines;
(note: zz input replaced ctrl-z via write script above - chr(13))
at+cmgf=1zz [press enter commit write]
ok
at+cmgw="+447725123123"\r\n [press enter commit write]
error
i should writing text of message, followed ctrl-z (chr(13) immediate error.
the usb modem has valid sim, credit, has signal, can send text zoom modem software (this works in pdu mode - modem support text mode, per at+cmgf=? command) , receive messages.
any ideas?
happy provide more information needed, stu
also remember there many projects out there task (pysms 1 of them)
Comments
Post a Comment