Part of wader.common.protocol View In Hierarchy
Known subclasses: wader.common.protocol.BaseDeviceConnection
SIMProtocol defines the protocol used to communicate with the SIM card
SIMProtocol communicates with the SIM synchronously, only one command at
a time. However, SIMProtocol offers an asynchronous interface queue_at_cmd
which accepts and queues an wader.common.command.ATCmd
and returns a Deferred
that will be callbacked with the
commands response, or errback if an exception is raised.
waiting: the FSM is buffering and parsing all the SIM's response to the command till it matches the regexp that signals the end of the command. If the command has an associated regexp to extract information, the buffered response will be parsed and the command's deferred will be callbacked with the regexp as argument. There are commands that don't have an associated regexp to extract information as we are not interested in the "all went ok" response, only if an exception occurred (e.g. when deleting a contact we are only interested if something went wront, not if all went ok)
The transition to each state is driven by regular expressions, each command has associated a set of regular expressions that make the FSM change states. This regexps are defined inwader.common.command.CMD_DICT
although the plugin
mechanism offers the possibility of customizing the CMD_DICT through
wader.common.hardware.Customizer
if a card uses a
different AT string than the rest for that particular command.
Method | __init__ | Undocumented |
Method | transition_to_idle | Transitions to idle and processes next queued ATCmd
|
Method | send_splitcmd | Used to send the second part of a split command after prompt appears |
Method | queue_at_cmd | Queues an ATCmd and returns a deferred
|
Inherited from BufferingStateMachine:
Method | _timeout_eb | Executed when a command exceeds its timeout |
Method | cancel_current_delayed_call | Cancels current ATCmd dellayed call if active
|
Method | notify_success | Notify success to current ATCmd callbacks
|
Method | notify_failure | Notify failure to current ATCmd errbacks
|
Method | set_cmd | Sets self.cmd to cmd
|
Method | set_state | Sets and logs the new state |
Method | emit_signal | Emits a signal |
Method | dataReceived | See twisted.internet.protocol.Protocol.dataReceived
|
Method | process_notifications | Processes unsolicited notifications in _buffer
|
Method | handle_idle | See the method comments |
Method | handle_waiting | Undocumented |