1 2 3 4 5 6 7 8 | Port: /dev/ttyUSB2 (这个不行就换个试试) Connection: at19200 Model: 空 Synchronize times: yes Log file: 空 Log format: nothing Use locking: 空 Gammu localisation: 空 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Gammu library configuration, see gammurc(5) [gammu] # Please configure this! port = /dev/ttyUSB2 connection = at # Debugging #logformat = textall # SMSD configuration, see gammu-smsdrc(5) [smsd] RunOnReceive = /home/pi/smsutil.py service = sql driver = native_mysql logfile = /var/log/gammu-smsd host = localhost pc = localhost user = root password = chungechunyemen database = smsd # Increase for debugging information debuglevel = 0 ReceiveFrequency = 60 PIN = 1234 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import gammu import sys sm = gammu.StateMachine() # Read ~/.gammurc sm.ReadConfig() try: sm.Init() netinfo = sm.GetNetworkInfo() print 'Network name: %s' % netinfo['NetworkName'] print 'Network code: %s' % netinfo['NetworkCode'] print 'LAC: %s' % netinfo['LAC'] print 'CID: %s' % netinfo['CID'] # Prepare message data # We tell that we want to use first SMSC number stored in phone phone_number = raw_input('Enter Phone Number:\n').decode('utf-8') message = raw_input('Enter text:\n').decode('utf-8') message = { 'Text': message, 'SMSC': {'Location': 1}, 'Number': phone_number, 'Coding': 'Unicode_No_Compression', } # Actually send the message sm.SendSMS(message) except Exception,e: print e |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |