Package gammu :: Module Core
[hide private]
[frames] | no frames]

Module Core



Module wrapping Gammu functions. Gammu is software for communication with GSM phones allowing work with most of data stored in them. Most of functionality is hidden in StateMachine class which does all phone communication.

This documentation describes python-gammu 0.26.

This python-gammu has been compiled with Gammu 1.19.0.

Classes [hide private]
  StateMachine
StateNachine(Locale)
Functions [hide private]
hash
DecodeSMS(Messages, EMS)
Decodes multi part SMS message.
dict
EncodeSMS(MessageInfo)
Encodes multi part SMS message.
list
LinkSMS(Messages, EMS)
Links multi part SMS messages.
dict
ReadBackup(Filename, Format)
Reads backup into file.
list
ReadSMSBackup(Filename)
Reads SMS backup into file.
None
SaveBackup(Filename, Backup, Format)
Saves backup into file.
None
SaveRingtone(Filename, Ringtone, Format)
Saves ringtone into file.
None
SaveSMSBackup(Filename, Backup)
Saves SMS backup into file.
None
SetDebugFile(File)
Sets global debug file.
None
SetDebugLevel(Level)
Sets global debug level accorting to passed string.
tuple
Version()
Get version information.
Variables [hide private]
  ErrorNumbers = {1: 'ERR_NONE', 2: 'ERR_DEVICEOPENERROR', 3: 'E...
Mapping of gammu error codes to text representation.
  Errors = {'ERR_BADFEATURE': 61, 'ERR_BUG': 37, 'ERR_CANCELED':...
Mapping of text representation of errors to gammu error codes.
Function Details [hide private]

DecodeSMS(Messages, EMS)

 
Decodes multi part SMS message.
Parameters:
  • Messages (list) - Nessages to decode
  • EMS (bool) - Whether to use EMS, defalt to True
Returns: hash
Multi part message information

EncodeSMS(MessageInfo)

 
Encodes multi part SMS message.
Parameters:
  • MessageInfo (dict) - Description of message
Returns: dict
Dictionary with raw message

LinkSMS(Messages, EMS)

 
Links multi part SMS messages.
Parameters:
  • Messages (list) - List of messages to link
  • EMS (bool) - Whether to detect ems, defauls to True
Returns: list
List of linked messages

ReadBackup(Filename, Format)

 
Reads backup into file.
Parameters:
  • Filename (string) - Name of file where backup is stored
  • Format (string (Auto, AutoUnicode, LMB, VCalendar, VCard, LDIF, ICS, Gammu, GammuUnicode)) - File format to use (default is AutoUnicode)
Returns: dict
Dictionary of read entries, it contains following keys, each might be empty:
  • IMEI
  • Model
  • Creator
  • PhonePhonebook
  • SIMPhonebook
  • Calendar
  • ToDo
  • DateTime

ReadSMSBackup(Filename)

 
Reads SMS backup into file.
Parameters:
  • Filename (string) - Name of file where SMS backup is stored
Returns: list
List of messages read from file

SaveBackup(Filename, Backup, Format)

 
Saves backup into file.
Parameters:
  • Filename (string) - Name of file to read backup from
  • Backup (dict) - Backup data, see ReadBackup for description
  • Format (string (Auto, AutoUnicode, LMB, VCalendar, VCard, LDIF, ICS, Gammu, GammuUnicode)) - File format to use (default is AutoUnicode)
Returns: None
None

SaveRingtone(Filename, Ringtone, Format)

 
Saves ringtone into file.
Parameters:
  • Filename (string) - Name of file where ringote will be saved
  • Ringtone (dict) - Ringtone to save
  • Format (string) - One of 'ott', 'mid', 'rng', 'imy', 'wav', 'rttl'
Returns: None
None

SaveSMSBackup(Filename, Backup)

 
Saves SMS backup into file.
Parameters:
  • Filename (string) - Name of file where to save SMS backup
  • Backup (list) - List of messages to store
Returns: None
None

SetDebugFile(File)

 
Sets global debug file.
Parameters:
  • File (mixed) - File where to write debug stuff (as configured by SetDebugLevel). Can be either None for no file, Python file object or filename.
Returns: None
None

SetDebugLevel(Level)

 
Sets global debug level accorting to passed string. You need to configure output file using SetDebugFile to activate it.
Parameters:
  • Level (string) - name of debug level to use, currently one of:
    • nothing
    • text
    • textall
    • binary
    • errors
    • textdate
    • textalldate
    • errorsdate
Returns: None
None

Version()

 
Get version information.
Returns: tuple
Tuple of version information - Gammu runtime version, python-gammu version, build time Gammu version.

Variables Details [hide private]

ErrorNumbers

Mapping of gammu error codes to text representation. Reverse to Errors.
Value:
{1: 'ERR_NONE',
 2: 'ERR_DEVICEOPENERROR',
 3: 'ERR_DEVICELOCKED',
 4: 'ERR_DEVICENOTEXIST',
 5: 'ERR_DEVICEBUSY',
 6: 'ERR_DEVICENOPERMISSION',
 7: 'ERR_DEVICENODRIVER',
 8: 'ERR_DEVICENOTWORK',
...

Errors

Mapping of text representation of errors to gammu error codes. Reverse to ErrorNumbers.
Value:
{'ERR_BADFEATURE': 61,
 'ERR_BUG': 37,
 'ERR_CANCELED': 38,
 'ERR_CANTOPENFILE': 28,
 'ERR_CORRUPTED': 60,
 'ERR_DATACONVERTED': 53,
 'ERR_DEVICEBUSY': 5,
 'ERR_DEVICECHANGESPEEDERROR': 10,
...