dwm_anchor_list_get
Reads the list of surrounding anchors and works for anchors only. Anchors in the list can be from the same network or neighbor network.
-
void dwm_anchor_list_get(dwm_anchor_list_t *list)
- Parameters
input – (SPI/UART) ‘0’ | ‘1’(page number (only on SPI/UART, the user application reads whole list in 1 call), valid numbers are 0,1)
input – (user application) (none)
output – Status code, cnt, {node_id, position, rssi, seat, neighbor_network}
cnt – ? 1 byte? (element count, 15 is maximum for SPI/UART, 30 is maximum for user application)
node_id – ? 2 bytes ? (anchor ID)
position – ? 12 bytes ?
rssi – ? 1 byte signed? (signal strength indicator)
seat – ? 5 bits ? (seat number occupied by the anchor)
neighbor_network – ? 1 bit ? (status flags that indicates if anchor is from current network or if it is from neighbor network)
C code example
dwm_anchor_list_t list;
int i;
dwm_anchor_list_get(&list);
for (i:0; i < list.cnt; ++i) {
printf("%d. id=0x%04X pos=[%ld,%ld,%ld] rssi=%d seat=%u neighbor=%d\n", i,
list.v[i].node_id,
list.v[i].x,
list.v[i].y,
list.v[i].z,
list.v[i].rssi,
list.v[i].seat,
list.v[i].neighbor_network);
}
SPI/UART example 1
TLV Request |
||
---|---|---|
Type |
Length |
Value |
0x0B |
0x01 |
0x00 |
Type 0x0B means command dwm_an_list_get
TLV response |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Type |
Length |
Value |
Type |
Length |
Value |
|||||
uint8 - error code |
uint8 - number of elements encoded |
uint16 - UWB address in little endian |
anchor nr.1 |
anchors nr. 2 … nr.15 |
||||||
3 x int32 - position coordinates x, y, z in little endian |
int8 - RSSI |
uint8 - flags
(bits 0-4) seat number
(bit 5) neighbour network
(bits 6-7) reserved
|
… |
|||||||
0x40 |
0x01 |
0x00 |
0x56 |
0xE1 |
0x0F |
0xAB 0x1E … |
… |
SPI/UART example 2
TLV Request |
||
---|---|---|
Type |
Length |
Value |
0x0B |
0x01 |
0x01 |
Type 0x0B means command dwm_an_list_get
TLV Response (anchor list is empty) |
|||||
---|---|---|---|---|---|
Type |
Length |
Value |
Type |
Length |
Value |
0x40 |
0x01 |
0x00 |
0x56 |
0x01 |
uint8 - number of elements encoded in the Value |
0x00 |