This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
phone:gammu_send_sms [2011/05/29 20:24] flozz [Send SMS from the command line] |
phone:gammu_send_sms [2017/09/01 12:24] (current) |
||
---|---|---|---|
Line 21: | Line 21: | ||
FIXME | FIXME | ||
+ | <code python sendsms.py> | ||
+ | #!/usr/bin/python | ||
+ | # -*- coding: UTF-8 -*- | ||
+ | |||
+ | import gammu | ||
+ | |||
+ | |||
+ | SMS = { | ||
+ | 'Class': 1, #SMS Class | ||
+ | 'Text': "Hello World from Python", #Message | ||
+ | 'SMSC': {'Location': 1}, | ||
+ | 'Number': "+336xxxxxxxx", #The phone number | ||
+ | } | ||
+ | |||
+ | |||
+ | gamu_sm = gammu.StateMachine() | ||
+ | gamu_sm.ReadConfig() #Read the default config file (~/.gammurc) | ||
+ | gamu_sm.Init() #Connect to the phone | ||
+ | |||
+ | gamu_sm.SendSMS(SMS) #Send the SMS | ||
+ | |||
+ | </code> | ||
===== EXAMPLE: A simple Python application with a GTK2 GUI ===== | ===== EXAMPLE: A simple Python application with a GTK2 GUI ===== | ||
FIXME | FIXME | ||