dwm_dev_status_get
This command reads the device status. The battery level is unavailable when used in the user application (on-chip library), as it allows for the use of the ADC peripheral.
-
void dwm_dev_status_get(dwm_mac_addr_list_t *mac_addr_list)
- Parameters
input – (none)
output – Status code, uptime, battery_level, temperature
uptime – 32-bit unsigned integer (uptime in seconds)
battery_level – 8-bit unsigned integer (battery level in percents, not available in the user application library)
temperature – 16-bit integer (temperature in °C)
C code example
dwm_dev_status_t status;
int rv;
if (rv == DWM_OK) {
printf("uptime=%lu\n", status.uptime);
printf("temperature=%d\n", status.temperature);
} else {
printf("can't read device status, error %d\n", rv);
}
SPI/UART example
TLV Request |
|
---|---|
Type |
Length |
0x25 |
0x00 |
Type 0x25 (37 dec) means command dwm_dev_status_get.
TLV Response |
|||||
---|---|---|---|---|---|
Type |
Length |
Value (see error codes) |
Type |
Length |
Value |
0x40 |
0x01 |
0x00 |
0x59 |
0x08 |
uptime (byte 0-3)
battery_level (byte 4)
reserved (byte 5)
temperature (byte 6-7)
|
0x9d 0x16 0x00 0x00 0x64 0x00 0x21 0x00 |
Type 0x59 (89 dec) means device status
Type 0x40 means Status code of the previous command