Functions | |
int | fwHw_getServerState (string domain, string device) |
int | fwHw_connectServerState (string domain, string device, string callback="") |
string | fwHw_makeRecipeName (string domain, string device, string command) |
int fwHw_connectServerState | ( | string | domain, | |
string | device, | |||
string | callback = "" | |||
) |
Connect to the running state of the SpecsServer/CcpcServer. Will automatically set the DU in state "UNKNOWN" when the server is not running, and to "NOT_READY" when the server reconnects. If a callback function is given instead of setting the state the callback function is called in the format: <yourCallback>(string domain, string device, int serverState), where serverState is 1 when server running and 0 when server not running
[in] | domain | The FSM domain received from <YourDUType>_initialize(...). |
[in] | device | The device received from <YourDUType>_initialize(...). |
[in] | callback | [optional] A callback to be executed when the Server state changes. |
0 error found.
HwTypeXXXXMyBoard_initialize(string domain, string device) { fwHw_connectServerState(domain, device, "setServerStateCallback"); } // use the callback to set the dpe that the FSM State depends on setServerStateCallback(string domain, string device, int state) { int oldState; // If the Server is not running set the DU state to, for example, "UNKNOWN" (0). if(state == 0) dpSet(device+".status", 0); else { // If the DU state was "UNKNOWN" (0), set it to, for example, "NOT_READY" (1). // Otherwise leave it as it was. dpGet(device+".status", oldState); if(oldState == 0) dpSet(device+".status", 1); } }
int fwHw_getServerState | ( | string | domain, | |
string | device | |||
) |
Check if the SpecsServer/CcpcServer is running. Can be used to set the DU in state UNKNOWN if the server is not running.
[in] | domain | The FSM domain received from <YourDUType>_valueChanged(...). |
[in] | device | The device received from <YourDUType>_valueChanged(...). |
0 the server is not running.
HwTypeXXXXMyBoard_valueChanged( string domain, string device, int status, string &fwState) { int serverState; serverState = fwHw_getServerState(domain, device); if(!serverState) { fwState = "UNKNOWN"; } else { if(status == 0) { fwState = "NOT_READY"; } (...) } }
string fwHw_makeRecipeName | ( | string | domain, | |
string | device, | |||
string | command | |||
) |
Prepare the standard recipe name based on RUN_TYPE and received command.
[in] | domain | The FSM domain received from <YourDUType>_doCommand(...). |
[in] | device | The device received from <YourDUType>_doCommand(...). |
[in] | command | The command received from <YourDUType>_doCommand(...). |
HwTypeXXXXMyBoard_doCommand(string domain, string device, string command) { (...) if (command == "Configure") { string recipe; recipe = fwHw_makeRecipeName(domain, device, command); fwHw_getApplyRecipe(device, recipe, 0, domain); } (...) }