######################################################################## ### FILE: states.mod ### PURPOSE: Instrument States and triggers ### AUTHORS: Tor Slettnes ### SCOPE: Top Level ### ### Copyrights (C) 2010 Life Technologies. All rights reserved. ######################################################################## ### Create Aliases ALIas+ STATe? STATe:SETTing? ALIas+ STATe= STATe:SETTing -createMissing ALIas+ STATe* STATe:SETTING* STATe:ALIas+ TRIGger TRIGger+ -replaceExisting STATe:ALIas+ DEPendency DEPendency+ -replaceExisting ### Publish state changes on the "State" topic STATe:NOTify= State ### Common instrument states STATe:NEW Instrument:Online STATe:NEW Instrument:Safe -requires=Instrument:Online STATe:NEW Instrument:Initialized STATe:NEW Instrument:Operational -requires=Instrument:Initialized STATe:TRIGGer+ -states=Instrument:Online,Instrument:Initialized Publish INFO "State $name$ changed to $value$" ### User-friendly command to find culprits DEFine WhatsWrong? SET wrongs $(STATE:CULPRITS? Instrument:Operational) IF $(STATE:ERRORS? Instrument:Operational) SET wrongs "\nStates: ${wrongs}\n" REPeat -counter=index -start=1 $(STATE:ERRORS? Instrument:Operational) APPend wrongs "Error: $(STATE:ERRor? Instrument:Operational ${index})\n" RETurn "${wrongs:-I am content}" ALIas -hidden WHASSUP? WhatsWrong?