Connecting Tech Pros Worldwide Forums | Help | Site Map

Python: SMS listener and generator

Newbie
 
Join Date: Oct 2009
Posts: 1
#1: 4 Weeks Ago
Hi all,

I am developing a simple application on GM862 GPS modem using python script. I want to toggle a GPIO (General Purpose IO)pin on the board from a SMS. Like if a SMS text says "ON", the pin should set to "1" and if it says "OFF", pin should set to "0".
I think I can do the toggling part but where I am facing difficulty is:
1. How to detect an incoming SMS. On the Rsterm it does show the response as "+CMTI: SM, 2" but how to listen using a python script.
2. How to extract the SMS text using python and use it for invoking desired tasks.

Also I want to send an SMS from the modem using python script. I wrote this script this nothing happens. It doesnt show any error but SMS is not sent also.
Expand|Select|Wrap|Line Numbers
  1. import MDM
  2.  
  3. MDM.send('AT\r', 20)
  4. MDM.send('AT+CMGF=1\r', 20)
  5. MDM.send('AT+CMGS = 585XXXXXXX, 129\r', 20)
  6. MDM.send('Hi Modem...this is a test SMS for you!!!\n', 20)
  7. MDM.send('chr(26)', 20)

I would really appreciate if someone could guide me on this.

Thanks

Reply

Tags
python, sms