Methods Summary |
---|
public final void | deferMessage(Message msg)Defer this message until next state transition.
Upon transitioning all deferred messages will be
placed on the queue and reprocessed in the original
order. (i.e. The next state the oldest messages will
be processed first)
if (mDbg) {
Log.d(TAG, "StateMachine.deferMessage EX mDeferredMessages="
+ mHandler.mDeferredMessages);
}
/* Copy the "msg" to "newMsg" as "msg" will be recycled */
Message newMsg = obtainMessage();
newMsg.copyFrom(msg);
/* Place on front of queue */
newMsg.next = mHandler.mDeferredMessages;
mHandler.mDeferredMessages = newMsg;
|
public Handler | getHandler()
return mHandler;
|
public java.lang.String | getName()
return mName;
|
public boolean | isDbg()
return mDbg;
|
public final Message | obtainMessage()Get a message and set Message.target = this.
Message msg = Message.obtain(mHandler);
if (mDbg) Log.d(TAG, "StateMachine.obtainMessage() EX target=" + msg.target);
return msg;
|
public final Message | obtainMessage(int what)Get a message and set Message.target = this and
Message.what = what.
Message msg = Message.obtain(mHandler, what);
if (mDbg) {
Log.d(TAG, "StateMachine.obtainMessage(what) EX what=" + msg.what +
" target=" + msg.target);
}
return msg;
|
public final void | sendMessage(Message msg)Enqueue a message to this state machine.
if (mDbg) Log.d(TAG, "StateMachine.sendMessage EX msg.what=" + msg.what);
mHandler.sendMessage(msg);
|
public final void | sendMessageDelayed(Message msg, long delayMillis)Enqueue a message to this state machine after a delay.
if (mDbg) {
Log.d(TAG, "StateMachine.sendMessageDelayed EX msg.what="
+ msg.what + " delay=" + delayMillis);
}
mHandler.sendMessageDelayed(msg, delayMillis);
|
public void | setDbg(boolean dbg)Set debug enable/disabled.
mDbg = dbg;
if (mDbg) {
mHandlerThread.getLooper().setMessageLogging(new LogPrinter(Log.VERBOSE, TAG));
} else {
mHandlerThread.getLooper().setMessageLogging(null);
}
|
public void | setInitialState(HandlerState initialState)Set the initial state. This must be invoked before
and messages are sent to the state machine.
if (mDbg) {
Log.d(TAG, "StateMachine.setInitialState EX initialState"
+ initialState.getClass().getName());
}
mHandler.mDestState = initialState;
|
public final void | transitionTo(HandlerState destState)transition to destination state. Upon returning
from processMessage the current state's exit will
be executed and upon the next message arriving
destState.enter will be invoked.
if (mDbg) {
Log.d(TAG, "StateMachine.transitionTo EX destState"
+ destState.getClass().getName());
}
mHandler.mDestState = destState;
|