dwm_dev_status_get
此命令读取设备状态. 在用户应用程序(片上库)中使用时,电池电量不可用,因为它允许使用 ADC 外设.
-
void dwm_dev_status_get(dwm_mac_addr_list_t *mac_addr_list)
- 参数
input – (无)
output – 状态代码, 正常运行时间, battery_level, 温度
uptime – 32 位无符号整数 (以秒为单位的正常运行时间)
battery_level – 8 位无符号整数 (电池电量,以百分比表示,用户应用程序库中没有提供)
temperature – 16位整数 (温度,单位°C)
C代码示例
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 示例
TLV 请求 |
|
---|---|
类型 |
长度 |
0x25 |
0x00 |
类型 0x25 (37 dec) 表示命令 dwm_dev_status_get.
TLV 响应 |
|||||
---|---|---|---|---|---|
类型 |
长度 |
价值(参见错误代码) |
类型 |
长度 |
价值 |
0x40 |
0x01 |
0x00 |
0x59 |
0x08 |
运行时间(字节 0-3)
battery_level (字节 4)
保留(字节 5)
温度(字节 6-7)
|
0x9d 0x16 0x00 0x00 0x64 0x00 0x21 0x00 |
类型 0x59 (89 dec) 表示设备状态
类型0x40表示 状态代码 上一条命令的状态码