GetDeviceStatus
Fetch the Comm / Op / App status of a given device (or aggregate status)
Description
GetDeviceStatus( deviceno, status item )
Returns the given status item for.
Parameters
deviceno | Device number to request status from (or 0 for all devices) |
status item | The status item to return (see below) |
Parameter | Description | Aggregate |
---|---|---|
DVCSTAT_BATTVOLT | The device battery/supply voltage in mV (if supported) | YES |
DVCSTAT_SIGNAL | The reported device signal strength | YES |
DVCSTAT_COMMCOUNT | Number of successful comm attempts | NO |
DVCSTAT_COMMERR | Number of failed comm attempts | NO |
DVCSTAT_LASTCOMM | Time of last status update | NO |
DVCSTAT_COMMSTAT | Communication status, one of: DS_COM_UNKNOWN DS_COM_ERROR DS_COM_ISSUE DS_COM_OK DS_COM_BEST | YES |
DVCSTAT_OPSTAT | Operational status, one of: DS_OP_UNKNOWN DS_OP_ERROR DS_OP_PART DS_OP_FULL | YES |
DVCSTAT_APPSTAT | Application status, one of: DS_APP_UNKNOWN DS_APP_ERROR DS_APP_WARNING DS_APP_OK DS_APP_OK1 DS_APP_OK2 DS_APP_OK3 DS_APP_OK4 | YES |
DVCSTAT_STAT | Aggregated status, one of: (read only) DS_UNKNOWN DS_ERROR DS_WARNING DS_OK | YES |
DVCSTAT_ACTIVE | Returns 1 if device is loaded/active (read only) | NO |
DVCSTAT_REGCOUNT | Number of registers allocated (read only) | NO |
DVCSTAT_TYPE | Driver id number | NO |
DVCSTAT_VERSION | Driver version | NO |
DVCSTAT_MODE | User defined mode | NO |
DVCSTAT_PARAM | User defined parameter | NO |
DVCSTAT_ACTIVE, _REGCOUNT, _TYPE, _VERSION, _MODE and _PARAM are available in firmware 21061101 and newer
Return value
Depends on parameter requested. See above.
Example usage
if( GetDeviceStatus(0, DVCSTAT_STAT) < DS_OK ) { // Get 'worst' status from all devices // DEVICE ERROR DETECTED -- SHUT OFF PROCESS SetOutput(1, 0); }