Python: SMS listener and generator

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahultripathi
    New Member
    • Oct 2009
    • 1

    #1

    Python: SMS listener and generator

    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.
    Code:
    import MDM
    
    MDM.send('AT\r', 20)
    MDM.send('AT+CMGF=1\r', 20)
    MDM.send('AT+CMGS = 585XXXXXXX, 129\r', 20)
    MDM.send('Hi Modem...this is a test SMS for you!!!\n', 20)
    MDM.send('chr(26)', 20)

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

    Thanks
Working...