mobile_insight.analyzer.state_machine module

State machine abstraction

Abstract protocol FSMs, and operationnal policies (algorithms)

Author: Yuanjie Li, Zhehui Zhang

class mobile_insight.analyzer.state_machine.StateMachine(state_machine, init_callback)

Bases: object

__init_state(event)

A specical callback to initiate the current state. Why this is needed: when MobileInsight starts, the device can be in any state. The state machine must have a callback to determine the initial state. This callback is protocol specific, since it depends on specific messages

get_current_state()

Get current state

Returns

current state

get_transition_condition(src, dest)

Get transition condition from source to destination

Parameters
  • src (string) – source state

  • dest (string) – destination state

Returns

an ordered list of callbacks that represent the state transition

update_state(event)

Trigger state transition from analyzer events. If more than one state transition is satisfied, return False

Parameters

event (Event) – the event from analyzer

Returns

True if state updated (including no change), or False if transition fails