Skip to content

Instantly share code, notes, and snippets.

@john-j-mclaughlin
Last active August 14, 2021 14:23
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save john-j-mclaughlin/6c1b3912b40ca78fdab3c2bef0e24e4b to your computer and use it in GitHub Desktop.
state_machine( load_unload_stage : STAGE ) {
default_state(offline) ;
state(online) {
on_event("host/rcvd/stageOffline"("stageId":this.root.id), ../offline);
on_event("secs/rcvd/stageSetdown"("stageId":this.root.id), loading);
on_event("secs/rcvd/stagePickup"("stageId":this.root.id), unloading);
default_state(unknown) ; // the default state when "online"
state(empty);
state(loading) {
on_timer(settleTimeMilliSecs, ../hasCassette) ;
}
state(hasCassette) {
on_entry ${
this.root.PublishEvent("from/stage/cassetteLoaded", nil, PAIR("stageId",this.root.id));
$}
on_exit ${
this.root.PublishEvent("from/stage/cassetteUnloaded", nil, PAIR("stageId",this.root.id));
$}
}
state(unloading) {
on_timer(settleTimeMilliSecs, ../empty) ;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment