bt_shell_printf("\tModel: %4.4x\n",
(uint16_t) (mod_id & 0xffff));
- bt_shell_printf("\tApp Key Idx: %4.4x\n", pub->app_idx);
+ bt_shell_printf("\tApp Key Idx: %u (0x%3.3x)\n", pub->app_idx,
+ pub->app_idx);
bt_shell_printf("\tTTL: %2.2x\n", pub->ttl);
}
bt_shell_printf("\t\t%4.4x\n ", get_le16(data + i));
}
+static void print_appkey_list(uint16_t len, uint8_t *data)
+{
+ uint16_t app_idx;
+
+ bt_shell_printf("AppKeys:\n");
+
+ while (len >= 3) {
+ app_idx = l_get_le16(data) & 0xfff;
+ bt_shell_printf("\t%u (0x%3.3x)\n", app_idx, app_idx);
+ app_idx = l_get_le16(data + 1) >> 4;
+ bt_shell_printf("\t%u (0x%3.3x)\n", app_idx, app_idx);
+ data += 3;
+ len -= 3;
+ }
+
+ if (len == 2) {
+ app_idx = l_get_le16(data) & 0xfff;
+ bt_shell_printf("\t %u (0x%3.3x)\n", app_idx, app_idx);
+ }
+}
+
static bool msg_recvd(uint16_t src, uint16_t idx, uint8_t *data,
uint16_t len)
{
uint32_t mod_id;
struct model_pub pub;
int n;
- uint16_t i;
struct pending_req *req;
if (mesh_opcode_get(data, len, &opcode, &n)) {
net_idx = get_le16(data + 1) & 0xfff;
app_idx = get_le16(data + 2) >> 4;
- bt_shell_printf("NetKey\t%3.3x\n", net_idx);
- bt_shell_printf("AppKey\t%3.3x\n", app_idx);
+ bt_shell_printf("NetKey\t%u (0x%3.3x)\n", net_idx, net_idx);
+ bt_shell_printf("AppKey\t%u (0x%3.3x)\n", app_idx, app_idx);
if (data[0] != MESH_STATUS_SUCCESS)
break;
bt_shell_printf("AppKey List (node %4.4x) Status %s\n",
src, mesh_status_str(data[0]));
- bt_shell_printf("NetKey %3.3x\n", l_get_le16(&data[1]));
+
+ net_idx = l_get_le16(&data[1]);
+ bt_shell_printf("NetKey %u (0x%3.3x)\n", net_idx, net_idx);
len -= 3;
if (data[0] != MESH_STATUS_SUCCESS)
break;
- bt_shell_printf("AppKeys:\n");
data += 3;
-
- while (len >= 3) {
- bt_shell_printf("\t%3.3x\n", l_get_le16(data) & 0xfff);
- bt_shell_printf("\t%3.3x\n", l_get_le16(data + 1) >> 4);
- len -= 3;
- data += 3;
- }
-
- if (len == 2)
- bt_shell_printf("\t%3.3x\n", l_get_le16(data));
+ print_appkey_list(len, data);
break;
mesh_status_str(data[0]));
net_idx = get_le16(data + 1) & 0xfff;
- bt_shell_printf("\tNetKey %3.3x\n", net_idx);
+ bt_shell_printf("\tNetKey %u (0x%3.3x)\n", net_idx, net_idx);
if (data[0] != MESH_STATUS_SUCCESS)
break;
while (len >= 3) {
net_idx = l_get_le16(data) & 0xfff;
- bt_shell_printf("\t%3.3x\n", net_idx);
+ bt_shell_printf("\t%u (0x%3.3x)\n", net_idx, net_idx);
net_idx = l_get_le16(data + 1) >> 4;
- bt_shell_printf("\t%3.3x\n", net_idx);
+ bt_shell_printf("\t%u (0x%3.3x)\n", net_idx, net_idx);
data += 3;
len -= 3;
}
- if (len == 2)
- bt_shell_printf("\t%3.3x\n", l_get_le16(data) & 0xfff);
+ if (len == 2) {
+ net_idx = l_get_le16(data) & 0xfff;
+ bt_shell_printf("\t %u (0x%3.3x)\n", net_idx, net_idx);
+ }
break;
mesh_status_str(data[0]));
net_idx = get_le16(data + 1) & 0xfff;
- bt_shell_printf("\tNetKey %3.3x\n", net_idx);
+ bt_shell_printf("\tNetKey %u (0x%3.3x)\n", net_idx, net_idx);
bt_shell_printf("\tKR Phase %2.2x\n", data[3]);
break;
print_mod_id(data + 5, len == 9, "");
- bt_shell_printf("AppIdx\t\t%3.3x\n ", app_idx);
+ bt_shell_printf("AppIdx\t\t%u (0x%3.3x)\n ", app_idx, app_idx);
break;
bt_shell_printf("Element Addr\t%4.4x\n", get_le16(data + 1));
bt_shell_printf("Model ID\t%4.4x\n", get_le16(data + 3));
- for (i = 5; i < len; i += 2)
- bt_shell_printf("Model AppIdx\t%4.4x\n",
- get_le16(data + i));
+ data += 5;
+ len -= 5;
+ print_appkey_list(len, data);
+
break;
case OP_VEND_MODEL_APP_LIST:
bt_shell_printf("Element Addr\t%4.4x\n", get_le16(data + 1));
print_mod_id(data + 3, true, "");
- for (i = 7; i < len; i += 2)
- bt_shell_printf("Model AppIdx\t%4.4x\n",
- get_le16(data + i));
+ data += 7;
+ len -= 7;
+ print_appkey_list(len, data);
+
break;
/* Per Mesh Profile 4.3.2.63 */
bt_shell_printf("Period\t\t%2.2x\n", data[4]);
bt_shell_printf("TTL\t\t%2.2x\n", data[5]);
bt_shell_printf("Features\t%4.4x\n", get_le16(data + 6));
- bt_shell_printf("Net_Idx\t%4.4x\n", get_le16(data + 8));
+ net_idx = get_le16(data + 8);
+ bt_shell_printf("Net_Idx\t%u (0x%3.3x)\n", net_idx, net_idx);
break;
/* Per Mesh Profile 4.3.2.66 */
if (len != 1)
return true;
- bt_shell_printf("Node %4.4x: Network transmit cnt %d, steps %d\n",
+ bt_shell_printf("Node %4.4x: Net transmit cnt %d, steps %d\n",
src, data[0] & 7, data[0] >> 3);
break;