138 state_array = (RTC.CREATED_STATE,
225 if self.
_entry.has_key(state):
226 self.
_entry[state] = call_back
228 self.
_entry.setdefault(state, call_back)
248 if self.
_predo.has_key(state):
249 self.
_predo[state] = call_back
251 self.
_predo.setdefault(state, call_back)
271 if self.
_do.has_key(state):
272 self.
_do[state] = call_back
274 self.
_do.setdefault(state, call_back)
294 if self.
_postdo.has_key(state):
295 self.
_postdo[state] = call_back
297 self.
_postdo.setdefault(state, call_back)
317 if self.
_exit.has_key(state):
318 self.
_exit[state] = call_back
320 self.
_exit.setdefault(state, call_back)
358 self.
_states.curr = states.curr
359 self.
_states.prev = states.prev
360 self.
_states.next = states.next
460 if states.curr == states.next:
462 if self.
_predo[states.curr]:
463 self.
_predo[states.curr](states)
468 if self.
_do[states.curr]:
469 self.
_do[states.curr](states)
475 self.
_postdo[states.curr](states)
478 if self.
_exit[states.curr]:
479 self.
_exit[states.curr](states)
483 if states.curr != states.next:
484 states.curr = states.next
485 if self.
_entry[states.curr]:
486 self.
_entry[states.curr](states)
504 for i
in range(self.
_num):
505 if s.has_key(StateMachine.state_array[i]):
506 s[StateMachine.state_array[i]] = nullfunc
508 s.setdefault(StateMachine.state_array[i], nullfunc)
522 states.prev = self.
_states.prev
523 states.curr = self.
_states.curr
524 states.next = self.
_states.next
def __init__(self, num_of_state)
Constructor.
def setTransitionAction(self, call_back)
Set state transition action function.
def setPreDoAction(self, state, call_back)
Set PreDo action function.
def setNullFunc(self, s, nullfunc)
Worker function.
def update_curr(self, curr)
def setNOP(self, call_back)
Set NOP function.
def getStates(self)
Get state machine's status.
def setPostDoAction(self, state, call_back)
Set PostDo action function.
def setStartState(self, states)
Set Exit action function.
def isIn(self, state)
Evaluate current status.
def getState(self)
Get current state.
def worker(self)
Worker function.
def setEntryAction(self, state, call_back)
Set Entry action function.
def setExitAction(self, state, call_back)
Set Exit action function.
def setDoAction(self, state, call_back)
Set Do action function.
def goTo(self, state)
Change status.
def setListener(self, listener)
Set Listener Object.