python-gammu¶
A taste of python-gammu¶
Python-gammu allows you to easily access the phone. Following code will connect
to phone based on your Gammu configuration (usually stored in
~/.gammurc
) and gets network information from it:
import gammu
import sys
# Create state machine object
sm = gammu.StateMachine()
# Read ~/.gammurc
sm.ReadConfig()
# Connect to phone
sm.Init()
# Reads network information from phone
netinfo = sm.GetNetworkInfo()
# Print information
print 'Network name: %s' % netinfo['NetworkName']
print 'Network code: %s' % netinfo['NetworkCode']
print 'LAC: %s' % netinfo['LAC']
print 'CID: %s' % netinfo['CID']
API documentation¶
gammu
– Mobile phone accessgammu.smsd
– SMSD accessgammu.data
– Generic data usable with Gammugammu.worker
- Asynchronous communication to phone.gammu.exception
– Gammu exception handlinggammu.GSMError
gammu.ERR_ABORTED
gammu.ERR_BADFEATURE
gammu.ERR_BUG
gammu.ERR_BUSY
gammu.ERR_CANCELED
gammu.ERR_CANTOPENFILE
gammu.ERR_CORRUPTED
gammu.ERR_COULDNT_CONNECT
gammu.ERR_COULDNT_RESOLVE
gammu.ERR_DATACONVERTED
gammu.ERR_DEVICEBUSY
gammu.ERR_DEVICECHANGESPEEDERROR
gammu.ERR_DEVICEDTRRTSERROR
gammu.ERR_DEVICELOCKED
gammu.ERR_DEVICENODRIVER
gammu.ERR_DEVICENOPERMISSION
gammu.ERR_DEVICENOTEXIST
gammu.ERR_DEVICENOTWORK
gammu.ERR_DEVICEOPENERROR
gammu.ERR_DEVICEPARITYERROR
gammu.ERR_DEVICEREADERROR
gammu.ERR_DEVICEWRITEERROR
gammu.ERR_DISABLED
gammu.ERR_EMPTY
gammu.ERR_EMPTYSMSC
gammu.ERR_FILEALREADYEXIST
gammu.ERR_FILENOTEXIST
gammu.ERR_FILENOTSUPPORTED
gammu.ERR_FOLDERNOTEMPTY
gammu.ERR_FOLDERPART
gammu.ERR_FRAMENOTREQUESTED
gammu.ERR_FULL
gammu.ERR_GETTING_SMSC
gammu.ERR_GNAPPLETWRONG
gammu.ERR_INSIDEPHONEMENU
gammu.ERR_INSTALL_NOT_FOUND
gammu.ERR_INVALIDDATA
gammu.ERR_INVALIDDATETIME
gammu.ERR_INVALIDLOCATION
gammu.ERR_MEMORY
gammu.ERR_MOREMEMORY
gammu.ERR_NEEDANOTHERANSWER
gammu.ERR_NETWORK_ERROR
gammu.ERR_NONE
gammu.ERR_NONE_SECTION
gammu.ERR_NOSERVICE
gammu.ERR_NOSIM
gammu.ERR_NOTCONNECTED
gammu.ERR_NOTIMPLEMENTED
gammu.ERR_NOTRUNNING
gammu.ERR_NOTSUPPORTED
gammu.ERR_OTHERCONNECTIONREQUIRED
gammu.ERR_PERMISSION
gammu.ERR_PHONEOFF
gammu.ERR_PHONE_INTERNAL
gammu.ERR_READ_ONLY
gammu.ERR_SECURITYERROR
gammu.ERR_SHOULDBEFILE
gammu.ERR_SHOULDBEFOLDER
gammu.ERR_SOURCENOTAVAILABLE
gammu.ERR_SPECIFYCHANNEL
gammu.ERR_TIMEOUT
gammu.ERR_UNCONFIGURED
gammu.ERR_UNKNOWN
gammu.ERR_UNKNOWNCONNECTIONTYPESTRING
gammu.ERR_UNKNOWNFRAME
gammu.ERR_UNKNOWNMODELSTRING
gammu.ERR_UNKNOWNRESPONSE
gammu.ERR_USING_DEFAULTS
gammu.ERR_WORKINPROGRESS
gammu.ERR_WRITING_FILE
gammu.ERR_WRONGCRC
gammu.ERR_WRONGFOLDER
- Objects