To: | |
---|---|
Subject: | Re: [ts-7000] Re: TS-GSM1 send SMS |
From: | ApOgEE <> |
Date: | Mon, 8 Mar 2010 12:36:27 +0800 |
Hi haiqal,
I normally use minicom or screen to connect to the GSM modem from my TS7260. If you use Debian, you can install it using this command: apt-get install minicom apt-get install screen
here is some snippet if you like to try: # ----------------------- begin snippet -------------------- #!/usr/bin/python """ Developer: Muhammad Fauzilkamil Zainuddin Started: 04 Aug 2008 Purpose: Send SMS using Python Requires: Python configobj.py pySerial """ import sys, os import subprocess import string import time from configobj import ConfigObj import serial # function to send data to GSM modem - by M. Fauzilkamil Zainuddin def sendmdm(ser,commands): mreply=[] if ser.isOpen(): ser.write(commands) time.sleep(0.5) norepcount = 0 while 1: out = ser.readline() if out.strip()=='OK': mreply.append(out.strip()) break if out.strip()=='>': mreply.append(out.strip()) break if out.strip()!='': mreply.append(out.strip()) if out.strip() == 'ERROR': mreply.append(out.strip()) break if not out: if norepcount > 10: break norepcount = norepcount + 1 time.sleep(0.5) return mreply # end of sendmdm function # function sendsmsdata - by M. Fauzilkamil Zainuddin def sendsmsdata(sphone,smsdata): smodem="/dev/ttyTS0" sbaud="9600" ser = serial.Serial(smodem,sbaud,timeout=0.2) fret = 0 ser.open() if ser.isOpen(): mrep = sendmdm(ser,'at+cmgs="' + sphone + '"\r') if len(mrep) > 0: if mrep[len(mrep)-1] == '>': mrep = sendmdm(ser,smsdata + '\x1A') if len(mrep) > 0: if mrep[len(mrep)-1] == 'OK': fret = 1 ser.close() return fret # end sendsmsdata function # example of sending SMS if sendsmsdata("60193701234","This is the SMS message from Malaysia") == 1: print "Message Sent" else: print "send data via sms Failed" # --------------------------------------------------------------------- end snippet ----------- -- Best Wishes, M. Fauzilkamil Zainuddin Software Engineer Persiasys Sdn. Bhd. ---------------------------------------------------- ApOgEE a.k.a JeRuNgKuN ---------------------------------------------------- https://edge.launchpad.net/~apogee - ApOgEE on LaunchPad http://artofapogee.blogspot.com - Art Of ApOgEE http://coderstalk.blogspot.com - Coder's Talk ---------------------------------------------------- __._,_.___
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required) Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe __,_._,___ |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | Re: [ts-7000] Porting U Boot onto TS7200, Balaji Ravindran |
---|---|
Next by Date: | Re: [ts-7000] Porting U Boot onto TS7200, Petr Štetiar |
Previous by Thread: | [ts-7000] Re: TS-GSM1 send SMS, naturalwatt |
Next by Thread: | Re: [ts-7000] Re: TS-GSM1 send SMS, fais faiz |
Indexes: | [Date] [Thread] [Top] [All Lists] |
Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU