Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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