Module gammu :: Class StateMachine
[show private | hide private]
[frames | no frames]

Type StateMachine

object --+
         |
        StateMachine


StateNachine(Locale)

StateMachine object, that is used for communication with phone.

param Locale: What locales to use for gammu error messages, default is 'auto' which does autodetection according to user locales type Locale: string
Method Summary
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  AddCalendar(Value)
Adds calendar entry.
  AddCategory(Type, Name)
Adds category to phone.
  AddFilePart(File)
Adds file part to filesystem.
  AddFolder(ParentFolderID, Name)
Adds folder to filesystem.
  AddMemory(Value)
Adds memory (phonebooks or calls) entry.
  AddSMS(Value)
Adds SMS to specified folder.
  AddSMSFolder(Name)
Creates SMS folder.
  AddToDo(Value)
Adds ToDo in phone.
  DeleteAllCalendar()
Deletes all calendar entries.
  DeleteAllMemory(Type)
Deletes all memory (phonebooks or calls) entries of specified type.
  DeleteAllToDo()
Deletes all todo entries in phone.
  DeleteCalendar(Location)
Deletes calendar entry.
  DeleteFile(FileID)
Deletes file from filesystem.
  DeleteFolder(FolderID)
Deletes folder on filesystem.
  DeleteMemory(Type, Location)
Deletes memory (phonebooks or calls) entry.
  DeleteSMS(Folder, Location)
Deletes SMS.
  DeleteSMSFolder(ID)
Deletes SMS folder.
  DeleteToDo(Location)
Deletes ToDo entry in phone.
  DialVoice(Number, ShowNumber)
Dials number and starts voice call.
  EnterSecurityCode(Type, Code)
Entres security code.
  GetAlarm(Location)
Reads alarm set in phone.
  GetBatteryCharge()
Gets information about batery charge and phone charging state.
  GetCalendar(Location)
Retrieves calendar entry.
  GetCalendarStatus()
Retrieves calendar status (number of used entries).
  GetCategory(Type, Location)
Reads category from phone.
  GetCategoryStatus(Type)
Reads category status (number of used entries) from phone.
  GetConfig(Section)
Gets specified config section.
  GetDateTime()
Reads date and time from phone.
  GetDisplayStatus()
Acquired display status.
  GetFilePart(File)
Gets file part from filesystem.
  GetFileSystemStatus()
Acquires filesystem status.
  GetFirmware()
Reads firmware information from phone.
  GetFolderListing(Folder, Start)
Gets next filename from filesystem folder.
  GetHardware()
Gets hardware information about device.
  GetIMEI()
Reads IMEI/serial number from phone.
  GetLocale()
Gets locale information from phone.
  GetManufactureMonth()
Gets month when device was manufactured.
  GetManufacturer()
Reads manufacturer from phone.
  GetMemory(Type, Location)
Reads entry from memory (phonebooks or calls).
  GetMemoryStatus(Type)
Gets memory (phonebooks or calls) status (eg.
  GetModel()
Reads model from phone.
  GetNetworkInfo()
Gets network information.
  GetNextCalendar(Start, Location)
Retrieves calendar entry.
  GetNextFileFolder(Start)
Gets next filename from filesystem.
  GetNextMemory(Type, Start, Location)
Reads entry from memory (phonebooks or calls).
  GetNextRootFolder(Folder)
Gets next root folder from filesystem.
  GetNextSMS(Folder, Start, Location)
Reads next (or first if start set) SMS message.
  GetNextToDo(Start, Location)
Reads ToDo from phone.
  GetOriginalIMEI()
Gets original IMEI from phone.
  GetPPM()
Gets PPM (Post Programmable Memory) from phone.
  GetProductCode()
Gets product code of device.
  GetSecurityStatus()
Queries whether some security code needs to be entered.
  GetSignalQuality()
Reads signal quality (strength and error rate).
  GetSIMIMSI()
Gets SIM IMSI from phone.
  GetSMS(Folder, Location)
Reads SMS message.
  GetSMSC(Location)
Gets SMS Service Center number and SMS settings.
  GetSMSFolders()
Returns SMS folders information.
  GetSMSStatus()
Gets information about SMS memory (read/unread/size of memory for both SIM and phone).
  GetSpeedDial(Location)
Gets speed dial.
  GetToDo(Location)
Reads ToDo from phone.
  GetToDoStatus()
Gets status of ToDos (count of used entries).
  Init(Replies)
Initialises the connection with phone.
  PressKey(Key, Press)
Emulates key press.
  ReadConfig(Section, Configuration)
Reads specified section of gammurc
  Reset(Hard)
Performs phone reset.
  ResetPhoneSettings(Type)
Resets phone settings.
  SendSavedSMS(Folder, Location)
Sends SMS saved in phone.
  SendSMS(Value)
Sends SMS.
  SetAlarm(DateTime, Location, Repeating, Text)
Sets alarm in phone.
  SetAutoNetworkLogin()
Enables network auto login.
  SetCalendar(Value)
Sets calendar entry
  SetConfig(Section, Values)
Sets specified config section.
  SetDateTime(Date)
Sets date and time in phone.
  SetDebugFile(File, Global)
Sets state machine debug file.
  SetDebugLevel(Level)
Sets state machine debug level accorting to passed string.
  SetFileAttributes(Filename, ReadOnly, Protected, System, Hidden)
Sets file attributes.
  SetIncomingCall(Enable)
Activates/deactivates noticing about incoming calls.
  SetIncomingCallback(Callback)
Sets callback function which is called whenever any (enabled) incoming event appears.
  SetIncomingCB(Enable)
Gets network information from phone.
  SetIncomingSMS(Enable)
Enable/disable notification on incoming SMS.
  SetIncomingUSSD(Enable)
Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services).
  SetLocale(DateSeparator, DateFormat, AMPMTime)
Sets locale of phone.
  SetMemory(Value)
Sets memory (phonebooks or calls) entry.
  SetSMS(Value)
Sets SMS.
  SetSMSC(Value)
Sets SMS Service Center number and SMS settings.
  SetSpeedDial(Value)
Sets speed dial.
  SetToDo(Value)
Sets ToDo in phone.
  ShowStartInfo(Enable)
Enables showing information on phone display.
  Terminate()
Terminates the connection with phone.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(...)
(Constructor)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides:
__builtin__.object.__init__

__new__(T, S, ...)

T.__new__(S, ...) -> a new object with type S, a subtype of T
Returns:
a new object with type S, a subtype of T
Overrides:
__builtin__.object.__new__

AddCalendar(Value)

Adds calendar entry.
Parameters:
Value - Calendar entry data
           (type=hash)
Returns:
Location of newly created entry

AddCategory(Type, Name)

Adds category to phone.
Parameters:
Type - Type of category to read, one of 'ToDo', 'Phonebook'
           (type=string)
Name - Category name
           (type=string)
Returns:
Location of created category

AddFilePart(File)

Adds file part to filesystem.
Parameters:
File - File data
           (type=hash)
Returns:
File data for subsequent calls (Finished indicates transfer has been completed)

AddFolder(ParentFolderID, Name)

Adds folder to filesystem.
Parameters:
ParentFolderID - Folder where to create subfolder
           (type=string)
Name - New folder name
           (type=string)
Returns:
New folder ID.

AddMemory(Value)

Adds memory (phonebooks or calls) entry.
Parameters:
Value - Memory entry
           (type=hash)
Returns:
Location of created entry

AddSMS(Value)

Adds SMS to specified folder.
Parameters:
Value - SMS data
           (type=hash)
Returns:
Tuple for location and folder.

AddSMSFolder(Name)

Creates SMS folder.
Parameters:
Name - Name of new folder
           (type=string)
Returns:
None

AddToDo(Value)

Adds ToDo in phone.
Parameters:
Value - ToDo data
           (type=hash)
Returns:
Location of created entry

DeleteAllCalendar()

Deletes all calendar entries.
Returns:
None

DeleteAllMemory(Type)

Deletes all memory (phonebooks or calls) entries of specified type.
Parameters:
Type - Memory type, one of 'ME', 'SM', 'ON', 'DC', 'RC', 'MC', 'MT', 'FD', 'VM'
           (type=string)
Returns:
None

DeleteAllToDo()

Deletes all todo entries in phone.
Returns:
None

DeleteCalendar(Location)

Deletes calendar entry.
Parameters:
Location - Calendar entry to delete
           (type=int)
Returns:
None

DeleteFile(FileID)

Deletes file from filesystem.
Parameters:
FileID - File to delete
           (type=string)
Returns:
None

DeleteFolder(FolderID)

Deletes folder on filesystem.
Parameters:
FolderID - Folder to delete
           (type=string)
Returns:
None

DeleteMemory(Type, Location)

Deletes memory (phonebooks or calls) entry.
Parameters:
Type - Memory type, one of 'ME', 'SM', 'ON', 'DC', 'RC', 'MC', 'MT', 'FD', 'VM'
           (type=string)
Location - Location of entry to delete
           (type=int)
Returns:
None

DeleteSMS(Folder, Location)

Deletes SMS.
Parameters:
Folder - Folder where to read entry (0 is emulated flat memory)
           (type=int)
Location - Location of entry to delete
           (type=int)
Returns:
None

DeleteSMSFolder(ID)

Deletes SMS folder.
Parameters:
ID - Index of folder to delete
           (type=int)
Returns:
None

DeleteToDo(Location)

Deletes ToDo entry in phone.
Parameters:
Location - Location of entry to delete
           (type=int)
Returns:
None

DialVoice(Number, ShowNumber)

Dials number and starts voice call.
Parameters:
Number - Number to dial
           (type=string)
ShowNumber - Identifies whether to enable CLIR (None = keep default phone settings). Default is None
           (type=bool or None)
Returns:
None

EnterSecurityCode(Type, Code)

Entres security code.
Parameters:
Type - What code to enter, one of 'PIN', 'PUK', 'PIN2', 'PUK2'.
           (type=string)
Code - Code value
           (type=string)
Returns:
None

GetAlarm(Location)

Reads alarm set in phone.
Parameters:
Location - Which alarm to read. Many phone support only one alarm. Default is 1.
           (type=int)
Returns:
Alarm hash

GetBatteryCharge()

Gets information about batery charge and phone charging state.
Returns:
Hash containing information about battery state (BatteryPercent and ChargeState)

GetCalendar(Location)

Retrieves calendar entry.
Parameters:
Location - Calendar entry to read
           (type=int)
Returns:
Hash with calendar values

GetCalendarStatus()

Retrieves calendar status (number of used entries).
Returns:
Hash with calendar status (Used)

GetCategory(Type, Location)

Reads category from phone.
Parameters:
Type - Type of category to read, one of 'ToDo', 'Phonebook'
           (type=string)
Location - Location of category to read
           (type=int)
Returns:
Category name as string

GetCategoryStatus(Type)

Reads category status (number of used entries) from phone.
Parameters:
Type - Type of category to read, one of 'ToDo', 'Phonebook'
           (type=string)
Returns:
Hash containing information about category status (Used)

GetConfig(Section)

Gets specified config section. Configuration consists of all params which can be defined in gammurc config file:
  • Model
  • DebugLevel
  • Device
  • Connection
  • SyncTime
  • LockDevice
  • DebugFile
  • Localize
  • StartInfo
  • UseGlobalDebugFile
Parameters:
Section - Index of config section to read. Defaults to 0.
           (type=int)
Returns:
Hash containing configuration

GetDateTime()

Reads date and time from phone.
Returns:
Date and time from phone as datetime.datetime object.

GetDisplayStatus()

Acquired display status.
Returns:
List of indicators displayed on display

GetFilePart(File)

Gets file part from filesystem.
Parameters:
File - File data
           (type=hash)
Returns:
File data for subsequent calls (Finished indicates transfer has been completed)

GetFileSystemStatus()

Acquires filesystem status.
Returns:
Hash containing filesystem status (Used and Free)

GetFirmware()

Reads firmware information from phone.
Returns:
Tuple from version, date and numeric version.

GetFolderListing(Folder, Start)

Gets next filename from filesystem folder.
Parameters:
Folder - Folder to list
           (type=string)
Start - Whether we're starting listing. Defaults to False.
           (type=bool)
Returns:
File data as hash

GetHardware()

Gets hardware information about device.
Returns:
Hardware information as string.

GetIMEI()

Reads IMEI/serial number from phone.
Returns:
IMEI of phone as string.

GetLocale()

Gets locale information from phone.
Returns:
Hash of locale settings. SetLocale lists them all.

GetManufactureMonth()

Gets month when device was manufactured.
Returns:
Month of manufacture as string.

GetManufacturer()

Reads manufacturer from phone.
Returns:
String with manufacturer name

GetMemory(Type, Location)

Reads entry from memory (phonebooks or calls). Which entry shouldbe read is defined in entry.
Parameters:
Type - Memory type, one of 'ME', 'SM', 'ON', 'DC', 'RC', 'MC', 'MT', 'FD', 'VM'
           (type=string)

GetMemoryStatus(Type)

Gets memory (phonebooks or calls) status (eg. number of used andfree entries).
Parameters:
Type - Memory type, one of 'ME', 'SM', 'ON', 'DC', 'RC', 'MC', 'MT', 'FD', 'VM'
           (type=string)
Returns:
Hash with information about memory (Used and Free)

GetModel()

Reads model from phone.
Returns:
Tuple containing gammu identification and real model returned by phone.

GetNetworkInfo()

Gets network information.
Returns:
Hash with information about network (NetworkName, State, NetworkCode, CID and LAC)

GetNextCalendar(Start, Location)

Retrieves calendar entry. This is useful for continuous reading of all calendar entries.
Parameters:
Start - Whether to start. This can not be used together with Location
           (type=bool)
Location - Last read location. This can not be used together with Start
           (type=int)
Returns:
Hash with calendar values

GetNextFileFolder(Start)

Gets next filename from filesystem.
Parameters:
Start - Whether we're starting listing. Defaults to False.
           (type=bool)
Returns:
File data as hash

GetNextMemory(Type, Start, Location)

Reads entry from memory (phonebooks or calls). Which entry shouldbe read is defined in entry. This can be easily used for reading all entries.
Parameters:
Type - Memory type, one of 'ME', 'SM', 'ON', 'DC', 'RC', 'MC', 'MT', 'FD', 'VM'
           (type=string)
Start - Whether to start. This can not be used together with Location
           (type=bool)
Location - Last read location. This can not be used together with Start
           (type=int)
Returns:
Memory entry as hash

GetNextRootFolder(Folder)

Gets next root folder from filesystem. Start with empty folder name.
Parameters:
Folder - Previous read fodlder. Start with empty folder name.
           (type=string)
Returns:
Structure with folder information

GetNextSMS(Folder, Start, Location)

Reads next (or first if start set) SMS message. This might befaster for some phones than using GetSMS for each message.
Parameters:
Folder - Folder where to read entry (0 is emulated flat memory)
           (type=int)
Start - Whether to start. This can not be used together with Location
           (type=bool)
Location - Location last read entry. This can not be used together with Start
           (type=int)
Returns:
Hash with SMS data

GetNextToDo(Start, Location)

Reads ToDo from phone.
Parameters:
Start - Whether to start. This can not be used together with Location
           (type=bool)
Location - Last read location. This can not be used together with Start
           (type=int)
Returns:
Hash with ToDo values

GetOriginalIMEI()

Gets original IMEI from phone.
Returns:
Original IMEI of phone as string.

GetPPM()

Gets PPM (Post Programmable Memory) from phone.
Returns:
PPM as string

GetProductCode()

Gets product code of device.
Returns:
Product code as string.

GetSecurityStatus()

Queries whether some security code needs to be entered.
Returns:
String indicating which code needs to be entered or None if none is needed

GetSignalQuality()

Reads signal quality (strength and error rate).
Returns:
Hash containing information about signal state (SignalStrength, SignalPercent and BitErrorRate)

GetSIMIMSI()

Gets SIM IMSI from phone.
Returns:
SIM IMSI as string

GetSMS(Folder, Location)

Reads SMS message.
Parameters:
Folder - Folder where to read entry (0 is emulated flat memory)
           (type=int)
Location - Location of entry to read
           (type=int)
Returns:
Hash with SMS data

GetSMSC(Location)

Gets SMS Service Center number and SMS settings.
Parameters:
Location - Location of entry to read. Defaults to 1
           (type=int)
Returns:
Hash with SMSC information

GetSMSFolders()

Returns SMS folders information.
Returns:
List of SMS folders.

GetSMSStatus()

Gets information about SMS memory (read/unread/size of memory for both SIM and phone).
Returns:
Hash with information about phone memory (SIMUnRead, SIMUsed, SIMSize, PhoneUnRead, PhoneUsed, PhoneSize and TemplatesUsed)

GetSpeedDial(Location)

Gets speed dial.
Parameters:
Location - Location of entry to read
           (type=int)
Returns:
Hash with speed dial (Location, MemoryLocation, MemoryNumberID, MemoryType)

GetToDo(Location)

Reads ToDo from phone.
Parameters:
Location - Location of entry to read
           (type=int)
Returns:
Hash with ToDo values

GetToDoStatus()

Gets status of ToDos (count of used entries).
Returns:
Hash of status (Used)

Init(Replies)

Initialises the connection with phone.
Parameters:
Replies - Number of replies to wait for on each request. Defaults to 3.
           (type=int)
Returns:
None

PressKey(Key, Press)

Emulates key press.
Parameters:
Key - What key to press
           (type=string)
Press - Whether to emulate press or release.
           (type=bool)
Returns:
None

ReadConfig(Section, Configuration)

Reads specified section of gammurc
Parameters:
Section - Index of config section to read. Defaults to 0.
           (type=int)
Configuration - Index where config section will be stored. Defaults to Section.
           (type=int)
Returns:
None

Reset(Hard)

Performs phone reset.
Parameters:
Hard - Whether to make hard reset
           (type=bool)
Returns:
None

ResetPhoneSettings(Type)

Resets phone settings.
Parameters:
Type - What to reset, one of 'PHONE', 'UIF', 'ALL', 'DEV', 'FACTORY'
           (type=string)
Returns:
None

SendSavedSMS(Folder, Location)

Sends SMS saved in phone.
Parameters:
Folder - Folder where to read entry (0 is emulated flat memory)
           (type=int)
Location - Location of entry to send
           (type=int)
Returns:
Message reference as integer

SendSMS(Value)

Sends SMS.
Parameters:
Value - SMS data
           (type=hash)
Returns:
Message reference as integer

SetAlarm(DateTime, Location, Repeating, Text)

Sets alarm in phone.
Parameters:
DateTime - When should alarm happen.
           (type=datetime.datetime)
Location - Location of alarm to set. Defaults to 1.
           (type=int)
Repeating - Whether alarm should be repeating. Defaults to True.
           (type=bool)
Text - Text to be displayed on alarm. Defaults to empty.
           (type=string)
Returns:
None

SetAutoNetworkLogin()

Enables network auto login.
Returns:
None

SetCalendar(Value)

Sets calendar entry
Parameters:
Value - Calendar entry data
           (type=hash)
Returns:
Location of set entry

SetConfig(Section, Values)

Sets specified config section.
Parameters:
Section - Index of config section to modify
           (type=int)
Values - Config values, see GetConfig for description of accepted
           (type=hash)
Returns:
None

SetDateTime(Date)

Sets date and time in phone.
Parameters:
Date - Date to set
           (type=datetime.datetime)
Returns:
None

SetDebugFile(File, Global)

Sets state machine debug file.
Parameters:
File - File where to write debug stuff (as configured by SetDebugLevel). Can be either None for no file, Python file object or filename.
           (type=mixed)
Global - Whether to use global debug structure (overrides File)
           (type=bool)
Returns:
None

SetDebugLevel(Level)

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

           (type=string)
Returns:
None

SetFileAttributes(Filename, ReadOnly, Protected, System, Hidden)

Sets file attributes.
Parameters:
Filename - File to modify
           (type=string)
ReadOnly - Whether file is read only. Default to False.
           (type=bool)
Protected - Whether file is protected. Default to False.
           (type=bool)
System - Whether file is system. Default to False.
           (type=bool)
Hidden - Whether file is hidden. Default to False.
           (type=bool)

SetIncomingCall(Enable)

Activates/deactivates noticing about incoming calls.
Parameters:
Enable - Whether to enable notifications, default is True
           (type=boolean)
Returns:
None

SetIncomingCallback(Callback)

Sets callback function which is called whenever any (enabled) incoming event appears. Please note that you have to enable each event type by calling SetIncoming* functions.
Parameters:
Callback - callback function or None for disabling
           (type=function, it will get three params: StateMachine object, event type and it's data in dictionary)
Returns:
None

SetIncomingCB(Enable)

Gets network information from phone.
Parameters:
Enable - Whether to enable notifications, default is True
           (type=boolean)
Returns:
None

SetIncomingSMS(Enable)

Enable/disable notification on incoming SMS.
Parameters:
Enable - Whether to enable notifications, default is True
           (type=boolean)
Returns:
None

SetIncomingUSSD(Enable)

Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services).
Parameters:
Enable - Whether to enable notifications, default is True
           (type=boolean)
Returns:
None

SetLocale(DateSeparator, DateFormat, AMPMTime)

Sets locale of phone.
Parameters:
DateSeparator - Date separator.
           (type=string)
DateFormat - Date format, one of 'DDMMYYYY', 'MMDDYYYY', 'YYYYMMDD'
           (type=string)
AMPMTime - Whether to use AM/PM time.
           (type=bool)
Returns:
None

SetMemory(Value)

Sets memory (phonebooks or calls) entry.
Parameters:
Value - Memory entry
           (type=hash)
Returns:
Location of created entry

SetSMS(Value)

Sets SMS.
Parameters:
Value - SMS data
           (type=hash)
Returns:
Tuple for location and folder.

SetSMSC(Value)

Sets SMS Service Center number and SMS settings.
Parameters:
Value - SMSC information
           (type=hash)
Returns:
None

SetSpeedDial(Value)

Sets speed dial.
Parameters:
Value - Speed dial data, see GetSpeedDial for listing.
           (type=hash)
Returns:
None

SetToDo(Value)

Sets ToDo in phone.
Parameters:
Value - ToDo data
           (type=hash)
Returns:
Location of created entry

ShowStartInfo(Enable)

Enables showing information on phone display.
Parameters:
Enable - Whether to enable. Defaults to True.
           (type=bool)
Returns:
None

Terminate()

Terminates the connection with phone.
Returns:
None

Generated by Epydoc 2.1 on Fri Sep 22 08:28:07 2006 http://epydoc.sf.net