Skip to content

Instantly share code, notes, and snippets.

@neilmanuell
Created March 6, 2011 10:40
Show Gist options
  • Save neilmanuell/857194 to your computer and use it in GitHub Desktop.
Save neilmanuell/857194 to your computer and use it in GitHub Desktop.
Pseudocode examples of Locked State transition phases
////////////////////////////////////////////
// exiting guard
if( !lock.isKeyValid( user ) ){
fsm.cancel( Reasons.KEY_INVALID );
}
////////////////////////////////////////////
////////////////////////////////////////////
// cancelled
if( reason == Reasons.KEY_INVALID ){
Alert( "You do not have the correct privilege to open this door" );
} else {
Alert( "Cancelled for unknown reason: " + reason );
}
////////////////////////////////////////////
////////////////////////////////////////////
// entering
lock.insertKey( user ).disengage();
////////////////////////////////////////////
////////////////////////////////////////////
// teardown
lock.insertKey( user ).engage();
////////////////////////////////////////////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment