gammu.worker
- Asynchronous communication to phone.¶
Mostly you should use only GammuWorker
class, others are only helpers
which are used by this class.
- class gammu.worker.GammuCommand(command, params=None, percentage=100)¶
Storage of single command for gammu.
- get_command()¶
Returns command name.
- get_params()¶
Returns command params.
- get_percentage()¶
Returns percentage of current task.
- class gammu.worker.GammuTask(name, commands)¶
Storage of task for gammu.
- get_name()¶
Returns task name.
- get_next()¶
Returns next command to be executed as
GammuCommand
.
- class gammu.worker.GammuThread(queue, config, callback)¶
Thread for phone communication.
- join(timeout=None)¶
Terminates thread and waits for it.
- kill()¶
Forces thread end without emptying queue.
- run()¶
Thread body, which handles phone communication. This should not be used from outside.
- class gammu.worker.GammuWorker(callback)¶
Wrapper class for asynchronous communication with Gammu. It spawns own thread and then passes all commands to this thread. When task is done, caller is notified via callback.
- abort()¶
Aborts any remaining operations.
- configure(config)¶
Configures gammu instance according to config.
- Parameters:
config (hash) – Gammu configuration, same as
gammu.StateMachine.SetConfig()
accepts.
- enqueue(command, params=None, commands=None)¶
Enqueues command or task.
- Parameters:
command (tuple of list of tuples) – Command(s) to execute. Each command is tuple containing function name and it’s parameters.
params (tuple or string) – Parameters to command.
commands (list of tuples or strings) – List of commands to execute. When this is not none, params are ignored and command is taken as task name.
- enqueue_command(command, params)¶
Enqueues command.
- enqueue_task(command, commands)¶
Enqueues task.
- initiate()¶
Connects to phone.
- terminate(timeout=None)¶
Terminates phone connection.
- exception gammu.worker.InvalidCommand(value)¶
Exception indicating invalid command.
- gammu.worker.check_worker_command(command)¶
Checks whether command is valid.
- Parameters:
command (string) – Name of command.