sys/shell/nimble_netif: add list channel map cmd
This commit is contained in:
parent
ef4cecae25
commit
18d6e122b5
@ -380,9 +380,9 @@ int _nimble_netif_handler(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if ((argc == 1) || _ishelp(argv[1])) {
|
if ((argc == 1) || _ishelp(argv[1])) {
|
||||||
#if !IS_USED(MODULE_NIMBLE_AUTOCONN) && !IS_USED(MODULE_NIMBLE_STATCONN)
|
#if !IS_USED(MODULE_NIMBLE_AUTOCONN) && !IS_USED(MODULE_NIMBLE_STATCONN)
|
||||||
printf("usage: %s [help|info|adv|scan|connect|close|update]\n", argv[0]);
|
printf("usage: %s [help|info|adv|scan|connect|close|update|chanmap]\n", argv[0]);
|
||||||
#else
|
#else
|
||||||
printf("usage: %s [help|info|close|update]\n", argv[0]);
|
printf("usage: %s [help|info|close|update|chanmap]\n", argv[0]);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -474,6 +474,28 @@ int _nimble_netif_handler(int argc, char **argv)
|
|||||||
int timeout = atoi(argv[4]);
|
int timeout = atoi(argv[4]);
|
||||||
_cmd_update(handle, itvl, timeout);
|
_cmd_update(handle, itvl, timeout);
|
||||||
}
|
}
|
||||||
|
else if ((memcmp(argv[1], "chanmap", 7) == 0)) {
|
||||||
|
int handle = nimble_netif_conn_get_next(NIMBLE_NETIF_CONN_INVALID,
|
||||||
|
NIMBLE_NETIF_GAP_CONNECTED);
|
||||||
|
if (handle == NIMBLE_NETIF_CONN_INVALID) {
|
||||||
|
printf("err: no BLE connection(s) found\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
puts("Used channels per Slot\n"
|
||||||
|
"Bitmap denotes channels in ascending order: CH36, ..., CH0\n"
|
||||||
|
"e.g. '1f ff ff ff ff' shows that all 37 data channels in use");
|
||||||
|
while (handle != NIMBLE_NETIF_CONN_INVALID) {
|
||||||
|
uint8_t map[5];
|
||||||
|
nimble_netif_used_chanmap(handle, map);
|
||||||
|
printf("[%02i] %02x %02x %02x %02x %02x\n", handle,
|
||||||
|
(int)map[4], (int)map[3], (int)map[2],
|
||||||
|
(int)map[1], (int)map[0]);
|
||||||
|
handle = nimble_netif_conn_get_next(handle,
|
||||||
|
NIMBLE_NETIF_GAP_CONNECTED);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
printf("unable to parse the command. Use '%s help' for more help\n",
|
printf("unable to parse the command. Use '%s help' for more help\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user