Hi Guys

I want to use ModemDriver.py (v2.0.13) to send and receive SMS via a Mobile Broadband modem.

Please don’t tell me to use Wammu/Gammu etc. I have wasted weeks trying to get then to work correctly!

I can get things working via the command line. What I want to do is send a SMS message from within a Python program, then get a SMS reply and process it within the program.

I am at a loss as how to call the various functions in ModemDriver.py. There does not seem to be a defined API and trawling through the Python code seems to send me in ever decreasing circles!

So, before I ‘vanish’, can someone give me some pointers, or an example to get me started.

Thanks

I read the docs quickly. If I read it correcty, there is no advertised funkcionality in modemdriver.py, that allows you to use it as a library. As you said it.

If all else fail you can construct the command line and the files needed in python, and run the whole thing with subprocess.

To send sms you type:
python ModemDriver.py -d /dev/ttyUSB0 -p sms.txt

You create the sms.txt file as you like, store the command line parameters in variables and issue the following:

p = subprocess.Popen(['python', 'ModemDriver.py', '-d' ....], stdin=subprocess.PIPE, stdout=subprocess.PIPE)

Then you read stdout and decide if the sms was sent or not.

Hi slate

Thanks for your reply. I had come to the conclusion that I needed to work along the lines you indicated.

HOWEVER I no longer need to use ModemDriver!

I have located Python-gsmmodem and it contains python code to do what I want.

I am able to get my credit balance using ussd and send a sms message.

Thanks again for taking the time to reply

Regards

W Price

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.