uint16_t appkey_idx;
oal_uuid_t net_uuid;
uint16_t data_len;
+ uint16_t msg_hex_len = 0;
uint32_t opcode = 0;
uint8_t buffer[MESH_CONFIG_BUFFER_MAX_LEN];
uint8_t msg[BLUETOOTH_MESH_MODEL_MSG_LENGTH_MAX + 1];
req->opcode, req->msg_len);
if (req->msg_len > 0) {
/* Convert Mesh msg to hex*/
- BT_DBG("Mesh: Model string msg opcode: 0x%2.2X msg_len: %zd, msg: %s",
- req->opcode, strlen(req->msg), req->msg);
- _bt_mesh_util_convert_string_to_hex(req->msg, strlen(req->msg), msg, (req->msg_len)/2);
+ BT_DBG("Mesh: Model string msg_len: %zd, msg: %s", strlen(req->msg), req->msg);
+ msg_hex_len = req->msg_len/2;
+ _bt_mesh_util_convert_string_to_hex(req->msg, strlen(req->msg), msg, msg_hex_len);
- for (int msg_idx = 0; msg_idx < (req->msg_len)/2; msg_idx++)
+ for (int msg_idx = 0; msg_idx < msg_hex_len; msg_idx++)
BT_DBG("Mesh: Model hex msg[%d]: msg: 0x%2.2X", msg_idx, msg[msg_idx]);
/* Append model msg */
- if (req->msg_len > 0) {
- memcpy(buffer + data_len, msg, req->msg_len);
- data_len += req->msg_len;
+ if (msg_hex_len > 0) {
+ memcpy(buffer + data_len, msg, msg_hex_len);
+ data_len += msg_hex_len;
}
}