Part of vmc.common.protocol View In Hierarchy
Known subclasses: vmc.common.protocol.SIMCardConnection
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 vmc.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 invmc.common.command.CMD_DICT
although the plugin mechanism
offers the possibility of customizing the CMD_DICT through
vmc.common.hardware.Customizer
if a card uses a different
AT string than the rest for that particular command.
Method | __init__ | Undocumented |
Method | __repr__ | 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 | Undocumented |
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 | enque_notification | Enqueues a notification |
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 |