ble_mesh: Replace zephyr integer types with C99 types [Zephyr]

This commit is contained in:
lly 2020-12-07 17:03:11 +08:00
parent 866b6b439c
commit 93991bda4a
108 changed files with 4195 additions and 4211 deletions

View File

@ -367,10 +367,10 @@ typedef struct {
/** Parameters of Generic Battery Status. */ /** Parameters of Generic Battery Status. */
typedef struct { typedef struct {
u32_t battery_level : 8; /*!< Value of Generic Battery Level state */ uint32_t battery_level : 8; /*!< Value of Generic Battery Level state */
u32_t time_to_discharge : 24; /*!< Value of Generic Battery Time to Discharge state */ uint32_t time_to_discharge : 24; /*!< Value of Generic Battery Time to Discharge state */
u32_t time_to_charge : 24; /*!< Value of Generic Battery Time to Charge state */ uint32_t time_to_charge : 24; /*!< Value of Generic Battery Time to Charge state */
u32_t flags : 8; /*!< Value of Generic Battery Flags state */ uint32_t flags : 8; /*!< Value of Generic Battery Flags state */
} esp_ble_mesh_gen_battery_status_cb_t; } esp_ble_mesh_gen_battery_status_cb_t;
/** Parameters of Generic Location Global Status. */ /** Parameters of Generic Location Global Status. */

View File

@ -128,7 +128,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
{ {
esp_ble_mesh_cfg_client_cb_param_t *p_dest_data = (esp_ble_mesh_cfg_client_cb_param_t *)p_dest; esp_ble_mesh_cfg_client_cb_param_t *p_dest_data = (esp_ble_mesh_cfg_client_cb_param_t *)p_dest;
esp_ble_mesh_cfg_client_cb_param_t *p_src_data = (esp_ble_mesh_cfg_client_cb_param_t *)p_src; esp_ble_mesh_cfg_client_cb_param_t *p_src_data = (esp_ble_mesh_cfg_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -310,10 +310,10 @@ static void btc_ble_mesh_config_client_callback(esp_ble_mesh_cfg_client_cb_param
btc_ble_mesh_config_client_copy_req_data); btc_ble_mesh_config_client_copy_req_data);
} }
void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_config_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_cfg_client_cb_param_t cb_params = {0}; esp_ble_mesh_cfg_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -364,7 +364,7 @@ void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_config_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_config_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -713,9 +713,9 @@ static void btc_ble_mesh_config_server_callback(esp_ble_mesh_cfg_server_cb_param
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_cfg_server_cb_param_t), NULL); btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_cfg_server_cb_param_t), NULL);
} }
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_config_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_cfg_server_cb_param_t cb_params = {0}; esp_ble_mesh_cfg_server_cb_param_t cb_params = {0};
uint8_t act = 0U; uint8_t act = 0U;

View File

@ -37,7 +37,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
{ {
btc_ble_mesh_generic_client_args_t *dst = (btc_ble_mesh_generic_client_args_t *)p_dest; btc_ble_mesh_generic_client_args_t *dst = (btc_ble_mesh_generic_client_args_t *)p_dest;
btc_ble_mesh_generic_client_args_t *src = (btc_ble_mesh_generic_client_args_t *)p_src; btc_ble_mesh_generic_client_args_t *src = (btc_ble_mesh_generic_client_args_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !dst || !src) { if (!msg || !dst || !src) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -164,7 +164,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
{ {
esp_ble_mesh_generic_client_cb_param_t *p_dest_data = (esp_ble_mesh_generic_client_cb_param_t *)p_dest; esp_ble_mesh_generic_client_cb_param_t *p_dest_data = (esp_ble_mesh_generic_client_cb_param_t *)p_dest;
esp_ble_mesh_generic_client_cb_param_t *p_src_data = (esp_ble_mesh_generic_client_cb_param_t *)p_src; esp_ble_mesh_generic_client_cb_param_t *p_src_data = (esp_ble_mesh_generic_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -380,10 +380,10 @@ static void btc_ble_mesh_generic_client_callback(esp_ble_mesh_generic_client_cb_
btc_ble_mesh_generic_client_copy_req_data); btc_ble_mesh_generic_client_copy_req_data);
} }
void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_generic_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_generic_client_cb_param_t cb_params = {0}; esp_ble_mesh_generic_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -434,7 +434,7 @@ void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_generic_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -552,7 +552,7 @@ static void btc_ble_mesh_generic_server_copy_req_data(btc_msg_t *msg, void *p_de
{ {
esp_ble_mesh_generic_server_cb_param_t *p_dest_data = (esp_ble_mesh_generic_server_cb_param_t *)p_dest; esp_ble_mesh_generic_server_cb_param_t *p_dest_data = (esp_ble_mesh_generic_server_cb_param_t *)p_dest;
esp_ble_mesh_generic_server_cb_param_t *p_src_data = (esp_ble_mesh_generic_server_cb_param_t *)p_src; esp_ble_mesh_generic_server_cb_param_t *p_src_data = (esp_ble_mesh_generic_server_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -697,9 +697,9 @@ static void btc_ble_mesh_generic_server_callback(esp_ble_mesh_generic_server_cb_
btc_ble_mesh_generic_server_copy_req_data); btc_ble_mesh_generic_server_copy_req_data);
} }
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_generic_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_generic_server_cb_param_t cb_params = {0}; esp_ble_mesh_generic_server_cb_param_t cb_params = {0};
uint8_t act = 0U; uint8_t act = 0U;

View File

@ -121,7 +121,7 @@ static void btc_ble_mesh_health_client_copy_req_data(btc_msg_t *msg, void *p_des
{ {
esp_ble_mesh_health_client_cb_param_t *p_dest_data = (esp_ble_mesh_health_client_cb_param_t *)p_dest; esp_ble_mesh_health_client_cb_param_t *p_dest_data = (esp_ble_mesh_health_client_cb_param_t *)p_dest;
esp_ble_mesh_health_client_cb_param_t *p_src_data = (esp_ble_mesh_health_client_cb_param_t *)p_src; esp_ble_mesh_health_client_cb_param_t *p_src_data = (esp_ble_mesh_health_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -243,10 +243,10 @@ static void btc_ble_mesh_health_client_callback(esp_ble_mesh_health_client_cb_pa
btc_ble_mesh_health_client_copy_req_data); btc_ble_mesh_health_client_copy_req_data);
} }
void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_health_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, u16_t len) const uint8_t *val, uint16_t len)
{ {
esp_ble_mesh_health_client_cb_param_t cb_params = {0}; esp_ble_mesh_health_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -297,7 +297,7 @@ void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_health_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_health_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -602,7 +602,7 @@ void btc_ble_mesh_health_server_cb_handler(btc_msg_t *msg)
return; return;
} }
void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, u16_t company_id) void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, uint16_t company_id)
{ {
esp_ble_mesh_health_server_cb_param_t param = {0}; esp_ble_mesh_health_server_cb_param_t param = {0};
@ -613,7 +613,7 @@ void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, u16_t c
} }
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model, void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model,
u8_t test_id, u16_t company_id) uint8_t test_id, uint16_t company_id)
{ {
esp_ble_mesh_health_server_cb_param_t param = {0}; esp_ble_mesh_health_server_cb_param_t param = {0};
@ -624,7 +624,7 @@ void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model,
btc_ble_mesh_health_server_callback(&param, ESP_BLE_MESH_HEALTH_SERVER_FAULT_TEST_EVT); btc_ble_mesh_health_server_callback(&param, ESP_BLE_MESH_HEALTH_SERVER_FAULT_TEST_EVT);
} }
void btc_ble_mesh_health_server_attention_on(struct bt_mesh_model *model, u8_t time) void btc_ble_mesh_health_server_attention_on(struct bt_mesh_model *model, uint8_t time)
{ {
esp_ble_mesh_health_server_cb_param_t param = {0}; esp_ble_mesh_health_server_cb_param_t param = {0};

View File

@ -120,7 +120,7 @@ static void btc_ble_mesh_lighting_client_copy_req_data(btc_msg_t *msg, void *p_d
{ {
esp_ble_mesh_light_client_cb_param_t *p_dest_data = (esp_ble_mesh_light_client_cb_param_t *)p_dest; esp_ble_mesh_light_client_cb_param_t *p_dest_data = (esp_ble_mesh_light_client_cb_param_t *)p_dest;
esp_ble_mesh_light_client_cb_param_t *p_src_data = (esp_ble_mesh_light_client_cb_param_t *)p_src; esp_ble_mesh_light_client_cb_param_t *p_src_data = (esp_ble_mesh_light_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -224,10 +224,10 @@ static void btc_ble_mesh_lighting_client_callback(esp_ble_mesh_light_client_cb_p
btc_ble_mesh_lighting_client_copy_req_data); btc_ble_mesh_lighting_client_copy_req_data);
} }
void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_lighting_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_light_client_cb_param_t cb_params = {0}; esp_ble_mesh_light_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -278,7 +278,7 @@ void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_lighting_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -396,7 +396,7 @@ static void btc_ble_mesh_lighting_server_copy_req_data(btc_msg_t *msg, void *p_d
{ {
esp_ble_mesh_lighting_server_cb_param_t *p_dest_data = (esp_ble_mesh_lighting_server_cb_param_t *)p_dest; esp_ble_mesh_lighting_server_cb_param_t *p_dest_data = (esp_ble_mesh_lighting_server_cb_param_t *)p_dest;
esp_ble_mesh_lighting_server_cb_param_t *p_src_data = (esp_ble_mesh_lighting_server_cb_param_t *)p_src; esp_ble_mesh_lighting_server_cb_param_t *p_src_data = (esp_ble_mesh_lighting_server_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -509,9 +509,9 @@ static void btc_ble_mesh_lighting_server_callback(esp_ble_mesh_lighting_server_c
btc_ble_mesh_lighting_server_copy_req_data); btc_ble_mesh_lighting_server_copy_req_data);
} }
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_lighting_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_lighting_server_cb_param_t cb_params = {0}; esp_ble_mesh_lighting_server_cb_param_t cb_params = {0};
uint8_t act = 0U; uint8_t act = 0U;

View File

@ -467,7 +467,7 @@ static void btc_ble_mesh_client_model_timeout_cb(struct k_work *work)
static void btc_ble_mesh_model_send_comp_cb(esp_ble_mesh_model_t *model, static void btc_ble_mesh_model_send_comp_cb(esp_ble_mesh_model_t *model,
esp_ble_mesh_msg_ctx_t *ctx, esp_ble_mesh_msg_ctx_t *ctx,
u32_t opcode, int err) uint32_t opcode, int err)
{ {
esp_ble_mesh_model_cb_param_t mesh_param = {0}; esp_ble_mesh_model_cb_param_t mesh_param = {0};
@ -552,7 +552,7 @@ static void btc_ble_mesh_oob_pub_key_cb(void)
return; return;
} }
static int btc_ble_mesh_output_number_cb(bt_mesh_output_action_t act, u32_t num) static int btc_ble_mesh_output_number_cb(bt_mesh_output_action_t act, uint32_t num)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
bt_status_t ret = BT_STATUS_SUCCESS; bt_status_t ret = BT_STATUS_SUCCESS;
@ -580,7 +580,7 @@ static int btc_ble_mesh_output_string_cb(const char *str)
return (ret == BT_STATUS_SUCCESS) ? 0 : -1; return (ret == BT_STATUS_SUCCESS) ? 0 : -1;
} }
static int btc_ble_mesh_input_cb(bt_mesh_input_action_t act, u8_t size) static int btc_ble_mesh_input_cb(bt_mesh_input_action_t act, uint8_t size)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
bt_status_t ret = BT_STATUS_SUCCESS; bt_status_t ret = BT_STATUS_SUCCESS;
@ -618,8 +618,8 @@ static void btc_ble_mesh_link_close_cb(bt_mesh_prov_bearer_t bearer)
return; return;
} }
static void btc_ble_mesh_complete_cb(u16_t net_idx, const u8_t net_key[16], static void btc_ble_mesh_complete_cb(uint16_t net_idx, const uint8_t net_key[16],
u16_t addr, u8_t flags, u32_t iv_index) uint16_t addr, uint8_t flags, uint32_t iv_index)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -675,10 +675,10 @@ static void btc_ble_mesh_prov_set_complete_cb(esp_ble_mesh_prov_cb_param_t *para
} }
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
static void btc_ble_mesh_provisioner_recv_unprov_adv_pkt_cb(const u8_t addr[6], const u8_t addr_type, static void btc_ble_mesh_provisioner_recv_unprov_adv_pkt_cb(const uint8_t addr[6], const uint8_t addr_type,
const u8_t adv_type, const u8_t dev_uuid[16], const uint8_t adv_type, const uint8_t dev_uuid[16],
u16_t oob_info, bt_mesh_prov_bearer_t bearer, uint16_t oob_info, bt_mesh_prov_bearer_t bearer,
s8_t rssi) int8_t rssi)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -702,7 +702,7 @@ static void btc_ble_mesh_provisioner_recv_unprov_adv_pkt_cb(const u8_t addr[6],
return; return;
} }
static int btc_ble_mesh_provisioner_prov_read_oob_pub_key_cb(u8_t link_idx) static int btc_ble_mesh_provisioner_prov_read_oob_pub_key_cb(uint8_t link_idx)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
bt_status_t ret = BT_STATUS_SUCCESS; bt_status_t ret = BT_STATUS_SUCCESS;
@ -715,8 +715,8 @@ static int btc_ble_mesh_provisioner_prov_read_oob_pub_key_cb(u8_t link_idx)
return (ret == BT_STATUS_SUCCESS) ? 0 : -1; return (ret == BT_STATUS_SUCCESS) ? 0 : -1;
} }
static int btc_ble_mesh_provisioner_prov_input_cb(u8_t method, bt_mesh_output_action_t act, static int btc_ble_mesh_provisioner_prov_input_cb(uint8_t method, bt_mesh_output_action_t act,
u8_t size, u8_t link_idx) uint8_t size, uint8_t link_idx)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
bt_status_t ret = BT_STATUS_SUCCESS; bt_status_t ret = BT_STATUS_SUCCESS;
@ -732,8 +732,8 @@ static int btc_ble_mesh_provisioner_prov_input_cb(u8_t method, bt_mesh_output_ac
return (ret == BT_STATUS_SUCCESS) ? 0 : -1; return (ret == BT_STATUS_SUCCESS) ? 0 : -1;
} }
static int btc_ble_mesh_provisioner_prov_output_cb(u8_t method, bt_mesh_input_action_t act, static int btc_ble_mesh_provisioner_prov_output_cb(uint8_t method, bt_mesh_input_action_t act,
void *data, u8_t size, u8_t link_idx) void *data, uint8_t size, uint8_t link_idx)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
bt_status_t ret = BT_STATUS_SUCCESS; bt_status_t ret = BT_STATUS_SUCCESS;
@ -747,7 +747,7 @@ static int btc_ble_mesh_provisioner_prov_output_cb(u8_t method, bt_mesh_input_ac
if (act == BLE_MESH_ENTER_STRING) { if (act == BLE_MESH_ENTER_STRING) {
strncpy(mesh_param.provisioner_prov_output.string, (char *)data, size); strncpy(mesh_param.provisioner_prov_output.string, (char *)data, size);
} else { } else {
mesh_param.provisioner_prov_output.number = sys_get_le32((u8_t *)data); mesh_param.provisioner_prov_output.number = sys_get_le32((uint8_t *)data);
} }
ret = btc_ble_mesh_prov_callback(&mesh_param, ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT); ret = btc_ble_mesh_prov_callback(&mesh_param, ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT);
@ -766,7 +766,7 @@ static void btc_ble_mesh_provisioner_link_open_cb(bt_mesh_prov_bearer_t bearer)
return; return;
} }
static void btc_ble_mesh_provisioner_link_close_cb(bt_mesh_prov_bearer_t bearer, u8_t reason) static void btc_ble_mesh_provisioner_link_close_cb(bt_mesh_prov_bearer_t bearer, uint8_t reason)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -779,9 +779,9 @@ static void btc_ble_mesh_provisioner_link_close_cb(bt_mesh_prov_bearer_t bearer,
return; return;
} }
static void btc_ble_mesh_provisioner_prov_complete_cb(u16_t node_idx, const u8_t device_uuid[16], static void btc_ble_mesh_provisioner_prov_complete_cb(uint16_t node_idx, const uint8_t device_uuid[16],
u16_t unicast_addr, u8_t element_num, uint16_t unicast_addr, uint8_t element_num,
u16_t netkey_idx) uint16_t netkey_idx)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -812,7 +812,7 @@ esp_ble_mesh_node_t *btc_ble_mesh_provisioner_get_node_with_name(const char *nam
return (esp_ble_mesh_node_t *)bt_mesh_provisioner_get_node_with_name(name); return (esp_ble_mesh_node_t *)bt_mesh_provisioner_get_node_with_name(name);
} }
u16_t btc_ble_mesh_provisioner_get_prov_node_count(void) uint16_t btc_ble_mesh_provisioner_get_prov_node_count(void)
{ {
return bt_mesh_provisioner_get_node_count(); return bt_mesh_provisioner_get_node_count();
} }
@ -823,9 +823,9 @@ const esp_ble_mesh_node_t **btc_ble_mesh_provisioner_get_node_table_entry(void)
} }
#if CONFIG_BLE_MESH_PROVISIONER_RECV_HB #if CONFIG_BLE_MESH_PROVISIONER_RECV_HB
static void btc_ble_mesh_provisioner_recv_heartbeat_cb(u16_t hb_src, u16_t hb_dst, static void btc_ble_mesh_provisioner_recv_heartbeat_cb(uint16_t hb_src, uint16_t hb_dst,
u8_t init_ttl, u8_t rx_ttl, uint8_t init_ttl, uint8_t rx_ttl,
u8_t hops, u16_t feat, s8_t rssi) uint8_t hops, uint16_t feat, int8_t rssi)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -860,7 +860,7 @@ uint8_t btc_ble_mesh_provisioner_get_free_settings_count(void)
#endif /* CONFIG_BLE_MESH_PROVISIONER */ #endif /* CONFIG_BLE_MESH_PROVISIONER */
static void btc_ble_mesh_node_recv_heartbeat_cb(u8_t hops, u16_t feature) static void btc_ble_mesh_node_recv_heartbeat_cb(uint8_t hops, uint16_t feature)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -874,10 +874,10 @@ static void btc_ble_mesh_node_recv_heartbeat_cb(u8_t hops, u16_t feature)
} }
#if CONFIG_BLE_MESH_LOW_POWER #if CONFIG_BLE_MESH_LOW_POWER
static void btc_ble_mesh_lpn_cb(u16_t friend_addr, bool established) static void btc_ble_mesh_lpn_cb(uint16_t friend_addr, bool established)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
u8_t act = 0U; uint8_t act = 0U;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -895,10 +895,10 @@ static void btc_ble_mesh_lpn_cb(u16_t friend_addr, bool established)
#endif /* CONFIG_BLE_MESH_LOW_POWER */ #endif /* CONFIG_BLE_MESH_LOW_POWER */
#if CONFIG_BLE_MESH_FRIEND #if CONFIG_BLE_MESH_FRIEND
void btc_ble_mesh_friend_cb(bool establish, u16_t lpn_addr, u8_t reason) void btc_ble_mesh_friend_cb(bool establish, uint16_t lpn_addr, uint8_t reason)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
u8_t act = 0U; uint8_t act = 0U;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -922,8 +922,8 @@ void btc_ble_mesh_friend_cb(bool establish, u16_t lpn_addr, u8_t reason)
#endif /* CONFIG_BLE_MESH_FRIEND */ #endif /* CONFIG_BLE_MESH_FRIEND */
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT #if CONFIG_BLE_MESH_GATT_PROXY_CLIENT
static void btc_ble_mesh_proxy_client_adv_recv_cb(const bt_mesh_addr_t *addr, u8_t type, static void btc_ble_mesh_proxy_client_adv_recv_cb(const bt_mesh_addr_t *addr, uint8_t type,
bt_mesh_proxy_adv_ctx_t *ctx, s8_t rssi) bt_mesh_proxy_adv_ctx_t *ctx, int8_t rssi)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -945,7 +945,7 @@ static void btc_ble_mesh_proxy_client_adv_recv_cb(const bt_mesh_addr_t *addr, u8
} }
static void btc_ble_mesh_proxy_client_connect_cb(const bt_mesh_addr_t *addr, static void btc_ble_mesh_proxy_client_connect_cb(const bt_mesh_addr_t *addr,
u8_t conn_handle, u16_t net_idx) uint8_t conn_handle, uint16_t net_idx)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -965,8 +965,8 @@ static void btc_ble_mesh_proxy_client_connect_cb(const bt_mesh_addr_t *addr,
return; return;
} }
static void btc_ble_mesh_proxy_client_disconnect_cb(const bt_mesh_addr_t *addr, u8_t conn_handle, static void btc_ble_mesh_proxy_client_disconnect_cb(const bt_mesh_addr_t *addr, uint8_t conn_handle,
u16_t net_idx, u8_t reason) uint16_t net_idx, uint8_t reason)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -987,8 +987,8 @@ static void btc_ble_mesh_proxy_client_disconnect_cb(const bt_mesh_addr_t *addr,
return; return;
} }
static void btc_ble_mesh_proxy_client_filter_status_recv_cb(u8_t conn_handle, u16_t src, u16_t net_idx, static void btc_ble_mesh_proxy_client_filter_status_recv_cb(uint8_t conn_handle, uint16_t src, uint16_t net_idx,
u8_t filter_type, u16_t list_size) uint8_t filter_type, uint16_t list_size)
{ {
esp_ble_mesh_prov_cb_param_t mesh_param = {0}; esp_ble_mesh_prov_cb_param_t mesh_param = {0};
@ -1048,7 +1048,7 @@ uint16_t *btc_ble_mesh_model_find_group(esp_ble_mesh_model_t *mod, uint16_t addr
return bt_mesh_model_find_group((struct bt_mesh_model *)mod, addr); return bt_mesh_model_find_group((struct bt_mesh_model *)mod, addr);
} }
esp_ble_mesh_elem_t *btc_ble_mesh_elem_find(u16_t addr) esp_ble_mesh_elem_t *btc_ble_mesh_elem_find(uint16_t addr)
{ {
return (esp_ble_mesh_elem_t *)bt_mesh_elem_find(addr); return (esp_ble_mesh_elem_t *)bt_mesh_elem_find(addr);
} }
@ -1873,13 +1873,15 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
act = ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT; act = ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT;
param.provisioner_prov_input_str_comp.err_code = param.provisioner_prov_input_str_comp.err_code =
bt_mesh_provisioner_set_oob_input_data(arg->provisioner_input_str.link_idx, bt_mesh_provisioner_set_oob_input_data(arg->provisioner_input_str.link_idx,
(const u8_t *)&arg->provisioner_input_str.string, false); (const uint8_t *)&arg->provisioner_input_str.string,
false);
break; break;
case BTC_BLE_MESH_ACT_PROVISIONER_INPUT_NUM: case BTC_BLE_MESH_ACT_PROVISIONER_INPUT_NUM:
act = ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT; act = ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT;
param.provisioner_prov_input_num_comp.err_code = param.provisioner_prov_input_num_comp.err_code =
bt_mesh_provisioner_set_oob_input_data(arg->provisioner_input_num.link_idx, bt_mesh_provisioner_set_oob_input_data(arg->provisioner_input_num.link_idx,
(const u8_t *)&arg->provisioner_input_num.number, true); (const uint8_t *)&arg->provisioner_input_num.number,
true);
break; break;
case BTC_BLE_MESH_ACT_PROVISIONER_ENABLE: case BTC_BLE_MESH_ACT_PROVISIONER_ENABLE:
act = ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT; act = ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT;
@ -1964,8 +1966,8 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
bt_mesh_provisioner_set_node_name(arg->set_node_name.index, arg->set_node_name.name); bt_mesh_provisioner_set_node_name(arg->set_node_name.index, arg->set_node_name.name);
break; break;
case BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_APP_KEY: { case BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_APP_KEY: {
const u8_t *app_key = NULL; const uint8_t *app_key = NULL;
const u8_t zero[16] = {0}; const uint8_t zero[16] = {0};
if (memcmp(arg->add_local_app_key.app_key, zero, 16)) { if (memcmp(arg->add_local_app_key.app_key, zero, 16)) {
app_key = arg->add_local_app_key.app_key; app_key = arg->add_local_app_key.app_key;
} }
@ -1998,8 +2000,8 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
arg->local_mod_app_bind.app_idx); arg->local_mod_app_bind.app_idx);
break; break;
case BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_NET_KEY: { case BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_NET_KEY: {
const u8_t *net_key = NULL; const uint8_t *net_key = NULL;
const u8_t zero[16] = {0}; const uint8_t zero[16] = {0};
if (memcmp(arg->add_local_net_key.net_key, zero, 16)) { if (memcmp(arg->add_local_net_key.net_key, zero, 16)) {
net_key = arg->add_local_net_key.net_key; net_key = arg->add_local_net_key.net_key;
} }

View File

@ -37,7 +37,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
{ {
btc_ble_mesh_sensor_client_args_t *dst = (btc_ble_mesh_sensor_client_args_t *)p_dest; btc_ble_mesh_sensor_client_args_t *dst = (btc_ble_mesh_sensor_client_args_t *)p_dest;
btc_ble_mesh_sensor_client_args_t *src = (btc_ble_mesh_sensor_client_args_t *)p_src; btc_ble_mesh_sensor_client_args_t *src = (btc_ble_mesh_sensor_client_args_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !dst || !src) { if (!msg || !dst || !src) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -248,7 +248,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
{ {
esp_ble_mesh_sensor_client_cb_param_t *p_dest_data = (esp_ble_mesh_sensor_client_cb_param_t *)p_dest; esp_ble_mesh_sensor_client_cb_param_t *p_dest_data = (esp_ble_mesh_sensor_client_cb_param_t *)p_dest;
esp_ble_mesh_sensor_client_cb_param_t *p_src_data = (esp_ble_mesh_sensor_client_cb_param_t *)p_src; esp_ble_mesh_sensor_client_cb_param_t *p_src_data = (esp_ble_mesh_sensor_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -462,10 +462,10 @@ static void btc_ble_mesh_sensor_client_callback(esp_ble_mesh_sensor_client_cb_pa
btc_ble_mesh_sensor_client_copy_req_data); btc_ble_mesh_sensor_client_copy_req_data);
} }
void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_sensor_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_sensor_client_cb_param_t cb_params = {0}; esp_ble_mesh_sensor_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -516,7 +516,7 @@ void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_sensor_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -634,7 +634,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
{ {
esp_ble_mesh_sensor_server_cb_param_t *p_dest_data = (esp_ble_mesh_sensor_server_cb_param_t *)p_dest; esp_ble_mesh_sensor_server_cb_param_t *p_dest_data = (esp_ble_mesh_sensor_server_cb_param_t *)p_dest;
esp_ble_mesh_sensor_server_cb_param_t *p_src_data = (esp_ble_mesh_sensor_server_cb_param_t *)p_src; esp_ble_mesh_sensor_server_cb_param_t *p_src_data = (esp_ble_mesh_sensor_server_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -829,9 +829,9 @@ static void btc_ble_mesh_sensor_server_callback(esp_ble_mesh_sensor_server_cb_pa
btc_ble_mesh_sensor_server_copy_req_data); btc_ble_mesh_sensor_server_copy_req_data);
} }
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_sensor_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_sensor_server_cb_param_t cb_params = {0}; esp_ble_mesh_sensor_server_cb_param_t cb_params = {0};
uint8_t act = 0U; uint8_t act = 0U;

View File

@ -120,7 +120,7 @@ static void btc_ble_mesh_time_scene_client_copy_req_data(btc_msg_t *msg, void *p
{ {
esp_ble_mesh_time_scene_client_cb_param_t *p_dest_data = (esp_ble_mesh_time_scene_client_cb_param_t *)p_dest; esp_ble_mesh_time_scene_client_cb_param_t *p_dest_data = (esp_ble_mesh_time_scene_client_cb_param_t *)p_dest;
esp_ble_mesh_time_scene_client_cb_param_t *p_src_data = (esp_ble_mesh_time_scene_client_cb_param_t *)p_src; esp_ble_mesh_time_scene_client_cb_param_t *p_src_data = (esp_ble_mesh_time_scene_client_cb_param_t *)p_src;
u16_t length = 0U; uint16_t length = 0U;
if (!msg || !p_src_data || !p_dest_data) { if (!msg || !p_src_data || !p_dest_data) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -226,10 +226,10 @@ static void btc_ble_mesh_time_scene_client_callback(esp_ble_mesh_time_scene_clie
btc_ble_mesh_time_scene_client_copy_req_data); btc_ble_mesh_time_scene_client_copy_req_data);
} }
void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_time_scene_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_time_scene_client_cb_param_t cb_params = {0}; esp_ble_mesh_time_scene_client_cb_param_t cb_params = {0};
esp_ble_mesh_client_common_param_t params = {0}; esp_ble_mesh_client_common_param_t params = {0};
@ -280,7 +280,7 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
return; return;
} }
void btc_ble_mesh_time_scene_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_time_scene_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -412,9 +412,9 @@ static void btc_ble_mesh_time_scene_server_callback(esp_ble_mesh_time_scene_serv
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL); btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL);
} }
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_time_scene_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
esp_ble_mesh_time_scene_server_cb_param_t cb_params = {0}; esp_ble_mesh_time_scene_server_cb_param_t cb_params = {0};
uint8_t act = 0U; uint8_t act = 0U;

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_config_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_config_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_config_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg); void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg);
@ -69,9 +69,9 @@ typedef enum {
BTC_BLE_MESH_EVT_CONFIG_SERVER_MAX, BTC_BLE_MESH_EVT_CONFIG_SERVER_MAX,
} btc_ble_mesh_config_server_evt_t; } btc_ble_mesh_config_server_evt_t;
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_config_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_generic_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_generic_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
typedef enum { typedef enum {
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE,
@ -69,9 +69,9 @@ typedef enum {
BTC_BLE_MESH_EVT_GENERIC_SERVER_MAX, BTC_BLE_MESH_EVT_GENERIC_SERVER_MAX,
} btc_ble_mesh_generic_server_evt_t; } btc_ble_mesh_generic_server_evt_t;
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_generic_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg); void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg);

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg);
void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg); void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_health_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_health_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_health_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, u16_t len); const uint8_t *val, uint16_t len);
typedef enum { typedef enum {
BTC_BLE_MESH_ACT_HEALTH_SERVER_FAULT_UPDATE, BTC_BLE_MESH_ACT_HEALTH_SERVER_FAULT_UPDATE,
@ -79,12 +79,12 @@ void btc_ble_mesh_health_server_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_health_server_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_health_server_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, u16_t company_id); void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, uint16_t company_id);
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model, void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model,
u8_t test_id, u16_t company_id); uint8_t test_id, uint16_t company_id);
void btc_ble_mesh_health_server_attention_on(struct bt_mesh_model *model, u8_t time); void btc_ble_mesh_health_server_attention_on(struct bt_mesh_model *model, uint8_t time);
void btc_ble_mesh_health_server_attention_off(struct bt_mesh_model *model); void btc_ble_mesh_health_server_attention_off(struct bt_mesh_model *model);

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_lighting_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_lighting_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
typedef enum { typedef enum {
BTC_BLE_MESH_EVT_LIGHTING_SERVER_STATE_CHANGE, BTC_BLE_MESH_EVT_LIGHTING_SERVER_STATE_CHANGE,
@ -70,9 +70,9 @@ typedef enum {
BTC_BLE_MESH_EVT_LIGHTING_SERVER_MAX, BTC_BLE_MESH_EVT_LIGHTING_SERVER_MAX,
} btc_ble_mesh_lighting_server_evt_t; } btc_ble_mesh_lighting_server_evt_t;
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_lighting_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg); void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg);

View File

@ -365,7 +365,7 @@ esp_ble_mesh_node_t *btc_ble_mesh_provisioner_get_node_with_addr(uint16_t unicas
esp_ble_mesh_node_t *btc_ble_mesh_provisioner_get_node_with_name(const char *name); esp_ble_mesh_node_t *btc_ble_mesh_provisioner_get_node_with_name(const char *name);
u16_t btc_ble_mesh_provisioner_get_prov_node_count(void); uint16_t btc_ble_mesh_provisioner_get_prov_node_count(void);
const esp_ble_mesh_node_t **btc_ble_mesh_provisioner_get_node_table_entry(void); const esp_ble_mesh_node_t **btc_ble_mesh_provisioner_get_node_table_entry(void);
@ -379,7 +379,7 @@ uint16_t btc_ble_mesh_get_primary_addr(void);
uint16_t *btc_ble_mesh_model_find_group(esp_ble_mesh_model_t *mod, uint16_t addr); uint16_t *btc_ble_mesh_model_find_group(esp_ble_mesh_model_t *mod, uint16_t addr);
esp_ble_mesh_elem_t *btc_ble_mesh_elem_find(u16_t addr); esp_ble_mesh_elem_t *btc_ble_mesh_elem_find(uint16_t addr);
uint8_t btc_ble_mesh_elem_count(void); uint8_t btc_ble_mesh_elem_count(void);

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_sensor_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_sensor_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
typedef enum { typedef enum {
BTC_BLE_MESH_EVT_SENSOR_SERVER_STATE_CHANGE, BTC_BLE_MESH_EVT_SENSOR_SERVER_STATE_CHANGE,
@ -69,9 +69,9 @@ typedef enum {
BTC_BLE_MESH_EVT_SENSOR_SERVER_MAX, BTC_BLE_MESH_EVT_SENSOR_SERVER_MAX,
} btc_ble_mesh_sensor_server_evt_t; } btc_ble_mesh_sensor_server_evt_t;
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_sensor_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg); void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg);

View File

@ -53,14 +53,14 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg);
void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_mesh_time_scene_client_publish_callback(u32_t opcode, struct bt_mesh_model *model, void btc_ble_mesh_time_scene_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf); struct net_buf_simple *buf);
void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, void bt_mesh_time_scene_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
struct bt_mesh_model *model, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
typedef enum { typedef enum {
BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_STATE_CHANGE, BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_STATE_CHANGE,
@ -70,9 +70,9 @@ typedef enum {
BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_MAX, BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_MAX,
} btc_ble_mesh_time_scene_server_evt_t; } btc_ble_mesh_time_scene_server_evt_t;
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model, void bt_mesh_time_scene_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg); void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg);

View File

@ -12,6 +12,7 @@
#define _BLE_MESH_BUF_H_ #define _BLE_MESH_BUF_H_
#include "mesh_config.h" #include "mesh_config.h"
#include "mesh_types.h"
#include "mesh_slist.h" #include "mesh_slist.h"
#include "mesh_compiler.h" #include "mesh_compiler.h"
@ -51,7 +52,7 @@ __extension__ ({ \
* @param _size Maximum data storage for the buffer. * @param _size Maximum data storage for the buffer.
*/ */
#define NET_BUF_SIMPLE_DEFINE(_name, _size) \ #define NET_BUF_SIMPLE_DEFINE(_name, _size) \
u8_t net_buf_data_##_name[_size]; \ uint8_t net_buf_data_##_name[_size]; \
struct net_buf_simple _name = { \ struct net_buf_simple _name = { \
.data = net_buf_data_##_name, \ .data = net_buf_data_##_name, \
.len = 0, \ .len = 0, \
@ -70,7 +71,7 @@ __extension__ ({ \
* @param _size Maximum data storage for the buffer. * @param _size Maximum data storage for the buffer.
*/ */
#define NET_BUF_SIMPLE_DEFINE_STATIC(_name, _size) \ #define NET_BUF_SIMPLE_DEFINE_STATIC(_name, _size) \
static u8_t net_buf_data_##_name[_size]; \ static uint8_t net_buf_data_##_name[_size]; \
static struct net_buf_simple _name = { \ static struct net_buf_simple _name = { \
.data = net_buf_data_##_name, \ .data = net_buf_data_##_name, \
.len = 0, \ .len = 0, \
@ -93,18 +94,18 @@ __extension__ ({ \
*/ */
struct net_buf_simple { struct net_buf_simple {
/** Pointer to the start of data in the buffer. */ /** Pointer to the start of data in the buffer. */
u8_t *data; uint8_t *data;
/** Length of the data behind the data pointer. */ /** Length of the data behind the data pointer. */
u16_t len; uint16_t len;
/** Amount of data that this buffer can store. */ /** Amount of data that this buffer can store. */
u16_t size; uint16_t size;
/** Start of the data storage. Not to be accessed directly /** Start of the data storage. Not to be accessed directly
* (the data pointer should be used instead). * (the data pointer should be used instead).
*/ */
u8_t *__buf; uint8_t *__buf;
}; };
/** /**
@ -123,13 +124,13 @@ struct net_buf_simple {
* *
* @return Pointer to stack-allocated net_buf_simple object. * @return Pointer to stack-allocated net_buf_simple object.
*/ */
#define NET_BUF_SIMPLE(_size) \ #define NET_BUF_SIMPLE(_size) \
((struct net_buf_simple *)(&(struct { \ ((struct net_buf_simple *)(&(struct { \
struct net_buf_simple buf; \ struct net_buf_simple buf; \
u8_t data[_size] __net_buf_align; \ uint8_t data[_size] __net_buf_align; \
}) { \ }) { \
.buf.size = _size, \ .buf.size = _size, \
.buf.__buf = NULL, \ .buf.__buf = NULL, \
})) }))
/** /**
@ -145,7 +146,7 @@ static inline void net_buf_simple_init(struct net_buf_simple *buf,
size_t reserve_head) size_t reserve_head)
{ {
if (!buf->__buf) { if (!buf->__buf) {
buf->__buf = (u8_t *)buf + sizeof(*buf); buf->__buf = (uint8_t *)buf + sizeof(*buf);
} }
buf->data = buf->__buf + reserve_head; buf->data = buf->__buf + reserve_head;
@ -229,7 +230,7 @@ void *net_buf_simple_add_mem(struct net_buf_simple *buf, const void *mem,
* *
* @return Pointer to the value added * @return Pointer to the value added
*/ */
u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val); uint8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val);
/** /**
* @brief Add 16-bit value at the end of the buffer * @brief Add 16-bit value at the end of the buffer
@ -241,7 +242,7 @@ u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 16-bit value to be added. * @param val 16-bit value to be added.
*/ */
void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val); void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val);
/** /**
* @brief Add 16-bit value at the end of the buffer * @brief Add 16-bit value at the end of the buffer
@ -253,7 +254,7 @@ void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 16-bit value to be added. * @param val 16-bit value to be added.
*/ */
void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val); void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val);
/** /**
* @brief Add 24-bit value at the end of the buffer * @brief Add 24-bit value at the end of the buffer
@ -265,7 +266,7 @@ void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 24-bit value to be added. * @param val 24-bit value to be added.
*/ */
void net_buf_simple_add_le24(struct net_buf_simple *buf, u32_t val); void net_buf_simple_add_le24(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Add 24-bit value at the end of the buffer * @brief Add 24-bit value at the end of the buffer
@ -277,7 +278,7 @@ void net_buf_simple_add_le24(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 24-bit value to be added. * @param val 24-bit value to be added.
*/ */
void net_buf_simple_add_be24(struct net_buf_simple *buf, u32_t val); void net_buf_simple_add_be24(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Add 32-bit value at the end of the buffer * @brief Add 32-bit value at the end of the buffer
@ -289,7 +290,7 @@ void net_buf_simple_add_be24(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 32-bit value to be added. * @param val 32-bit value to be added.
*/ */
void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val); void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Add 32-bit value at the end of the buffer * @brief Add 32-bit value at the end of the buffer
@ -301,7 +302,7 @@ void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 32-bit value to be added. * @param val 32-bit value to be added.
*/ */
void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val); void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Add 48-bit value at the end of the buffer * @brief Add 48-bit value at the end of the buffer
@ -313,7 +314,7 @@ void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 48-bit value to be added. * @param val 48-bit value to be added.
*/ */
void net_buf_simple_add_le48(struct net_buf_simple *buf, u64_t val); void net_buf_simple_add_le48(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Add 48-bit value at the end of the buffer * @brief Add 48-bit value at the end of the buffer
@ -325,7 +326,7 @@ void net_buf_simple_add_le48(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 48-bit value to be added. * @param val 48-bit value to be added.
*/ */
void net_buf_simple_add_be48(struct net_buf_simple *buf, u64_t val); void net_buf_simple_add_be48(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Add 64-bit value at the end of the buffer * @brief Add 64-bit value at the end of the buffer
@ -337,7 +338,7 @@ void net_buf_simple_add_be48(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 64-bit value to be added. * @param val 64-bit value to be added.
*/ */
void net_buf_simple_add_le64(struct net_buf_simple *buf, u64_t val); void net_buf_simple_add_le64(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Add 64-bit value at the end of the buffer * @brief Add 64-bit value at the end of the buffer
@ -349,7 +350,7 @@ void net_buf_simple_add_le64(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 64-bit value to be added. * @param val 64-bit value to be added.
*/ */
void net_buf_simple_add_be64(struct net_buf_simple *buf, u64_t val); void net_buf_simple_add_be64(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Push data to the beginning of the buffer. * @brief Push data to the beginning of the buffer.
@ -373,7 +374,7 @@ void *net_buf_simple_push(struct net_buf_simple *buf, size_t len);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 16-bit value to be pushed to the buffer. * @param val 16-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val); void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val);
/** /**
* @brief Push 16-bit value to the beginning of the buffer * @brief Push 16-bit value to the beginning of the buffer
@ -384,7 +385,7 @@ void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 16-bit value to be pushed to the buffer. * @param val 16-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val); void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val);
/** /**
* @brief Push 8-bit value to the beginning of the buffer * @brief Push 8-bit value to the beginning of the buffer
@ -394,7 +395,7 @@ void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 8-bit value to be pushed to the buffer. * @param val 8-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val); void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val);
/** /**
* @brief Push 24-bit value to the beginning of the buffer * @brief Push 24-bit value to the beginning of the buffer
@ -405,7 +406,7 @@ void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 24-bit value to be pushed to the buffer. * @param val 24-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_le24(struct net_buf_simple *buf, u32_t val); void net_buf_simple_push_le24(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Push 24-bit value to the beginning of the buffer * @brief Push 24-bit value to the beginning of the buffer
@ -416,7 +417,7 @@ void net_buf_simple_push_le24(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 24-bit value to be pushed to the buffer. * @param val 24-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_be24(struct net_buf_simple *buf, u32_t val); void net_buf_simple_push_be24(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Push 32-bit value to the beginning of the buffer * @brief Push 32-bit value to the beginning of the buffer
@ -427,7 +428,7 @@ void net_buf_simple_push_be24(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 32-bit value to be pushed to the buffer. * @param val 32-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_le32(struct net_buf_simple *buf, u32_t val); void net_buf_simple_push_le32(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Push 32-bit value to the beginning of the buffer * @brief Push 32-bit value to the beginning of the buffer
@ -438,7 +439,7 @@ void net_buf_simple_push_le32(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 32-bit value to be pushed to the buffer. * @param val 32-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_be32(struct net_buf_simple *buf, u32_t val); void net_buf_simple_push_be32(struct net_buf_simple *buf, uint32_t val);
/** /**
* @brief Push 48-bit value to the beginning of the buffer * @brief Push 48-bit value to the beginning of the buffer
@ -449,7 +450,7 @@ void net_buf_simple_push_be32(struct net_buf_simple *buf, u32_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 48-bit value to be pushed to the buffer. * @param val 48-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_le48(struct net_buf_simple *buf, u64_t val); void net_buf_simple_push_le48(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Push 48-bit value to the beginning of the buffer * @brief Push 48-bit value to the beginning of the buffer
@ -460,7 +461,7 @@ void net_buf_simple_push_le48(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 48-bit value to be pushed to the buffer. * @param val 48-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_be48(struct net_buf_simple *buf, u64_t val); void net_buf_simple_push_be48(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Push 64-bit value to the beginning of the buffer * @brief Push 64-bit value to the beginning of the buffer
@ -471,7 +472,7 @@ void net_buf_simple_push_be48(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 64-bit value to be pushed to the buffer. * @param val 64-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_le64(struct net_buf_simple *buf, u64_t val); void net_buf_simple_push_le64(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Push 64-bit value to the beginning of the buffer * @brief Push 64-bit value to the beginning of the buffer
@ -482,7 +483,7 @@ void net_buf_simple_push_le64(struct net_buf_simple *buf, u64_t val);
* @param buf Buffer to update. * @param buf Buffer to update.
* @param val 64-bit value to be pushed to the buffer. * @param val 64-bit value to be pushed to the buffer.
*/ */
void net_buf_simple_push_be64(struct net_buf_simple *buf, u64_t val); void net_buf_simple_push_be64(struct net_buf_simple *buf, uint64_t val);
/** /**
* @brief Remove data from the beginning of the buffer. * @brief Remove data from the beginning of the buffer.
@ -520,7 +521,7 @@ void *net_buf_simple_pull_mem(struct net_buf_simple *buf, size_t len);
* *
* @return The 8-bit removed value * @return The 8-bit removed value
*/ */
u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf); uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 16 bits from the beginning of the buffer. * @brief Remove and convert 16 bits from the beginning of the buffer.
@ -532,7 +533,7 @@ u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf);
* *
* @return 16-bit value converted from little endian to host endian. * @return 16-bit value converted from little endian to host endian.
*/ */
u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf); uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 16 bits from the beginning of the buffer. * @brief Remove and convert 16 bits from the beginning of the buffer.
@ -544,7 +545,7 @@ u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf);
* *
* @return 16-bit value converted from big endian to host endian. * @return 16-bit value converted from big endian to host endian.
*/ */
u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf); uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 24 bits from the beginning of the buffer. * @brief Remove and convert 24 bits from the beginning of the buffer.
@ -556,7 +557,7 @@ u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf);
* *
* @return 24-bit value converted from little endian to host endian. * @return 24-bit value converted from little endian to host endian.
*/ */
u32_t net_buf_simple_pull_le24(struct net_buf_simple *buf); uint32_t net_buf_simple_pull_le24(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 24 bits from the beginning of the buffer. * @brief Remove and convert 24 bits from the beginning of the buffer.
@ -568,7 +569,7 @@ u32_t net_buf_simple_pull_le24(struct net_buf_simple *buf);
* *
* @return 24-bit value converted from big endian to host endian. * @return 24-bit value converted from big endian to host endian.
*/ */
u32_t net_buf_simple_pull_be24(struct net_buf_simple *buf); uint32_t net_buf_simple_pull_be24(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 32 bits from the beginning of the buffer. * @brief Remove and convert 32 bits from the beginning of the buffer.
@ -580,7 +581,7 @@ u32_t net_buf_simple_pull_be24(struct net_buf_simple *buf);
* *
* @return 32-bit value converted from little endian to host endian. * @return 32-bit value converted from little endian to host endian.
*/ */
u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf); uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 32 bits from the beginning of the buffer. * @brief Remove and convert 32 bits from the beginning of the buffer.
@ -592,7 +593,7 @@ u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf);
* *
* @return 32-bit value converted from big endian to host endian. * @return 32-bit value converted from big endian to host endian.
*/ */
u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf); uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 48 bits from the beginning of the buffer. * @brief Remove and convert 48 bits from the beginning of the buffer.
@ -604,7 +605,7 @@ u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf);
* *
* @return 48-bit value converted from little endian to host endian. * @return 48-bit value converted from little endian to host endian.
*/ */
u64_t net_buf_simple_pull_le48(struct net_buf_simple *buf); uint64_t net_buf_simple_pull_le48(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 48 bits from the beginning of the buffer. * @brief Remove and convert 48 bits from the beginning of the buffer.
@ -616,7 +617,7 @@ u64_t net_buf_simple_pull_le48(struct net_buf_simple *buf);
* *
* @return 48-bit value converted from big endian to host endian. * @return 48-bit value converted from big endian to host endian.
*/ */
u64_t net_buf_simple_pull_be48(struct net_buf_simple *buf); uint64_t net_buf_simple_pull_be48(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 64 bits from the beginning of the buffer. * @brief Remove and convert 64 bits from the beginning of the buffer.
@ -628,7 +629,7 @@ u64_t net_buf_simple_pull_be48(struct net_buf_simple *buf);
* *
* @return 64-bit value converted from little endian to host endian. * @return 64-bit value converted from little endian to host endian.
*/ */
u64_t net_buf_simple_pull_le64(struct net_buf_simple *buf); uint64_t net_buf_simple_pull_le64(struct net_buf_simple *buf);
/** /**
* @brief Remove and convert 64 bits from the beginning of the buffer. * @brief Remove and convert 64 bits from the beginning of the buffer.
@ -640,7 +641,7 @@ u64_t net_buf_simple_pull_le64(struct net_buf_simple *buf);
* *
* @return 64-bit value converted from big endian to host endian. * @return 64-bit value converted from big endian to host endian.
*/ */
u64_t net_buf_simple_pull_be64(struct net_buf_simple *buf); uint64_t net_buf_simple_pull_be64(struct net_buf_simple *buf);
/** /**
* @brief Get the tail pointer for a buffer. * @brief Get the tail pointer for a buffer.
@ -651,7 +652,7 @@ u64_t net_buf_simple_pull_be64(struct net_buf_simple *buf);
* *
* @return Tail pointer for the buffer. * @return Tail pointer for the buffer.
*/ */
static inline u8_t *net_buf_simple_tail(struct net_buf_simple *buf) static inline uint8_t *net_buf_simple_tail(struct net_buf_simple *buf)
{ {
return buf->data + buf->len; return buf->data + buf->len;
} }
@ -687,9 +688,9 @@ size_t net_buf_simple_tailroom(struct net_buf_simple *buf);
*/ */
struct net_buf_simple_state { struct net_buf_simple_state {
/** Offset of the data pointer from the beginning of the storage */ /** Offset of the data pointer from the beginning of the storage */
u16_t offset; uint16_t offset;
/** Length of data */ /** Length of data */
u16_t len; uint16_t len;
}; };
/** /**
@ -760,10 +761,10 @@ struct net_buf {
}; };
/** Reference count. */ /** Reference count. */
u8_t ref; uint8_t ref;
/** Bit-field of buffer flags. */ /** Bit-field of buffer flags. */
u8_t flags; uint8_t flags;
/** Where the buffer should go when freed up. */ /** Where the buffer should go when freed up. */
struct net_buf_pool *pool; struct net_buf_pool *pool;
@ -775,32 +776,32 @@ struct net_buf {
/* The ABI of this struct must match net_buf_simple */ /* The ABI of this struct must match net_buf_simple */
struct { struct {
/** Pointer to the start of data in the buffer. */ /** Pointer to the start of data in the buffer. */
u8_t *data; uint8_t *data;
/** Length of the data behind the data pointer. */ /** Length of the data behind the data pointer. */
u16_t len; uint16_t len;
/** Amount of data that this buffer can store. */ /** Amount of data that this buffer can store. */
u16_t size; uint16_t size;
/** Start of the data storage. Not to be accessed /** Start of the data storage. Not to be accessed
* directly (the data pointer should be used * directly (the data pointer should be used
* instead). * instead).
*/ */
u8_t *__buf; uint8_t *__buf;
}; };
struct net_buf_simple b; struct net_buf_simple b;
}; };
/** System metadata for this buffer. */ /** System metadata for this buffer. */
u8_t user_data[BLE_MESH_NET_BUF_USER_DATA_SIZE] __net_buf_align; uint8_t user_data[BLE_MESH_NET_BUF_USER_DATA_SIZE] __net_buf_align;
}; };
struct net_buf_data_cb { struct net_buf_data_cb {
u8_t *(*alloc)(struct net_buf *buf, size_t *size, s32_t timeout); uint8_t *(*alloc)(struct net_buf *buf, size_t *size, int32_t timeout);
u8_t *(*ref)(struct net_buf *buf, u8_t *data); uint8_t *(*ref)(struct net_buf *buf, uint8_t *data);
void (*unref)(struct net_buf *buf, u8_t *data); void (*unref)(struct net_buf *buf, uint8_t *data);
}; };
struct net_buf_data_alloc { struct net_buf_data_alloc {
@ -810,17 +811,17 @@ struct net_buf_data_alloc {
struct net_buf_pool { struct net_buf_pool {
/** Number of buffers in pool */ /** Number of buffers in pool */
const u16_t buf_count; const uint16_t buf_count;
/** Number of uninitialized buffers */ /** Number of uninitialized buffers */
u16_t uninit_count; uint16_t uninit_count;
#if defined(CONFIG_BLE_MESH_NET_BUF_POOL_USAGE) #if defined(CONFIG_BLE_MESH_NET_BUF_POOL_USAGE)
/** Amount of available buffers in the pool. */ /** Amount of available buffers in the pool. */
s16_t avail_count; int16_t avail_count;
/** Total size of the pool. */ /** Total size of the pool. */
const u16_t pool_size; const uint16_t pool_size;
/** Name of the pool. Used when printing pool information. */ /** Name of the pool. Used when printing pool information. */
const char *name; const char *name;
@ -860,7 +861,7 @@ struct net_buf_pool {
struct net_buf_pool_fixed { struct net_buf_pool_fixed {
size_t data_size; size_t data_size;
u8_t *data_pool; uint8_t *data_pool;
}; };
/** @cond INTERNAL_HIDDEN */ /** @cond INTERNAL_HIDDEN */
@ -895,10 +896,10 @@ extern const struct net_buf_data_cb net_buf_fixed_cb;
*/ */
#define NET_BUF_POOL_FIXED_DEFINE(_name, _count, _data_size, _destroy) \ #define NET_BUF_POOL_FIXED_DEFINE(_name, _count, _data_size, _destroy) \
static struct net_buf net_buf_##_name[_count]; \ static struct net_buf net_buf_##_name[_count]; \
static u8_t net_buf_data_##_name[_count][_data_size]; \ static uint8_t net_buf_data_##_name[_count][_data_size]; \
static const struct net_buf_pool_fixed net_buf_fixed_##_name = { \ static const struct net_buf_pool_fixed net_buf_fixed_##_name = { \
.data_size = _data_size, \ .data_size = _data_size, \
.data_pool = (u8_t *)net_buf_data_##_name, \ .data_pool = (uint8_t *)net_buf_data_##_name, \
}; \ }; \
static const struct net_buf_data_alloc net_buf_fixed_alloc_##_name = { \ static const struct net_buf_data_alloc net_buf_fixed_alloc_##_name = { \
.cb = &net_buf_fixed_cb, \ .cb = &net_buf_fixed_cb, \
@ -962,12 +963,12 @@ int net_buf_id(struct net_buf *buf);
* @return New buffer or NULL if out of buffers. * @return New buffer or NULL if out of buffers.
*/ */
#if defined(CONFIG_BLE_MESH_NET_BUF_LOG) #if defined(CONFIG_BLE_MESH_NET_BUF_LOG)
struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool, s32_t timeout, struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool, int32_t timeout,
const char *func, int line); const char *func, int line);
#define net_buf_alloc_fixed(_pool, _timeout) \ #define net_buf_alloc_fixed(_pool, _timeout) \
net_buf_alloc_fixed_debug(_pool, _timeout, __func__, __LINE__) net_buf_alloc_fixed_debug(_pool, _timeout, __func__, __LINE__)
#else #else
struct net_buf *net_buf_alloc_fixed(struct net_buf_pool *pool, s32_t timeout); struct net_buf *net_buf_alloc_fixed(struct net_buf_pool *pool, int32_t timeout);
#endif #endif
/** /**
@ -1671,7 +1672,7 @@ size_t net_buf_linearize(void *dst, size_t dst_len,
* @param user_data The user data given in net_buf_append_bytes call. * @param user_data The user data given in net_buf_append_bytes call.
* @return pointer to allocated net_buf or NULL on error. * @return pointer to allocated net_buf or NULL on error.
*/ */
typedef struct net_buf *(*net_buf_allocator_cb)(s32_t timeout, void *user_data); typedef struct net_buf *(*net_buf_allocator_cb)(int32_t timeout, void *user_data);
/** /**
* @brief Append data to a list of net_buf * @brief Append data to a list of net_buf
@ -1694,7 +1695,7 @@ typedef struct net_buf *(*net_buf_allocator_cb)(s32_t timeout, void *user_data);
* were no free fragments in a pool to accommodate all data. * were no free fragments in a pool to accommodate all data.
*/ */
size_t net_buf_append_bytes(struct net_buf *buf, size_t len, size_t net_buf_append_bytes(struct net_buf *buf, size_t len,
const void *value, s32_t timeout, const void *value, int32_t timeout,
net_buf_allocator_cb allocate_cb, void *user_data); net_buf_allocator_cb allocate_cb, void *user_data);
/** /**

View File

@ -16,40 +16,40 @@ extern "C" {
/* Internal helpers only used by the sys_* APIs further below */ /* Internal helpers only used by the sys_* APIs further below */
#ifndef __bswap_16 #ifndef __bswap_16
#define __bswap_16(x) ((u16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) #define __bswap_16(x) ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
#endif #endif
#ifndef __bswap_24 #ifndef __bswap_24
#define __bswap_24(x) ((u32_t) ((((x) >> 16) & 0xff) | \ #define __bswap_24(x) ((uint32_t) ((((x) >> 16) & 0xff) | \
(((x)) & 0xff00) | \ (((x)) & 0xff00) | \
(((x) & 0xff) << 16))) (((x) & 0xff) << 16)))
#endif #endif
#ifndef __bswap_32 #ifndef __bswap_32
#define __bswap_32(x) ((u32_t) ((((x) >> 24) & 0xff) | \ #define __bswap_32(x) ((uint32_t) ((((x) >> 24) & 0xff) | \
(((x) >> 8) & 0xff00) | \ (((x) >> 8) & 0xff00) | \
(((x) & 0xff00) << 8) | \ (((x) & 0xff00) << 8) | \
(((x) & 0xff) << 24))) (((x) & 0xff) << 24)))
#endif #endif
#ifndef __bswap_48 #ifndef __bswap_48
#define __bswap_48(x) ((u64_t) ((((x) >> 40) & 0xff) | \ #define __bswap_48(x) ((uint64_t) ((((x) >> 40) & 0xff) | \
(((x) >> 24) & 0xff00) | \ (((x) >> 24) & 0xff00) | \
(((x) >> 8) & 0xff0000) | \ (((x) >> 8) & 0xff0000) | \
(((x) & 0xff0000) << 8) | \ (((x) & 0xff0000) << 8) | \
(((x) & 0xff00) << 24) | \ (((x) & 0xff00) << 24) | \
(((x) & 0xff) << 40))) (((x) & 0xff) << 40)))
#endif #endif
#ifndef __bswap_64 #ifndef __bswap_64
#define __bswap_64(x) ((u64_t) ((((x) >> 56) & 0xff) | \ #define __bswap_64(x) ((uint64_t) ((((x) >> 56) & 0xff) | \
(((x) >> 40) & 0xff00) | \ (((x) >> 40) & 0xff00) | \
(((x) >> 24) & 0xff0000) | \ (((x) >> 24) & 0xff0000) | \
(((x) >> 8) & 0xff000000) | \ (((x) >> 8) & 0xff000000) | \
(((x) & 0xff000000) << 8) | \ (((x) & 0xff000000) << 8) | \
(((x) & 0xff0000) << 24) | \ (((x) & 0xff0000) << 24) | \
(((x) & 0xff00) << 40) | \ (((x) & 0xff00) << 40) | \
(((x) & 0xff) << 56))) (((x) & 0xff) << 56)))
#endif #endif
/** @def sys_le16_to_cpu /** @def sys_le16_to_cpu
@ -250,7 +250,7 @@ extern "C" {
* @param val 16-bit integer in host endianness. * @param val 16-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_be16(u16_t val, u8_t dst[2]) static inline void sys_put_be16(uint16_t val, uint8_t dst[2])
{ {
dst[0] = val >> 8; dst[0] = val >> 8;
dst[1] = val; dst[1] = val;
@ -265,7 +265,7 @@ static inline void sys_put_be16(u16_t val, u8_t dst[2])
* @param val 24-bit integer in host endianness. * @param val 24-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_be24(u32_t val, u8_t dst[3]) static inline void sys_put_be24(uint32_t val, uint8_t dst[3])
{ {
dst[0] = val >> 16; dst[0] = val >> 16;
sys_put_be16(val, &dst[1]); sys_put_be16(val, &dst[1]);
@ -280,7 +280,7 @@ static inline void sys_put_be24(u32_t val, u8_t dst[3])
* @param val 32-bit integer in host endianness. * @param val 32-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_be32(u32_t val, u8_t dst[4]) static inline void sys_put_be32(uint32_t val, uint8_t dst[4])
{ {
sys_put_be16(val >> 16, dst); sys_put_be16(val >> 16, dst);
sys_put_be16(val, &dst[2]); sys_put_be16(val, &dst[2]);
@ -295,7 +295,7 @@ static inline void sys_put_be32(u32_t val, u8_t dst[4])
* @param val 48-bit integer in host endianness. * @param val 48-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_be48(u64_t val, u8_t dst[6]) static inline void sys_put_be48(uint64_t val, uint8_t dst[6])
{ {
sys_put_be16(val >> 32, dst); sys_put_be16(val >> 32, dst);
sys_put_be32(val, &dst[2]); sys_put_be32(val, &dst[2]);
@ -310,7 +310,7 @@ static inline void sys_put_be48(u64_t val, u8_t dst[6])
* @param val 64-bit integer in host endianness. * @param val 64-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_be64(u64_t val, u8_t dst[8]) static inline void sys_put_be64(uint64_t val, uint8_t dst[8])
{ {
sys_put_be32(val >> 32, dst); sys_put_be32(val >> 32, dst);
sys_put_be32(val, &dst[4]); sys_put_be32(val, &dst[4]);
@ -325,7 +325,7 @@ static inline void sys_put_be64(u64_t val, u8_t dst[8])
* @param val 16-bit integer in host endianness. * @param val 16-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_le16(u16_t val, u8_t dst[2]) static inline void sys_put_le16(uint16_t val, uint8_t dst[2])
{ {
dst[0] = val; dst[0] = val;
dst[1] = val >> 8; dst[1] = val >> 8;
@ -340,7 +340,7 @@ static inline void sys_put_le16(u16_t val, u8_t dst[2])
* @param val 24-bit integer in host endianness. * @param val 24-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_le24(u32_t val, u8_t dst[3]) static inline void sys_put_le24(uint32_t val, uint8_t dst[3])
{ {
sys_put_le16(val, dst); sys_put_le16(val, dst);
dst[2] = val >> 16; dst[2] = val >> 16;
@ -355,7 +355,7 @@ static inline void sys_put_le24(u32_t val, u8_t dst[3])
* @param val 32-bit integer in host endianness. * @param val 32-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_le32(u32_t val, u8_t dst[4]) static inline void sys_put_le32(uint32_t val, uint8_t dst[4])
{ {
sys_put_le16(val, dst); sys_put_le16(val, dst);
sys_put_le16(val >> 16, &dst[2]); sys_put_le16(val >> 16, &dst[2]);
@ -370,7 +370,7 @@ static inline void sys_put_le32(u32_t val, u8_t dst[4])
* @param val 48-bit integer in host endianness. * @param val 48-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_le48(u64_t val, u8_t dst[6]) static inline void sys_put_le48(uint64_t val, uint8_t dst[6])
{ {
sys_put_le32(val, dst); sys_put_le32(val, dst);
sys_put_le16(val >> 32, &dst[4]); sys_put_le16(val >> 32, &dst[4]);
@ -385,7 +385,7 @@ static inline void sys_put_le48(u64_t val, u8_t dst[6])
* @param val 64-bit integer in host endianness. * @param val 64-bit integer in host endianness.
* @param dst Destination memory address to store the result. * @param dst Destination memory address to store the result.
*/ */
static inline void sys_put_le64(u64_t val, u8_t dst[8]) static inline void sys_put_le64(uint64_t val, uint8_t dst[8])
{ {
sys_put_le32(val, dst); sys_put_le32(val, dst);
sys_put_le32(val >> 32, &dst[4]); sys_put_le32(val >> 32, &dst[4]);
@ -401,9 +401,9 @@ static inline void sys_put_le64(u64_t val, u8_t dst[8])
* *
* @return 16-bit integer in host endianness. * @return 16-bit integer in host endianness.
*/ */
static inline u16_t sys_get_be16(const u8_t src[2]) static inline uint16_t sys_get_be16(const uint8_t src[2])
{ {
return ((u16_t)src[0] << 8) | src[1]; return ((uint16_t)src[0] << 8) | src[1];
} }
/** /**
@ -416,9 +416,9 @@ static inline u16_t sys_get_be16(const u8_t src[2])
* *
* @return 24-bit integer in host endianness. * @return 24-bit integer in host endianness.
*/ */
static inline u32_t sys_get_be24(const u8_t src[3]) static inline uint32_t sys_get_be24(const uint8_t src[3])
{ {
return ((u32_t)src[0] << 16) | sys_get_be16(&src[1]); return ((uint32_t)src[0] << 16) | sys_get_be16(&src[1]);
} }
/** /**
@ -431,9 +431,9 @@ static inline u32_t sys_get_be24(const u8_t src[3])
* *
* @return 32-bit integer in host endianness. * @return 32-bit integer in host endianness.
*/ */
static inline u32_t sys_get_be32(const u8_t src[4]) static inline uint32_t sys_get_be32(const uint8_t src[4])
{ {
return ((u32_t)sys_get_be16(&src[0]) << 16) | sys_get_be16(&src[2]); return ((uint32_t)sys_get_be16(&src[0]) << 16) | sys_get_be16(&src[2]);
} }
/** /**
@ -446,9 +446,9 @@ static inline u32_t sys_get_be32(const u8_t src[4])
* *
* @return 48-bit integer in host endianness. * @return 48-bit integer in host endianness.
*/ */
static inline u64_t sys_get_be48(const u8_t src[6]) static inline uint64_t sys_get_be48(const uint8_t src[6])
{ {
return ((u64_t)sys_get_be32(&src[0]) << 32) | sys_get_be16(&src[4]); return ((uint64_t)sys_get_be32(&src[0]) << 32) | sys_get_be16(&src[4]);
} }
/** /**
@ -461,9 +461,9 @@ static inline u64_t sys_get_be48(const u8_t src[6])
* *
* @return 64-bit integer in host endianness. * @return 64-bit integer in host endianness.
*/ */
static inline u64_t sys_get_be64(const u8_t src[8]) static inline uint64_t sys_get_be64(const uint8_t src[8])
{ {
return ((u64_t)sys_get_be32(&src[0]) << 32) | sys_get_be32(&src[4]); return ((uint64_t)sys_get_be32(&src[0]) << 32) | sys_get_be32(&src[4]);
} }
/** /**
@ -476,9 +476,9 @@ static inline u64_t sys_get_be64(const u8_t src[8])
* *
* @return 16-bit integer in host endianness. * @return 16-bit integer in host endianness.
*/ */
static inline u16_t sys_get_le16(const u8_t src[2]) static inline uint16_t sys_get_le16(const uint8_t src[2])
{ {
return ((u16_t)src[1] << 8) | src[0]; return ((uint16_t)src[1] << 8) | src[0];
} }
/** /**
@ -491,9 +491,9 @@ static inline u16_t sys_get_le16(const u8_t src[2])
* *
* @return 24-bit integer in host endianness. * @return 24-bit integer in host endianness.
*/ */
static inline u32_t sys_get_le24(const u8_t src[3]) static inline uint32_t sys_get_le24(const uint8_t src[3])
{ {
return ((u32_t)src[2] << 16) | sys_get_le16(&src[0]); return ((uint32_t)src[2] << 16) | sys_get_le16(&src[0]);
} }
/** /**
@ -506,9 +506,9 @@ static inline u32_t sys_get_le24(const u8_t src[3])
* *
* @return 32-bit integer in host endianness. * @return 32-bit integer in host endianness.
*/ */
static inline u32_t sys_get_le32(const u8_t src[4]) static inline uint32_t sys_get_le32(const uint8_t src[4])
{ {
return ((u32_t)sys_get_le16(&src[2]) << 16) | sys_get_le16(&src[0]); return ((uint32_t)sys_get_le16(&src[2]) << 16) | sys_get_le16(&src[0]);
} }
/** /**
@ -521,9 +521,9 @@ static inline u32_t sys_get_le32(const u8_t src[4])
* *
* @return 48-bit integer in host endianness. * @return 48-bit integer in host endianness.
*/ */
static inline u64_t sys_get_le48(const u8_t src[6]) static inline uint64_t sys_get_le48(const uint8_t src[6])
{ {
return ((u64_t)sys_get_le32(&src[2]) << 32) | sys_get_le16(&src[0]); return ((uint64_t)sys_get_le32(&src[2]) << 32) | sys_get_le16(&src[0]);
} }
/** /**
@ -536,9 +536,9 @@ static inline u64_t sys_get_le48(const u8_t src[6])
* *
* @return 64-bit integer in host endianness. * @return 64-bit integer in host endianness.
*/ */
static inline u64_t sys_get_le64(const u8_t src[8]) static inline uint64_t sys_get_le64(const uint8_t src[8])
{ {
return ((u64_t)sys_get_le32(&src[4]) << 32) | sys_get_le32(&src[0]); return ((uint64_t)sys_get_le32(&src[4]) << 32) | sys_get_le32(&src[0]);
} }
/** /**
@ -556,8 +556,8 @@ static inline u64_t sys_get_le64(const u8_t src[8])
*/ */
static inline void sys_memcpy_swap(void *dst, const void *src, size_t length) static inline void sys_memcpy_swap(void *dst, const void *src, size_t length)
{ {
u8_t *pdst = (u8_t *)dst; uint8_t *pdst = (uint8_t *)dst;
const u8_t *psrc = (const u8_t *)src; const uint8_t *psrc = (const uint8_t *)src;
__ASSERT(((psrc < pdst && (psrc + length) <= pdst) || __ASSERT(((psrc < pdst && (psrc + length) <= pdst) ||
(psrc > pdst && (pdst + length) <= psrc)), (psrc > pdst && (pdst + length) <= psrc)),
@ -585,10 +585,10 @@ static inline void sys_mem_swap(void *buf, size_t length)
size_t i; size_t i;
for (i = 0; i < (length / 2); i++) { for (i = 0; i < (length / 2); i++) {
u8_t tmp = ((u8_t *)buf)[i]; uint8_t tmp = ((uint8_t *)buf)[i];
((u8_t *)buf)[i] = ((u8_t *)buf)[length - 1 - i]; ((uint8_t *)buf)[i] = ((uint8_t *)buf)[length - 1 - i];
((u8_t *)buf)[length - 1 - i] = tmp; ((uint8_t *)buf)[length - 1 - i] = tmp;
} }
} }

View File

@ -48,7 +48,7 @@ IRAM_ATTR void bt_mesh_free(void *ptr);
* *
* @return NULL-fail, pointer of a net_buf_simple structure-success * @return NULL-fail, pointer of a net_buf_simple structure-success
*/ */
struct net_buf_simple *bt_mesh_alloc_buf(u16_t size); struct net_buf_simple *bt_mesh_alloc_buf(uint16_t size);
/** /**
* @brief This function releases the memory allocated for the outgoing message. * @brief This function releases the memory allocated for the outgoing message.
@ -71,7 +71,7 @@ void bt_mesh_free_buf(struct net_buf_simple *buf);
* *
* @return 0 - Node, 1 - Provisioner * @return 0 - Node, 1 - Provisioner
*/ */
u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send); uint8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -27,7 +27,7 @@ extern "C" {
* @return most significant bit set, 0 if @a op is 0 * @return most significant bit set, 0 if @a op is 0
*/ */
static ALWAYS_INLINE unsigned int find_msb_set(u32_t op) static ALWAYS_INLINE unsigned int find_msb_set(uint32_t op)
{ {
if (op == 0) { if (op == 0) {
return 0; return 0;
@ -48,7 +48,7 @@ static ALWAYS_INLINE unsigned int find_msb_set(u32_t op)
* @return least significant bit set, 0 if @a op is 0 * @return least significant bit set, 0 if @a op is 0
*/ */
static ALWAYS_INLINE unsigned int find_lsb_set(u32_t op) static ALWAYS_INLINE unsigned int find_lsb_set(uint32_t op)
{ {
return __builtin_ffs(op); return __builtin_ffs(op);
} }

View File

@ -50,7 +50,7 @@ extern "C" {
* *
* @return N/A * @return N/A
*/ */
void k_sleep(s32_t duration); void k_sleep(int32_t duration);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -142,7 +142,7 @@ struct k_work {
* *
* @return Current uptime. * @return Current uptime.
*/ */
u32_t k_uptime_get_32(void); uint32_t k_uptime_get_32(void);
struct k_delayed_work { struct k_delayed_work {
struct k_work work; struct k_work work;
@ -180,9 +180,9 @@ struct k_delayed_work {
* @retval -EINVAL Work item is being processed or has completed its work. * @retval -EINVAL Work item is being processed or has completed its work.
* @retval -EADDRINUSE Work item is pending on a different workqueue. * @retval -EADDRINUSE Work item is pending on a different workqueue.
*/ */
int k_delayed_work_submit(struct k_delayed_work *work, s32_t delay); int k_delayed_work_submit(struct k_delayed_work *work, int32_t delay);
int k_delayed_work_submit_periodic(struct k_delayed_work *work, s32_t period); int k_delayed_work_submit_periodic(struct k_delayed_work *work, int32_t period);
/** /**
* @brief Get time remaining before a delayed work gets scheduled. * @brief Get time remaining before a delayed work gets scheduled.
@ -195,7 +195,7 @@ int k_delayed_work_submit_periodic(struct k_delayed_work *work, s32_t period);
* *
* @return Remaining time (in milliseconds). * @return Remaining time (in milliseconds).
*/ */
s32_t k_delayed_work_remaining_get(struct k_delayed_work *work); int32_t k_delayed_work_remaining_get(struct k_delayed_work *work);
/** /**
* @brief Submit a work item to the system workqueue. * @brief Submit a work item to the system workqueue.
@ -254,7 +254,7 @@ int k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler);
* *
* @return Current uptime. * @return Current uptime.
*/ */
s64_t k_uptime_get(void); int64_t k_uptime_get(void);
void bt_mesh_timer_init(void); void bt_mesh_timer_init(void);
void bt_mesh_timer_deinit(void); void bt_mesh_timer_deinit(void);

View File

@ -16,16 +16,6 @@
extern "C" { extern "C" {
#endif #endif
typedef signed char s8_t;
typedef signed short s16_t;
typedef signed int s32_t;
typedef signed long long s64_t;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;
typedef unsigned long long u64_t;
typedef int bt_mesh_atomic_t; typedef int bt_mesh_atomic_t;
#ifndef PRIu64 #ifndef PRIu64

View File

@ -26,13 +26,13 @@ extern "C" {
* Those are available for 32 bits architectures: * Those are available for 32 bits architectures:
*/ */
#ifndef POINTER_TO_UINT #ifndef POINTER_TO_UINT
#define POINTER_TO_UINT(x) ((u32_t) (x)) #define POINTER_TO_UINT(x) ((uint32_t) (x))
#endif #endif
#ifndef UINT_TO_POINTER #ifndef UINT_TO_POINTER
#define UINT_TO_POINTER(x) ((void *) (x)) #define UINT_TO_POINTER(x) ((void *) (x))
#endif #endif
#ifndef POINTER_TO_INT #ifndef POINTER_TO_INT
#define POINTER_TO_INT(x) ((s32_t) (x)) #define POINTER_TO_INT(x) ((int32_t) (x))
#endif #endif
#ifndef INT_TO_POINTER #ifndef INT_TO_POINTER
#define INT_TO_POINTER(x) ((void *) (x)) #define INT_TO_POINTER(x) ((void *) (x))
@ -182,7 +182,7 @@ extern "C" {
const char *bt_hex(const void *buf, size_t len); const char *bt_hex(const void *buf, size_t len);
void mem_rcopy(u8_t *dst, u8_t const *src, u16_t len); void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -16,7 +16,7 @@ int net_buf_id(struct net_buf *buf)
} }
static inline struct net_buf *pool_get_uninit(struct net_buf_pool *pool, static inline struct net_buf *pool_get_uninit(struct net_buf_pool *pool,
u16_t uninit_count) uint16_t uninit_count)
{ {
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -35,7 +35,7 @@ void net_buf_simple_clone(const struct net_buf_simple *original,
void *net_buf_simple_add(struct net_buf_simple *buf, size_t len) void *net_buf_simple_add(struct net_buf_simple *buf, size_t len)
{ {
u8_t *tail = net_buf_simple_tail(buf); uint8_t *tail = net_buf_simple_tail(buf);
NET_BUF_SIMPLE_DBG("buf %p len %u", buf, len); NET_BUF_SIMPLE_DBG("buf %p len %u", buf, len);
@ -53,9 +53,9 @@ void *net_buf_simple_add_mem(struct net_buf_simple *buf, const void *mem,
return memcpy(net_buf_simple_add(buf, len), mem, len); return memcpy(net_buf_simple_add(buf, len), mem, len);
} }
u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val) uint8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, uint8_t val)
{ {
u8_t *u8 = NULL; uint8_t *u8 = NULL;
NET_BUF_SIMPLE_DBG("buf %p val 0x%02x", buf, val); NET_BUF_SIMPLE_DBG("buf %p val 0x%02x", buf, val);
@ -65,70 +65,70 @@ u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val)
return u8; return u8;
} }
void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val) void net_buf_simple_add_le16(struct net_buf_simple *buf, uint16_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le16(val, net_buf_simple_add(buf, sizeof(val))); sys_put_le16(val, net_buf_simple_add(buf, sizeof(val)));
} }
void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val) void net_buf_simple_add_be16(struct net_buf_simple *buf, uint16_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be16(val, net_buf_simple_add(buf, sizeof(val))); sys_put_be16(val, net_buf_simple_add(buf, sizeof(val)));
} }
void net_buf_simple_add_le24(struct net_buf_simple *buf, u32_t val) void net_buf_simple_add_le24(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le24(val, net_buf_simple_add(buf, 3)); sys_put_le24(val, net_buf_simple_add(buf, 3));
} }
void net_buf_simple_add_be24(struct net_buf_simple *buf, u32_t val) void net_buf_simple_add_be24(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be24(val, net_buf_simple_add(buf, 3)); sys_put_be24(val, net_buf_simple_add(buf, 3));
} }
void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val) void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le32(val, net_buf_simple_add(buf, sizeof(val))); sys_put_le32(val, net_buf_simple_add(buf, sizeof(val)));
} }
void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val) void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be32(val, net_buf_simple_add(buf, sizeof(val))); sys_put_be32(val, net_buf_simple_add(buf, sizeof(val)));
} }
void net_buf_simple_add_le48(struct net_buf_simple *buf, u64_t val) void net_buf_simple_add_le48(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_le48(val, net_buf_simple_add(buf, 6)); sys_put_le48(val, net_buf_simple_add(buf, 6));
} }
void net_buf_simple_add_be48(struct net_buf_simple *buf, u64_t val) void net_buf_simple_add_be48(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_be48(val, net_buf_simple_add(buf, 6)); sys_put_be48(val, net_buf_simple_add(buf, 6));
} }
void net_buf_simple_add_le64(struct net_buf_simple *buf, u64_t val) void net_buf_simple_add_le64(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_le64(val, net_buf_simple_add(buf, sizeof(val))); sys_put_le64(val, net_buf_simple_add(buf, sizeof(val)));
} }
void net_buf_simple_add_be64(struct net_buf_simple *buf, u64_t val) void net_buf_simple_add_be64(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
@ -146,77 +146,77 @@ void *net_buf_simple_push(struct net_buf_simple *buf, size_t len)
return buf->data; return buf->data;
} }
void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val) void net_buf_simple_push_le16(struct net_buf_simple *buf, uint16_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le16(val, net_buf_simple_push(buf, sizeof(val))); sys_put_le16(val, net_buf_simple_push(buf, sizeof(val)));
} }
void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val) void net_buf_simple_push_be16(struct net_buf_simple *buf, uint16_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be16(val, net_buf_simple_push(buf, sizeof(val))); sys_put_be16(val, net_buf_simple_push(buf, sizeof(val)));
} }
void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val) void net_buf_simple_push_u8(struct net_buf_simple *buf, uint8_t val)
{ {
u8_t *data = net_buf_simple_push(buf, 1); uint8_t *data = net_buf_simple_push(buf, 1);
*data = val; *data = val;
} }
void net_buf_simple_push_le24(struct net_buf_simple *buf, u32_t val) void net_buf_simple_push_le24(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le24(val, net_buf_simple_push(buf, 3)); sys_put_le24(val, net_buf_simple_push(buf, 3));
} }
void net_buf_simple_push_be24(struct net_buf_simple *buf, u32_t val) void net_buf_simple_push_be24(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be24(val, net_buf_simple_push(buf, 3)); sys_put_be24(val, net_buf_simple_push(buf, 3));
} }
void net_buf_simple_push_le32(struct net_buf_simple *buf, u32_t val) void net_buf_simple_push_le32(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_le32(val, net_buf_simple_push(buf, sizeof(val))); sys_put_le32(val, net_buf_simple_push(buf, sizeof(val)));
} }
void net_buf_simple_push_be32(struct net_buf_simple *buf, u32_t val) void net_buf_simple_push_be32(struct net_buf_simple *buf, uint32_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val); NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);
sys_put_be32(val, net_buf_simple_push(buf, sizeof(val))); sys_put_be32(val, net_buf_simple_push(buf, sizeof(val)));
} }
void net_buf_simple_push_le48(struct net_buf_simple *buf, u64_t val) void net_buf_simple_push_le48(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_le48(val, net_buf_simple_push(buf, 6)); sys_put_le48(val, net_buf_simple_push(buf, 6));
} }
void net_buf_simple_push_be48(struct net_buf_simple *buf, u64_t val) void net_buf_simple_push_be48(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_be48(val, net_buf_simple_push(buf, 6)); sys_put_be48(val, net_buf_simple_push(buf, 6));
} }
void net_buf_simple_push_le64(struct net_buf_simple *buf, u64_t val) void net_buf_simple_push_le64(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
sys_put_le64(val, net_buf_simple_push(buf, sizeof(val))); sys_put_le64(val, net_buf_simple_push(buf, sizeof(val)));
} }
void net_buf_simple_push_be64(struct net_buf_simple *buf, u64_t val) void net_buf_simple_push_be64(struct net_buf_simple *buf, uint64_t val)
{ {
NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val); NET_BUF_SIMPLE_DBG("buf %p val %" PRIu64, buf, val);
@ -247,9 +247,9 @@ void *net_buf_simple_pull_mem(struct net_buf_simple *buf, size_t len)
return data; return data;
} }
u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf) uint8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
{ {
u8_t val = 0U; uint8_t val = 0U;
val = buf->data[0]; val = buf->data[0];
net_buf_simple_pull(buf, 1); net_buf_simple_pull(buf, 1);
@ -257,30 +257,30 @@ u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
return val; return val;
} }
u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf) uint16_t net_buf_simple_pull_le16(struct net_buf_simple *buf)
{ {
u16_t val = 0U; uint16_t val = 0U;
val = UNALIGNED_GET((u16_t *)buf->data); val = UNALIGNED_GET((uint16_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_le16_to_cpu(val); return sys_le16_to_cpu(val);
} }
u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf) uint16_t net_buf_simple_pull_be16(struct net_buf_simple *buf)
{ {
u16_t val = 0U; uint16_t val = 0U;
val = UNALIGNED_GET((u16_t *)buf->data); val = UNALIGNED_GET((uint16_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_be16_to_cpu(val); return sys_be16_to_cpu(val);
} }
u32_t net_buf_simple_pull_le24(struct net_buf_simple *buf) uint32_t net_buf_simple_pull_le24(struct net_buf_simple *buf)
{ {
struct uint24 { struct uint24 {
u32_t u24:24; uint32_t u24:24;
} __packed val; } __packed val;
val = UNALIGNED_GET((struct uint24 *)buf->data); val = UNALIGNED_GET((struct uint24 *)buf->data);
@ -289,10 +289,10 @@ u32_t net_buf_simple_pull_le24(struct net_buf_simple *buf)
return sys_le24_to_cpu(val.u24); return sys_le24_to_cpu(val.u24);
} }
u32_t net_buf_simple_pull_be24(struct net_buf_simple *buf) uint32_t net_buf_simple_pull_be24(struct net_buf_simple *buf)
{ {
struct uint24 { struct uint24 {
u32_t u24:24; uint32_t u24:24;
} __packed val; } __packed val;
val = UNALIGNED_GET((struct uint24 *)buf->data); val = UNALIGNED_GET((struct uint24 *)buf->data);
@ -301,30 +301,30 @@ u32_t net_buf_simple_pull_be24(struct net_buf_simple *buf)
return sys_be24_to_cpu(val.u24); return sys_be24_to_cpu(val.u24);
} }
u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf) uint32_t net_buf_simple_pull_le32(struct net_buf_simple *buf)
{ {
u32_t val = 0U; uint32_t val = 0U;
val = UNALIGNED_GET((u32_t *)buf->data); val = UNALIGNED_GET((uint32_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_le32_to_cpu(val); return sys_le32_to_cpu(val);
} }
u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf) uint32_t net_buf_simple_pull_be32(struct net_buf_simple *buf)
{ {
u32_t val = 0U; uint32_t val = 0U;
val = UNALIGNED_GET((u32_t *)buf->data); val = UNALIGNED_GET((uint32_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_be32_to_cpu(val); return sys_be32_to_cpu(val);
} }
u64_t net_buf_simple_pull_le48(struct net_buf_simple *buf) uint64_t net_buf_simple_pull_le48(struct net_buf_simple *buf)
{ {
struct uint48 { struct uint48 {
u64_t u48:48; uint64_t u48:48;
} __packed val; } __packed val;
val = UNALIGNED_GET((struct uint48 *)buf->data); val = UNALIGNED_GET((struct uint48 *)buf->data);
@ -333,10 +333,10 @@ u64_t net_buf_simple_pull_le48(struct net_buf_simple *buf)
return sys_le48_to_cpu(val.u48); return sys_le48_to_cpu(val.u48);
} }
u64_t net_buf_simple_pull_be48(struct net_buf_simple *buf) uint64_t net_buf_simple_pull_be48(struct net_buf_simple *buf)
{ {
struct uint48 { struct uint48 {
u64_t u48:48; uint64_t u48:48;
} __packed val; } __packed val;
val = UNALIGNED_GET((struct uint48 *)buf->data); val = UNALIGNED_GET((struct uint48 *)buf->data);
@ -345,21 +345,21 @@ u64_t net_buf_simple_pull_be48(struct net_buf_simple *buf)
return sys_be48_to_cpu(val.u48); return sys_be48_to_cpu(val.u48);
} }
u64_t net_buf_simple_pull_le64(struct net_buf_simple *buf) uint64_t net_buf_simple_pull_le64(struct net_buf_simple *buf)
{ {
u64_t val; uint64_t val;
val = UNALIGNED_GET((u64_t *)buf->data); val = UNALIGNED_GET((uint64_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_le64_to_cpu(val); return sys_le64_to_cpu(val);
} }
u64_t net_buf_simple_pull_be64(struct net_buf_simple *buf) uint64_t net_buf_simple_pull_be64(struct net_buf_simple *buf)
{ {
u64_t val; uint64_t val;
val = UNALIGNED_GET((u64_t *)buf->data); val = UNALIGNED_GET((uint64_t *)buf->data);
net_buf_simple_pull(buf, sizeof(val)); net_buf_simple_pull(buf, sizeof(val));
return sys_be64_to_cpu(val); return sys_be64_to_cpu(val);
@ -506,7 +506,7 @@ void net_buf_unref(struct net_buf *buf)
} }
} }
static u8_t *fixed_data_alloc(struct net_buf *buf, size_t *size, s32_t timeout) static uint8_t *fixed_data_alloc(struct net_buf *buf, size_t *size, int32_t timeout)
{ {
struct net_buf_pool *pool = buf->pool; struct net_buf_pool *pool = buf->pool;
const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data; const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data;
@ -516,7 +516,7 @@ static u8_t *fixed_data_alloc(struct net_buf *buf, size_t *size, s32_t timeout)
return fixed->data_pool + fixed->data_size * net_buf_id(buf); return fixed->data_pool + fixed->data_size * net_buf_id(buf);
} }
static void fixed_data_unref(struct net_buf *buf, u8_t *data) static void fixed_data_unref(struct net_buf *buf, uint8_t *data)
{ {
/* Nothing needed for fixed-size data pools */ /* Nothing needed for fixed-size data pools */
} }
@ -526,7 +526,7 @@ const struct net_buf_data_cb net_buf_fixed_cb = {
.unref = fixed_data_unref, .unref = fixed_data_unref,
}; };
static u8_t *data_alloc(struct net_buf *buf, size_t *size, s32_t timeout) static uint8_t *data_alloc(struct net_buf *buf, size_t *size, int32_t timeout)
{ {
struct net_buf_pool *pool = buf->pool; struct net_buf_pool *pool = buf->pool;
@ -535,10 +535,10 @@ static u8_t *data_alloc(struct net_buf *buf, size_t *size, s32_t timeout)
#if defined(CONFIG_BLE_MESH_NET_BUF_LOG) #if defined(CONFIG_BLE_MESH_NET_BUF_LOG)
struct net_buf *net_buf_alloc_len_debug(struct net_buf_pool *pool, size_t size, struct net_buf *net_buf_alloc_len_debug(struct net_buf_pool *pool, size_t size,
s32_t timeout, const char *func, int line) int32_t timeout, const char *func, int line)
#else #else
struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size, struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
s32_t timeout) int32_t timeout)
#endif #endif
{ {
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -604,7 +604,7 @@ success:
#if defined(CONFIG_BLE_MESH_NET_BUF_LOG) #if defined(CONFIG_BLE_MESH_NET_BUF_LOG)
struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool, struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool,
s32_t timeout, const char *func, int32_t timeout, const char *func,
int line) int line)
{ {
const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data; const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data;
@ -612,7 +612,7 @@ struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool,
return net_buf_alloc_len_debug(pool, fixed->data_size, timeout, func, line); return net_buf_alloc_len_debug(pool, fixed->data_size, timeout, func, line);
} }
#else #else
struct net_buf *net_buf_alloc_fixed(struct net_buf_pool *pool, s32_t timeout) struct net_buf *net_buf_alloc_fixed(struct net_buf_pool *pool, int32_t timeout)
{ {
const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data; const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data;
@ -708,7 +708,7 @@ size_t net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src,
copied = 0; copied = 0;
while (frag && len > 0) { while (frag && len > 0) {
to_copy = MIN(len, frag->len - offset); to_copy = MIN(len, frag->len - offset);
memcpy((u8_t *)dst + copied, frag->data + offset, to_copy); memcpy((uint8_t *)dst + copied, frag->data + offset, to_copy);
copied += to_copy; copied += to_copy;
@ -728,15 +728,15 @@ size_t net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src,
* the buffer. It assumes that the buffer has at least one fragment. * the buffer. It assumes that the buffer has at least one fragment.
*/ */
size_t net_buf_append_bytes(struct net_buf *buf, size_t len, size_t net_buf_append_bytes(struct net_buf *buf, size_t len,
const void *value, s32_t timeout, const void *value, int32_t timeout,
net_buf_allocator_cb allocate_cb, void *user_data) net_buf_allocator_cb allocate_cb, void *user_data)
{ {
struct net_buf *frag = net_buf_frag_last(buf); struct net_buf *frag = net_buf_frag_last(buf);
size_t added_len = 0U; size_t added_len = 0U;
const u8_t *value8 = value; const uint8_t *value8 = value;
do { do {
u16_t count = MIN(len, net_buf_tailroom(frag)); uint16_t count = MIN(len, net_buf_tailroom(frag));
net_buf_add_mem(frag, value8, count); net_buf_add_mem(frag, value8, count);
len -= count; len -= count;

View File

@ -50,10 +50,10 @@ IRAM_ATTR void bt_mesh_free(void *ptr)
heap_caps_free(ptr); heap_caps_free(ptr);
} }
struct net_buf_simple *bt_mesh_alloc_buf(u16_t size) struct net_buf_simple *bt_mesh_alloc_buf(uint16_t size)
{ {
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
u8_t *data = NULL; uint8_t *data = NULL;
buf = (struct net_buf_simple *)bt_mesh_calloc(sizeof(struct net_buf_simple) + size); buf = (struct net_buf_simple *)bt_mesh_calloc(sizeof(struct net_buf_simple) + size);
if (!buf) { if (!buf) {
@ -61,7 +61,7 @@ struct net_buf_simple *bt_mesh_alloc_buf(u16_t size)
return NULL; return NULL;
} }
data = (u8_t *)buf + sizeof(struct net_buf_simple); data = (uint8_t *)buf + sizeof(struct net_buf_simple);
buf->data = data; buf->data = data;
buf->len = 0; buf->len = 0;
@ -78,7 +78,7 @@ void bt_mesh_free_buf(struct net_buf_simple *buf)
} }
} }
u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send) uint8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send)
{ {
bt_mesh_client_user_data_t *client = NULL; bt_mesh_client_user_data_t *client = NULL;

View File

@ -8,7 +8,7 @@
#include "mesh_kernel.h" #include "mesh_kernel.h"
void k_sleep(s32_t duration) void k_sleep(int32_t duration)
{ {
vTaskDelay(duration / portTICK_PERIOD_MS); vTaskDelay(duration / portTICK_PERIOD_MS);
} }

View File

@ -27,20 +27,20 @@ typedef struct alarm_t {
int64_t deadline_us; int64_t deadline_us;
} osi_alarm_t; } osi_alarm_t;
s64_t k_uptime_get(void) int64_t k_uptime_get(void)
{ {
/** k_uptime_get_32 is in in milliseconds, /* k_uptime_get_32 is in in milliseconds,
* but esp_timer_get_time is in microseconds * but esp_timer_get_time is in microseconds
*/ */
return (esp_timer_get_time() / 1000); return (esp_timer_get_time() / 1000);
} }
u32_t k_uptime_get_32(void) uint32_t k_uptime_get_32(void)
{ {
/** k_uptime_get_32 is in in milliseconds, /* k_uptime_get_32 is in in milliseconds,
* but esp_timer_get_time is in microseconds * but esp_timer_get_time is in microseconds
*/ */
return (u32_t)(esp_timer_get_time() / 1000); return (uint32_t)(esp_timer_get_time() / 1000);
} }
void bt_mesh_timer_init(void) void bt_mesh_timer_init(void)
@ -100,7 +100,7 @@ int k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)
return 0; return 0;
} }
int k_delayed_work_submit(struct k_delayed_work *work, s32_t delay) int k_delayed_work_submit(struct k_delayed_work *work, int32_t delay)
{ {
if (!work || !bm_alarm_hash_map) { if (!work || !bm_alarm_hash_map) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -122,7 +122,7 @@ int k_delayed_work_submit(struct k_delayed_work *work, s32_t delay)
return 0; return 0;
} }
int k_delayed_work_submit_periodic(struct k_delayed_work *work, s32_t period) int k_delayed_work_submit_periodic(struct k_delayed_work *work, int32_t period)
{ {
if (!work || !bm_alarm_hash_map) { if (!work || !bm_alarm_hash_map) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -186,9 +186,9 @@ int k_delayed_work_free(struct k_delayed_work *work)
return 0; return 0;
} }
s32_t k_delayed_work_remaining_get(struct k_delayed_work *work) int32_t k_delayed_work_remaining_get(struct k_delayed_work *work)
{ {
s32_t time = 0; int32_t time = 0;
if (!work || !bm_alarm_hash_map) { if (!work || !bm_alarm_hash_map) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);

View File

@ -15,8 +15,8 @@ const char *bt_hex(const void *buf, size_t len)
{ {
static const char hex[] = "0123456789abcdef"; static const char hex[] = "0123456789abcdef";
static char hexbufs[2][129]; static char hexbufs[2][129];
static u8_t curbuf; static uint8_t curbuf;
const u8_t *b = buf; const uint8_t *b = buf;
char *str = NULL; char *str = NULL;
int i; int i;
@ -35,7 +35,7 @@ const char *bt_hex(const void *buf, size_t len)
return str; return str;
} }
void mem_rcopy(u8_t *dst, u8_t const *src, u16_t len) void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len)
{ {
src += len; src += len;
while (len--) { while (len--) {

View File

@ -25,7 +25,7 @@
#define BLE_MESH_SDU_MAX_LEN 384 #define BLE_MESH_SDU_MAX_LEN 384
static const struct bt_mesh_comp *dev_comp; static const struct bt_mesh_comp *dev_comp;
static u16_t dev_primary_addr; static uint16_t dev_primary_addr;
void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod, void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, struct bt_mesh_elem *elem,
@ -57,7 +57,7 @@ void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
} }
} }
s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod) int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
{ {
int period = 0; int period = 0;
@ -95,10 +95,10 @@ s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
} }
} }
static s32_t next_period(struct bt_mesh_model *mod) static int32_t next_period(struct bt_mesh_model *mod)
{ {
struct bt_mesh_model_pub *pub = mod->pub; struct bt_mesh_model_pub *pub = mod->pub;
u32_t elapsed = 0U, period = 0U; uint32_t elapsed = 0U, period = 0U;
if (!pub) { if (!pub) {
BT_ERR("Model has no publication support"); BT_ERR("Model has no publication support");
@ -126,7 +126,7 @@ static s32_t next_period(struct bt_mesh_model *mod)
static void publish_sent(int err, void *user_data) static void publish_sent(int err, void *user_data)
{ {
struct bt_mesh_model *mod = user_data; struct bt_mesh_model *mod = user_data;
s32_t delay = 0; int32_t delay = 0;
BT_DBG("err %d", err); BT_DBG("err %d", err);
@ -147,7 +147,7 @@ static void publish_sent(int err, void *user_data)
} }
} }
static void publish_start(u16_t duration, int err, void *user_data) static void publish_start(uint16_t duration, int err, void *user_data)
{ {
struct bt_mesh_model *mod = user_data; struct bt_mesh_model *mod = user_data;
struct bt_mesh_model_pub *pub = mod->pub; struct bt_mesh_model_pub *pub = mod->pub;
@ -236,7 +236,7 @@ static void mod_publish(struct k_work *work)
struct bt_mesh_model_pub *pub = CONTAINER_OF(work, struct bt_mesh_model_pub *pub = CONTAINER_OF(work,
struct bt_mesh_model_pub, struct bt_mesh_model_pub,
timer.work); timer.work);
s32_t period_ms = 0; int32_t period_ms = 0;
int err = 0; int err = 0;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -287,7 +287,7 @@ struct bt_mesh_elem *bt_mesh_model_elem(struct bt_mesh_model *mod)
return &dev_comp->elem[mod->elem_idx]; return &dev_comp->elem[mod->elem_idx];
} }
struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx) struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx)
{ {
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
@ -437,7 +437,7 @@ int bt_mesh_comp_deregister(void)
} }
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
void bt_mesh_comp_provision(u16_t addr) void bt_mesh_comp_provision(uint16_t addr)
{ {
int i; int i;
@ -462,12 +462,12 @@ void bt_mesh_comp_unprovision(void)
dev_primary_addr = BLE_MESH_ADDR_UNASSIGNED; dev_primary_addr = BLE_MESH_ADDR_UNASSIGNED;
} }
u16_t bt_mesh_primary_addr(void) uint16_t bt_mesh_primary_addr(void)
{ {
return dev_primary_addr; return dev_primary_addr;
} }
u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr) uint16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, uint16_t addr)
{ {
int i; int i;
@ -481,10 +481,10 @@ u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr)
} }
static struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *elem, static struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *elem,
u16_t group_addr) uint16_t group_addr)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
u16_t *match = NULL; uint16_t *match = NULL;
int i; int i;
for (i = 0; i < elem->model_count; i++) { for (i = 0; i < elem->model_count; i++) {
@ -508,9 +508,9 @@ static struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *elem,
return NULL; return NULL;
} }
struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr) struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr)
{ {
u16_t index = 0U; uint16_t index = 0U;
if (BLE_MESH_ADDR_IS_UNICAST(addr)) { if (BLE_MESH_ADDR_IS_UNICAST(addr)) {
index = (addr - dev_comp->elem[0].addr); index = (addr - dev_comp->elem[0].addr);
@ -532,12 +532,12 @@ struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr)
return NULL; return NULL;
} }
u8_t bt_mesh_elem_count(void) uint8_t bt_mesh_elem_count(void)
{ {
return dev_comp->elem_count; return dev_comp->elem_count;
} }
static bool model_has_key(struct bt_mesh_model *mod, u16_t key) static bool model_has_key(struct bt_mesh_model *mod, uint16_t key)
{ {
int i; int i;
@ -550,7 +550,7 @@ static bool model_has_key(struct bt_mesh_model *mod, u16_t key)
return false; return false;
} }
static bool model_has_dst(struct bt_mesh_model *model, u16_t dst) static bool model_has_dst(struct bt_mesh_model *model, uint16_t dst)
{ {
if (BLE_MESH_ADDR_IS_UNICAST(dst)) { if (BLE_MESH_ADDR_IS_UNICAST(dst)) {
return (dev_comp->elem[model->elem_idx].addr == dst); return (dev_comp->elem[model->elem_idx].addr == dst);
@ -562,7 +562,7 @@ static bool model_has_dst(struct bt_mesh_model *model, u16_t dst)
} }
static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models, static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models,
u8_t model_count, u32_t opcode, uint8_t model_count, uint32_t opcode,
struct bt_mesh_model **model) struct bt_mesh_model **model)
{ {
int i; int i;
@ -583,7 +583,7 @@ static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models,
return NULL; return NULL;
} }
static int get_opcode(struct net_buf_simple *buf, u32_t *opcode) static int get_opcode(struct net_buf_simple *buf, uint32_t *opcode)
{ {
switch (buf->data[0] >> 6) { switch (buf->data[0] >> 6) {
case 0x00: case 0x00:
@ -621,7 +621,7 @@ static int get_opcode(struct net_buf_simple *buf, u32_t *opcode)
return -EINVAL; return -EINVAL;
} }
bool bt_mesh_fixed_group_match(u16_t addr) bool bt_mesh_fixed_group_match(uint16_t addr)
{ {
/* Check for fixed group addresses */ /* Check for fixed group addresses */
switch (addr) { switch (addr) {
@ -642,8 +642,8 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
{ {
struct bt_mesh_model *models = NULL, *model = NULL; struct bt_mesh_model *models = NULL, *model = NULL;
const struct bt_mesh_model_op *op = NULL; const struct bt_mesh_model_op *op = NULL;
u32_t opcode = 0U; uint32_t opcode = 0U;
u8_t count = 0U; uint8_t count = 0U;
int i; int i;
BT_INFO("recv, app_idx 0x%04x src 0x%04x dst 0x%04x", rx->ctx.app_idx, BT_INFO("recv, app_idx 0x%04x src 0x%04x dst 0x%04x", rx->ctx.app_idx,
@ -714,7 +714,7 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
} }
} }
void bt_mesh_model_msg_init(struct net_buf_simple *msg, u32_t opcode) void bt_mesh_model_msg_init(struct net_buf_simple *msg, uint32_t opcode)
{ {
net_buf_simple_init(msg, 0); net_buf_simple_init(msg, 0);
@ -739,7 +739,7 @@ void bt_mesh_model_msg_init(struct net_buf_simple *msg, u32_t opcode)
} }
} }
static bool ready_to_send(u8_t role, u16_t dst) static bool ready_to_send(uint8_t role, uint16_t dst)
{ {
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && role == NODE) { if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && role == NODE) {
return true; return true;
@ -761,7 +761,7 @@ static int model_send(struct bt_mesh_model *model,
struct net_buf_simple *msg, struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data) const struct bt_mesh_send_cb *cb, void *cb_data)
{ {
u8_t role = 0U; uint8_t role = 0U;
role = bt_mesh_get_device_role(model, tx->ctx->srv_send); role = bt_mesh_get_device_role(model, tx->ctx->srv_send);
if (role == ROLE_NVAL) { if (role == ROLE_NVAL) {
@ -802,7 +802,7 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
const struct bt_mesh_send_cb *cb, void *cb_data) const struct bt_mesh_send_cb *cb, void *cb_data)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t role = 0U; uint8_t role = 0U;
role = bt_mesh_get_device_role(model, ctx->srv_send); role = bt_mesh_get_device_role(model, ctx->srv_send);
if (role == ROLE_NVAL) { if (role == ROLE_NVAL) {
@ -911,7 +911,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
} }
struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem, struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
u16_t company, u16_t id) uint16_t company, uint16_t id)
{ {
int i; int i;
@ -925,7 +925,7 @@ struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
return NULL; return NULL;
} }
struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, u16_t id) struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, uint16_t id)
{ {
int i; int i;
@ -944,7 +944,7 @@ const struct bt_mesh_comp *bt_mesh_comp_get(void)
} }
/* APIs used by messages encryption in upper transport layer & network layer */ /* APIs used by messages encryption in upper transport layer & network layer */
struct bt_mesh_subnet *bt_mesh_tx_netkey_get(u8_t role, u16_t net_idx) struct bt_mesh_subnet *bt_mesh_tx_netkey_get(uint8_t role, uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
@ -959,9 +959,9 @@ struct bt_mesh_subnet *bt_mesh_tx_netkey_get(u8_t role, u16_t net_idx)
return sub; return sub;
} }
const u8_t *bt_mesh_tx_devkey_get(u8_t role, u16_t dst) const uint8_t *bt_mesh_tx_devkey_get(uint8_t role, uint16_t dst)
{ {
const u8_t *key = NULL; const uint8_t *key = NULL;
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && role == NODE) { if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && role == NODE) {
key = bt_mesh.dev_key; key = bt_mesh.dev_key;
@ -974,7 +974,7 @@ const u8_t *bt_mesh_tx_devkey_get(u8_t role, u16_t dst)
return key; return key;
} }
struct bt_mesh_app_key *bt_mesh_tx_appkey_get(u8_t role, u16_t app_idx) struct bt_mesh_app_key *bt_mesh_tx_appkey_get(uint8_t role, uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -1069,9 +1069,9 @@ size_t bt_mesh_rx_devkey_size(void)
return size; return size;
} }
const u8_t *bt_mesh_rx_devkey_get(size_t index, u16_t src) const uint8_t *bt_mesh_rx_devkey_get(size_t index, uint16_t src)
{ {
const u8_t *key = NULL; const uint8_t *key = NULL;
#if CONFIG_BLE_MESH_NODE && !CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_NODE && !CONFIG_BLE_MESH_PROVISIONER
if (bt_mesh_is_provisioned()) { if (bt_mesh_is_provisioned()) {

View File

@ -22,16 +22,16 @@ enum {
BLE_MESH_MOD_PUB_PENDING = BIT(2), BLE_MESH_MOD_PUB_PENDING = BIT(2),
}; };
void bt_mesh_elem_register(struct bt_mesh_elem *elem, u8_t count); void bt_mesh_elem_register(struct bt_mesh_elem *elem, uint8_t count);
u8_t bt_mesh_elem_count(void); uint8_t bt_mesh_elem_count(void);
/* Find local element based on unicast or group address */ /* Find local element based on unicast or group address */
struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr); struct bt_mesh_elem *bt_mesh_elem_find(uint16_t addr);
u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr); uint16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, uint16_t addr);
bool bt_mesh_fixed_group_match(u16_t addr); bool bt_mesh_fixed_group_match(uint16_t addr);
void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod, void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
struct bt_mesh_elem *elem, struct bt_mesh_elem *elem,
@ -39,27 +39,27 @@ void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
void *user_data), void *user_data),
void *user_data); void *user_data);
s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod); int32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod);
void bt_mesh_comp_provision(u16_t addr); void bt_mesh_comp_provision(uint16_t addr);
void bt_mesh_comp_unprovision(void); void bt_mesh_comp_unprovision(void);
u16_t bt_mesh_primary_addr(void); uint16_t bt_mesh_primary_addr(void);
const struct bt_mesh_comp *bt_mesh_comp_get(void); const struct bt_mesh_comp *bt_mesh_comp_get(void);
struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx); struct bt_mesh_model *bt_mesh_model_get(bool vnd, uint8_t elem_idx, uint8_t mod_idx);
void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
int bt_mesh_comp_register(const struct bt_mesh_comp *comp); int bt_mesh_comp_register(const struct bt_mesh_comp *comp);
int bt_mesh_comp_deregister(void); int bt_mesh_comp_deregister(void);
struct bt_mesh_subnet *bt_mesh_tx_netkey_get(u8_t role, u16_t net_idx); struct bt_mesh_subnet *bt_mesh_tx_netkey_get(uint8_t role, uint16_t net_idx);
const u8_t *bt_mesh_tx_devkey_get(u8_t role, u16_t dst); const uint8_t *bt_mesh_tx_devkey_get(uint8_t role, uint16_t dst);
struct bt_mesh_app_key *bt_mesh_tx_appkey_get(u8_t role, u16_t app_idx); struct bt_mesh_app_key *bt_mesh_tx_appkey_get(uint8_t role, uint16_t app_idx);
size_t bt_mesh_rx_netkey_size(void); size_t bt_mesh_rx_netkey_size(void);
@ -67,7 +67,7 @@ struct bt_mesh_subnet *bt_mesh_rx_netkey_get(size_t index);
size_t bt_mesh_rx_devkey_size(void); size_t bt_mesh_rx_devkey_size(void);
const u8_t *bt_mesh_rx_devkey_get(size_t index, u16_t src); const uint8_t *bt_mesh_rx_devkey_get(size_t index, uint16_t src);
size_t bt_mesh_rx_appkey_size(void); size_t bt_mesh_rx_appkey_size(void);

View File

@ -43,7 +43,7 @@
static const bt_mesh_addr_t *dev_addr; static const bt_mesh_addr_t *dev_addr;
static const u8_t adv_type[] = { static const uint8_t adv_type[] = {
[BLE_MESH_ADV_PROV] = BLE_MESH_DATA_MESH_PROV, [BLE_MESH_ADV_PROV] = BLE_MESH_DATA_MESH_PROV,
[BLE_MESH_ADV_DATA] = BLE_MESH_DATA_MESH_MESSAGE, [BLE_MESH_ADV_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
[BLE_MESH_ADV_BEACON] = BLE_MESH_DATA_MESH_BEACON, [BLE_MESH_ADV_BEACON] = BLE_MESH_DATA_MESH_BEACON,
@ -59,7 +59,7 @@ struct bt_mesh_queue {
QueueHandle_t handle; QueueHandle_t handle;
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC #if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
StaticQueue_t *buffer; StaticQueue_t *buffer;
u8_t *storage; uint8_t *storage;
#endif #endif
}; };
@ -86,7 +86,7 @@ static QueueSetHandle_t mesh_queue_set;
#define BLE_MESH_RELAY_TIME_INTERVAL K_SECONDS(6) #define BLE_MESH_RELAY_TIME_INTERVAL K_SECONDS(6)
#define BLE_MESH_MAX_TIME_INTERVAL 0xFFFFFFFF #define BLE_MESH_MAX_TIME_INTERVAL 0xFFFFFFFF
static bool ignore_relay_packet(u32_t timestamp); static bool ignore_relay_packet(uint32_t timestamp);
#endif /* defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */ #endif /* defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV #if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
@ -132,7 +132,7 @@ static struct bt_mesh_adv *adv_alloc(int id)
return &adv_pool[id]; return &adv_pool[id];
} }
static inline void adv_send_start(u16_t duration, int err, static inline void adv_send_start(uint16_t duration, int err,
const struct bt_mesh_send_cb *cb, const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)
{ {
@ -151,12 +151,12 @@ static inline void adv_send_end(int err, const struct bt_mesh_send_cb *cb,
static inline int adv_send(struct net_buf *buf) static inline int adv_send(struct net_buf *buf)
{ {
const s32_t adv_int_min = ((bt_mesh_dev.hci_version >= BLE_MESH_HCI_VERSION_5_0) ? const int32_t adv_int_min = ((bt_mesh_dev.hci_version >= BLE_MESH_HCI_VERSION_5_0) ?
ADV_INT_FAST_MS : ADV_INT_DEFAULT_MS); ADV_INT_FAST_MS : ADV_INT_DEFAULT_MS);
const struct bt_mesh_send_cb *cb = BLE_MESH_ADV(buf)->cb; const struct bt_mesh_send_cb *cb = BLE_MESH_ADV(buf)->cb;
void *cb_data = BLE_MESH_ADV(buf)->cb_data; void *cb_data = BLE_MESH_ADV(buf)->cb_data;
struct bt_mesh_adv_param param = {0}; struct bt_mesh_adv_param param = {0};
u16_t duration = 0U, adv_int = 0U; uint16_t duration = 0U, adv_int = 0U;
struct bt_mesh_adv_data ad = {0}; struct bt_mesh_adv_data ad = {0};
int err = 0; int err = 0;
@ -263,7 +263,7 @@ static void adv_thread(void *p)
CONFIG_BLE_MESH_GATT_PROXY_SERVER CONFIG_BLE_MESH_GATT_PROXY_SERVER
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT); xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
while (!(*buf)) { while (!(*buf)) {
s32_t timeout; int32_t timeout = 0;
BT_DBG("Mesh Proxy Advertising start"); BT_DBG("Mesh Proxy Advertising start");
timeout = bt_mesh_proxy_server_adv_start(); timeout = bt_mesh_proxy_server_adv_start();
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
@ -286,7 +286,7 @@ static void adv_thread(void *p)
} }
} else { } else {
while (!(*buf)) { while (!(*buf)) {
s32_t timeout = 0; int32_t timeout = 0;
BT_DBG("Mesh Proxy Advertising start"); BT_DBG("Mesh Proxy Advertising start");
timeout = bt_mesh_proxy_server_adv_start(); timeout = bt_mesh_proxy_server_adv_start();
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
@ -351,7 +351,7 @@ static void adv_thread(void *p)
struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *pool, struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *pool,
bt_mesh_adv_alloc_t get_id, bt_mesh_adv_alloc_t get_id,
enum bt_mesh_adv_type type, enum bt_mesh_adv_type type,
u8_t xmit, s32_t timeout) uint8_t xmit, int32_t timeout)
{ {
struct bt_mesh_adv *adv = NULL; struct bt_mesh_adv *adv = NULL;
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -374,8 +374,8 @@ struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *pool,
(void)memset(adv, 0, sizeof(*adv)); (void)memset(adv, 0, sizeof(*adv));
adv->type = type; adv->type = type;
adv->xmit = xmit; adv->xmit = xmit;
return buf; return buf;
} }
@ -398,15 +398,15 @@ void bt_mesh_unref_buf_from_pool(struct net_buf_pool *pool)
} }
} }
struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit, struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, uint8_t xmit,
s32_t timeout) int32_t timeout)
{ {
return bt_mesh_adv_create_from_pool(&adv_buf_pool, adv_alloc, type, return bt_mesh_adv_create_from_pool(&adv_buf_pool, adv_alloc, type,
xmit, timeout); xmit, timeout);
} }
void bt_mesh_adv_buf_ref_debug(const char *func, struct net_buf *buf, void bt_mesh_adv_buf_ref_debug(const char *func, struct net_buf *buf,
u8_t ref_cmp, bt_mesh_buf_ref_flag_t flag) uint8_t ref_cmp, bt_mesh_buf_ref_flag_t flag)
{ {
if (buf == NULL || func == NULL || flag >= BLE_MESH_BUF_REF_MAX) { if (buf == NULL || func == NULL || flag >= BLE_MESH_BUF_REF_MAX) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -500,10 +500,10 @@ void bt_mesh_adv_update(void)
} }
#if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
static bool ignore_relay_packet(u32_t timestamp) static bool ignore_relay_packet(uint32_t timestamp)
{ {
u32_t now = k_uptime_get_32(); uint32_t now = k_uptime_get_32();
u32_t interval = 0U; uint32_t interval = 0U;
if (now >= timestamp) { if (now >= timestamp) {
interval = now - timestamp; interval = now - timestamp;
@ -519,8 +519,8 @@ static struct bt_mesh_adv *relay_adv_alloc(int id)
return &relay_adv_pool[id]; return &relay_adv_pool[id];
} }
struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, u8_t xmit, struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, uint8_t xmit,
s32_t timeout) int32_t timeout)
{ {
return bt_mesh_adv_create_from_pool(&relay_adv_buf_pool, relay_adv_alloc, type, return bt_mesh_adv_create_from_pool(&relay_adv_buf_pool, relay_adv_alloc, type,
xmit, timeout); xmit, timeout);
@ -570,7 +570,7 @@ static void ble_mesh_relay_task_post(bt_mesh_msg_t *msg, uint32_t timeout)
} }
void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
void *cb_data, u16_t src, u16_t dst) void *cb_data, uint16_t src, uint16_t dst)
{ {
bt_mesh_msg_t msg = { bt_mesh_msg_t msg = {
.relay = true, .relay = true,
@ -591,9 +591,9 @@ void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *c
ble_mesh_relay_task_post(&msg, K_NO_WAIT); ble_mesh_relay_task_post(&msg, K_NO_WAIT);
} }
u16_t bt_mesh_get_stored_relay_count(void) uint16_t bt_mesh_get_stored_relay_count(void)
{ {
return (u16_t)uxQueueMessagesWaiting(relay_queue.handle); return (uint16_t)uxQueueMessagesWaiting(relay_queue.handle);
} }
#endif /* #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */ #endif /* #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
@ -606,7 +606,7 @@ const bt_mesh_addr_t *bt_mesh_get_unprov_dev_addr(void)
CONFIG_BLE_MESH_GATT_PROXY_CLIENT CONFIG_BLE_MESH_GATT_PROXY_CLIENT
static bool adv_flags_valid(struct net_buf_simple *buf) static bool adv_flags_valid(struct net_buf_simple *buf)
{ {
u8_t flags = 0U; uint8_t flags = 0U;
if (buf->len != 1U) { if (buf->len != 1U) {
BT_DBG("Unexpected adv flags length %d", buf->len); BT_DBG("Unexpected adv flags length %d", buf->len);
@ -623,7 +623,7 @@ static bool adv_flags_valid(struct net_buf_simple *buf)
return true; return true;
} }
static bool adv_service_uuid_valid(struct net_buf_simple *buf, u16_t *uuid) static bool adv_service_uuid_valid(struct net_buf_simple *buf, uint16_t *uuid)
{ {
if (buf->len != 2U) { if (buf->len != 2U) {
BT_DBG("Length not match mesh service uuid"); BT_DBG("Length not match mesh service uuid");
@ -658,9 +658,9 @@ static bool adv_service_uuid_valid(struct net_buf_simple *buf, u16_t *uuid)
static void handle_adv_service_data(struct net_buf_simple *buf, static void handle_adv_service_data(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, const bt_mesh_addr_t *addr,
u16_t uuid, s8_t rssi) uint16_t uuid, int8_t rssi)
{ {
u16_t type = 0U; uint16_t type = 0U;
if (!buf || !addr) { if (!buf || !addr) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -705,12 +705,12 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
} }
#endif #endif
static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr, s8_t rssi, static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr, int8_t rssi,
u8_t adv_type, struct net_buf_simple *buf) uint8_t adv_type, struct net_buf_simple *buf)
{ {
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \ #if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT CONFIG_BLE_MESH_GATT_PROXY_CLIENT
u16_t uuid = 0U; uint16_t uuid = 0U;
#endif #endif
if (adv_type != BLE_MESH_ADV_NONCONN_IND && adv_type != BLE_MESH_ADV_IND) { if (adv_type != BLE_MESH_ADV_NONCONN_IND && adv_type != BLE_MESH_ADV_IND) {
@ -723,7 +723,7 @@ static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr, s8_t rssi,
while (buf->len > 1) { while (buf->len > 1) {
struct net_buf_simple_state state; struct net_buf_simple_state state;
u8_t len, type; uint8_t len, type;
len = net_buf_simple_pull_u8(buf); len = net_buf_simple_pull_u8(buf);
/* Check for early termination */ /* Check for early termination */
@ -997,7 +997,7 @@ static struct bt_mesh_adv *ble_adv_alloc(int id)
return &ble_adv_pool[id]; return &ble_adv_pool[id];
} }
static struct net_buf *bt_mesh_ble_adv_create(enum bt_mesh_adv_type type, u8_t xmit, s32_t timeout) static struct net_buf *bt_mesh_ble_adv_create(enum bt_mesh_adv_type type, uint8_t xmit, int32_t timeout)
{ {
return bt_mesh_adv_create_from_pool(&ble_adv_buf_pool, ble_adv_alloc, type, return bt_mesh_adv_create_from_pool(&ble_adv_buf_pool, ble_adv_alloc, type,
xmit, timeout); xmit, timeout);
@ -1041,7 +1041,7 @@ static void ble_adv_tx_reset(struct ble_adv_tx *tx, bool unref)
tx->buf = NULL; tx->buf = NULL;
} }
static void ble_adv_send_start(u16_t duration, int err, void *cb_data) static void ble_adv_send_start(uint16_t duration, int err, void *cb_data)
{ {
struct ble_adv_tx *tx = cb_data; struct ble_adv_tx *tx = cb_data;
@ -1107,7 +1107,7 @@ static void ble_adv_resend(struct k_work *work)
} }
int bt_mesh_start_ble_advertising(const struct bt_mesh_ble_adv_param *param, int bt_mesh_start_ble_advertising(const struct bt_mesh_ble_adv_param *param,
const struct bt_mesh_ble_adv_data *data, u8_t *index) const struct bt_mesh_ble_adv_data *data, uint8_t *index)
{ {
struct ble_adv_tx *tx = NULL; struct ble_adv_tx *tx = NULL;
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -1205,7 +1205,7 @@ int bt_mesh_start_ble_advertising(const struct bt_mesh_ble_adv_param *param,
return 0; return 0;
} }
int bt_mesh_stop_ble_advertising(u8_t index) int bt_mesh_stop_ble_advertising(uint8_t index)
{ {
struct ble_adv_tx *tx = NULL; struct ble_adv_tx *tx = NULL;
bool unref = true; bool unref = true;

View File

@ -28,9 +28,9 @@ extern "C" {
typedef struct bt_mesh_msg { typedef struct bt_mesh_msg {
bool relay; /* Flag indicates if the packet is a relayed one */ bool relay; /* Flag indicates if the packet is a relayed one */
void *arg; /* Pointer to the struct net_buf */ void *arg; /* Pointer to the struct net_buf */
u16_t src; /* Source address for relay packets */ uint16_t src; /* Source address for relay packets */
u16_t dst; /* Destination address for relay packets */ uint16_t dst; /* Destination address for relay packets */
u32_t timestamp; /* Timestamp recorded when the relay packet is posted to queue */ uint32_t timestamp; /* Timestamp recorded when the relay packet is posted to queue */
} bt_mesh_msg_t; } bt_mesh_msg_t;
enum bt_mesh_adv_type { enum bt_mesh_adv_type {
@ -41,23 +41,23 @@ enum bt_mesh_adv_type {
BLE_MESH_ADV_BLE, BLE_MESH_ADV_BLE,
}; };
typedef void (*bt_mesh_adv_func_t)(struct net_buf *buf, u16_t duration, typedef void (*bt_mesh_adv_func_t)(struct net_buf *buf, uint16_t duration,
int err, void *user_data); int err, void *user_data);
struct bt_mesh_adv { struct bt_mesh_adv {
const struct bt_mesh_send_cb *cb; const struct bt_mesh_send_cb *cb;
void *cb_data; void *cb_data;
u8_t type:3, uint8_t type:3,
busy:1; busy:1;
u8_t xmit; uint8_t xmit;
}; };
typedef struct bt_mesh_adv *(*bt_mesh_adv_alloc_t)(int id); typedef struct bt_mesh_adv *(*bt_mesh_adv_alloc_t)(int id);
/* xmit_count: Number of retransmissions, i.e. 0 == 1 transmission */ /* xmit_count: Number of retransmissions, i.e. 0 == 1 transmission */
struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, u8_t xmit, struct net_buf *bt_mesh_adv_create(enum bt_mesh_adv_type type, uint8_t xmit,
s32_t timeout); int32_t timeout);
typedef enum { typedef enum {
BLE_MESH_BUF_REF_EQUAL, BLE_MESH_BUF_REF_EQUAL,
@ -66,12 +66,12 @@ typedef enum {
} bt_mesh_buf_ref_flag_t; } bt_mesh_buf_ref_flag_t;
void bt_mesh_adv_buf_ref_debug(const char *func, struct net_buf *buf, void bt_mesh_adv_buf_ref_debug(const char *func, struct net_buf *buf,
u8_t ref_cmp, bt_mesh_buf_ref_flag_t flag); uint8_t ref_cmp, bt_mesh_buf_ref_flag_t flag);
struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *pool, struct net_buf *bt_mesh_adv_create_from_pool(struct net_buf_pool *pool,
bt_mesh_adv_alloc_t get_id, bt_mesh_adv_alloc_t get_id,
enum bt_mesh_adv_type type, enum bt_mesh_adv_type type,
u8_t xmit, s32_t timeout); uint8_t xmit, int32_t timeout);
void bt_mesh_unref_buf_from_pool(struct net_buf_pool *pool); void bt_mesh_unref_buf_from_pool(struct net_buf_pool *pool);
@ -80,13 +80,13 @@ void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
const bt_mesh_addr_t *bt_mesh_get_unprov_dev_addr(void); const bt_mesh_addr_t *bt_mesh_get_unprov_dev_addr(void);
struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, u8_t xmit, struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, uint8_t xmit,
s32_t timeout); int32_t timeout);
void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, void bt_mesh_relay_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
void *cb_data, u16_t src, u16_t dst); void *cb_data, uint16_t src, uint16_t dst);
u16_t bt_mesh_get_stored_relay_count(void); uint16_t bt_mesh_get_stored_relay_count(void);
void bt_mesh_adv_update(void); void bt_mesh_adv_update(void);
@ -101,9 +101,9 @@ int bt_mesh_scan_with_wl_enable(void);
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV #if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
int bt_mesh_start_ble_advertising(const struct bt_mesh_ble_adv_param *param, int bt_mesh_start_ble_advertising(const struct bt_mesh_ble_adv_param *param,
const struct bt_mesh_ble_adv_data *data, u8_t *index); const struct bt_mesh_ble_adv_data *data, uint8_t *index);
int bt_mesh_stop_ble_advertising(u8_t index); int bt_mesh_stop_ble_advertising(uint8_t index);
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */ #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -40,12 +40,12 @@
/* 1 transmission, 20ms interval */ /* 1 transmission, 20ms interval */
#define PROV_XMIT BLE_MESH_TRANSMIT(0, 20) #define PROV_XMIT BLE_MESH_TRANSMIT(0, 20)
#define SNB_NET_IDX_SET(_val) ((void *)((u32_t)(_val))) #define SNB_NET_IDX_SET(_val) ((void *)((uint32_t)(_val)))
#define SNB_NET_IDX_GET(_ptr) ((u32_t)(_ptr)) #define SNB_NET_IDX_GET(_ptr) ((uint32_t)(_ptr))
static struct k_delayed_work beacon_timer; static struct k_delayed_work beacon_timer;
static struct bt_mesh_subnet *cache_check(u8_t data[21]) static struct bt_mesh_subnet *cache_check(uint8_t data[21])
{ {
size_t subnet_size = 0U; size_t subnet_size = 0U;
int i = 0; int i = 0;
@ -67,7 +67,7 @@ static struct bt_mesh_subnet *cache_check(u8_t data[21])
return NULL; return NULL;
} }
static void cache_add(u8_t data[21], struct bt_mesh_subnet *sub) static void cache_add(uint8_t data[21], struct bt_mesh_subnet *sub)
{ {
memcpy(sub->beacon_cache, data, 21); memcpy(sub->beacon_cache, data, 21);
} }
@ -75,11 +75,11 @@ static void cache_add(u8_t data[21], struct bt_mesh_subnet *sub)
static void beacon_complete(int err, void *user_data) static void beacon_complete(int err, void *user_data)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t net_idx = BLE_MESH_KEY_UNUSED; uint16_t net_idx = BLE_MESH_KEY_UNUSED;
BT_DBG("err %d", err); BT_DBG("err %d", err);
net_idx = (u16_t)SNB_NET_IDX_GET(user_data); net_idx = (uint16_t)SNB_NET_IDX_GET(user_data);
/* For node, directly updating the "beacon_sent" timestamp is fine, /* For node, directly updating the "beacon_sent" timestamp is fine,
* since the subnet is pre-allocated. * since the subnet is pre-allocated.
@ -103,7 +103,7 @@ static void beacon_complete(int err, void *user_data)
void bt_mesh_beacon_create(struct bt_mesh_subnet *sub, void bt_mesh_beacon_create(struct bt_mesh_subnet *sub,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t flags = bt_mesh_net_flags(sub); uint8_t flags = bt_mesh_net_flags(sub);
struct bt_mesh_subnet_keys *keys = NULL; struct bt_mesh_subnet_keys *keys = NULL;
net_buf_simple_add_u8(buf, BEACON_TYPE_SECURE); net_buf_simple_add_u8(buf, BEACON_TYPE_SECURE);
@ -131,15 +131,14 @@ void bt_mesh_beacon_create(struct bt_mesh_subnet *sub,
} }
/* If the interval has passed or is within 5 seconds from now send a beacon */ /* If the interval has passed or is within 5 seconds from now send a beacon */
#define BEACON_THRESHOLD(sub) (K_SECONDS(10 * ((sub)->beacons_last + 1)) - \ #define BEACON_THRESHOLD(sub) (K_SECONDS(10 * ((sub)->beacons_last + 1)) - K_SECONDS(5))
K_SECONDS(5))
static int secure_beacon_send(void) static int secure_beacon_send(void)
{ {
static const struct bt_mesh_send_cb send_cb = { static const struct bt_mesh_send_cb send_cb = {
.end = beacon_complete, .end = beacon_complete,
}; };
u32_t now = k_uptime_get_32(); uint32_t now = k_uptime_get_32();
size_t subnet_size = 0U; size_t subnet_size = 0U;
int i = 0; int i = 0;
@ -150,7 +149,7 @@ static int secure_beacon_send(void)
for (i = 0; i < subnet_size; i++) { for (i = 0; i < subnet_size; i++) {
struct bt_mesh_subnet *sub = bt_mesh_rx_netkey_get(i); struct bt_mesh_subnet *sub = bt_mesh_rx_netkey_get(i);
struct net_buf *buf; struct net_buf *buf;
u32_t time_diff; uint32_t time_diff;
if (sub == NULL || sub->net_idx == BLE_MESH_KEY_UNUSED) { if (sub == NULL || sub->net_idx == BLE_MESH_KEY_UNUSED) {
continue; continue;
@ -205,9 +204,9 @@ static int unprovisioned_beacon_send(void)
{ {
#if defined(CONFIG_BLE_MESH_PB_ADV) #if defined(CONFIG_BLE_MESH_PB_ADV)
const struct bt_mesh_prov *prov = NULL; const struct bt_mesh_prov *prov = NULL;
u8_t uri_hash[16] = { 0 }; uint8_t uri_hash[16] = { 0 };
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
u16_t oob_info = 0U; uint16_t oob_info = 0U;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -334,11 +333,13 @@ static void beacon_send(struct k_work *work)
static void secure_beacon_recv(struct net_buf_simple *buf) static void secure_beacon_recv(struct net_buf_simple *buf)
{ {
u8_t *data = NULL, *net_id = NULL, *auth = NULL; uint8_t *data = NULL, *net_id = NULL, *auth = NULL;
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u32_t iv_index = 0U; uint32_t iv_index = 0U;
bool new_key = false, kr_change = false, iv_change = false; bool kr_change = false;
u8_t flags = 0U; bool iv_change = false;
bool new_key = false;
uint8_t flags = 0U;
if (buf->len < 21) { if (buf->len < 21) {
BT_ERR("Too short secure beacon (len %u)", buf->len); BT_ERR("Too short secure beacon (len %u)", buf->len);
@ -413,9 +414,9 @@ update_stats:
} }
} }
void bt_mesh_beacon_recv(struct net_buf_simple *buf, s8_t rssi) void bt_mesh_beacon_recv(struct net_buf_simple *buf, int8_t rssi)
{ {
u8_t type = 0U; uint8_t type = 0U;
BT_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len));

View File

@ -20,7 +20,7 @@ void bt_mesh_beacon_disable(void);
void bt_mesh_beacon_ivu_initiator(bool enable); void bt_mesh_beacon_ivu_initiator(bool enable);
void bt_mesh_beacon_recv(struct net_buf_simple *buf, s8_t rssi); void bt_mesh_beacon_recv(struct net_buf_simple *buf, int8_t rssi);
void bt_mesh_beacon_create(struct bt_mesh_subnet *sub, void bt_mesh_beacon_create(struct bt_mesh_subnet *sub,
struct net_buf_simple *buf); struct net_buf_simple *buf);

View File

@ -38,8 +38,8 @@ struct bt_mesh_dev bt_mesh_dev;
} \ } \
} while(0); } while(0);
#define BLE_MESH_GATT_GET_CONN_ID(conn_id) (((u16_t)(conn_id)) >> 8) #define BLE_MESH_GATT_GET_CONN_ID(conn_id) (((uint16_t)(conn_id)) >> 8)
#define BLE_MESH_GATT_CREATE_CONN_ID(gatt_if, conn_id) ((u16_t)((((u8_t)(conn_id)) << 8) | ((u8_t)(gatt_if)))) #define BLE_MESH_GATT_CREATE_CONN_ID(gatt_if, conn_id) ((uint16_t)((((uint8_t)(conn_id)) << 8) | ((uint8_t)(gatt_if))))
/* We don't need to manage the BLE_MESH_DEV_ADVERTISING flags in the version of Bluedroid, /* We don't need to manage the BLE_MESH_DEV_ADVERTISING flags in the version of Bluedroid,
* it will manage it in the BTM layer. * it will manage it in the BTM layer.
@ -47,7 +47,7 @@ struct bt_mesh_dev bt_mesh_dev;
#define BLE_MESH_DEV 0 #define BLE_MESH_DEV 0
/* P-256 Variables */ /* P-256 Variables */
static u8_t bt_mesh_public_key[64]; static uint8_t bt_mesh_public_key[64];
static BT_OCTET32 bt_mesh_private_key; static BT_OCTET32 bt_mesh_private_key;
/* Scan related functions */ /* Scan related functions */
@ -66,11 +66,11 @@ static struct bt_mesh_conn bt_mesh_gatts_conn[BLE_MESH_MAX_CONN];
static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb; static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb;
static tBTA_GATTS_IF bt_mesh_gatts_if; static tBTA_GATTS_IF bt_mesh_gatts_if;
static BD_ADDR bt_mesh_gatts_addr; static BD_ADDR bt_mesh_gatts_addr;
static u16_t svc_handle, char_handle; static uint16_t svc_handle, char_handle;
static future_t *future_mesh; static future_t *future_mesh;
/* Static Functions */ /* Static Functions */
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle); static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle);
#endif #endif
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \ #if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
@ -81,14 +81,14 @@ static struct gattc_prov_info {
/* Service to be found depends on the type of adv pkt received */ /* Service to be found depends on the type of adv pkt received */
struct bt_mesh_conn conn; struct bt_mesh_conn conn;
bt_mesh_addr_t addr; bt_mesh_addr_t addr;
u16_t service_uuid; uint16_t service_uuid;
u16_t mtu; uint16_t mtu;
bool wr_desc_done; /* Indicate if write char descriptor event is received */ bool wr_desc_done; /* Indicate if write char descriptor event is received */
u16_t start_handle; /* Service attribute start handle */ uint16_t start_handle; /* Service attribute start handle */
u16_t end_handle; /* Service attribute end handle */ uint16_t end_handle; /* Service attribute end handle */
u16_t data_in_handle; /* Data In Characteristic attribute handle */ uint16_t data_in_handle; /* Data In Characteristic attribute handle */
u16_t data_out_handle; /* Data Out Characteristic attribute handle */ uint16_t data_out_handle; /* Data Out Characteristic attribute handle */
u16_t ccc_handle; /* Data Out Characteristic CCC attribute handle */ uint16_t ccc_handle; /* Data Out Characteristic CCC attribute handle */
} bt_mesh_gattc_info[BLE_MESH_MAX_CONN]; } bt_mesh_gattc_info[BLE_MESH_MAX_CONN];
static struct bt_mesh_prov_conn_cb *bt_mesh_gattc_conn_cb; static struct bt_mesh_prov_conn_cb *bt_mesh_gattc_conn_cb;
static tBTA_GATTC_IF bt_mesh_gattc_if; static tBTA_GATTC_IF bt_mesh_gattc_if;
@ -128,7 +128,7 @@ void bt_mesh_hci_init(void)
bt_mesh_dev.le.states = (states_sh << 32) | states_fh; bt_mesh_dev.le.states = (states_sh << 32) | states_fh;
} }
static void bt_mesh_scan_results_change_2_bta(tBTM_INQ_RESULTS *p_inq, u8_t *p_eir, static void bt_mesh_scan_results_change_2_bta(tBTM_INQ_RESULTS *p_inq, uint8_t *p_eir,
tBTA_DM_SEARCH_CBACK *p_scan_cback) tBTA_DM_SEARCH_CBACK *p_scan_cback)
{ {
tBTM_INQ_INFO *p_inq_info = NULL; tBTM_INQ_INFO *p_inq_info = NULL;
@ -166,7 +166,7 @@ static void bt_mesh_scan_results_change_2_bta(tBTM_INQ_RESULTS *p_inq, u8_t *p_e
} }
} }
static void bt_mesh_scan_results_cb(tBTM_INQ_RESULTS *p_inq, u8_t *p_eir) static void bt_mesh_scan_results_cb(tBTM_INQ_RESULTS *p_inq, uint8_t *p_eir)
{ {
bt_mesh_scan_results_change_2_bta(p_inq, p_eir, bt_mesh_scan_result_callback); bt_mesh_scan_results_change_2_bta(p_inq, p_eir, bt_mesh_scan_result_callback);
} }
@ -190,7 +190,7 @@ static bool valid_adv_param(const struct bt_mesh_adv_param *param)
return true; return true;
} }
static int set_adv_data(u16_t hci_op, const struct bt_mesh_adv_data *ad, size_t ad_len) static int set_adv_data(uint16_t hci_op, const struct bt_mesh_adv_data *ad, size_t ad_len)
{ {
struct bt_mesh_hci_cp_set_adv_data param = {0}; struct bt_mesh_hci_cp_set_adv_data param = {0};
int i; int i;
@ -222,7 +222,7 @@ static int set_adv_data(u16_t hci_op, const struct bt_mesh_adv_data *ad, size_t
return 0; return 0;
} }
static void start_adv_completed_cb(u8_t status) static void start_adv_completed_cb(uint8_t status)
{ {
#if BLE_MESH_DEV #if BLE_MESH_DEV
if (!status) { if (!status) {
@ -258,8 +258,8 @@ static bool valid_scan_param(const struct bt_mesh_scan_param *param)
return true; return true;
} }
static int start_le_scan(u8_t scan_type, u16_t interval, u16_t window, static int start_le_scan(uint8_t scan_type, uint16_t interval, uint16_t window,
u8_t filter_dup, u8_t scan_fil_policy) uint8_t filter_dup, uint8_t scan_fil_policy)
{ {
UINT8 addr_type_own = BLE_MESH_ADDR_PUBLIC; /* Currently only support Public Address */ UINT8 addr_type_own = BLE_MESH_ADDR_PUBLIC; /* Currently only support Public Address */
tGATT_IF client_if = 0xFF; /* Default GATT interface id */ tGATT_IF client_if = 0xFF; /* Default GATT interface id */
@ -285,8 +285,8 @@ static int start_le_scan(u8_t scan_type, u16_t interval, u16_t window,
static void bt_mesh_scan_result_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data) static void bt_mesh_scan_result_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
{ {
bt_mesh_addr_t addr = {0}; bt_mesh_addr_t addr = {0};
u8_t adv_type = 0U; uint8_t adv_type = 0U;
s8_t rssi = 0; int8_t rssi = 0;
BT_DBG("%s, event %d", __func__, event); BT_DBG("%s, event %d", __func__, event);
@ -326,7 +326,7 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
tBLE_ADDR_TYPE addr_type_own = 0U; tBLE_ADDR_TYPE addr_type_own = 0U;
tBLE_BD_ADDR p_dir_bda = {0}; tBLE_BD_ADDR p_dir_bda = {0};
tBTM_BLE_AFP adv_fil_pol = 0U; tBTM_BLE_AFP adv_fil_pol = 0U;
u8_t adv_type = 0U; uint8_t adv_type = 0U;
int err = 0; int err = 0;
#if BLE_MESH_DEV #if BLE_MESH_DEV
@ -532,10 +532,10 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
break; break;
case BTA_GATTS_READ_EVT: { case BTA_GATTS_READ_EVT: {
struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(p_data->req_data.p_data->read_req.handle); struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(p_data->req_data.p_data->read_req.handle);
u8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->req_data.conn_id); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->req_data.conn_id);
tBTA_GATTS_RSP rsp = {0}; tBTA_GATTS_RSP rsp = {0};
u8_t buf[100] = {0}; uint8_t buf[100] = {0};
u16_t len = 0; uint16_t len = 0;
BT_DBG("gatts read, handle %d", p_data->req_data.p_data->read_req.handle); BT_DBG("gatts read, handle %d", p_data->req_data.p_data->read_req.handle);
@ -556,8 +556,8 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
} }
case BTA_GATTS_WRITE_EVT: { case BTA_GATTS_WRITE_EVT: {
struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(p_data->req_data.p_data->write_req.handle); struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(p_data->req_data.p_data->write_req.handle);
u8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->req_data.conn_id); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->req_data.conn_id);
u16_t len = 0; uint16_t len = 0;
BT_DBG("gatts write, handle %d, len %d, data %s", p_data->req_data.p_data->write_req.handle, BT_DBG("gatts write, handle %d, len %d, data %s", p_data->req_data.p_data->write_req.handle,
p_data->req_data.p_data->write_req.len, p_data->req_data.p_data->write_req.len,
@ -620,7 +620,7 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING); bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING);
#endif #endif
if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->connected != NULL) { if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->connected != NULL) {
u8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id);
if (index < BLE_MESH_MAX_CONN) { if (index < BLE_MESH_MAX_CONN) {
bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id); bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id);
(bt_mesh_gatts_conn_cb->connected)(&bt_mesh_gatts_conn[index], 0); (bt_mesh_gatts_conn_cb->connected)(&bt_mesh_gatts_conn[index], 0);
@ -639,7 +639,7 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING); bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING);
#endif #endif
if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->disconnected != NULL) { if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->disconnected != NULL) {
u8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id);
if (index < BLE_MESH_MAX_CONN) { if (index < BLE_MESH_MAX_CONN) {
bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id); bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(p_data->conn.conn_id);
(bt_mesh_gatts_conn_cb->disconnected)(&bt_mesh_gatts_conn[index], p_data->conn.reason); (bt_mesh_gatts_conn_cb->disconnected)(&bt_mesh_gatts_conn[index], p_data->conn.reason);
@ -664,7 +664,7 @@ void bt_mesh_gatts_conn_cb_deregister(void)
bt_mesh_gatts_conn_cb = NULL; bt_mesh_gatts_conn_cb = NULL;
} }
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle) static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle)
{ {
struct bt_mesh_gatt_service *svc = NULL; struct bt_mesh_gatt_service *svc = NULL;
struct bt_mesh_gatt_attr *attr = NULL; struct bt_mesh_gatt_attr *attr = NULL;
@ -684,7 +684,7 @@ static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle)
return NULL; return NULL;
} }
static void bt_mesh_gatts_foreach_attr(u16_t start_handle, u16_t end_handle, static void bt_mesh_gatts_foreach_attr(uint16_t start_handle, uint16_t end_handle,
bt_mesh_gatt_attr_func_t func, void *user_data) bt_mesh_gatt_attr_func_t func, void *user_data)
{ {
struct bt_mesh_gatt_service *svc = NULL; struct bt_mesh_gatt_service *svc = NULL;
@ -708,7 +708,7 @@ static void bt_mesh_gatts_foreach_attr(u16_t start_handle, u16_t end_handle,
} }
} }
static u8_t find_next(const struct bt_mesh_gatt_attr *attr, void *user_data) static uint8_t find_next(const struct bt_mesh_gatt_attr *attr, void *user_data)
{ {
struct bt_mesh_gatt_attr **next = user_data; struct bt_mesh_gatt_attr **next = user_data;
@ -728,10 +728,10 @@ static struct bt_mesh_gatt_attr *bt_mesh_gatts_attr_next(const struct bt_mesh_ga
ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t buf_len, u16_t offset, void *buf, uint16_t buf_len, uint16_t offset,
const void *value, u16_t value_len) const void *value, uint16_t value_len)
{ {
u16_t len = 0U; uint16_t len = 0U;
if (offset > value_len) { if (offset > value_len) {
return BLE_MESH_GATT_ERR(BLE_MESH_ATT_ERR_INVALID_OFFSET); return BLE_MESH_GATT_ERR(BLE_MESH_ATT_ERR_INVALID_OFFSET);
@ -747,19 +747,19 @@ ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn,
} }
struct gatts_incl { struct gatts_incl {
u16_t start_handle; uint16_t start_handle;
u16_t end_handle; uint16_t end_handle;
u16_t uuid16; uint16_t uuid16;
} __packed; } __packed;
ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_gatt_attr *incl = attr->user_data; struct bt_mesh_gatt_attr *incl = attr->user_data;
struct bt_mesh_uuid *uuid = incl->user_data; struct bt_mesh_uuid *uuid = incl->user_data;
struct gatts_incl pdu = {0}; struct gatts_incl pdu = {0};
u8_t value_len = 0U; uint8_t value_len = 0U;
/* First attr points to the start handle */ /* First attr points to the start handle */
pdu.start_handle = sys_cpu_to_le16(incl->handle); pdu.start_handle = sys_cpu_to_le16(incl->handle);
@ -779,12 +779,12 @@ ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn,
ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_uuid *uuid = attr->user_data; struct bt_mesh_uuid *uuid = attr->user_data;
if (uuid->type == BLE_MESH_UUID_TYPE_16) { if (uuid->type == BLE_MESH_UUID_TYPE_16) {
u16_t uuid16 = sys_cpu_to_le16(BLE_MESH_UUID_16(uuid)->val); uint16_t uuid16 = sys_cpu_to_le16(BLE_MESH_UUID_16(uuid)->val);
return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, &uuid16, 2); return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, &uuid16, 2);
} }
@ -794,22 +794,22 @@ ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn,
} }
struct gatts_chrc { struct gatts_chrc {
u8_t properties; uint8_t properties;
u16_t value_handle; uint16_t value_handle;
union { union {
u16_t uuid16; uint16_t uuid16;
u8_t uuid[16]; uint8_t uuid[16];
}; };
} __packed; } __packed;
ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_gatt_char *chrc = attr->user_data; struct bt_mesh_gatt_char *chrc = attr->user_data;
const struct bt_mesh_gatt_attr *next = NULL; const struct bt_mesh_gatt_attr *next = NULL;
struct gatts_chrc pdu = {0}; struct gatts_chrc pdu = {0};
u8_t value_len = 0U; uint8_t value_len = 0U;
pdu.properties = chrc->properties; pdu.properties = chrc->properties;
/* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534: /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534:
@ -862,7 +862,7 @@ static void bta_uuid_to_bt_mesh_uuid(tBT_UUID *bta_uuid, const struct bt_mesh_uu
static int gatts_register(struct bt_mesh_gatt_service *svc) static int gatts_register(struct bt_mesh_gatt_service *svc)
{ {
struct bt_mesh_gatt_service *last = NULL; struct bt_mesh_gatt_service *last = NULL;
u16_t handle = 0U; uint16_t handle = 0U;
if (sys_slist_is_empty(&bt_mesh_gatts_db)) { if (sys_slist_is_empty(&bt_mesh_gatts_db)) {
handle = 0; handle = 0;
@ -890,7 +890,7 @@ static int gatts_deregister(struct bt_mesh_gatt_service *svc)
return 0; return 0;
} }
static tBTA_GATT_PERM bt_mesh_perm_to_bta_perm(u8_t perm) static tBTA_GATT_PERM bt_mesh_perm_to_bta_perm(uint8_t perm)
{ {
tBTA_GATT_PERM bta_perm = 0; tBTA_GATT_PERM bta_perm = 0;
@ -1025,10 +1025,10 @@ int bt_mesh_gatts_service_deregister(struct bt_mesh_gatt_service *svc)
return 0; return 0;
} }
int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, u8_t reason) int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, uint8_t reason)
{ {
UNUSED(reason); UNUSED(reason);
u16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gatts_if, conn->handle); uint16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gatts_if, conn->handle);
BTA_GATTS_Close(conn_id); BTA_GATTS_Close(conn_id);
return 0; return 0;
} }
@ -1043,14 +1043,14 @@ int bt_mesh_gatts_service_unregister(struct bt_mesh_gatt_service *svc)
int bt_mesh_gatts_notify(struct bt_mesh_conn *conn, int bt_mesh_gatts_notify(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len) const void *data, uint16_t len)
{ {
u16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gatts_if, conn->handle); uint16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gatts_if, conn->handle);
BTA_GATTS_HandleValueIndication(conn_id, attr->handle, len, (u8_t *)data, false); BTA_GATTS_HandleValueIndication(conn_id, attr->handle, len, (uint8_t *)data, false);
return 0; return 0;
} }
u16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn) uint16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn)
{ {
return BTA_GATT_GetLocalMTU(); return BTA_GATT_GetLocalMTU();
} }
@ -1120,9 +1120,9 @@ void bt_mesh_gattc_conn_cb_deregister(void)
bt_mesh_gattc_conn_cb = NULL; bt_mesh_gattc_conn_cb = NULL;
} }
u8_t bt_mesh_gattc_get_free_conn_count(void) uint8_t bt_mesh_gattc_get_free_conn_count(void)
{ {
u8_t count = 0U; uint8_t count = 0U;
int i; int i;
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
@ -1135,7 +1135,7 @@ u8_t bt_mesh_gattc_get_free_conn_count(void)
return count; return count;
} }
u16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn) uint16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn)
{ {
int i; int i;
@ -1159,9 +1159,9 @@ u16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn)
* 6. Set the Notification bit of CCC * 6. Set the Notification bit of CCC
*/ */
int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, u16_t service_uuid) int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
{ {
u8_t zero[6] = {0}; uint8_t zero[6] = {0};
int i; int i;
if (!addr || !memcmp(addr->val, zero, BLE_MESH_ADDR_LEN) || if (!addr || !memcmp(addr->val, zero, BLE_MESH_ADDR_LEN) ||
@ -1222,20 +1222,20 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, u16_t service_uuid)
return 0; return 0;
} }
void bt_mesh_gattc_exchange_mtu(u8_t index) void bt_mesh_gattc_exchange_mtu(uint8_t index)
{ {
/** Set local MTU and exchange with GATT server. /** Set local MTU and exchange with GATT server.
* ATT_MTU >= 69 for Mesh GATT Prov Service * ATT_MTU >= 69 for Mesh GATT Prov Service
* ATT_NTU >= 33 for Mesh GATT Proxy Service * ATT_NTU >= 33 for Mesh GATT Proxy Service
*/ */
u16_t conn_id = 0U; uint16_t conn_id = 0U;
conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gattc_if, bt_mesh_gattc_info[index].conn.handle); conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gattc_if, bt_mesh_gattc_info[index].conn.handle);
BTA_GATTC_ConfigureMTU(conn_id); BTA_GATTC_ConfigureMTU(conn_id);
} }
u16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn) uint16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn)
{ {
int i; int i;
@ -1250,9 +1250,9 @@ u16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn)
int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn, int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len) const void *data, uint16_t len)
{ {
u16_t conn_id = 0U; uint16_t conn_id = 0U;
int i; int i;
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
@ -1260,7 +1260,7 @@ int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn,
conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gattc_if, bt_mesh_gattc_info[i].conn.handle); conn_id = BLE_MESH_GATT_CREATE_CONN_ID(bt_mesh_gattc_if, bt_mesh_gattc_info[i].conn.handle);
BTA_GATTC_WriteCharValue(conn_id, bt_mesh_gattc_info[i].data_in_handle, BTA_GATTC_WriteCharValue(conn_id, bt_mesh_gattc_info[i].data_in_handle,
BTA_GATTC_TYPE_WRITE_NO_RSP, len, BTA_GATTC_TYPE_WRITE_NO_RSP, len,
(u8_t *)data, BTA_GATT_AUTH_REQ_NONE); (uint8_t *)data, BTA_GATT_AUTH_REQ_NONE);
return 0; return 0;
} }
} }
@ -1279,7 +1279,7 @@ void bt_mesh_gattc_disconnect(struct bt_mesh_conn *conn)
* when proxy_disconnected callback comes, the proxy server * when proxy_disconnected callback comes, the proxy server
* information and prov_link information should be cleared. * information and prov_link information should be cleared.
*/ */
u16_t conn_id = 0U; uint16_t conn_id = 0U;
int i; int i;
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
@ -1304,14 +1304,14 @@ void bt_mesh_gattc_disconnect(struct bt_mesh_conn *conn)
static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data) static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
{ {
struct bt_mesh_conn *conn = NULL; struct bt_mesh_conn *conn = NULL;
u16_t handle = 0U; uint16_t handle = 0U;
ssize_t len = 0; ssize_t len = 0;
int i = 0; int i = 0;
switch (event) { switch (event) {
case BTA_GATTC_REG_EVT: case BTA_GATTC_REG_EVT:
if (p_data->reg_oper.status == BTA_GATT_OK) { if (p_data->reg_oper.status == BTA_GATT_OK) {
u8_t uuid[16] = { [0 ... 15] = BLE_MESH_GATTC_APP_UUID_BYTE }; uint8_t uuid[16] = { [0 ... 15] = BLE_MESH_GATTC_APP_UUID_BYTE };
BT_DBG("BTA_GATTC_REG_EVT"); BT_DBG("BTA_GATTC_REG_EVT");
@ -1386,13 +1386,13 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
return; return;
} }
u16_t notify_en = BLE_MESH_GATT_CCC_NOTIFY; uint16_t notify_en = BLE_MESH_GATT_CCC_NOTIFY;
btgatt_db_element_t *result = NULL; btgatt_db_element_t *result = NULL;
tBT_UUID char_uuid = {0}; tBT_UUID char_uuid = {0};
tBTA_GATT_STATUS status = 0U; tBTA_GATT_STATUS status = 0U;
tBTA_GATT_UNFMT write = {0}; tBTA_GATT_UNFMT write = {0};
u16_t count = 0U; uint16_t count = 0U;
u16_t num = 0; uint16_t num = 0;
/* Get the characteristic num within Mesh Provisioning/Proxy Service */ /* Get the characteristic num within Mesh Provisioning/Proxy Service */
BTA_GATTC_GetDBSizeByType(p_data->search_cmpl.conn_id, BTGATT_DB_CHARACTERISTIC, BTA_GATTC_GetDBSizeByType(p_data->search_cmpl.conn_id, BTGATT_DB_CHARACTERISTIC,
@ -1490,7 +1490,7 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
* Characteristic Descriptor. * Characteristic Descriptor.
*/ */
write.len = sizeof(notify_en); write.len = sizeof(notify_en);
write.p_value = (u8_t *)&notify_en; write.p_value = (uint8_t *)&notify_en;
BTA_GATTC_WriteCharDescr(p_data->search_cmpl.conn_id, result[0].attribute_handle, BTA_GATTC_WriteCharDescr(p_data->search_cmpl.conn_id, result[0].attribute_handle,
BTA_GATTC_TYPE_WRITE, &write, BTA_GATT_AUTH_REQ_NONE); BTA_GATTC_TYPE_WRITE, &write, BTA_GATT_AUTH_REQ_NONE);
@ -1806,21 +1806,21 @@ int bt_mesh_rand(void *buf, size_t len)
return -EAGAIN; return -EAGAIN;
} }
for (i = 0; i < (int)(len / sizeof(u32_t)); i++) { for (i = 0; i < (int)(len / sizeof(uint32_t)); i++) {
u32_t rand = esp_random(); uint32_t rand = esp_random();
memcpy(buf + i * sizeof(u32_t), &rand, sizeof(u32_t)); memcpy(buf + i * sizeof(uint32_t), &rand, sizeof(uint32_t));
} }
BT_DBG("Rand %s", bt_hex(buf, len)); BT_DBG("Rand %s", bt_hex(buf, len));
return 0; return 0;
} }
void bt_mesh_set_private_key(const u8_t pri_key[32]) void bt_mesh_set_private_key(const uint8_t pri_key[32])
{ {
memcpy(bt_mesh_private_key, pri_key, 32); memcpy(bt_mesh_private_key, pri_key, 32);
} }
const u8_t *bt_mesh_pub_key_get(void) const uint8_t *bt_mesh_pub_key_get(void)
{ {
BT_OCTET32 private_key = {0}; BT_OCTET32 private_key = {0};
Point public_key = {0}; Point public_key = {0};
@ -1856,11 +1856,11 @@ const u8_t *bt_mesh_pub_key_get(void)
return bt_mesh_public_key; return bt_mesh_public_key;
} }
bool bt_mesh_check_public_key(const u8_t key[64]) bool bt_mesh_check_public_key(const uint8_t key[64])
{ {
struct p256_pub_key { struct p256_pub_key {
u8_t x[32]; uint8_t x[32];
u8_t y[32]; uint8_t y[32];
} check = {0}; } check = {0};
sys_memcpy_swap(check.x, key, 32); sys_memcpy_swap(check.x, key, 32);
@ -1869,7 +1869,7 @@ bool bt_mesh_check_public_key(const u8_t key[64])
return ECC_CheckPointIsInElliCur_P256((Point *)&check); return ECC_CheckPointIsInElliCur_P256((Point *)&check);
} }
int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u8_t idx) int bt_mesh_dh_key_gen(const uint8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const uint8_t idx)
{ {
BT_OCTET32 private_key = {0}; BT_OCTET32 private_key = {0};
Point peer_pub_key = {0}; Point peer_pub_key = {0};
@ -1890,15 +1890,15 @@ int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u
BT_DBG("new public key y = %s", bt_hex(new_pub_key.y, 32)); BT_DBG("new public key y = %s", bt_hex(new_pub_key.y, 32));
if (cb != NULL) { if (cb != NULL) {
cb((const u8_t *)new_pub_key.x, idx); cb((const uint8_t *)new_pub_key.x, idx);
} }
return 0; return 0;
} }
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
static void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_le, static void ecb_encrypt(uint8_t const *const key_le, uint8_t const *const clear_text_le,
u8_t *const cipher_text_le, u8_t *const cipher_text_be) uint8_t *const cipher_text_le, uint8_t *const cipher_text_be)
{ {
struct bt_mesh_ecb_param ecb = {0}; struct bt_mesh_ecb_param ecb = {0};
mbedtls_aes_context aes_ctx = {0}; mbedtls_aes_context aes_ctx = {0};
@ -1919,8 +1919,8 @@ static void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_l
} }
} }
static void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_text_be, static void ecb_encrypt_be(uint8_t const *const key_be, uint8_t const *const clear_text_be,
u8_t *const cipher_text_be) uint8_t *const cipher_text_be)
{ {
struct bt_mesh_ecb_param ecb = {0}; struct bt_mesh_ecb_param ecb = {0};
mbedtls_aes_context aes_ctx = {0}; mbedtls_aes_context aes_ctx = {0};
@ -1934,8 +1934,8 @@ static void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_tex
} }
#endif /* CONFIG_MBEDTLS_HARDWARE_AES */ #endif /* CONFIG_MBEDTLS_HARDWARE_AES */
int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]) uint8_t enc_data[16])
{ {
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -1946,7 +1946,7 @@ int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16],
return 0; return 0;
#else /* CONFIG_MBEDTLS_HARDWARE_AES */ #else /* CONFIG_MBEDTLS_HARDWARE_AES */
struct tc_aes_key_sched_struct s = {0}; struct tc_aes_key_sched_struct s = {0};
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -1970,8 +1970,8 @@ int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16],
#endif /* CONFIG_MBEDTLS_HARDWARE_AES */ #endif /* CONFIG_MBEDTLS_HARDWARE_AES */
} }
int bt_mesh_encrypt_be(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]) uint8_t enc_data[16])
{ {
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -2001,7 +2001,7 @@ int bt_mesh_encrypt_be(const u8_t key[16], const u8_t plaintext[16],
} }
#if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN) #if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN)
int bt_mesh_update_exceptional_list(u8_t sub_code, u8_t type, void *info) int bt_mesh_update_exceptional_list(uint8_t sub_code, uint8_t type, void *info)
{ {
BD_ADDR value = {0}; BD_ADDR value = {0};
@ -2016,7 +2016,7 @@ int bt_mesh_update_exceptional_list(u8_t sub_code, u8_t type, void *info)
BT_ERR("Invalid Provisioning Link ID"); BT_ERR("Invalid Provisioning Link ID");
return -EINVAL; return -EINVAL;
} }
sys_memcpy_swap(value, info, sizeof(u32_t)); sys_memcpy_swap(value, info, sizeof(uint32_t));
} }
BT_DBG("%s exceptional list, type 0x%02x", sub_code ? "Remove" : "Add", type); BT_DBG("%s exceptional list, type 0x%02x", sub_code ? "Remove" : "Add", type);

View File

@ -104,7 +104,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive configuration status message timeout"); BT_WARN("Receive configuration status message timeout");
@ -134,7 +134,7 @@ static void cfg_client_recv_status(struct bt_mesh_model *model,
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct net_buf_simple buf = {0}; struct net_buf_simple buf = {0};
u8_t evt_type = 0xFF; uint8_t evt_type = 0xFF;
if (!model || !ctx) { if (!model || !ctx) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -142,8 +142,8 @@ static void cfg_client_recv_status(struct bt_mesh_model *model,
} }
/* If it is a publish message, sent to the user directly. */ /* If it is a publish message, sent to the user directly. */
buf.data = (u8_t *)status; buf.data = (uint8_t *)status;
buf.len = (u16_t)len; buf.len = (uint16_t)len;
bt_mesh_cfg_client_lock(); bt_mesh_cfg_client_lock();
@ -208,10 +208,10 @@ static void cfg_client_recv_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_config_client_cb_evt_to_btc( bt_mesh_config_client_cb_evt_to_btc(
opcode, evt_type, model, ctx, (const u8_t *)status, len); opcode, evt_type, model, ctx, (const uint8_t *)status, len);
} }
} }
@ -276,7 +276,7 @@ static void state_status_u8(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t status = 0U; uint8_t status = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -284,7 +284,7 @@ static void state_status_u8(struct bt_mesh_model *model,
status = net_buf_simple_pull_u8(buf); status = net_buf_simple_pull_u8(buf);
cfg_client_recv_status(model, ctx, &status, sizeof(u8_t)); cfg_client_recv_status(model, ctx, &status, sizeof(uint8_t));
} }
static void beacon_status(struct bt_mesh_model *model, static void beacon_status(struct bt_mesh_model *model,
@ -678,7 +678,7 @@ const struct bt_mesh_model_op bt_mesh_cfg_cli_op[] = {
BLE_MESH_MODEL_OP_END, BLE_MESH_MODEL_OP_END,
}; };
static int send_msg_with_none(bt_mesh_client_common_param_t *param, u32_t op) static int send_msg_with_none(bt_mesh_client_common_param_t *param, uint32_t op)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 0); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 0);
@ -687,7 +687,7 @@ static int send_msg_with_none(bt_mesh_client_common_param_t *param, u32_t op)
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
static int send_msg_with_u8(bt_mesh_client_common_param_t *param, u32_t op, u8_t val) static int send_msg_with_u8(bt_mesh_client_common_param_t *param, uint32_t op, uint8_t val)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 1); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 1);
@ -697,7 +697,7 @@ static int send_msg_with_u8(bt_mesh_client_common_param_t *param, u32_t op, u8_t
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
static int send_msg_with_le16(bt_mesh_client_common_param_t *param, u32_t op, u16_t val) static int send_msg_with_le16(bt_mesh_client_common_param_t *param, uint32_t op, uint16_t val)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 2); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 2);
@ -707,7 +707,7 @@ static int send_msg_with_le16(bt_mesh_client_common_param_t *param, u32_t op, u1
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
int bt_mesh_cfg_comp_data_get(bt_mesh_client_common_param_t *param, u8_t page) int bt_mesh_cfg_comp_data_get(bt_mesh_client_common_param_t *param, uint8_t page)
{ {
return send_msg_with_u8(param, OP_DEV_COMP_DATA_GET, page); return send_msg_with_u8(param, OP_DEV_COMP_DATA_GET, page);
} }
@ -717,7 +717,7 @@ int bt_mesh_cfg_beacon_get(bt_mesh_client_common_param_t *param)
return send_msg_with_none(param, OP_BEACON_GET); return send_msg_with_none(param, OP_BEACON_GET);
} }
int bt_mesh_cfg_beacon_set(bt_mesh_client_common_param_t *param, u8_t val) int bt_mesh_cfg_beacon_set(bt_mesh_client_common_param_t *param, uint8_t val)
{ {
if (val > 0x01) { if (val > 0x01) {
BT_ERR("Invalid beacon state 0x%02x", val); BT_ERR("Invalid beacon state 0x%02x", val);
@ -731,7 +731,7 @@ int bt_mesh_cfg_ttl_get(bt_mesh_client_common_param_t *param)
return send_msg_with_none(param, OP_DEFAULT_TTL_GET); return send_msg_with_none(param, OP_DEFAULT_TTL_GET);
} }
int bt_mesh_cfg_ttl_set(bt_mesh_client_common_param_t *param, u8_t val) int bt_mesh_cfg_ttl_set(bt_mesh_client_common_param_t *param, uint8_t val)
{ {
return send_msg_with_u8(param, OP_DEFAULT_TTL_SET, val); return send_msg_with_u8(param, OP_DEFAULT_TTL_SET, val);
} }
@ -741,7 +741,7 @@ int bt_mesh_cfg_friend_get(bt_mesh_client_common_param_t *param)
return send_msg_with_none(param, OP_FRIEND_GET); return send_msg_with_none(param, OP_FRIEND_GET);
} }
int bt_mesh_cfg_friend_set(bt_mesh_client_common_param_t *param, u8_t val) int bt_mesh_cfg_friend_set(bt_mesh_client_common_param_t *param, uint8_t val)
{ {
return send_msg_with_u8(param, OP_FRIEND_SET, val); return send_msg_with_u8(param, OP_FRIEND_SET, val);
} }
@ -751,7 +751,7 @@ int bt_mesh_cfg_gatt_proxy_get(bt_mesh_client_common_param_t *param)
return send_msg_with_none(param, OP_GATT_PROXY_GET); return send_msg_with_none(param, OP_GATT_PROXY_GET);
} }
int bt_mesh_cfg_gatt_proxy_set(bt_mesh_client_common_param_t *param, u8_t val) int bt_mesh_cfg_gatt_proxy_set(bt_mesh_client_common_param_t *param, uint8_t val)
{ {
return send_msg_with_u8(param, OP_GATT_PROXY_SET, val); return send_msg_with_u8(param, OP_GATT_PROXY_SET, val);
} }
@ -762,7 +762,7 @@ int bt_mesh_cfg_relay_get(bt_mesh_client_common_param_t *param)
} }
int bt_mesh_cfg_relay_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_relay_set(bt_mesh_client_common_param_t *param,
u8_t relay, u8_t retransmit) uint8_t relay, uint8_t retransmit)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_SET, 2); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_RELAY_SET, 2);
@ -774,7 +774,7 @@ int bt_mesh_cfg_relay_set(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_net_key_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_net_key_add(bt_mesh_client_common_param_t *param,
u16_t net_idx, const u8_t net_key[16]) uint16_t net_idx, const uint8_t net_key[16])
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_ADD, 18); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_ADD, 18);
@ -791,8 +791,8 @@ int bt_mesh_cfg_net_key_add(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_app_key_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_add(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx, uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]) const uint8_t app_key[16])
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_ADD, 19); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_ADD, 19);
@ -809,8 +809,8 @@ int bt_mesh_cfg_app_key_add(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_mod_app_bind(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_bind(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t app_idx, uint16_t elem_addr, uint16_t app_idx,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_BIND, 8); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_BIND, 8);
@ -825,9 +825,9 @@ int bt_mesh_cfg_mod_app_bind(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
static int mod_sub(bt_mesh_client_common_param_t *param, u32_t op, static int mod_sub(bt_mesh_client_common_param_t *param, uint32_t op,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 8); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 8);
@ -843,29 +843,29 @@ static int mod_sub(bt_mesh_client_common_param_t *param, u32_t op,
} }
int bt_mesh_cfg_mod_sub_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_add(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub(param, OP_MOD_SUB_ADD, elem_addr, sub_addr, mod_id, cid); return mod_sub(param, OP_MOD_SUB_ADD, elem_addr, sub_addr, mod_id, cid);
} }
int bt_mesh_cfg_mod_sub_del(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_del(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub(param, OP_MOD_SUB_DEL, elem_addr, sub_addr, mod_id, cid); return mod_sub(param, OP_MOD_SUB_DEL, elem_addr, sub_addr, mod_id, cid);
} }
int bt_mesh_cfg_mod_sub_overwrite(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_overwrite(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub(param, OP_MOD_SUB_OVERWRITE, elem_addr, sub_addr, mod_id, cid); return mod_sub(param, OP_MOD_SUB_OVERWRITE, elem_addr, sub_addr, mod_id, cid);
} }
static int mod_sub_va(bt_mesh_client_common_param_t *param, u32_t op, static int mod_sub_va(bt_mesh_client_common_param_t *param, uint32_t op,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 22); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 22);
@ -889,28 +889,28 @@ static int mod_sub_va(bt_mesh_client_common_param_t *param, u32_t op,
} }
int bt_mesh_cfg_mod_sub_va_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_add(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub_va(param, OP_MOD_SUB_VA_ADD, elem_addr, label, mod_id, cid); return mod_sub_va(param, OP_MOD_SUB_VA_ADD, elem_addr, label, mod_id, cid);
} }
int bt_mesh_cfg_mod_sub_va_del(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_del(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub_va(param, OP_MOD_SUB_VA_DEL, elem_addr, label, mod_id, cid); return mod_sub_va(param, OP_MOD_SUB_VA_DEL, elem_addr, label, mod_id, cid);
} }
int bt_mesh_cfg_mod_sub_va_overwrite(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_overwrite(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
return mod_sub_va(param, OP_MOD_SUB_VA_OVERWRITE, elem_addr, label, mod_id, cid); return mod_sub_va(param, OP_MOD_SUB_VA_OVERWRITE, elem_addr, label, mod_id, cid);
} }
int bt_mesh_cfg_mod_pub_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_GET, 6); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_GET, 6);
@ -925,7 +925,7 @@ int bt_mesh_cfg_mod_pub_get(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_mod_pub_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_set(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid, uint16_t elem_addr, uint16_t mod_id, uint16_t cid,
struct bt_mesh_cfg_mod_pub *pub) struct bt_mesh_cfg_mod_pub *pub)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_SET, 13); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_SET, 13);
@ -1005,8 +1005,8 @@ int bt_mesh_cfg_node_reset(bt_mesh_client_common_param_t *param)
} }
int bt_mesh_cfg_mod_pub_va_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_va_set(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, uint16_t elem_addr, uint16_t mod_id,
u16_t cid, const u8_t label[16], uint16_t cid, const uint8_t label[16],
struct bt_mesh_cfg_mod_pub *pub) struct bt_mesh_cfg_mod_pub *pub)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_VA_SET, 27); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_VA_SET, 27);
@ -1032,7 +1032,7 @@ int bt_mesh_cfg_mod_pub_va_set(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_mod_sub_del_all(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_del_all(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_SUB_DEL_ALL, 6); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_SUB_DEL_ALL, 6);
@ -1046,8 +1046,8 @@ int bt_mesh_cfg_mod_sub_del_all(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
static int mod_sub_get(bt_mesh_client_common_param_t *param, u32_t op, static int mod_sub_get(bt_mesh_client_common_param_t *param, uint32_t op,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 6); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 6);
@ -1062,13 +1062,13 @@ static int mod_sub_get(bt_mesh_client_common_param_t *param, u32_t op,
} }
int bt_mesh_cfg_mod_sub_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id) uint16_t elem_addr, uint16_t mod_id)
{ {
return mod_sub_get(param, OP_MOD_SUB_GET, elem_addr, mod_id, BLE_MESH_CID_NVAL); return mod_sub_get(param, OP_MOD_SUB_GET, elem_addr, mod_id, BLE_MESH_CID_NVAL);
} }
int bt_mesh_cfg_mod_sub_get_vnd(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_get_vnd(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
if (cid == BLE_MESH_CID_NVAL) { if (cid == BLE_MESH_CID_NVAL) {
BT_ERR("Invalid company id"); BT_ERR("Invalid company id");
@ -1078,7 +1078,7 @@ int bt_mesh_cfg_mod_sub_get_vnd(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_net_key_update(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_net_key_update(bt_mesh_client_common_param_t *param,
u16_t net_idx, const u8_t net_key[16]) uint16_t net_idx, const uint8_t net_key[16])
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_UPDATE, 18); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_UPDATE, 18);
@ -1094,7 +1094,7 @@ int bt_mesh_cfg_net_key_update(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
int bt_mesh_cfg_net_key_delete(bt_mesh_client_common_param_t *param, u16_t net_idx) int bt_mesh_cfg_net_key_delete(bt_mesh_client_common_param_t *param, uint16_t net_idx)
{ {
return send_msg_with_le16(param, OP_NET_KEY_DEL, net_idx); return send_msg_with_le16(param, OP_NET_KEY_DEL, net_idx);
} }
@ -1105,8 +1105,8 @@ int bt_mesh_cfg_net_key_get(bt_mesh_client_common_param_t *param)
} }
int bt_mesh_cfg_app_key_update(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_update(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx, uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]) const uint8_t app_key[16])
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_UPDATE, 19); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_UPDATE, 19);
@ -1123,7 +1123,7 @@ int bt_mesh_cfg_app_key_update(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_app_key_delete(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_delete(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx) uint16_t net_idx, uint16_t app_idx)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_DEL, 3); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_DEL, 3);
@ -1133,18 +1133,18 @@ int bt_mesh_cfg_app_key_delete(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
int bt_mesh_cfg_app_key_get(bt_mesh_client_common_param_t *param, u16_t net_idx) int bt_mesh_cfg_app_key_get(bt_mesh_client_common_param_t *param, uint16_t net_idx)
{ {
return send_msg_with_le16(param, OP_APP_KEY_GET, net_idx); return send_msg_with_le16(param, OP_APP_KEY_GET, net_idx);
} }
int bt_mesh_cfg_node_identity_get(bt_mesh_client_common_param_t *param, u16_t net_idx) int bt_mesh_cfg_node_identity_get(bt_mesh_client_common_param_t *param, uint16_t net_idx)
{ {
return send_msg_with_le16(param, OP_NODE_IDENTITY_GET, net_idx); return send_msg_with_le16(param, OP_NODE_IDENTITY_GET, net_idx);
} }
int bt_mesh_cfg_node_identity_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_node_identity_set(bt_mesh_client_common_param_t *param,
u16_t net_idx, u8_t identity) uint16_t net_idx, uint8_t identity)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_SET, 3); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_SET, 3);
@ -1161,8 +1161,8 @@ int bt_mesh_cfg_node_identity_set(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_cfg_mod_app_unbind(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_unbind(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t app_idx, uint16_t elem_addr, uint16_t app_idx,
u16_t mod_id, u16_t cid) uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_UNBIND, 8); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_UNBIND, 8);
@ -1177,8 +1177,8 @@ int bt_mesh_cfg_mod_app_unbind(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
static int mod_app_get(bt_mesh_client_common_param_t *param, u32_t op, static int mod_app_get(bt_mesh_client_common_param_t *param, uint32_t op,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, op, 6); BLE_MESH_MODEL_BUF_DEFINE(msg, op, 6);
@ -1193,13 +1193,13 @@ static int mod_app_get(bt_mesh_client_common_param_t *param, u32_t op,
} }
int bt_mesh_cfg_mod_app_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id) uint16_t elem_addr, uint16_t mod_id)
{ {
return mod_app_get(param, OP_SIG_MOD_APP_GET, elem_addr, mod_id, BLE_MESH_CID_NVAL); return mod_app_get(param, OP_SIG_MOD_APP_GET, elem_addr, mod_id, BLE_MESH_CID_NVAL);
} }
int bt_mesh_cfg_mod_app_get_vnd(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_get_vnd(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid) uint16_t elem_addr, uint16_t mod_id, uint16_t cid)
{ {
if (cid == BLE_MESH_CID_NVAL) { if (cid == BLE_MESH_CID_NVAL) {
BT_ERR("Invalid company id"); BT_ERR("Invalid company id");
@ -1208,13 +1208,13 @@ int bt_mesh_cfg_mod_app_get_vnd(bt_mesh_client_common_param_t *param,
return mod_app_get(param, OP_VND_MOD_APP_GET, elem_addr, mod_id, cid); return mod_app_get(param, OP_VND_MOD_APP_GET, elem_addr, mod_id, cid);
} }
int bt_mesh_cfg_kr_phase_get(bt_mesh_client_common_param_t *param, u16_t net_idx) int bt_mesh_cfg_kr_phase_get(bt_mesh_client_common_param_t *param, uint16_t net_idx)
{ {
return send_msg_with_le16(param, OP_KRP_GET, net_idx); return send_msg_with_le16(param, OP_KRP_GET, net_idx);
} }
int bt_mesh_cfg_kr_phase_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_kr_phase_set(bt_mesh_client_common_param_t *param,
u16_t net_idx, u8_t transition) uint16_t net_idx, uint8_t transition)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_SET, 3); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_SET, 3);
@ -1230,7 +1230,7 @@ int bt_mesh_cfg_kr_phase_set(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, true, timeout_handler); return bt_mesh_client_send_msg(param, &msg, true, timeout_handler);
} }
int bt_mesh_cfg_lpn_timeout_get(bt_mesh_client_common_param_t *param, u16_t lpn_addr) int bt_mesh_cfg_lpn_timeout_get(bt_mesh_client_common_param_t *param, uint16_t lpn_addr)
{ {
return send_msg_with_le16(param, OP_LPN_TIMEOUT_GET, lpn_addr); return send_msg_with_le16(param, OP_LPN_TIMEOUT_GET, lpn_addr);
} }
@ -1240,7 +1240,7 @@ int bt_mesh_cfg_net_transmit_get(bt_mesh_client_common_param_t *param)
return send_msg_with_none(param, OP_NET_TRANSMIT_GET); return send_msg_with_none(param, OP_NET_TRANSMIT_GET);
} }
int bt_mesh_cfg_net_transmit_set(bt_mesh_client_common_param_t *param, u8_t transmit) int bt_mesh_cfg_net_transmit_set(bt_mesh_client_common_param_t *param, uint8_t transmit)
{ {
return send_msg_with_u8(param, OP_NET_TRANSMIT_SET, transmit); return send_msg_with_u8(param, OP_NET_TRANSMIT_SET, transmit);
} }

View File

@ -75,8 +75,8 @@ static int comp_add_elem(struct net_buf_simple *buf, struct bt_mesh_elem *elem,
static int comp_get_page_0(struct net_buf_simple *buf) static int comp_get_page_0(struct net_buf_simple *buf)
{ {
u16_t feat = 0U;
const struct bt_mesh_comp *comp = NULL; const struct bt_mesh_comp *comp = NULL;
uint16_t feat = 0U;
int i; int i;
comp = bt_mesh_comp_get(); comp = bt_mesh_comp_get();
@ -120,7 +120,7 @@ static void dev_comp_data_get(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct net_buf_simple *sdu = NULL; struct net_buf_simple *sdu = NULL;
u8_t page = 0U; uint8_t page = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -159,7 +159,7 @@ static struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
struct net_buf_simple *buf, bool *vnd) struct net_buf_simple *buf, bool *vnd)
{ {
if (buf->len < 4) { if (buf->len < 4) {
u16_t id = 0U; uint16_t id = 0U;
id = net_buf_simple_pull_le16(buf); id = net_buf_simple_pull_le16(buf);
@ -169,7 +169,7 @@ static struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
return bt_mesh_model_find(elem, id); return bt_mesh_model_find(elem, id);
} else { } else {
u16_t company = 0U, id = 0U; uint16_t company = 0U, id = 0U;
company = net_buf_simple_pull_le16(buf); company = net_buf_simple_pull_le16(buf);
id = net_buf_simple_pull_le16(buf); id = net_buf_simple_pull_le16(buf);
@ -183,7 +183,7 @@ static struct bt_mesh_model *get_model(struct bt_mesh_elem *elem,
} }
} }
static bool app_key_is_valid(u16_t app_idx) static bool app_key_is_valid(uint16_t app_idx)
{ {
int i; int i;
@ -199,9 +199,9 @@ static bool app_key_is_valid(u16_t app_idx)
return false; return false;
} }
static u8_t _mod_pub_set(struct bt_mesh_model *model, u16_t pub_addr, static uint8_t _mod_pub_set(struct bt_mesh_model *model, uint16_t pub_addr,
u16_t app_idx, u8_t cred_flag, u8_t ttl, u8_t period, uint16_t app_idx, uint8_t cred_flag, uint8_t ttl, uint8_t period,
u8_t retransmit, bool store) uint8_t retransmit, bool store)
{ {
if (!model->pub) { if (!model->pub) {
return STATUS_NVAL_PUB_PARAM; return STATUS_NVAL_PUB_PARAM;
@ -251,7 +251,7 @@ static u8_t _mod_pub_set(struct bt_mesh_model *model, u16_t pub_addr,
model->pub->retransmit = retransmit; model->pub->retransmit = retransmit;
if (model->pub->update) { if (model->pub->update) {
s32_t period_ms; int32_t period_ms;
period_ms = bt_mesh_model_pub_period_get(model); period_ms = bt_mesh_model_pub_period_get(model);
BT_DBG("period %u ms", period_ms); BT_DBG("period %u ms", period_ms);
@ -270,7 +270,7 @@ static u8_t _mod_pub_set(struct bt_mesh_model *model, u16_t pub_addr,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static u8_t mod_bind(struct bt_mesh_model *model, u16_t key_idx) static uint8_t mod_bind(struct bt_mesh_model *model, uint16_t key_idx)
{ {
int i; int i;
@ -302,7 +302,7 @@ static u8_t mod_bind(struct bt_mesh_model *model, u16_t key_idx)
return STATUS_INSUFF_RESOURCES; return STATUS_INSUFF_RESOURCES;
} }
static u8_t mod_unbind(struct bt_mesh_model *model, u16_t key_idx, bool store) static uint8_t mod_unbind(struct bt_mesh_model *model, uint16_t key_idx, bool store)
{ {
int i; int i;
@ -332,7 +332,7 @@ static u8_t mod_unbind(struct bt_mesh_model *model, u16_t key_idx, bool store)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
struct bt_mesh_app_key *bt_mesh_app_key_alloc(u16_t app_idx) struct bt_mesh_app_key *bt_mesh_app_key_alloc(uint16_t app_idx)
{ {
int i; int i;
@ -347,8 +347,8 @@ struct bt_mesh_app_key *bt_mesh_app_key_alloc(u16_t app_idx)
return NULL; return NULL;
} }
static u8_t app_key_set(u16_t net_idx, u16_t app_idx, const u8_t val[16], static uint8_t app_key_set(uint16_t net_idx, uint16_t app_idx, const uint8_t val[16],
bool update) bool update)
{ {
struct bt_mesh_app_keys *keys = NULL; struct bt_mesh_app_keys *keys = NULL;
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -441,8 +441,8 @@ static void app_key_add(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4);
u16_t key_net_idx = 0U, key_app_idx = 0U; uint16_t key_net_idx = 0U, key_app_idx = 0U;
u8_t status = 0U; uint8_t status = 0U;
key_idx_unpack(buf, &key_net_idx, &key_app_idx); key_idx_unpack(buf, &key_net_idx, &key_app_idx);
@ -467,7 +467,7 @@ static void app_key_add(struct bt_mesh_model *model,
change.cfg_appkey_add.app_idx = key_app_idx; change.cfg_appkey_add.app_idx = key_app_idx;
memcpy(change.cfg_appkey_add.app_key, buf->data, 16); memcpy(change.cfg_appkey_add.app_key, buf->data, 16);
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -476,8 +476,8 @@ static void app_key_update(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4);
u16_t key_net_idx = 0U, key_app_idx = 0U; uint16_t key_net_idx = 0U, key_app_idx = 0U;
u8_t status = 0U; uint8_t status = 0U;
key_idx_unpack(buf, &key_net_idx, &key_app_idx); key_idx_unpack(buf, &key_net_idx, &key_app_idx);
@ -501,12 +501,12 @@ static void app_key_update(struct bt_mesh_model *model,
change.cfg_appkey_update.app_idx = key_app_idx; change.cfg_appkey_update.app_idx = key_app_idx;
memcpy(change.cfg_appkey_update.app_key, buf->data, 16); memcpy(change.cfg_appkey_update.app_key, buf->data, 16);
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
struct unbind_data { struct unbind_data {
u16_t app_idx; uint16_t app_idx;
bool store; bool store;
}; };
@ -539,9 +539,9 @@ static void app_key_del(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_STATUS, 4);
u16_t key_net_idx = 0U, key_app_idx = 0U; uint16_t key_net_idx = 0U, key_app_idx = 0U;
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
u8_t status = 0U; uint8_t status = 0U;
key_idx_unpack(buf, &key_net_idx, &key_app_idx); key_idx_unpack(buf, &key_net_idx, &key_app_idx);
@ -585,7 +585,7 @@ send_status:
change.cfg_appkey_delete.net_idx = key_net_idx; change.cfg_appkey_delete.net_idx = key_net_idx;
change.cfg_appkey_delete.app_idx = key_app_idx; change.cfg_appkey_delete.app_idx = key_app_idx;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -598,8 +598,8 @@ static void app_key_get(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_LIST, BLE_MESH_MODEL_BUF_DEFINE(msg, OP_APP_KEY_LIST,
3 + IDX_LEN(CONFIG_BLE_MESH_APP_KEY_COUNT)); 3 + IDX_LEN(CONFIG_BLE_MESH_APP_KEY_COUNT));
u16_t get_idx = 0U, i = 0U, prev = 0U; uint16_t get_idx = 0U, i = 0U, prev = 0U;
u8_t status = 0U; uint8_t status = 0U;
get_idx = net_buf_simple_pull_le16(buf); get_idx = net_buf_simple_pull_le16(buf);
if (get_idx > 0xfff) { if (get_idx > 0xfff) {
@ -953,9 +953,9 @@ static void relay_set(struct bt_mesh_model *model,
static void send_mod_pub_status(struct bt_mesh_model *cfg_mod, static void send_mod_pub_status(struct bt_mesh_model *cfg_mod,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t elem_addr, u16_t pub_addr, uint16_t elem_addr, uint16_t pub_addr,
bool vnd, struct bt_mesh_model *mod, bool vnd, struct bt_mesh_model *mod,
u8_t status, u8_t *mod_id) uint8_t status, uint8_t *mod_id)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_STATUS, 14); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_PUB_STATUS, 14);
@ -967,11 +967,11 @@ static void send_mod_pub_status(struct bt_mesh_model *cfg_mod,
if (status != STATUS_SUCCESS) { if (status != STATUS_SUCCESS) {
(void)memset(net_buf_simple_add(&msg, 7), 0, 7); (void)memset(net_buf_simple_add(&msg, 7), 0, 7);
} else { } else {
u16_t idx_cred; uint16_t idx_cred;
net_buf_simple_add_le16(&msg, pub_addr); net_buf_simple_add_le16(&msg, pub_addr);
idx_cred = mod->pub->key | (u16_t)mod->pub->cred << 12; idx_cred = mod->pub->key | (uint16_t)mod->pub->cred << 12;
net_buf_simple_add_le16(&msg, idx_cred); net_buf_simple_add_le16(&msg, idx_cred);
net_buf_simple_add_u8(&msg, mod->pub->ttl); net_buf_simple_add_u8(&msg, mod->pub->ttl);
net_buf_simple_add_u8(&msg, mod->pub->period); net_buf_simple_add_u8(&msg, mod->pub->period);
@ -993,10 +993,10 @@ static void mod_pub_get(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, pub_addr = 0U; uint16_t elem_addr = 0U, pub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL, status = 0U; uint8_t *mod_id = NULL, status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1040,11 +1040,11 @@ static void mod_pub_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t retransmit = 0U, status = 0U, pub_ttl = 0U, pub_period = 0U, cred_flag = 0U; uint8_t retransmit = 0U, status = 0U, pub_ttl = 0U, pub_period = 0U, cred_flag = 0U;
u16_t elem_addr = 0U, pub_addr = 0U, pub_app_idx = 0U; uint16_t elem_addr = 0U, pub_addr = 0U, pub_app_idx = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1109,11 +1109,11 @@ send_status:
change.cfg_mod_pub_set.cid = vnd ? mod->vnd.company : 0xFFFF; change.cfg_mod_pub_set.cid = vnd ? mod->vnd.company : 0xFFFF;
change.cfg_mod_pub_set.mod_id = vnd ? mod->vnd.id : mod->id; change.cfg_mod_pub_set.mod_id = vnd ? mod->vnd.id : mod->id;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
struct label *get_label(u16_t index) struct label *get_label(uint16_t index)
{ {
if (index >= ARRAY_SIZE(labels)) { if (index >= ARRAY_SIZE(labels)) {
return NULL; return NULL;
@ -1131,7 +1131,7 @@ static inline void va_store(struct label *store)
} }
} }
static struct label *va_find(const u8_t *label_uuid, static struct label *va_find(const uint8_t *label_uuid,
struct label **free_slot) struct label **free_slot)
{ {
struct label *match = NULL; struct label *match = NULL;
@ -1157,7 +1157,7 @@ static struct label *va_find(const u8_t *label_uuid,
return match; return match;
} }
static u8_t va_add(u8_t *label_uuid, u16_t *addr) static uint8_t va_add(uint8_t *label_uuid, uint16_t *addr)
{ {
struct label *update = NULL, *free_slot = NULL; struct label *update = NULL, *free_slot = NULL;
@ -1184,7 +1184,7 @@ static u8_t va_add(u8_t *label_uuid, u16_t *addr)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static u8_t va_del(u8_t *label_uuid, u16_t *addr) static uint8_t va_del(uint8_t *label_uuid, uint16_t *addr)
{ {
struct label *update = NULL; struct label *update = NULL;
@ -1209,7 +1209,7 @@ static u8_t va_del(u8_t *label_uuid, u16_t *addr)
static size_t mod_sub_list_clear(struct bt_mesh_model *mod) static size_t mod_sub_list_clear(struct bt_mesh_model *mod)
{ {
u8_t *label_uuid = NULL; uint8_t *label_uuid = NULL;
size_t clear_count = 0U; size_t clear_count = 0U;
int i; int i;
@ -1243,12 +1243,12 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t retransmit = 0U, status = 0U, pub_ttl = 0U, pub_period = 0U, cred_flag = 0U; uint8_t retransmit = 0U, status = 0U, pub_ttl = 0U, pub_period = 0U, cred_flag = 0U;
u16_t elem_addr = 0U, pub_addr = 0U, pub_app_idx = 0U; uint16_t elem_addr = 0U, pub_addr = 0U, pub_app_idx = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *label_uuid = NULL; uint8_t *label_uuid = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1325,10 +1325,10 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t *mod_id = NULL, status = 0U; uint8_t *mod_id = NULL, status = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t elem_addr = 0U, pub_addr = 0U; uint16_t elem_addr = 0U, pub_addr = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1371,8 +1371,8 @@ send_status:
#endif /* CONFIG_BLE_MESH_LABEL_COUNT > 0 */ #endif /* CONFIG_BLE_MESH_LABEL_COUNT > 0 */
static void send_mod_sub_status(struct bt_mesh_model *model, static void send_mod_sub_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, u8_t status, struct bt_mesh_msg_ctx *ctx, uint8_t status,
u16_t elem_addr, u16_t sub_addr, u8_t *mod_id, uint16_t elem_addr, uint16_t sub_addr, uint8_t *mod_id,
bool vnd) bool vnd)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_SUB_STATUS, 9); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_SUB_STATUS, 9);
@ -1401,11 +1401,11 @@ static void mod_sub_add(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = 0U; uint16_t elem_addr = 0U, sub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
int i; int i;
@ -1479,7 +1479,7 @@ send_status:
change.cfg_mod_sub_add.cid = vnd ? mod->vnd.company : 0xFFFF; change.cfg_mod_sub_add.cid = vnd ? mod->vnd.company : 0xFFFF;
change.cfg_mod_sub_add.mod_id = vnd ? mod->vnd.id : mod->id; change.cfg_mod_sub_add.mod_id = vnd ? mod->vnd.id : mod->id;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -1487,12 +1487,12 @@ static void mod_sub_del(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = 0U; uint16_t elem_addr = 0U, sub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u16_t *match = NULL; uint16_t *match = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1555,7 +1555,7 @@ send_status:
change.cfg_mod_sub_delete.cid = vnd ? mod->vnd.company : 0xFFFF; change.cfg_mod_sub_delete.cid = vnd ? mod->vnd.company : 0xFFFF;
change.cfg_mod_sub_delete.mod_id = vnd ? mod->vnd.id : mod->id; change.cfg_mod_sub_delete.mod_id = vnd ? mod->vnd.id : mod->id;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -1563,11 +1563,11 @@ static void mod_sub_overwrite(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = 0U; uint16_t elem_addr = 0U, sub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1634,9 +1634,9 @@ static void mod_sub_del_all(struct bt_mesh_model *model,
{ {
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t elem_addr = 0U; uint16_t elem_addr = 0U;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1688,7 +1688,7 @@ static void mod_sub_get(struct bt_mesh_model *model,
5 + CONFIG_BLE_MESH_MODEL_GROUP_COUNT * 2); 5 + CONFIG_BLE_MESH_MODEL_GROUP_COUNT * 2);
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t addr = 0U, id = 0U; uint16_t addr = 0U, id = 0U;
int i; int i;
addr = net_buf_simple_pull_le16(buf); addr = net_buf_simple_pull_le16(buf);
@ -1744,7 +1744,7 @@ static void mod_sub_get_vnd(struct bt_mesh_model *model,
7 + CONFIG_BLE_MESH_MODEL_GROUP_COUNT * 2); 7 + CONFIG_BLE_MESH_MODEL_GROUP_COUNT * 2);
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t company = 0U, addr = 0U, id = 0U; uint16_t company = 0U, addr = 0U, id = 0U;
int i; int i;
addr = net_buf_simple_pull_le16(buf); addr = net_buf_simple_pull_le16(buf);
@ -1801,12 +1801,12 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = 0U; uint16_t elem_addr = 0U, sub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *label_uuid = NULL; uint8_t *label_uuid = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
int i; int i;
@ -1878,13 +1878,13 @@ static void mod_sub_va_del(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = 0U; uint16_t elem_addr = 0U, sub_addr = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *label_uuid = NULL; uint8_t *label_uuid = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u16_t *match = NULL; uint16_t *match = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -1946,12 +1946,12 @@ static void mod_sub_va_overwrite(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u16_t elem_addr = 0U, sub_addr = BLE_MESH_ADDR_UNASSIGNED; uint16_t elem_addr = 0U, sub_addr = BLE_MESH_ADDR_UNASSIGNED;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *label_uuid = NULL; uint8_t *label_uuid = NULL;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2014,9 +2014,9 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
{ {
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t elem_addr = 0U; uint16_t elem_addr = 0U;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2055,9 +2055,9 @@ static void mod_sub_va_del(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t elem_addr = 0U; uint16_t elem_addr = 0U;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2094,9 +2094,9 @@ static void mod_sub_va_overwrite(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u16_t elem_addr = 0U; uint16_t elem_addr = 0U;
u8_t *mod_id = NULL; uint8_t *mod_id = NULL;
u8_t status = 0U; uint8_t status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2131,7 +2131,7 @@ send_status:
static void send_net_key_status(struct bt_mesh_model *model, static void send_net_key_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t idx, u8_t status) uint16_t idx, uint8_t status)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_STATUS, 3); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_STATUS, 3);
@ -2150,7 +2150,7 @@ static void net_key_add(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t idx = 0U; uint16_t idx = 0U;
int err = 0; int err = 0;
idx = net_buf_simple_pull_le16(buf); idx = net_buf_simple_pull_le16(buf);
@ -2181,7 +2181,7 @@ static void net_key_add(struct bt_mesh_model *model,
/* Check for already existing subnet */ /* Check for already existing subnet */
if (sub->net_idx == idx) { if (sub->net_idx == idx) {
u8_t status = 0U; uint8_t status = 0U;
if (memcmp(buf->data, sub->keys[0].net, 16)) { if (memcmp(buf->data, sub->keys[0].net, 16)) {
status = STATUS_IDX_ALREADY_STORED; status = STATUS_IDX_ALREADY_STORED;
@ -2223,7 +2223,7 @@ static void net_key_add(struct bt_mesh_model *model,
change.cfg_netkey_add.net_idx = sub->net_idx; change.cfg_netkey_add.net_idx = sub->net_idx;
memcpy(change.cfg_netkey_add.net_key, sub->keys[0].net, 16); memcpy(change.cfg_netkey_add.net_key, sub->keys[0].net, 16);
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
static void net_key_update(struct bt_mesh_model *model, static void net_key_update(struct bt_mesh_model *model,
@ -2231,7 +2231,7 @@ static void net_key_update(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t idx = 0U; uint16_t idx = 0U;
int err = 0; int err = 0;
idx = net_buf_simple_pull_le16(buf); idx = net_buf_simple_pull_le16(buf);
@ -2298,7 +2298,7 @@ static void net_key_update(struct bt_mesh_model *model,
change.cfg_netkey_update.net_idx = sub->net_idx; change.cfg_netkey_update.net_idx = sub->net_idx;
memcpy(change.cfg_netkey_update.net_key, sub->keys[1].net, 16); memcpy(change.cfg_netkey_update.net_key, sub->keys[1].net, 16);
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
static void hb_pub_disable(struct bt_mesh_cfg_srv *cfg) static void hb_pub_disable(struct bt_mesh_cfg_srv *cfg)
@ -2318,8 +2318,8 @@ static void net_key_del(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t del_idx = 0U; uint16_t del_idx = 0U;
u8_t status = 0U; uint8_t status = 0U;
del_idx = net_buf_simple_pull_le16(buf); del_idx = net_buf_simple_pull_le16(buf);
if (del_idx > 0xfff) { if (del_idx > 0xfff) {
@ -2356,7 +2356,7 @@ send_status:
bt_mesh_cfg_server_state_change_t change = {0}; bt_mesh_cfg_server_state_change_t change = {0};
change.cfg_netkey_delete.net_idx = sub->net_idx; change.cfg_netkey_delete.net_idx = sub->net_idx;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -2366,7 +2366,7 @@ static void net_key_get(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_LIST, BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NET_KEY_LIST,
IDX_LEN(CONFIG_BLE_MESH_SUBNET_COUNT)); IDX_LEN(CONFIG_BLE_MESH_SUBNET_COUNT));
u16_t prev = 0U, i = 0U; uint16_t prev = 0U, i = 0U;
bt_mesh_model_msg_init(&msg, OP_NET_KEY_LIST); bt_mesh_model_msg_init(&msg, OP_NET_KEY_LIST);
@ -2402,8 +2402,8 @@ static void node_identity_get(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_STATUS, 4);
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t node_id = 0U; uint8_t node_id = 0U;
u16_t idx = 0U; uint16_t idx = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -2440,8 +2440,8 @@ static void node_identity_set(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_NODE_IDENTITY_STATUS, 4);
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t node_id = 0U; uint8_t node_id = 0U;
u16_t idx = 0U; uint16_t idx = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -2488,8 +2488,8 @@ static void node_identity_set(struct bt_mesh_model *model,
static void create_mod_app_status(struct net_buf_simple *msg, static void create_mod_app_status(struct net_buf_simple *msg,
struct bt_mesh_model *mod, bool vnd, struct bt_mesh_model *mod, bool vnd,
u16_t elem_addr, u16_t app_idx, uint16_t elem_addr, uint16_t app_idx,
u8_t status, u8_t *mod_id) uint8_t status, uint8_t *mod_id)
{ {
bt_mesh_model_msg_init(msg, OP_MOD_APP_STATUS); bt_mesh_model_msg_init(msg, OP_MOD_APP_STATUS);
@ -2509,10 +2509,10 @@ static void mod_app_bind(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
u16_t elem_addr = 0U, key_app_idx = 0U; uint16_t elem_addr = 0U, key_app_idx = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL, status = 0U; uint8_t *mod_id = NULL, status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2563,7 +2563,7 @@ send_status:
change.cfg_mod_app_bind.cid = vnd ? mod->vnd.company : 0xFFFF; change.cfg_mod_app_bind.cid = vnd ? mod->vnd.company : 0xFFFF;
change.cfg_mod_app_bind.mod_id = vnd ? mod->vnd.id : mod->id; change.cfg_mod_app_bind.mod_id = vnd ? mod->vnd.id : mod->id;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -2572,10 +2572,10 @@ static void mod_app_unbind(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_MOD_APP_STATUS, 9);
u16_t elem_addr = 0U, key_app_idx = 0U; uint16_t elem_addr = 0U, key_app_idx = 0U;
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL, status = 0U; uint8_t *mod_id = NULL, status = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2619,7 +2619,7 @@ send_status:
change.cfg_mod_app_unbind.cid = vnd ? mod->vnd.company : 0xFFFF; change.cfg_mod_app_unbind.cid = vnd ? mod->vnd.company : 0xFFFF;
change.cfg_mod_app_unbind.mod_id = vnd ? mod->vnd.id : mod->id; change.cfg_mod_app_unbind.mod_id = vnd ? mod->vnd.id : mod->id;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
} }
@ -2636,8 +2636,8 @@ static void mod_app_get(struct bt_mesh_model *model,
9 + KEY_LIST_LEN))); 9 + KEY_LIST_LEN)));
struct bt_mesh_model *mod = NULL; struct bt_mesh_model *mod = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
u8_t *mod_id = NULL, status = 0U; uint8_t *mod_id = NULL, status = 0U;
u16_t elem_addr = 0U; uint16_t elem_addr = 0U;
bool vnd = false; bool vnd = false;
elem_addr = net_buf_simple_pull_le16(buf); elem_addr = net_buf_simple_pull_le16(buf);
@ -2799,8 +2799,8 @@ static void lpn_timeout_get(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_LPN_TIMEOUT_STATUS, 5); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_LPN_TIMEOUT_STATUS, 5);
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u16_t lpn_addr = 0U; uint16_t lpn_addr = 0U;
s32_t timeout = 0; int32_t timeout = 0;
lpn_addr = net_buf_simple_pull_le16(buf); lpn_addr = net_buf_simple_pull_le16(buf);
@ -2838,7 +2838,7 @@ send_rsp:
static void send_krp_status(struct bt_mesh_model *model, static void send_krp_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t idx, u8_t phase, u8_t status) uint16_t idx, uint8_t phase, uint8_t status)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_STATUS, 4); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_KRP_STATUS, 4);
@ -2857,7 +2857,7 @@ static void krp_get(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t idx = 0U; uint16_t idx = 0U;
idx = net_buf_simple_pull_le16(buf); idx = net_buf_simple_pull_le16(buf);
if (idx > 0xfff) { if (idx > 0xfff) {
@ -2880,8 +2880,8 @@ static void krp_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t phase = 0U; uint8_t phase = 0U;
u16_t idx = 0U; uint16_t idx = 0U;
idx = net_buf_simple_pull_le16(buf); idx = net_buf_simple_pull_le16(buf);
phase = net_buf_simple_pull_u8(buf); phase = net_buf_simple_pull_u8(buf);
@ -2940,10 +2940,10 @@ static void krp_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
change.cfg_kr_phase_set.net_idx = idx; change.cfg_kr_phase_set.net_idx = idx;
change.cfg_kr_phase_set.kr_phase = phase; change.cfg_kr_phase_set.kr_phase = phase;
bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE, bt_mesh_config_server_cb_evt_to_btc(BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
model, ctx, (const u8_t *)&change, sizeof(change)); model, ctx, (const uint8_t *)&change, sizeof(change));
} }
static u8_t hb_log(u16_t val) static uint8_t hb_log(uint16_t val)
{ {
if (!val) { if (!val) {
return 0x00; return 0x00;
@ -2954,7 +2954,7 @@ static u8_t hb_log(u16_t val)
} }
} }
static u8_t hb_pub_count_log(u16_t val) static uint8_t hb_pub_count_log(uint16_t val)
{ {
if (!val) { if (!val) {
return 0x00; return 0x00;
@ -2967,7 +2967,7 @@ static u8_t hb_pub_count_log(u16_t val)
} }
} }
static u16_t hb_pwr2(u8_t val, u8_t sub) static uint16_t hb_pwr2(uint8_t val, uint8_t sub)
{ {
if (!val) { if (!val) {
return 0x0000; return 0x0000;
@ -2979,16 +2979,16 @@ static u16_t hb_pwr2(u8_t val, u8_t sub)
} }
struct hb_pub_param { struct hb_pub_param {
u16_t dst; uint16_t dst;
u8_t count_log; uint8_t count_log;
u8_t period_log; uint8_t period_log;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx; uint16_t net_idx;
} __packed; } __packed;
static void hb_pub_send_status(struct bt_mesh_model *model, static void hb_pub_send_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, u8_t status, struct bt_mesh_msg_ctx *ctx, uint8_t status,
struct hb_pub_param *orig_msg) struct hb_pub_param *orig_msg)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_STATUS, 10); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_PUB_STATUS, 10);
@ -3034,8 +3034,8 @@ static void heartbeat_pub_set(struct bt_mesh_model *model,
{ {
struct hb_pub_param *param = (void *)buf->data; struct hb_pub_param *param = (void *)buf->data;
struct bt_mesh_cfg_srv *cfg = model->user_data; struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t dst = 0U, feat = 0U, idx = 0U; uint16_t dst = 0U, feat = 0U, idx = 0U;
u8_t status = 0U; uint8_t status = 0U;
BT_DBG("src 0x%04x", ctx->addr); BT_DBG("src 0x%04x", ctx->addr);
@ -3127,12 +3127,12 @@ failed:
} }
static void hb_sub_send_status(struct bt_mesh_model *model, static void hb_sub_send_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, u8_t status) struct bt_mesh_msg_ctx *ctx, uint8_t status)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_STATUS, 9); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEARTBEAT_SUB_STATUS, 9);
struct bt_mesh_cfg_srv *cfg = model->user_data; struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t period = 0U; uint16_t period = 0U;
s64_t uptime = 0; int64_t uptime = 0;
BT_DBG("src 0x%04x status 0x%02x", ctx->addr, status); BT_DBG("src 0x%04x status 0x%02x", ctx->addr, status);
@ -3172,9 +3172,9 @@ static void heartbeat_sub_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_cfg_srv *cfg = model->user_data; struct bt_mesh_cfg_srv *cfg = model->user_data;
u16_t sub_src = 0U, sub_dst = 0U; uint16_t sub_src = 0U, sub_dst = 0U;
u8_t sub_period = 0U; uint8_t sub_period = 0U;
s32_t period_ms = 0; int32_t period_ms = 0;
BT_DBG("src 0x%04x", ctx->addr); BT_DBG("src 0x%04x", ctx->addr);
@ -3307,7 +3307,7 @@ static void hb_publish(struct k_work *work)
struct bt_mesh_cfg_srv, struct bt_mesh_cfg_srv,
hb_pub.timer.work); hb_pub.timer.work);
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u16_t period_ms = 0U; uint16_t period_ms = 0U;
BT_DBG("hb_pub.count: %u", cfg->hb_pub.count); BT_DBG("hb_pub.count: %u", cfg->hb_pub.count);
@ -3490,7 +3490,7 @@ void bt_mesh_cfg_reset(bool store)
(void)memset(labels, 0, sizeof(labels)); (void)memset(labels, 0, sizeof(labels));
} }
void bt_mesh_heartbeat(u16_t src, u16_t dst, u8_t hops, u16_t feat) void bt_mesh_heartbeat(uint16_t src, uint16_t dst, uint8_t hops, uint16_t feat)
{ {
struct bt_mesh_cfg_srv *cfg = conf; struct bt_mesh_cfg_srv *cfg = conf;
@ -3525,7 +3525,7 @@ void bt_mesh_heartbeat(u16_t src, u16_t dst, u8_t hops, u16_t feat)
} }
} }
u8_t bt_mesh_net_transmit_get(void) uint8_t bt_mesh_net_transmit_get(void)
{ {
if (conf) { if (conf) {
return conf->net_transmit; return conf->net_transmit;
@ -3534,7 +3534,7 @@ u8_t bt_mesh_net_transmit_get(void)
return 0; return 0;
} }
u8_t bt_mesh_relay_get(void) uint8_t bt_mesh_relay_get(void)
{ {
if (conf) { if (conf) {
return conf->relay; return conf->relay;
@ -3543,7 +3543,7 @@ u8_t bt_mesh_relay_get(void)
return BLE_MESH_RELAY_NOT_SUPPORTED; return BLE_MESH_RELAY_NOT_SUPPORTED;
} }
u8_t bt_mesh_friend_get(void) uint8_t bt_mesh_friend_get(void)
{ {
if (conf) { if (conf) {
BT_DBG("conf %p conf->frnd 0x%02x", conf, conf->frnd); BT_DBG("conf %p conf->frnd 0x%02x", conf, conf->frnd);
@ -3553,7 +3553,7 @@ u8_t bt_mesh_friend_get(void)
return BLE_MESH_FRIEND_NOT_SUPPORTED; return BLE_MESH_FRIEND_NOT_SUPPORTED;
} }
u8_t bt_mesh_relay_retransmit_get(void) uint8_t bt_mesh_relay_retransmit_get(void)
{ {
if (conf) { if (conf) {
return conf->relay_retransmit; return conf->relay_retransmit;
@ -3562,7 +3562,7 @@ u8_t bt_mesh_relay_retransmit_get(void)
return 0; return 0;
} }
u8_t bt_mesh_beacon_get(void) uint8_t bt_mesh_beacon_get(void)
{ {
if (conf) { if (conf) {
return conf->beacon; return conf->beacon;
@ -3571,7 +3571,7 @@ u8_t bt_mesh_beacon_get(void)
return BLE_MESH_BEACON_DISABLED; return BLE_MESH_BEACON_DISABLED;
} }
u8_t bt_mesh_gatt_proxy_get(void) uint8_t bt_mesh_gatt_proxy_get(void)
{ {
if (conf) { if (conf) {
return conf->gatt_proxy; return conf->gatt_proxy;
@ -3580,7 +3580,7 @@ u8_t bt_mesh_gatt_proxy_get(void)
return BLE_MESH_GATT_PROXY_NOT_SUPPORTED; return BLE_MESH_GATT_PROXY_NOT_SUPPORTED;
} }
u8_t bt_mesh_default_ttl_get(void) uint8_t bt_mesh_default_ttl_get(void)
{ {
if (conf) { if (conf) {
return conf->default_ttl; return conf->default_ttl;
@ -3589,7 +3589,7 @@ u8_t bt_mesh_default_ttl_get(void)
return DEFAULT_TTL; return DEFAULT_TTL;
} }
u8_t *bt_mesh_label_uuid_get(u16_t addr) uint8_t *bt_mesh_label_uuid_get(uint16_t addr)
{ {
int i; int i;

View File

@ -24,8 +24,8 @@
#define NET_MIC_LEN(pdu) (((pdu)[1] & 0x80) ? 8 : 4) #define NET_MIC_LEN(pdu) (((pdu)[1] & 0x80) ? 8 : 4)
#define APP_MIC_LEN(aszmic) ((aszmic) ? 8 : 4) #define APP_MIC_LEN(aszmic) ((aszmic) ? 8 : 4)
int bt_mesh_aes_cmac(const u8_t key[16], struct bt_mesh_sg *sg, int bt_mesh_aes_cmac(const uint8_t key[16], struct bt_mesh_sg *sg,
size_t sg_len, u8_t mac[16]) size_t sg_len, uint8_t mac[16])
{ {
struct tc_aes_key_sched_struct sched = {0}; struct tc_aes_key_sched_struct sched = {0};
struct tc_cmac_struct state = {0}; struct tc_cmac_struct state = {0};
@ -48,8 +48,8 @@ int bt_mesh_aes_cmac(const u8_t key[16], struct bt_mesh_sg *sg,
return 0; return 0;
} }
int bt_mesh_k1(const u8_t *ikm, size_t ikm_len, const u8_t salt[16], int bt_mesh_k1(const uint8_t *ikm, size_t ikm_len, const uint8_t salt[16],
const char *info, u8_t okm[16]) const char *info, uint8_t okm[16])
{ {
int err = 0; int err = 0;
@ -61,14 +61,14 @@ int bt_mesh_k1(const u8_t *ikm, size_t ikm_len, const u8_t salt[16],
return bt_mesh_aes_cmac_one(okm, info, strlen(info), okm); return bt_mesh_aes_cmac_one(okm, info, strlen(info), okm);
} }
int bt_mesh_k2(const u8_t n[16], const u8_t *p, size_t p_len, int bt_mesh_k2(const uint8_t n[16], const uint8_t *p, size_t p_len,
u8_t net_id[1], u8_t enc_key[16], u8_t priv_key[16]) uint8_t net_id[1], uint8_t enc_key[16], uint8_t priv_key[16])
{ {
struct bt_mesh_sg sg[3] = {0}; struct bt_mesh_sg sg[3] = {0};
u8_t salt[16] = {0}; uint8_t salt[16] = {0};
u8_t out[16] = {0}; uint8_t out[16] = {0};
u8_t t[16] = {0}; uint8_t t[16] = {0};
u8_t pad = 0U; uint8_t pad = 0U;
int err = 0; int err = 0;
BT_DBG("n %s", bt_hex(n, 16)); BT_DBG("n %s", bt_hex(n, 16));
@ -126,11 +126,11 @@ int bt_mesh_k2(const u8_t n[16], const u8_t *p, size_t p_len,
return 0; return 0;
} }
int bt_mesh_k3(const u8_t n[16], u8_t out[8]) int bt_mesh_k3(const uint8_t n[16], uint8_t out[8])
{ {
u8_t id64[] = { 'i', 'd', '6', '4', 0x01 }; uint8_t id64[] = { 'i', 'd', '6', '4', 0x01 };
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
u8_t t[16] = {0}; uint8_t t[16] = {0};
int err = 0; int err = 0;
err = bt_mesh_s1("smk3", tmp); err = bt_mesh_s1("smk3", tmp);
@ -153,11 +153,11 @@ int bt_mesh_k3(const u8_t n[16], u8_t out[8])
return 0; return 0;
} }
int bt_mesh_k4(const u8_t n[16], u8_t out[1]) int bt_mesh_k4(const uint8_t n[16], uint8_t out[1])
{ {
u8_t id6[] = { 'i', 'd', '6', 0x01 }; uint8_t id6[] = { 'i', 'd', '6', 0x01 };
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
u8_t t[16] = {0}; uint8_t t[16] = {0};
int err = 0; int err = 0;
err = bt_mesh_s1("smk4", tmp); err = bt_mesh_s1("smk4", tmp);
@ -180,10 +180,10 @@ int bt_mesh_k4(const u8_t n[16], u8_t out[1])
return 0; return 0;
} }
int bt_mesh_id128(const u8_t n[16], const char *s, u8_t out[16]) int bt_mesh_id128(const uint8_t n[16], const char *s, uint8_t out[16])
{ {
const char *id128 = "id128\x01"; const char *id128 = "id128\x01";
u8_t salt[16] = {0}; uint8_t salt[16] = {0};
int err = 0; int err = 0;
err = bt_mesh_s1(s, salt); err = bt_mesh_s1(s, salt);
@ -194,14 +194,14 @@ int bt_mesh_id128(const u8_t n[16], const char *s, u8_t out[16])
return bt_mesh_k1(n, 16, salt, id128, out); return bt_mesh_k1(n, 16, salt, id128, out);
} }
static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13], static int bt_mesh_ccm_decrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t *enc_msg, size_t msg_len, const uint8_t *enc_msg, size_t msg_len,
const u8_t *aad, size_t aad_len, const uint8_t *aad, size_t aad_len,
u8_t *out_msg, size_t mic_size) uint8_t *out_msg, size_t mic_size)
{ {
u8_t msg[16] = {0}, pmsg[16] = {0}, cmic[16] = {0}, uint8_t msg[16] = {0}, pmsg[16] = {0}, cmic[16] = {0},
cmsg[16] = {0}, Xn[16] = {0}, mic[16] = {0}; cmsg[16] = {0}, Xn[16] = {0}, mic[16] = {0};
u16_t last_blk = 0U, blk_cnt = 0U; uint16_t last_blk = 0U, blk_cnt = 0U;
size_t i = 0U, j = 0U; size_t i = 0U, j = 0U;
int err = 0; int err = 0;
@ -220,7 +220,7 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
} }
/* X_0 = e(AppKey, 0x09 || nonce || length) */ /* X_0 = e(AppKey, 0x09 || nonce || length) */
if (mic_size == sizeof(u64_t)) { if (mic_size == sizeof(uint64_t)) {
pmsg[0] = 0x19 | (aad_len ? 0x40 : 0x00); pmsg[0] = 0x19 | (aad_len ? 0x40 : 0x00);
} else { } else {
pmsg[0] = 0x09 | (aad_len ? 0x40 : 0x00); pmsg[0] = 0x09 | (aad_len ? 0x40 : 0x00);
@ -238,12 +238,12 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
if (aad_len) { if (aad_len) {
sys_put_be16(aad_len, pmsg); sys_put_be16(aad_len, pmsg);
for (i = 0; i < sizeof(u16_t); i++) { for (i = 0; i < sizeof(uint16_t); i++) {
pmsg[i] = Xn[i] ^ pmsg[i]; pmsg[i] = Xn[i] ^ pmsg[i];
} }
j = 0; j = 0;
aad_len += sizeof(u16_t); aad_len += sizeof(uint16_t);
while (aad_len > 16) { while (aad_len > 16) {
do { do {
pmsg[i] = Xn[i] ^ aad[j]; pmsg[i] = Xn[i] ^ aad[j];
@ -353,14 +353,14 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
return 0; return 0;
} }
static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13], static int bt_mesh_ccm_encrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t *msg, size_t msg_len, const uint8_t *msg, size_t msg_len,
const u8_t *aad, size_t aad_len, const uint8_t *aad, size_t aad_len,
u8_t *out_msg, size_t mic_size) uint8_t *out_msg, size_t mic_size)
{ {
u8_t pmsg[16] = {0}, cmic[16] = {0}, cmsg[16] = {0}, uint8_t pmsg[16] = {0}, cmic[16] = {0}, cmsg[16] = {0},
mic[16] = {0}, Xn[16] = {0}; mic[16] = {0}, Xn[16] = {0};
u16_t blk_cnt = 0U, last_blk = 0U; uint16_t blk_cnt = 0U, last_blk = 0U;
size_t i = 0U, j = 0U; size_t i = 0U, j = 0U;
int err = 0; int err = 0;
@ -385,7 +385,7 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
} }
/* X_0 = e(AppKey, 0x09 || nonce || length) */ /* X_0 = e(AppKey, 0x09 || nonce || length) */
if (mic_size == sizeof(u64_t)) { if (mic_size == sizeof(uint64_t)) {
pmsg[0] = 0x19 | (aad_len ? 0x40 : 0x00); pmsg[0] = 0x19 | (aad_len ? 0x40 : 0x00);
} else { } else {
pmsg[0] = 0x09 | (aad_len ? 0x40 : 0x00); pmsg[0] = 0x09 | (aad_len ? 0x40 : 0x00);
@ -403,12 +403,12 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
if (aad_len) { if (aad_len) {
sys_put_be16(aad_len, pmsg); sys_put_be16(aad_len, pmsg);
for (i = 0; i < sizeof(u16_t); i++) { for (i = 0; i < sizeof(uint16_t); i++) {
pmsg[i] = Xn[i] ^ pmsg[i]; pmsg[i] = Xn[i] ^ pmsg[i];
} }
j = 0; j = 0;
aad_len += sizeof(u16_t); aad_len += sizeof(uint16_t);
while (aad_len > 16) { while (aad_len > 16) {
do { do {
pmsg[i] = Xn[i] ^ aad[j]; pmsg[i] = Xn[i] ^ aad[j];
@ -515,8 +515,8 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
} }
#if defined(CONFIG_BLE_MESH_PROXY) #if defined(CONFIG_BLE_MESH_PROXY)
static void create_proxy_nonce(u8_t nonce[13], const u8_t *pdu, static void create_proxy_nonce(uint8_t nonce[13], const uint8_t *pdu,
u32_t iv_index) uint32_t iv_index)
{ {
/* Nonce Type */ /* Nonce Type */
nonce[0] = 0x03; nonce[0] = 0x03;
@ -542,8 +542,8 @@ static void create_proxy_nonce(u8_t nonce[13], const u8_t *pdu,
} }
#endif /* PROXY */ #endif /* PROXY */
static void create_net_nonce(u8_t nonce[13], const u8_t *pdu, static void create_net_nonce(uint8_t nonce[13], const uint8_t *pdu,
u32_t iv_index) uint32_t iv_index)
{ {
/* Nonce Type */ /* Nonce Type */
nonce[0] = 0x00; nonce[0] = 0x00;
@ -568,11 +568,11 @@ static void create_net_nonce(u8_t nonce[13], const u8_t *pdu,
sys_put_be32(iv_index, &nonce[9]); sys_put_be32(iv_index, &nonce[9]);
} }
int bt_mesh_net_obfuscate(u8_t *pdu, u32_t iv_index, int bt_mesh_net_obfuscate(uint8_t *pdu, uint32_t iv_index,
const u8_t privacy_key[16]) const uint8_t privacy_key[16])
{ {
u8_t priv_rand[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, }; uint8_t priv_rand[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, };
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
int err = 0, i; int err = 0, i;
BT_DBG("IVIndex %u, PrivacyKey %s", iv_index, bt_hex(privacy_key, 16)); BT_DBG("IVIndex %u, PrivacyKey %s", iv_index, bt_hex(privacy_key, 16));
@ -594,11 +594,11 @@ int bt_mesh_net_obfuscate(u8_t *pdu, u32_t iv_index,
return 0; return 0;
} }
int bt_mesh_net_encrypt(const u8_t key[16], struct net_buf_simple *buf, int bt_mesh_net_encrypt(const uint8_t key[16], struct net_buf_simple *buf,
u32_t iv_index, bool proxy) uint32_t iv_index, bool proxy)
{ {
u8_t mic_len = NET_MIC_LEN(buf->data); uint8_t mic_len = NET_MIC_LEN(buf->data);
u8_t nonce[13] = {0}; uint8_t nonce[13] = {0};
int err = 0; int err = 0;
BT_DBG("IVIndex %u EncKey %s mic_len %u", iv_index, bt_hex(key, 16), BT_DBG("IVIndex %u EncKey %s mic_len %u", iv_index, bt_hex(key, 16),
@ -626,11 +626,11 @@ int bt_mesh_net_encrypt(const u8_t key[16], struct net_buf_simple *buf,
return err; return err;
} }
int bt_mesh_net_decrypt(const u8_t key[16], struct net_buf_simple *buf, int bt_mesh_net_decrypt(const uint8_t key[16], struct net_buf_simple *buf,
u32_t iv_index, bool proxy) uint32_t iv_index, bool proxy)
{ {
u8_t mic_len = NET_MIC_LEN(buf->data); uint8_t mic_len = NET_MIC_LEN(buf->data);
u8_t nonce[13] = {0}; uint8_t nonce[13] = {0};
BT_DBG("PDU (%u bytes) %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("PDU (%u bytes) %s", buf->len, bt_hex(buf->data, buf->len));
BT_DBG("iv_index %u, key %s mic_len %u", iv_index, bt_hex(key, 16), BT_DBG("iv_index %u, key %s mic_len %u", iv_index, bt_hex(key, 16),
@ -654,9 +654,9 @@ int bt_mesh_net_decrypt(const u8_t key[16], struct net_buf_simple *buf,
NULL, 0, &buf->data[7], mic_len); NULL, 0, &buf->data[7], mic_len);
} }
static void create_app_nonce(u8_t nonce[13], bool dev_key, u8_t aszmic, static void create_app_nonce(uint8_t nonce[13], bool dev_key, uint8_t aszmic,
u16_t src, u16_t dst, u32_t seq_num, uint16_t src, uint16_t dst, uint32_t seq_num,
u32_t iv_index) uint32_t iv_index)
{ {
if (dev_key) { if (dev_key) {
nonce[0] = 0x02; nonce[0] = 0x02;
@ -664,7 +664,7 @@ static void create_app_nonce(u8_t nonce[13], bool dev_key, u8_t aszmic,
nonce[0] = 0x01; nonce[0] = 0x01;
} }
sys_put_be32((seq_num | ((u32_t)aszmic << 31)), &nonce[1]); sys_put_be32((seq_num | ((uint32_t)aszmic << 31)), &nonce[1]);
sys_put_be16(src, &nonce[5]); sys_put_be16(src, &nonce[5]);
sys_put_be16(dst, &nonce[7]); sys_put_be16(dst, &nonce[7]);
@ -672,11 +672,11 @@ static void create_app_nonce(u8_t nonce[13], bool dev_key, u8_t aszmic,
sys_put_be32(iv_index, &nonce[9]); sys_put_be32(iv_index, &nonce[9]);
} }
int bt_mesh_app_encrypt(const u8_t key[16], bool dev_key, u8_t aszmic, int bt_mesh_app_encrypt(const uint8_t key[16], bool dev_key, uint8_t aszmic,
struct net_buf_simple *buf, const u8_t *ad, struct net_buf_simple *buf, const uint8_t *ad,
u16_t src, u16_t dst, u32_t seq_num, u32_t iv_index) uint16_t src, uint16_t dst, uint32_t seq_num, uint32_t iv_index)
{ {
u8_t nonce[13] = {0}; uint8_t nonce[13] = {0};
int err = 0; int err = 0;
BT_DBG("AppKey %s", bt_hex(key, 16)); BT_DBG("AppKey %s", bt_hex(key, 16));
@ -698,12 +698,12 @@ int bt_mesh_app_encrypt(const u8_t key[16], bool dev_key, u8_t aszmic,
return err; return err;
} }
int bt_mesh_app_decrypt(const u8_t key[16], bool dev_key, u8_t aszmic, int bt_mesh_app_decrypt(const uint8_t key[16], bool dev_key, uint8_t aszmic,
struct net_buf_simple *buf, struct net_buf_simple *out, struct net_buf_simple *buf, struct net_buf_simple *out,
const u8_t *ad, u16_t src, u16_t dst, u32_t seq_num, const uint8_t *ad, uint16_t src, uint16_t dst, uint32_t seq_num,
u32_t iv_index) uint32_t iv_index)
{ {
u8_t nonce[13] = {0}; uint8_t nonce[13] = {0};
int err = 0; int err = 0;
BT_DBG("EncData (len %u) %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("EncData (len %u) %s", buf->len, bt_hex(buf->data, buf->len));
@ -723,7 +723,7 @@ int bt_mesh_app_decrypt(const u8_t key[16], bool dev_key, u8_t aszmic,
} }
/* reversed, 8-bit, poly=0x07 */ /* reversed, 8-bit, poly=0x07 */
static const u8_t crc_table[256] = { static const uint8_t crc_table[256] = {
0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
@ -765,9 +765,9 @@ static const u8_t crc_table[256] = {
0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf
}; };
u8_t bt_mesh_fcs_calc(const u8_t *data, u8_t data_len) uint8_t bt_mesh_fcs_calc(const uint8_t *data, uint8_t data_len)
{ {
u8_t fcs = 0xff; uint8_t fcs = 0xff;
while (data_len--) { while (data_len--) {
fcs = crc_table[fcs ^ *data++]; fcs = crc_table[fcs ^ *data++];
@ -778,11 +778,11 @@ u8_t bt_mesh_fcs_calc(const u8_t *data, u8_t data_len)
return 0xff - fcs; return 0xff - fcs;
} }
bool bt_mesh_fcs_check(struct net_buf_simple *buf, u8_t received_fcs) bool bt_mesh_fcs_check(struct net_buf_simple *buf, uint8_t received_fcs)
{ {
const u8_t *data = buf->data; const uint8_t *data = buf->data;
u16_t data_len = buf->len; uint16_t data_len = buf->len;
u8_t fcs = 0xff; uint8_t fcs = 0xff;
while (data_len--) { while (data_len--) {
fcs = crc_table[fcs ^ *data++]; fcs = crc_table[fcs ^ *data++];
@ -791,10 +791,10 @@ bool bt_mesh_fcs_check(struct net_buf_simple *buf, u8_t received_fcs)
return crc_table[fcs ^ received_fcs] == 0xcf; return crc_table[fcs ^ received_fcs] == 0xcf;
} }
int bt_mesh_virtual_addr(const u8_t virtual_label[16], u16_t *addr) int bt_mesh_virtual_addr(const uint8_t virtual_label[16], uint16_t *addr)
{ {
u8_t salt[16] = {0}; uint8_t salt[16] = {0};
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
int err = 0; int err = 0;
err = bt_mesh_s1("vtad", salt); err = bt_mesh_s1("vtad", salt);
@ -812,21 +812,21 @@ int bt_mesh_virtual_addr(const u8_t virtual_label[16], u16_t *addr)
return 0; return 0;
} }
int bt_mesh_prov_conf_salt(const u8_t conf_inputs[145], u8_t salt[16]) int bt_mesh_prov_conf_salt(const uint8_t conf_inputs[145], uint8_t salt[16])
{ {
const u8_t conf_salt_key[16] = { 0 }; const uint8_t conf_salt_key[16] = { 0 };
return bt_mesh_aes_cmac_one(conf_salt_key, conf_inputs, 145, salt); return bt_mesh_aes_cmac_one(conf_salt_key, conf_inputs, 145, salt);
} }
int bt_mesh_prov_conf_key(const u8_t dhkey[32], const u8_t conf_salt[16], int bt_mesh_prov_conf_key(const uint8_t dhkey[32], const uint8_t conf_salt[16],
u8_t conf_key[16]) uint8_t conf_key[16])
{ {
return bt_mesh_k1(dhkey, 32, conf_salt, "prck", conf_key); return bt_mesh_k1(dhkey, 32, conf_salt, "prck", conf_key);
} }
int bt_mesh_prov_conf(const u8_t conf_key[16], const u8_t rand[16], int bt_mesh_prov_conf(const uint8_t conf_key[16], const uint8_t rand[16],
const u8_t auth[16], u8_t conf[16]) const uint8_t auth[16], uint8_t conf[16])
{ {
struct bt_mesh_sg sg[] = { { rand, 16 }, { auth, 16 } }; struct bt_mesh_sg sg[] = { { rand, 16 }, { auth, 16 } };
@ -837,25 +837,25 @@ int bt_mesh_prov_conf(const u8_t conf_key[16], const u8_t rand[16],
return bt_mesh_aes_cmac(conf_key, sg, ARRAY_SIZE(sg), conf); return bt_mesh_aes_cmac(conf_key, sg, ARRAY_SIZE(sg), conf);
} }
int bt_mesh_prov_decrypt(const u8_t key[16], u8_t nonce[13], int bt_mesh_prov_decrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t data[25 + 8], u8_t out[25]) const uint8_t data[25 + 8], uint8_t out[25])
{ {
return bt_mesh_ccm_decrypt(key, nonce, data, 25, NULL, 0, out, 8); return bt_mesh_ccm_decrypt(key, nonce, data, 25, NULL, 0, out, 8);
} }
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
int bt_mesh_prov_encrypt(const u8_t key[16], u8_t nonce[13], int bt_mesh_prov_encrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t data[25], u8_t out[33]) const uint8_t data[25], uint8_t out[33])
{ {
return bt_mesh_ccm_encrypt(key, nonce, data, 25, NULL, 0, out, 8); return bt_mesh_ccm_encrypt(key, nonce, data, 25, NULL, 0, out, 8);
} }
#endif #endif
int bt_mesh_beacon_auth(const u8_t beacon_key[16], u8_t flags, int bt_mesh_beacon_auth(const uint8_t beacon_key[16], uint8_t flags,
const u8_t net_id[8], u32_t iv_index, const uint8_t net_id[8], uint32_t iv_index,
u8_t auth[8]) uint8_t auth[8])
{ {
u8_t msg[13] = {0}, tmp[16] = {0}; uint8_t msg[13] = {0}, tmp[16] = {0};
int err = 0; int err = 0;
BT_DBG("BeaconKey %s", bt_hex(beacon_key, 16)); BT_DBG("BeaconKey %s", bt_hex(beacon_key, 16));

View File

@ -22,81 +22,81 @@ struct bt_mesh_sg {
size_t len; size_t len;
}; };
int bt_mesh_aes_cmac(const u8_t key[16], struct bt_mesh_sg *sg, int bt_mesh_aes_cmac(const uint8_t key[16], struct bt_mesh_sg *sg,
size_t sg_len, u8_t mac[16]); size_t sg_len, uint8_t mac[16]);
static inline int bt_mesh_aes_cmac_one(const u8_t key[16], const void *m, static inline int bt_mesh_aes_cmac_one(const uint8_t key[16], const void *m,
size_t len, u8_t mac[16]) size_t len, uint8_t mac[16])
{ {
struct bt_mesh_sg sg = { m, len }; struct bt_mesh_sg sg = { m, len };
return bt_mesh_aes_cmac(key, &sg, 1, mac); return bt_mesh_aes_cmac(key, &sg, 1, mac);
} }
static inline bool bt_mesh_s1(const char *m, u8_t salt[16]) static inline bool bt_mesh_s1(const char *m, uint8_t salt[16])
{ {
const u8_t zero[16] = { 0 }; const uint8_t zero[16] = { 0 };
return bt_mesh_aes_cmac_one(zero, m, strlen(m), salt); return bt_mesh_aes_cmac_one(zero, m, strlen(m), salt);
} }
int bt_mesh_k1(const u8_t *ikm, size_t ikm_len, const u8_t salt[16], int bt_mesh_k1(const uint8_t *ikm, size_t ikm_len, const uint8_t salt[16],
const char *info, u8_t okm[16]); const char *info, uint8_t okm[16]);
#define bt_mesh_k1_str(ikm, ikm_len, salt_str, info, okm) \ #define bt_mesh_k1_str(ikm, ikm_len, salt_str, info, okm) \
({ \ ({ \
const u8_t salt[16] = salt_str; \ const uint8_t salt[16] = salt_str; \
bt_mesh_k1(ikm, ikm_len, salt, info, okm); \ bt_mesh_k1(ikm, ikm_len, salt, info, okm); \
}) })
int bt_mesh_k2(const u8_t n[16], const u8_t *p, size_t p_len, int bt_mesh_k2(const uint8_t n[16], const uint8_t *p, size_t p_len,
u8_t net_id[1], u8_t enc_key[16], u8_t priv_key[16]); uint8_t net_id[1], uint8_t enc_key[16], uint8_t priv_key[16]);
int bt_mesh_k3(const u8_t n[16], u8_t out[8]); int bt_mesh_k3(const uint8_t n[16], uint8_t out[8]);
int bt_mesh_k4(const u8_t n[16], u8_t out[1]); int bt_mesh_k4(const uint8_t n[16], uint8_t out[1]);
int bt_mesh_id128(const u8_t n[16], const char *s, u8_t out[16]); int bt_mesh_id128(const uint8_t n[16], const char *s, uint8_t out[16]);
static inline int bt_mesh_id_resolving_key(const u8_t net_key[16], static inline int bt_mesh_id_resolving_key(const uint8_t net_key[16],
u8_t resolving_key[16]) uint8_t resolving_key[16])
{ {
return bt_mesh_k1_str(net_key, 16, "smbt", "smbi", resolving_key); return bt_mesh_k1_str(net_key, 16, "smbt", "smbi", resolving_key);
} }
static inline int bt_mesh_identity_key(const u8_t net_key[16], static inline int bt_mesh_identity_key(const uint8_t net_key[16],
u8_t identity_key[16]) uint8_t identity_key[16])
{ {
return bt_mesh_id128(net_key, "nkik", identity_key); return bt_mesh_id128(net_key, "nkik", identity_key);
} }
static inline int bt_mesh_beacon_key(const u8_t net_key[16], static inline int bt_mesh_beacon_key(const uint8_t net_key[16],
u8_t beacon_key[16]) uint8_t beacon_key[16])
{ {
return bt_mesh_id128(net_key, "nkbk", beacon_key); return bt_mesh_id128(net_key, "nkbk", beacon_key);
} }
int bt_mesh_beacon_auth(const u8_t beacon_key[16], u8_t flags, int bt_mesh_beacon_auth(const uint8_t beacon_key[16], uint8_t flags,
const u8_t net_id[16], u32_t iv_index, const uint8_t net_id[16], uint32_t iv_index,
u8_t auth[8]); uint8_t auth[8]);
static inline int bt_mesh_app_id(const u8_t app_key[16], u8_t app_id[1]) static inline int bt_mesh_app_id(const uint8_t app_key[16], uint8_t app_id[1])
{ {
return bt_mesh_k4(app_key, app_id); return bt_mesh_k4(app_key, app_id);
} }
static inline int bt_mesh_session_key(const u8_t dhkey[32], static inline int bt_mesh_session_key(const uint8_t dhkey[32],
const u8_t prov_salt[16], const uint8_t prov_salt[16],
u8_t session_key[16]) uint8_t session_key[16])
{ {
return bt_mesh_k1(dhkey, 32, prov_salt, "prsk", session_key); return bt_mesh_k1(dhkey, 32, prov_salt, "prsk", session_key);
} }
static inline int bt_mesh_prov_nonce(const u8_t dhkey[32], static inline int bt_mesh_prov_nonce(const uint8_t dhkey[32],
const u8_t prov_salt[16], const uint8_t prov_salt[16],
u8_t nonce[13]) uint8_t nonce[13])
{ {
u8_t tmp[16]; uint8_t tmp[16];
int err; int err;
err = bt_mesh_k1(dhkey, 32, prov_salt, "prsn", tmp); err = bt_mesh_k1(dhkey, 32, prov_salt, "prsn", tmp);
@ -107,19 +107,19 @@ static inline int bt_mesh_prov_nonce(const u8_t dhkey[32],
return err; return err;
} }
static inline int bt_mesh_dev_key(const u8_t dhkey[32], static inline int bt_mesh_dev_key(const uint8_t dhkey[32],
const u8_t prov_salt[16], const uint8_t prov_salt[16],
u8_t dev_key[16]) uint8_t dev_key[16])
{ {
return bt_mesh_k1(dhkey, 32, prov_salt, "prdk", dev_key); return bt_mesh_k1(dhkey, 32, prov_salt, "prdk", dev_key);
} }
static inline int bt_mesh_prov_salt(const u8_t conf_salt[16], static inline int bt_mesh_prov_salt(const uint8_t conf_salt[16],
const u8_t prov_rand[16], const uint8_t prov_rand[16],
const u8_t dev_rand[16], const uint8_t dev_rand[16],
u8_t prov_salt[16]) uint8_t prov_salt[16])
{ {
const u8_t prov_salt_key[16] = { 0 }; const uint8_t prov_salt_key[16] = { 0 };
struct bt_mesh_sg sg[] = { struct bt_mesh_sg sg[] = {
{ conf_salt, 16 }, { conf_salt, 16 },
{ prov_rand, 16 }, { prov_rand, 16 },
@ -129,43 +129,43 @@ static inline int bt_mesh_prov_salt(const u8_t conf_salt[16],
return bt_mesh_aes_cmac(prov_salt_key, sg, ARRAY_SIZE(sg), prov_salt); return bt_mesh_aes_cmac(prov_salt_key, sg, ARRAY_SIZE(sg), prov_salt);
} }
int bt_mesh_net_obfuscate(u8_t *pdu, u32_t iv_index, int bt_mesh_net_obfuscate(uint8_t *pdu, uint32_t iv_index,
const u8_t privacy_key[16]); const uint8_t privacy_key[16]);
int bt_mesh_net_encrypt(const u8_t key[16], struct net_buf_simple *buf, int bt_mesh_net_encrypt(const uint8_t key[16], struct net_buf_simple *buf,
u32_t iv_index, bool proxy); uint32_t iv_index, bool proxy);
int bt_mesh_net_decrypt(const u8_t key[16], struct net_buf_simple *buf, int bt_mesh_net_decrypt(const uint8_t key[16], struct net_buf_simple *buf,
u32_t iv_index, bool proxy); uint32_t iv_index, bool proxy);
int bt_mesh_app_encrypt(const u8_t key[16], bool dev_key, u8_t aszmic, int bt_mesh_app_encrypt(const uint8_t key[16], bool dev_key, uint8_t aszmic,
struct net_buf_simple *buf, const u8_t *ad, struct net_buf_simple *buf, const uint8_t *ad,
u16_t src, u16_t dst, u32_t seq_num, u32_t iv_index); uint16_t src, uint16_t dst, uint32_t seq_num, uint32_t iv_index);
int bt_mesh_app_decrypt(const u8_t key[16], bool dev_key, u8_t aszmic, int bt_mesh_app_decrypt(const uint8_t key[16], bool dev_key, uint8_t aszmic,
struct net_buf_simple *buf, struct net_buf_simple *out, struct net_buf_simple *buf, struct net_buf_simple *out,
const u8_t *ad, u16_t src, u16_t dst, u32_t seq_num, const uint8_t *ad, uint16_t src, uint16_t dst, uint32_t seq_num,
u32_t iv_index); uint32_t iv_index);
u8_t bt_mesh_fcs_calc(const u8_t *data, u8_t data_len); uint8_t bt_mesh_fcs_calc(const uint8_t *data, uint8_t data_len);
bool bt_mesh_fcs_check(struct net_buf_simple *buf, u8_t received_fcs); bool bt_mesh_fcs_check(struct net_buf_simple *buf, uint8_t received_fcs);
int bt_mesh_virtual_addr(const u8_t virtual_label[16], u16_t *addr); int bt_mesh_virtual_addr(const uint8_t virtual_label[16], uint16_t *addr);
int bt_mesh_prov_conf_salt(const u8_t conf_inputs[145], u8_t salt[16]); int bt_mesh_prov_conf_salt(const uint8_t conf_inputs[145], uint8_t salt[16]);
int bt_mesh_prov_conf_key(const u8_t dhkey[32], const u8_t conf_salt[16], int bt_mesh_prov_conf_key(const uint8_t dhkey[32], const uint8_t conf_salt[16],
u8_t conf_key[16]); uint8_t conf_key[16]);
int bt_mesh_prov_conf(const u8_t conf_key[16], const u8_t rand[16], int bt_mesh_prov_conf(const uint8_t conf_key[16], const uint8_t rand[16],
const u8_t auth[16], u8_t conf[16]); const uint8_t auth[16], uint8_t conf[16]);
int bt_mesh_prov_decrypt(const u8_t key[16], u8_t nonce[13], int bt_mesh_prov_decrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t data[25 + 8], u8_t out[25]); const uint8_t data[25 + 8], uint8_t out[25]);
int bt_mesh_prov_encrypt(const u8_t key[16], u8_t nonce[13], int bt_mesh_prov_encrypt(const uint8_t key[16], uint8_t nonce[13],
const u8_t data[25], u8_t out[33]); const uint8_t data[25], uint8_t out[33]);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -30,7 +30,7 @@
#define ACTION_SUSPEND 0x02 #define ACTION_SUSPEND 0x02
#define ACTION_EXIT 0x03 #define ACTION_EXIT 0x03
const u8_t *bt_mesh_fast_prov_dev_key_get(u16_t dst) const uint8_t *bt_mesh_fast_prov_dev_key_get(uint16_t dst)
{ {
if (!BLE_MESH_ADDR_IS_UNICAST(dst)) { if (!BLE_MESH_ADDR_IS_UNICAST(dst)) {
BT_ERR("Invalid unicast address 0x%04x", dst); BT_ERR("Invalid unicast address 0x%04x", dst);
@ -44,7 +44,7 @@ const u8_t *bt_mesh_fast_prov_dev_key_get(u16_t dst)
return bt_mesh_provisioner_dev_key_get(dst); return bt_mesh_provisioner_dev_key_get(dst);
} }
struct bt_mesh_subnet *bt_mesh_fast_prov_subnet_get(u16_t net_idx) struct bt_mesh_subnet *bt_mesh_fast_prov_subnet_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -66,7 +66,7 @@ struct bt_mesh_subnet *bt_mesh_fast_prov_subnet_get(u16_t net_idx)
return NULL; return NULL;
} }
struct bt_mesh_app_key *bt_mesh_fast_prov_app_key_find(u16_t app_idx) struct bt_mesh_app_key *bt_mesh_fast_prov_app_key_find(uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
int i; int i;
@ -90,7 +90,7 @@ struct bt_mesh_app_key *bt_mesh_fast_prov_app_key_find(u16_t app_idx)
return NULL; return NULL;
} }
u8_t bt_mesh_set_fast_prov_net_idx(u16_t net_idx) uint8_t bt_mesh_set_fast_prov_net_idx(uint16_t net_idx)
{ {
/* Set net_idx for fast provisioning */ /* Set net_idx for fast provisioning */
bt_mesh_provisioner_set_fast_prov_net_idx(net_idx); bt_mesh_provisioner_set_fast_prov_net_idx(net_idx);
@ -104,9 +104,9 @@ u8_t bt_mesh_set_fast_prov_net_idx(u16_t net_idx)
return 0x0; /* status: Succeed */ return 0x0; /* status: Succeed */
} }
u8_t bt_mesh_fast_prov_net_key_add(const u8_t net_key[16]) uint8_t bt_mesh_fast_prov_net_key_add(const uint8_t net_key[16])
{ {
u16_t net_idx = 0U; uint16_t net_idx = 0U;
int err = 0; int err = 0;
net_idx = bt_mesh_provisioner_get_fast_prov_net_idx(); net_idx = bt_mesh_provisioner_get_fast_prov_net_idx();
@ -122,7 +122,7 @@ u8_t bt_mesh_fast_prov_net_key_add(const u8_t net_key[16])
return 0x0; /* status: Succeed */ return 0x0; /* status: Succeed */
} }
const u8_t *bt_mesh_fast_prov_net_key_get(u16_t net_idx) const uint8_t *bt_mesh_fast_prov_net_key_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
@ -135,7 +135,7 @@ const u8_t *bt_mesh_fast_prov_net_key_get(u16_t net_idx)
return (sub->kr_flag ? sub->keys[1].net : sub->keys[0].net); return (sub->kr_flag ? sub->keys[1].net : sub->keys[0].net);
} }
const u8_t *bt_mesh_get_fast_prov_app_key(u16_t net_idx, u16_t app_idx) const uint8_t *bt_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -148,7 +148,7 @@ const u8_t *bt_mesh_get_fast_prov_app_key(u16_t net_idx, u16_t app_idx)
return (key->updated ? key->keys[1].val : key->keys[0].val); return (key->updated ? key->keys[1].val : key->keys[0].val);
} }
u8_t bt_mesh_set_fast_prov_action(u8_t action) uint8_t bt_mesh_set_fast_prov_action(uint8_t action)
{ {
if (!action || action > ACTION_EXIT) { if (!action || action > ACTION_EXIT) {
return 0x01; return 0x01;

View File

@ -21,21 +21,21 @@
extern "C" { extern "C" {
#endif #endif
const u8_t *bt_mesh_fast_prov_dev_key_get(u16_t dst); const uint8_t *bt_mesh_fast_prov_dev_key_get(uint16_t dst);
struct bt_mesh_subnet *bt_mesh_fast_prov_subnet_get(u16_t net_idx); struct bt_mesh_subnet *bt_mesh_fast_prov_subnet_get(uint16_t net_idx);
struct bt_mesh_app_key *bt_mesh_fast_prov_app_key_find(u16_t app_idx); struct bt_mesh_app_key *bt_mesh_fast_prov_app_key_find(uint16_t app_idx);
u8_t bt_mesh_set_fast_prov_net_idx(u16_t net_idx); uint8_t bt_mesh_set_fast_prov_net_idx(uint16_t net_idx);
u8_t bt_mesh_fast_prov_net_key_add(const u8_t net_key[16]); uint8_t bt_mesh_fast_prov_net_key_add(const uint8_t net_key[16]);
const u8_t *bt_mesh_fast_prov_net_key_get(u16_t net_idx); const uint8_t *bt_mesh_fast_prov_net_key_get(uint16_t net_idx);
const u8_t *bt_mesh_get_fast_prov_app_key(u16_t net_idx, u16_t app_idx); const uint8_t *bt_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx);
u8_t bt_mesh_set_fast_prov_action(u8_t action); uint8_t bt_mesh_set_fast_prov_action(uint8_t action);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -126,9 +126,9 @@ enum {
}; };
struct label { struct label {
u16_t ref; uint16_t ref;
u16_t addr; uint16_t addr;
u8_t uuid[16]; uint8_t uuid[16];
bt_mesh_atomic_t flags[1]; bt_mesh_atomic_t flags[1];
}; };
@ -136,40 +136,40 @@ void bt_mesh_mod_sub_reset(bool store);
void bt_mesh_cfg_reset(bool store); void bt_mesh_cfg_reset(bool store);
void bt_mesh_heartbeat(u16_t src, u16_t dst, u8_t hops, u16_t feat); void bt_mesh_heartbeat(uint16_t src, uint16_t dst, uint8_t hops, uint16_t feat);
void bt_mesh_attention(struct bt_mesh_model *model, u8_t time); void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time);
struct label *get_label(u16_t index); struct label *get_label(uint16_t index);
u8_t *bt_mesh_label_uuid_get(u16_t addr); uint8_t *bt_mesh_label_uuid_get(uint16_t addr);
struct bt_mesh_hb_pub *bt_mesh_hb_pub_get(void); struct bt_mesh_hb_pub *bt_mesh_hb_pub_get(void);
void bt_mesh_hb_pub_disable(void); void bt_mesh_hb_pub_disable(void);
struct bt_mesh_cfg_srv *bt_mesh_cfg_get(void); struct bt_mesh_cfg_srv *bt_mesh_cfg_get(void);
u8_t bt_mesh_net_transmit_get(void); uint8_t bt_mesh_net_transmit_get(void);
u8_t bt_mesh_relay_get(void); uint8_t bt_mesh_relay_get(void);
u8_t bt_mesh_friend_get(void); uint8_t bt_mesh_friend_get(void);
u8_t bt_mesh_relay_retransmit_get(void); uint8_t bt_mesh_relay_retransmit_get(void);
u8_t bt_mesh_beacon_get(void); uint8_t bt_mesh_beacon_get(void);
u8_t bt_mesh_gatt_proxy_get(void); uint8_t bt_mesh_gatt_proxy_get(void);
u8_t bt_mesh_default_ttl_get(void); uint8_t bt_mesh_default_ttl_get(void);
void bt_mesh_subnet_del(struct bt_mesh_subnet *sub, bool store); void bt_mesh_subnet_del(struct bt_mesh_subnet *sub, bool store);
struct bt_mesh_app_key *bt_mesh_app_key_alloc(u16_t app_idx); struct bt_mesh_app_key *bt_mesh_app_key_alloc(uint16_t app_idx);
void bt_mesh_app_key_del(struct bt_mesh_app_key *key, bool store); void bt_mesh_app_key_del(struct bt_mesh_app_key *key, bool store);
static inline void key_idx_pack(struct net_buf_simple *buf, static inline void key_idx_pack(struct net_buf_simple *buf,
u16_t idx1, u16_t idx2) uint16_t idx1, uint16_t idx2)
{ {
net_buf_simple_add_le16(buf, idx1 | ((idx2 & 0x00f) << 12)); net_buf_simple_add_le16(buf, idx1 | ((idx2 & 0x00f) << 12));
net_buf_simple_add_u8(buf, idx2 >> 4); net_buf_simple_add_u8(buf, idx2 >> 4);
} }
static inline void key_idx_unpack(struct net_buf_simple *buf, static inline void key_idx_unpack(struct net_buf_simple *buf,
u16_t *idx1, u16_t *idx2) uint16_t *idx1, uint16_t *idx2)
{ {
*idx1 = sys_get_le16(&buf->data[0]) & 0xfff; *idx1 = sys_get_le16(&buf->data[0]) & 0xfff;
*idx2 = sys_get_le16(&buf->data[1]) >> 4; *idx2 = sys_get_le16(&buf->data[1]) >> 4;

View File

@ -38,15 +38,15 @@
#define FRIEND_XMIT BLE_MESH_TRANSMIT(0, 20) #define FRIEND_XMIT BLE_MESH_TRANSMIT(0, 20)
struct friend_pdu_info { struct friend_pdu_info {
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u8_t seq[3]; uint8_t seq[3];
u8_t ttl: 7, uint8_t ttl:7,
ctl: 1; ctl:1;
u32_t iv_index; uint32_t iv_index;
}; };
NET_BUF_POOL_FIXED_DEFINE(friend_buf_pool, FRIEND_BUF_COUNT, NET_BUF_POOL_FIXED_DEFINE(friend_buf_pool, FRIEND_BUF_COUNT,
@ -54,7 +54,7 @@ NET_BUF_POOL_FIXED_DEFINE(friend_buf_pool, FRIEND_BUF_COUNT,
static struct friend_adv { static struct friend_adv {
struct bt_mesh_adv adv; struct bt_mesh_adv adv;
u16_t app_idx; uint16_t app_idx;
} adv_pool[FRIEND_BUF_COUNT]; } adv_pool[FRIEND_BUF_COUNT];
enum { enum {
@ -65,11 +65,11 @@ enum {
BLE_MESH_FRIENDSHIP_TERMINATE_DISABLE, BLE_MESH_FRIENDSHIP_TERMINATE_DISABLE,
}; };
static void (*friend_cb)(bool establish, u16_t lpn_addr, u8_t reason); static void (*friend_cb)(bool establish, uint16_t lpn_addr, uint8_t reason);
static bool friend_init = false; static bool friend_init = false;
static struct bt_mesh_subnet *friend_subnet_get(u16_t net_idx) static struct bt_mesh_subnet *friend_subnet_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
@ -88,7 +88,7 @@ static struct bt_mesh_adv *adv_alloc(int id)
return &adv_pool[id].adv; return &adv_pool[id].adv;
} }
static bool is_lpn_unicast(struct bt_mesh_friend *frnd, u16_t addr) static bool is_lpn_unicast(struct bt_mesh_friend *frnd, uint16_t addr)
{ {
if (frnd->lpn == BLE_MESH_ADDR_UNASSIGNED) { if (frnd->lpn == BLE_MESH_ADDR_UNASSIGNED) {
return false; return false;
@ -97,8 +97,8 @@ static bool is_lpn_unicast(struct bt_mesh_friend *frnd, u16_t addr)
return (addr >= frnd->lpn && addr < (frnd->lpn + frnd->num_elem)); return (addr >= frnd->lpn && addr < (frnd->lpn + frnd->num_elem));
} }
struct bt_mesh_friend *bt_mesh_friend_find(u16_t net_idx, u16_t lpn_addr, struct bt_mesh_friend *bt_mesh_friend_find(uint16_t net_idx, uint16_t lpn_addr,
bool valid, bool established) bool valid, bool established)
{ {
int i; int i;
@ -146,16 +146,16 @@ static void purge_buffers(sys_slist_t *list)
* like the PTS, where the receiver might not have sufficiently compensated * like the PTS, where the receiver might not have sufficiently compensated
* for internal latencies required to start scanning. * for internal latencies required to start scanning.
*/ */
static s32_t recv_delay(struct bt_mesh_friend *frnd) static int32_t recv_delay(struct bt_mesh_friend *frnd)
{ {
#if CONFIG_BLE_MESH_FRIEND_RECV_WIN > 50 #if CONFIG_BLE_MESH_FRIEND_RECV_WIN > 50
return (s32_t)frnd->recv_delay + (CONFIG_BLE_MESH_FRIEND_RECV_WIN / 5); return (int32_t)frnd->recv_delay + (CONFIG_BLE_MESH_FRIEND_RECV_WIN / 5);
#else #else
return frnd->recv_delay; return frnd->recv_delay;
#endif #endif
} }
static void friend_clear(struct bt_mesh_friend *frnd, u8_t reason) static void friend_clear(struct bt_mesh_friend *frnd, uint8_t reason)
{ {
int i; int i;
@ -202,7 +202,7 @@ static void friend_clear(struct bt_mesh_friend *frnd, u8_t reason)
(void)memset(frnd->sub_list, 0, sizeof(frnd->sub_list)); (void)memset(frnd->sub_list, 0, sizeof(frnd->sub_list));
} }
void bt_mesh_friend_clear_net_idx(u16_t net_idx) void bt_mesh_friend_clear_net_idx(uint16_t net_idx)
{ {
int i; int i;
@ -221,7 +221,7 @@ void bt_mesh_friend_clear_net_idx(u16_t net_idx)
} }
} }
void bt_mesh_friend_sec_update(u16_t net_idx) void bt_mesh_friend_sec_update(uint16_t net_idx)
{ {
int i; int i;
@ -244,7 +244,7 @@ int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
{ {
struct bt_mesh_ctl_friend_clear *msg = (void *)buf->data; struct bt_mesh_ctl_friend_clear *msg = (void *)buf->data;
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u16_t lpn_addr = 0U, lpn_counter = 0U; uint16_t lpn_addr = 0U, lpn_counter = 0U;
struct bt_mesh_net_tx tx = { struct bt_mesh_net_tx tx = {
.sub = rx->sub, .sub = rx->sub,
.ctx = &rx->ctx, .ctx = &rx->ctx,
@ -294,7 +294,7 @@ int bt_mesh_friend_clear(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
return 0; return 0;
} }
static void friend_sub_add(struct bt_mesh_friend *frnd, u16_t addr) static void friend_sub_add(struct bt_mesh_friend *frnd, uint16_t addr)
{ {
int i; int i;
@ -308,7 +308,7 @@ static void friend_sub_add(struct bt_mesh_friend *frnd, u16_t addr)
BT_WARN("No space in friend subscription list"); BT_WARN("No space in friend subscription list");
} }
static void friend_sub_rem(struct bt_mesh_friend *frnd, u16_t addr) static void friend_sub_rem(struct bt_mesh_friend *frnd, uint16_t addr)
{ {
int i; int i;
@ -321,8 +321,8 @@ static void friend_sub_rem(struct bt_mesh_friend *frnd, u16_t addr)
} }
static struct net_buf *create_friend_pdu(struct bt_mesh_friend *frnd, static struct net_buf *create_friend_pdu(struct bt_mesh_friend *frnd,
struct friend_pdu_info *info, struct friend_pdu_info *info,
struct net_buf_simple *sdu) struct net_buf_simple *sdu)
{ {
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -353,19 +353,19 @@ static struct net_buf *create_friend_pdu(struct bt_mesh_friend *frnd,
struct unseg_app_sdu_meta { struct unseg_app_sdu_meta {
struct bt_mesh_net_rx net; struct bt_mesh_net_rx net;
const u8_t *key; const uint8_t *key;
struct bt_mesh_subnet *subnet; struct bt_mesh_subnet *subnet;
bool is_dev_key; bool is_dev_key;
u8_t aid; uint8_t aid;
u8_t *ad; uint8_t *ad;
}; };
static int unseg_app_sdu_unpack(struct bt_mesh_friend *frnd, static int unseg_app_sdu_unpack(struct bt_mesh_friend *frnd,
struct net_buf *buf, struct net_buf *buf,
struct unseg_app_sdu_meta *meta) struct unseg_app_sdu_meta *meta)
{ {
u16_t app_idx = FRIEND_ADV(buf)->app_idx; uint16_t app_idx = FRIEND_ADV(buf)->app_idx;
u8_t role = 0U; uint8_t role = 0U;
int err = 0; int err = 0;
meta->subnet = friend_subnet_get(frnd->net_idx); meta->subnet = friend_subnet_get(frnd->net_idx);
@ -471,10 +471,10 @@ static int encrypt_friend_pdu(struct bt_mesh_friend *frnd, struct net_buf *buf,
bool master_cred) bool master_cred)
{ {
struct bt_mesh_subnet *sub = friend_subnet_get(frnd->net_idx); struct bt_mesh_subnet *sub = friend_subnet_get(frnd->net_idx);
const u8_t *enc = NULL, *priv = NULL; const uint8_t *enc = NULL, *priv = NULL;
u32_t iv_index = 0U; uint32_t iv_index = 0U;
u16_t src = 0U; uint16_t src = 0U;
u8_t nid = 0U; uint8_t nid = 0U;
int err = 0; int err = 0;
if (!sub) { if (!sub) {
@ -496,7 +496,7 @@ static int encrypt_friend_pdu(struct bt_mesh_friend *frnd, struct net_buf *buf,
src = sys_get_be16(&buf->data[5]); src = sys_get_be16(&buf->data[5]);
if (bt_mesh_elem_find(src)) { if (bt_mesh_elem_find(src)) {
u32_t seq; uint32_t seq;
if (FRIEND_ADV(buf)->app_idx != BLE_MESH_KEY_UNUSED) { if (FRIEND_ADV(buf)->app_idx != BLE_MESH_KEY_UNUSED) {
err = unseg_app_sdu_prepare(frnd, buf); err = unseg_app_sdu_prepare(frnd, buf);
@ -511,7 +511,7 @@ static int encrypt_friend_pdu(struct bt_mesh_friend *frnd, struct net_buf *buf,
iv_index = BLE_MESH_NET_IVI_TX; iv_index = BLE_MESH_NET_IVI_TX;
FRIEND_ADV(buf)->app_idx = BLE_MESH_KEY_UNUSED; FRIEND_ADV(buf)->app_idx = BLE_MESH_KEY_UNUSED;
} else { } else {
u8_t ivi = (buf->data[0] >> 7); uint8_t ivi = (buf->data[0] >> 7);
iv_index = (bt_mesh.iv_index - ((bt_mesh.iv_index & 1) != ivi)); iv_index = (bt_mesh.iv_index - ((bt_mesh.iv_index & 1) != ivi));
} }
@ -531,8 +531,8 @@ static int encrypt_friend_pdu(struct bt_mesh_friend *frnd, struct net_buf *buf,
} }
static struct net_buf *encode_friend_ctl(struct bt_mesh_friend *frnd, static struct net_buf *encode_friend_ctl(struct bt_mesh_friend *frnd,
u8_t ctl_op, uint8_t ctl_op,
struct net_buf_simple *sdu) struct net_buf_simple *sdu)
{ {
struct friend_pdu_info info = {0}; struct friend_pdu_info info = {0};
@ -553,7 +553,7 @@ static struct net_buf *encode_friend_ctl(struct bt_mesh_friend *frnd,
return create_friend_pdu(frnd, &info, sdu); return create_friend_pdu(frnd, &info, sdu);
} }
static struct net_buf *encode_update(struct bt_mesh_friend *frnd, u8_t md) static struct net_buf *encode_update(struct bt_mesh_friend *frnd, uint8_t md)
{ {
struct bt_mesh_ctl_friend_update *upd = NULL; struct bt_mesh_ctl_friend_update *upd = NULL;
NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*upd)); NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*upd));
@ -576,7 +576,7 @@ static struct net_buf *encode_update(struct bt_mesh_friend *frnd, u8_t md)
return encode_friend_ctl(frnd, TRANS_CTL_OP_FRIEND_UPDATE, &sdu); return encode_friend_ctl(frnd, TRANS_CTL_OP_FRIEND_UPDATE, &sdu);
} }
static void enqueue_sub_cfm(struct bt_mesh_friend *frnd, u8_t xact) static void enqueue_sub_cfm(struct bt_mesh_friend *frnd, uint8_t xact)
{ {
struct bt_mesh_ctl_friend_sub_confirm *cfm = NULL; struct bt_mesh_ctl_friend_sub_confirm *cfm = NULL;
NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*cfm)); NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*cfm));
@ -619,7 +619,7 @@ int bt_mesh_friend_sub_add(struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u8_t xact = 0U; uint8_t xact = 0U;
if (buf->len < BLE_MESH_FRIEND_SUB_MIN_LEN) { if (buf->len < BLE_MESH_FRIEND_SUB_MIN_LEN) {
BT_WARN("Too short Friend Subscription Add (len %d)", buf->len); BT_WARN("Too short Friend Subscription Add (len %d)", buf->len);
@ -654,7 +654,7 @@ int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u8_t xact = 0U; uint8_t xact = 0U;
if (buf->len < BLE_MESH_FRIEND_SUB_MIN_LEN) { if (buf->len < BLE_MESH_FRIEND_SUB_MIN_LEN) {
BT_WARN("Too short Friend Subscription Remove (len %d)", buf->len); BT_WARN("Too short Friend Subscription Remove (len %d)", buf->len);
@ -691,7 +691,7 @@ static void enqueue_buf(struct bt_mesh_friend *frnd, struct net_buf *buf)
frnd->queue_size++; frnd->queue_size++;
} }
static void enqueue_update(struct bt_mesh_friend *frnd, u8_t md) static void enqueue_update(struct bt_mesh_friend *frnd, uint8_t md)
{ {
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -763,7 +763,7 @@ int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
return 0; return 0;
} }
static struct bt_mesh_friend *find_clear(u16_t prev_friend) static struct bt_mesh_friend *find_clear(uint16_t prev_friend)
{ {
int i; int i;
@ -825,7 +825,7 @@ static void clear_timeout(struct k_work *work)
{ {
struct bt_mesh_friend *frnd = CONTAINER_OF(work, struct bt_mesh_friend, struct bt_mesh_friend *frnd = CONTAINER_OF(work, struct bt_mesh_friend,
clear.timer.work); clear.timer.work);
u32_t duration = 0U; uint32_t duration = 0U;
BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd); BT_DBG("LPN 0x%04x (old) Friend 0x%04x", frnd->lpn, frnd->clear.frnd);
@ -854,7 +854,7 @@ int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
{ {
struct bt_mesh_ctl_friend_clear_confirm *msg = (void *)buf->data; struct bt_mesh_ctl_friend_clear_confirm *msg = (void *)buf->data;
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u16_t lpn_addr = 0U, lpn_counter = 0U; uint16_t lpn_addr = 0U, lpn_counter = 0U;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -889,7 +889,7 @@ int bt_mesh_friend_clear_cfm(struct bt_mesh_net_rx *rx,
return 0; return 0;
} }
static void enqueue_offer(struct bt_mesh_friend *frnd, s8_t rssi) static void enqueue_offer(struct bt_mesh_friend *frnd, int8_t rssi)
{ {
struct bt_mesh_ctl_friend_offer *off = NULL; struct bt_mesh_ctl_friend_offer *off = NULL;
NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*off)); NET_BUF_SIMPLE_DEFINE(sdu, 1 + sizeof(*off));
@ -928,26 +928,26 @@ static void enqueue_offer(struct bt_mesh_friend *frnd, s8_t rssi)
} }
#define RECV_WIN CONFIG_BLE_MESH_FRIEND_RECV_WIN #define RECV_WIN CONFIG_BLE_MESH_FRIEND_RECV_WIN
#define RSSI_FACT(crit) (((crit) >> 5) & (u8_t)BIT_MASK(2)) #define RSSI_FACT(crit) (((crit) >> 5) & (uint8_t)BIT_MASK(2))
#define RECV_WIN_FACT(crit) (((crit) >> 3) & (u8_t)BIT_MASK(2)) #define RECV_WIN_FACT(crit) (((crit) >> 3) & (uint8_t)BIT_MASK(2))
#define MIN_QUEUE_SIZE_LOG(crit) ((crit) & (u8_t)BIT_MASK(3)) #define MIN_QUEUE_SIZE_LOG(crit) ((crit) & (uint8_t)BIT_MASK(3))
#define MIN_QUEUE_SIZE(crit) ((u32_t)BIT(MIN_QUEUE_SIZE_LOG(crit))) #define MIN_QUEUE_SIZE(crit) ((uint32_t)BIT(MIN_QUEUE_SIZE_LOG(crit)))
static s32_t offer_delay(struct bt_mesh_friend *frnd, s8_t rssi, u8_t crit) static int32_t offer_delay(struct bt_mesh_friend *frnd, int8_t rssi, uint8_t crit)
{ {
/* Scaling factors. The actual values are 1, 1.5, 2 & 2.5, but we /* Scaling factors. The actual values are 1, 1.5, 2 & 2.5, but we
* want to avoid floating-point arithmetic. * want to avoid floating-point arithmetic.
*/ */
static const u8_t fact[] = { 10, 15, 20, 25 }; static const uint8_t fact[] = { 10, 15, 20, 25 };
s32_t delay = 0; int32_t delay = 0;
BT_INFO("ReceiveWindowFactor %u ReceiveWindow %u RSSIFactor %u RSSI %d", BT_INFO("ReceiveWindowFactor %u ReceiveWindow %u RSSIFactor %u RSSI %d",
fact[RECV_WIN_FACT(crit)], RECV_WIN, fact[RECV_WIN_FACT(crit)], RECV_WIN,
fact[RSSI_FACT(crit)], rssi); fact[RSSI_FACT(crit)], rssi);
/* Delay = ReceiveWindowFactor * ReceiveWindow - RSSIFactor * RSSI */ /* Delay = ReceiveWindowFactor * ReceiveWindow - RSSIFactor * RSSI */
delay = (s32_t)fact[RECV_WIN_FACT(crit)] * RECV_WIN; delay = (int32_t)fact[RECV_WIN_FACT(crit)] * RECV_WIN;
delay -= (s32_t)fact[RSSI_FACT(crit)] * rssi; delay -= (int32_t)fact[RSSI_FACT(crit)] * rssi;
delay /= 10; delay /= 10;
BT_DBG("Local Delay calculated as %d ms", delay); BT_DBG("Local Delay calculated as %d ms", delay);
@ -963,7 +963,7 @@ int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
{ {
struct bt_mesh_ctl_friend_req *msg = (void *)buf->data; struct bt_mesh_ctl_friend_req *msg = (void *)buf->data;
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;
u32_t poll_to = 0U; uint32_t poll_to = 0U;
int i; int i;
if (buf->len < sizeof(*msg)) { if (buf->len < sizeof(*msg)) {
@ -1061,12 +1061,12 @@ init_friend:
return 0; return 0;
} }
static bool is_seg(struct bt_mesh_friend_seg *seg, u16_t src, u16_t seq_zero) static bool is_seg(struct bt_mesh_friend_seg *seg, uint16_t src, uint16_t seq_zero)
{ {
struct net_buf *buf = (void *)sys_slist_peek_head(&seg->queue); struct net_buf *buf = (void *)sys_slist_peek_head(&seg->queue);
struct net_buf_simple_state state = {0}; struct net_buf_simple_state state = {0};
u16_t buf_seq_zero = 0U; uint16_t buf_seq_zero = 0U;
u16_t buf_src = 0U; uint16_t buf_src = 0U;
if (!buf) { if (!buf) {
return false; return false;
@ -1083,8 +1083,8 @@ static bool is_seg(struct bt_mesh_friend_seg *seg, u16_t src, u16_t seq_zero)
} }
static struct bt_mesh_friend_seg *get_seg(struct bt_mesh_friend *frnd, static struct bt_mesh_friend_seg *get_seg(struct bt_mesh_friend *frnd,
u16_t src, u16_t seq_zero, uint16_t src, uint16_t seq_zero,
u8_t seg_count) uint8_t seg_count)
{ {
struct bt_mesh_friend_seg *unassigned = NULL; struct bt_mesh_friend_seg *unassigned = NULL;
int i; int i;
@ -1110,7 +1110,7 @@ static struct bt_mesh_friend_seg *get_seg(struct bt_mesh_friend *frnd,
static void enqueue_friend_pdu(struct bt_mesh_friend *frnd, static void enqueue_friend_pdu(struct bt_mesh_friend *frnd,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
u16_t src, u8_t seg_count, uint16_t src, uint8_t seg_count,
struct net_buf *buf) struct net_buf *buf)
{ {
struct bt_mesh_friend_seg *seg = NULL; struct bt_mesh_friend_seg *seg = NULL;
@ -1126,7 +1126,7 @@ static void enqueue_friend_pdu(struct bt_mesh_friend *frnd,
return; return;
} }
u16_t seq_zero = (((buf->data[10] << 8 | buf->data[11]) >> 2) & TRANS_SEQ_ZERO_MASK); uint16_t seq_zero = (((buf->data[10] << 8 | buf->data[11]) >> 2) & TRANS_SEQ_ZERO_MASK);
seg = get_seg(frnd, src, seq_zero, seg_count); seg = get_seg(frnd, src, seq_zero, seg_count);
if (!seg) { if (!seg) {
@ -1152,7 +1152,7 @@ static void enqueue_friend_pdu(struct bt_mesh_friend *frnd,
} }
} }
static void buf_send_start(u16_t duration, int err, void *user_data) static void buf_send_start(uint16_t duration, int err, void *user_data)
{ {
struct bt_mesh_friend *frnd = user_data; struct bt_mesh_friend *frnd = user_data;
@ -1242,7 +1242,7 @@ send_last:
bt_mesh_adv_send(frnd->last, &buf_sent_cb, frnd); bt_mesh_adv_send(frnd->last, &buf_sent_cb, frnd);
} }
void bt_mesh_friend_set_cb(void (*cb)(bool establish, u16_t lpn_addr, u8_t reason)) void bt_mesh_friend_set_cb(void (*cb)(bool establish, uint16_t lpn_addr, uint8_t reason))
{ {
friend_cb = cb; friend_cb = cb;
} }
@ -1307,7 +1307,7 @@ int bt_mesh_friend_deinit(void)
} }
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
static bool is_segack(struct net_buf *buf, const u64_t *seqauth, u16_t src) static bool is_segack(struct net_buf *buf, const uint64_t *seqauth, uint16_t src)
{ {
struct net_buf_simple_state state = {0}; struct net_buf_simple_state state = {0};
bool found = false; bool found = false;
@ -1332,7 +1332,7 @@ static bool is_segack(struct net_buf *buf, const u64_t *seqauth, u16_t src)
net_buf_skip(buf, 2); /* skip dst */ net_buf_skip(buf, 2); /* skip dst */
if (TRANS_CTL_OP((u8_t *) net_buf_pull_mem(buf, 1)) != TRANS_CTL_OP_ACK) { if (TRANS_CTL_OP((uint8_t *) net_buf_pull_mem(buf, 1)) != TRANS_CTL_OP_ACK) {
goto end; goto end;
} }
@ -1344,7 +1344,7 @@ end:
} }
static void friend_purge_old_ack(struct bt_mesh_friend *frnd, static void friend_purge_old_ack(struct bt_mesh_friend *frnd,
const u64_t *seq_auth, u16_t src) const uint64_t *seq_auth, uint16_t src)
{ {
sys_snode_t *cur = NULL, *prev = NULL; sys_snode_t *cur = NULL, *prev = NULL;
@ -1371,7 +1371,7 @@ static void friend_purge_old_ack(struct bt_mesh_friend *frnd,
static void friend_lpn_enqueue_rx(struct bt_mesh_friend *frnd, static void friend_lpn_enqueue_rx(struct bt_mesh_friend *frnd,
struct bt_mesh_net_rx *rx, struct bt_mesh_net_rx *rx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf) struct net_buf_simple *sbuf)
{ {
struct friend_pdu_info info = {0}; struct friend_pdu_info info = {0};
@ -1421,7 +1421,7 @@ static void friend_lpn_enqueue_rx(struct bt_mesh_friend *frnd,
static void friend_lpn_enqueue_tx(struct bt_mesh_friend *frnd, static void friend_lpn_enqueue_tx(struct bt_mesh_friend *frnd,
struct bt_mesh_net_tx *tx, struct bt_mesh_net_tx *tx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf) struct net_buf_simple *sbuf)
{ {
struct friend_pdu_info info = {0}; struct friend_pdu_info info = {0};
@ -1462,8 +1462,8 @@ static void friend_lpn_enqueue_tx(struct bt_mesh_friend *frnd,
BT_DBG("Queued message for LPN 0x%04x", frnd->lpn); BT_DBG("Queued message for LPN 0x%04x", frnd->lpn);
} }
static bool friend_lpn_matches(struct bt_mesh_friend *frnd, u16_t net_idx, static bool friend_lpn_matches(struct bt_mesh_friend *frnd, uint16_t net_idx,
u16_t addr) uint16_t addr)
{ {
int i; int i;
@ -1488,7 +1488,7 @@ static bool friend_lpn_matches(struct bt_mesh_friend *frnd, u16_t net_idx,
return false; return false;
} }
bool bt_mesh_friend_match(u16_t net_idx, u16_t addr) bool bt_mesh_friend_match(uint16_t net_idx, uint16_t addr)
{ {
int i; int i;
@ -1507,10 +1507,10 @@ bool bt_mesh_friend_match(u16_t net_idx, u16_t addr)
return false; return false;
} }
static bool friend_queue_has_space(struct bt_mesh_friend *frnd, u16_t addr, static bool friend_queue_has_space(struct bt_mesh_friend *frnd, uint16_t addr,
const u64_t *seq_auth, u8_t seg_count) const uint64_t *seq_auth, uint8_t seg_count)
{ {
u32_t total = 0U; uint32_t total = 0U;
int i; int i;
if (seg_count > CONFIG_BLE_MESH_FRIEND_QUEUE_SIZE) { if (seg_count > CONFIG_BLE_MESH_FRIEND_QUEUE_SIZE) {
@ -1538,8 +1538,8 @@ static bool friend_queue_has_space(struct bt_mesh_friend *frnd, u16_t addr,
return (CONFIG_BLE_MESH_FRIEND_QUEUE_SIZE - total) > seg_count; return (CONFIG_BLE_MESH_FRIEND_QUEUE_SIZE - total) > seg_count;
} }
bool bt_mesh_friend_queue_has_space(u16_t net_idx, u16_t src, u16_t dst, bool bt_mesh_friend_queue_has_space(uint16_t net_idx, uint16_t src, uint16_t dst,
const u64_t *seq_auth, u8_t seg_count) const uint64_t *seq_auth, uint8_t seg_count)
{ {
bool someone_has_space = false, friend_match = false; bool someone_has_space = false, friend_match = false;
int i; int i;
@ -1573,11 +1573,11 @@ bool bt_mesh_friend_queue_has_space(u16_t net_idx, u16_t src, u16_t dst,
return someone_has_space; return someone_has_space;
} }
static bool friend_queue_prepare_space(struct bt_mesh_friend *frnd, u16_t addr, static bool friend_queue_prepare_space(struct bt_mesh_friend *frnd, uint16_t addr,
const u64_t *seq_auth, u8_t seg_count) const uint64_t *seq_auth, uint8_t seg_count)
{ {
bool pending_segments = false; bool pending_segments = false;
u8_t avail_space = 0U; uint8_t avail_space = 0U;
if (!friend_queue_has_space(frnd, addr, seq_auth, seg_count)) { if (!friend_queue_has_space(frnd, addr, seq_auth, seg_count)) {
return false; return false;
@ -1611,7 +1611,7 @@ static bool friend_queue_prepare_space(struct bt_mesh_friend *frnd, u16_t addr,
void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx, void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf) struct net_buf_simple *sbuf)
{ {
int i; int i;
@ -1646,7 +1646,7 @@ void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx, bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf) struct net_buf_simple *sbuf)
{ {
bool matched = false; bool matched = false;
@ -1681,8 +1681,8 @@ bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
return matched; return matched;
} }
void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, u16_t src, void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, uint16_t src,
u16_t dst, const u64_t *seq_auth) uint16_t dst, const uint64_t *seq_auth)
{ {
int i; int i;
@ -1712,7 +1712,7 @@ void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, u16_t src,
} }
} }
void bt_mesh_friend_remove_lpn(u16_t lpn_addr) void bt_mesh_friend_remove_lpn(uint16_t lpn_addr)
{ {
struct bt_mesh_friend *frnd = NULL; struct bt_mesh_friend *frnd = NULL;

View File

@ -21,29 +21,29 @@ enum bt_mesh_friend_pdu_type {
BLE_MESH_FRIEND_PDU_COMPLETE, BLE_MESH_FRIEND_PDU_COMPLETE,
}; };
bool bt_mesh_friend_match(u16_t net_idx, u16_t addr); bool bt_mesh_friend_match(uint16_t net_idx, uint16_t addr);
struct bt_mesh_friend *bt_mesh_friend_find(u16_t net_idx, u16_t lpn_addr, struct bt_mesh_friend *bt_mesh_friend_find(uint16_t net_idx, uint16_t lpn_addr,
bool valid, bool established); bool valid, bool established);
bool bt_mesh_friend_queue_has_space(u16_t net_idx, u16_t src, u16_t dst, bool bt_mesh_friend_queue_has_space(uint16_t net_idx, uint16_t src, uint16_t dst,
const u64_t *seq_auth, u8_t seg_count); const uint64_t *seq_auth, uint8_t seg_count);
void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx, void bt_mesh_friend_enqueue_rx(struct bt_mesh_net_rx *rx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf); struct net_buf_simple *sbuf);
bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx, bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
enum bt_mesh_friend_pdu_type type, enum bt_mesh_friend_pdu_type type,
const u64_t *seq_auth, u8_t seg_count, const uint64_t *seq_auth, uint8_t seg_count,
struct net_buf_simple *sbuf); struct net_buf_simple *sbuf);
void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, u16_t src, void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, uint16_t src,
u16_t dst, const u64_t *seq_auth); uint16_t dst, const uint64_t *seq_auth);
void bt_mesh_friend_sec_update(u16_t net_idx); void bt_mesh_friend_sec_update(uint16_t net_idx);
void bt_mesh_friend_clear_net_idx(u16_t net_idx); void bt_mesh_friend_clear_net_idx(uint16_t net_idx);
int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); int bt_mesh_friend_poll(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); int bt_mesh_friend_req(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
@ -58,7 +58,7 @@ int bt_mesh_friend_sub_rem(struct bt_mesh_net_rx *rx,
int bt_mesh_friend_init(void); int bt_mesh_friend_init(void);
int bt_mesh_friend_deinit(void); int bt_mesh_friend_deinit(void);
void bt_mesh_friend_remove_lpn(u16_t lpn_addr); void bt_mesh_friend_remove_lpn(uint16_t lpn_addr);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -62,7 +62,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive health status message timeout"); BT_WARN("Receive health status message timeout");
@ -92,7 +92,7 @@ static void health_client_recv_status(struct bt_mesh_model *model,
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct net_buf_simple buf = {0}; struct net_buf_simple buf = {0};
u8_t evt_type = 0xFF; uint8_t evt_type = 0xFF;
if (!model || !ctx || !status || !len) { if (!model || !ctx || !status || !len) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -100,8 +100,8 @@ static void health_client_recv_status(struct bt_mesh_model *model,
} }
/* If it is a publish message, sent to the user directly. */ /* If it is a publish message, sent to the user directly. */
buf.data = (u8_t *)status; buf.data = (uint8_t *)status;
buf.len = (u16_t)len; buf.len = (uint16_t)len;
bt_mesh_health_client_lock(); bt_mesh_health_client_lock();
@ -126,10 +126,10 @@ static void health_client_recv_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_health_client_cb_evt_to_btc( bt_mesh_health_client_cb_evt_to_btc(
opcode, evt_type, model, ctx, (const u8_t *)status, len); opcode, evt_type, model, ctx, (const uint8_t *)status, len);
} }
} }
@ -201,7 +201,7 @@ static void health_period_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t status = 0U; uint8_t status = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -209,14 +209,14 @@ static void health_period_status(struct bt_mesh_model *model,
status = net_buf_simple_pull_u8(buf); status = net_buf_simple_pull_u8(buf);
health_client_recv_status(model, ctx, &status, sizeof(u8_t)); health_client_recv_status(model, ctx, &status, sizeof(uint8_t));
} }
static void health_attention_status(struct bt_mesh_model *model, static void health_attention_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t status = 0U; uint8_t status = 0U;
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len, ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
@ -224,7 +224,7 @@ static void health_attention_status(struct bt_mesh_model *model,
status = net_buf_simple_pull_u8(buf); status = net_buf_simple_pull_u8(buf);
health_client_recv_status(model, ctx, &status, sizeof(u8_t)); health_client_recv_status(model, ctx, &status, sizeof(uint8_t));
} }
const struct bt_mesh_model_op bt_mesh_health_cli_op[] = { const struct bt_mesh_model_op bt_mesh_health_cli_op[] = {
@ -245,7 +245,7 @@ int bt_mesh_health_attention_get(bt_mesh_client_common_param_t *param)
} }
int bt_mesh_health_attention_set(bt_mesh_client_common_param_t *param, int bt_mesh_health_attention_set(bt_mesh_client_common_param_t *param,
u8_t attention, bool need_ack) uint8_t attention, bool need_ack)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_ATTENTION_SET, 1); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_ATTENTION_SET, 1);
@ -265,7 +265,7 @@ int bt_mesh_health_period_get(bt_mesh_client_common_param_t *param)
} }
int bt_mesh_health_period_set(bt_mesh_client_common_param_t *param, int bt_mesh_health_period_set(bt_mesh_client_common_param_t *param,
u8_t divisor, bool need_ack) uint8_t divisor, bool need_ack)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_PERIOD_SET, 1); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_PERIOD_SET, 1);
@ -276,7 +276,7 @@ int bt_mesh_health_period_set(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_health_fault_test(bt_mesh_client_common_param_t *param, int bt_mesh_health_fault_test(bt_mesh_client_common_param_t *param,
u16_t cid, u8_t test_id, bool need_ack) uint16_t cid, uint8_t test_id, bool need_ack)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_TEST, 3); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_TEST, 3);
@ -288,7 +288,7 @@ int bt_mesh_health_fault_test(bt_mesh_client_common_param_t *param,
} }
int bt_mesh_health_fault_clear(bt_mesh_client_common_param_t *param, int bt_mesh_health_fault_clear(bt_mesh_client_common_param_t *param,
u16_t cid, bool need_ack) uint16_t cid, bool need_ack)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_CLEAR, 2); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_CLEAR, 2);
@ -298,7 +298,7 @@ int bt_mesh_health_fault_clear(bt_mesh_client_common_param_t *param,
return bt_mesh_client_send_msg(param, &msg, need_ack, timeout_handler); return bt_mesh_client_send_msg(param, &msg, need_ack, timeout_handler);
} }
int bt_mesh_health_fault_get(bt_mesh_client_common_param_t *param, u16_t cid) int bt_mesh_health_fault_get(bt_mesh_client_common_param_t *param, uint16_t cid)
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_GET, 2); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_HEALTH_FAULT_GET, 2);

View File

@ -38,10 +38,10 @@ struct bt_mesh_health_srv *health_srv;
* the node for more than one Company ID. * the node for more than one Company ID.
*/ */
static u8_t health_get_curr_fault_count(struct bt_mesh_model *model) static uint8_t health_get_curr_fault_count(struct bt_mesh_model *model)
{ {
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
u8_t count = 0U; uint8_t count = 0U;
size_t i = 0U; size_t i = 0U;
for (i = 0U; i < ARRAY_SIZE(srv->test.curr_faults); i++) { for (i = 0U; i < ARRAY_SIZE(srv->test.curr_faults); i++) {
@ -68,14 +68,14 @@ static void health_get_fault_value(struct bt_mesh_model *model,
return; return;
} }
u8_t fault = current ? srv->test.curr_faults[i] : srv->test.reg_faults[i]; uint8_t fault = current ? srv->test.curr_faults[i] : srv->test.reg_faults[i];
if (fault != HEALTH_NO_FAULT) { if (fault != HEALTH_NO_FAULT) {
net_buf_simple_add_u8(msg, fault); net_buf_simple_add_u8(msg, fault);
} }
} }
} }
static bool health_is_test_id_exist(struct bt_mesh_model *model, u8_t test_id) static bool health_is_test_id_exist(struct bt_mesh_model *model, uint8_t test_id)
{ {
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
int i; int i;
@ -127,7 +127,7 @@ static void health_fault_get(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id = 0U; uint16_t company_id = 0U;
if (!srv) { if (!srv) {
BT_ERR("No Health Server context provided"); BT_ERR("No Health Server context provided");
@ -150,7 +150,7 @@ static void health_fault_clear(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id = 0U; uint16_t company_id = 0U;
if (!srv) { if (!srv) {
BT_ERR("No Health Server context provided"); BT_ERR("No Health Server context provided");
@ -181,8 +181,8 @@ static void health_fault_test(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
u16_t company_id = 0U; uint16_t company_id = 0U;
u8_t test_id = 0U; uint8_t test_id = 0U;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -221,7 +221,7 @@ static void send_attention_status(struct bt_mesh_model *model,
{ {
BLE_MESH_MODEL_BUF_DEFINE(msg, OP_ATTENTION_STATUS, 1); BLE_MESH_MODEL_BUF_DEFINE(msg, OP_ATTENTION_STATUS, 1);
struct bt_mesh_health_srv *srv = model->user_data; struct bt_mesh_health_srv *srv = model->user_data;
u8_t time = 0U; uint8_t time = 0U;
if (!srv) { if (!srv) {
BT_ERR("No Health Server context provided"); BT_ERR("No Health Server context provided");
@ -252,7 +252,7 @@ static void health_set_attention(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t time = 0U; uint8_t time = 0U;
time = net_buf_simple_pull_u8(buf); time = net_buf_simple_pull_u8(buf);
@ -300,7 +300,7 @@ static void health_set_period(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t period = 0U; uint8_t period = 0U;
period = net_buf_simple_pull_u8(buf); period = net_buf_simple_pull_u8(buf);
if (period > 15) { if (period > 15) {
@ -511,7 +511,7 @@ const struct bt_mesh_model_cb bt_mesh_health_srv_cb = {
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
void bt_mesh_attention(struct bt_mesh_model *model, u8_t time) void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
{ {
struct bt_mesh_health_srv *srv = NULL; struct bt_mesh_health_srv *srv = NULL;
@ -550,7 +550,7 @@ void bt_mesh_attention(struct bt_mesh_model *model, u8_t time)
} }
} }
#else /* CONFIG_BLE_MESH_HEALTH_SRV */ #else /* CONFIG_BLE_MESH_HEALTH_SRV */
void bt_mesh_attention(struct bt_mesh_model *model, u8_t time) void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
{ {
return; return;
} }

View File

@ -35,84 +35,84 @@ extern const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb;
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_CFG_CLI, \ BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_CFG_CLI, \
bt_mesh_cfg_cli_op, NULL, cli_data, &bt_mesh_cfg_cli_cb) bt_mesh_cfg_cli_op, NULL, cli_data, &bt_mesh_cfg_cli_cb)
int bt_mesh_cfg_comp_data_get(bt_mesh_client_common_param_t *param, u8_t page); int bt_mesh_cfg_comp_data_get(bt_mesh_client_common_param_t *param, uint8_t page);
int bt_mesh_cfg_beacon_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_beacon_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_beacon_set(bt_mesh_client_common_param_t *param, u8_t val); int bt_mesh_cfg_beacon_set(bt_mesh_client_common_param_t *param, uint8_t val);
int bt_mesh_cfg_ttl_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_ttl_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_ttl_set(bt_mesh_client_common_param_t *param, u8_t val); int bt_mesh_cfg_ttl_set(bt_mesh_client_common_param_t *param, uint8_t val);
int bt_mesh_cfg_friend_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_friend_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_friend_set(bt_mesh_client_common_param_t *param, u8_t val); int bt_mesh_cfg_friend_set(bt_mesh_client_common_param_t *param, uint8_t val);
int bt_mesh_cfg_gatt_proxy_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_gatt_proxy_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_gatt_proxy_set(bt_mesh_client_common_param_t *param, u8_t val); int bt_mesh_cfg_gatt_proxy_set(bt_mesh_client_common_param_t *param, uint8_t val);
int bt_mesh_cfg_relay_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_relay_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_relay_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_relay_set(bt_mesh_client_common_param_t *param,
u8_t relay, u8_t retransmit); uint8_t relay, uint8_t retransmit);
int bt_mesh_cfg_net_key_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_net_key_add(bt_mesh_client_common_param_t *param,
u16_t net_idx, const u8_t net_key[16]); uint16_t net_idx, const uint8_t net_key[16]);
int bt_mesh_cfg_app_key_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_add(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx, uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]); const uint8_t app_key[16]);
int bt_mesh_cfg_mod_app_bind(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_bind(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t app_idx, uint16_t elem_addr, uint16_t app_idx,
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
struct bt_mesh_cfg_mod_pub { struct bt_mesh_cfg_mod_pub {
u16_t addr; uint16_t addr;
u16_t app_idx; uint16_t app_idx;
bool cred_flag; bool cred_flag;
u8_t ttl; uint8_t ttl;
u8_t period; uint8_t period;
u8_t transmit; uint8_t transmit;
}; };
int bt_mesh_cfg_mod_pub_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid); uint16_t elem_addr, uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_pub_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_set(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid, uint16_t elem_addr, uint16_t mod_id, uint16_t cid,
struct bt_mesh_cfg_mod_pub *pub); struct bt_mesh_cfg_mod_pub *pub);
int bt_mesh_cfg_mod_sub_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_add(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_del(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_del(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_overwrite(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_overwrite(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t sub_addr, uint16_t elem_addr, uint16_t sub_addr,
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_va_add(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_add(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_va_del(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_del(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_va_overwrite(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_va_overwrite(bt_mesh_client_common_param_t *param,
u16_t elem_addr, const u8_t label[16], uint16_t elem_addr, const uint8_t label[16],
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
struct bt_mesh_cfg_hb_sub { struct bt_mesh_cfg_hb_sub {
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u8_t period; uint8_t period;
}; };
int bt_mesh_cfg_hb_sub_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_hb_sub_set(bt_mesh_client_common_param_t *param,
@ -121,12 +121,12 @@ int bt_mesh_cfg_hb_sub_set(bt_mesh_client_common_param_t *param,
int bt_mesh_cfg_hb_sub_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_hb_sub_get(bt_mesh_client_common_param_t *param);
struct bt_mesh_cfg_hb_pub { struct bt_mesh_cfg_hb_pub {
u16_t dst; uint16_t dst;
u8_t count; uint8_t count;
u8_t period; uint8_t period;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx; uint16_t net_idx;
}; };
int bt_mesh_cfg_hb_pub_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_hb_pub_set(bt_mesh_client_common_param_t *param,
@ -139,80 +139,80 @@ int bt_mesh_cfg_node_reset(bt_mesh_client_common_param_t *param);
/* Configuration Client Status Message Context */ /* Configuration Client Status Message Context */
struct bt_mesh_cfg_comp_data_status { struct bt_mesh_cfg_comp_data_status {
u8_t page; uint8_t page;
struct net_buf_simple *comp_data; struct net_buf_simple *comp_data;
}; };
struct bt_mesh_cfg_relay_status { struct bt_mesh_cfg_relay_status {
u8_t relay; uint8_t relay;
u8_t retransmit; uint8_t retransmit;
}; };
struct bt_mesh_cfg_netkey_status { struct bt_mesh_cfg_netkey_status {
u8_t status; uint8_t status;
u16_t net_idx; uint16_t net_idx;
}; };
struct bt_mesh_cfg_appkey_status { struct bt_mesh_cfg_appkey_status {
u8_t status; uint8_t status;
u16_t net_idx; uint16_t net_idx;
u16_t app_idx; uint16_t app_idx;
}; };
struct bt_mesh_cfg_mod_app_status { struct bt_mesh_cfg_mod_app_status {
u8_t status; uint8_t status;
u16_t elem_addr; uint16_t elem_addr;
u16_t app_idx; uint16_t app_idx;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
}; };
struct bt_mesh_cfg_mod_pub_status { struct bt_mesh_cfg_mod_pub_status {
u8_t status; uint8_t status;
u16_t elem_addr; uint16_t elem_addr;
u16_t addr; uint16_t addr;
u16_t app_idx; uint16_t app_idx;
bool cred_flag; bool cred_flag;
u8_t ttl; uint8_t ttl;
u8_t period; uint8_t period;
u8_t transmit; uint8_t transmit;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
}; };
struct bt_mesh_cfg_mod_sub_status { struct bt_mesh_cfg_mod_sub_status {
u8_t status; uint8_t status;
u16_t elem_addr; uint16_t elem_addr;
u16_t sub_addr; uint16_t sub_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
}; };
struct bt_mesh_cfg_hb_sub_status { struct bt_mesh_cfg_hb_sub_status {
u8_t status; uint8_t status;
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u8_t period; uint8_t period;
u8_t count; uint8_t count;
u8_t min; uint8_t min;
u8_t max; uint8_t max;
}; };
struct bt_mesh_cfg_hb_pub_status { struct bt_mesh_cfg_hb_pub_status {
u8_t status; uint8_t status;
u16_t dst; uint16_t dst;
u8_t count; uint8_t count;
u8_t period; uint8_t period;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx; uint16_t net_idx;
}; };
struct bt_mesh_cfg_mod_sub_list { struct bt_mesh_cfg_mod_sub_list {
u8_t status; uint8_t status;
u16_t elem_addr; uint16_t elem_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
struct net_buf_simple *addr; struct net_buf_simple *addr;
}; };
@ -221,91 +221,91 @@ struct bt_mesh_cfg_net_key_list {
}; };
struct bt_mesh_cfg_app_key_list { struct bt_mesh_cfg_app_key_list {
u8_t status; uint8_t status;
u16_t net_idx; uint16_t net_idx;
struct net_buf_simple *app_idx; struct net_buf_simple *app_idx;
}; };
struct bt_mesh_cfg_node_id_status { struct bt_mesh_cfg_node_id_status {
u8_t status; uint8_t status;
u16_t net_idx; uint16_t net_idx;
u8_t identity; uint8_t identity;
}; };
struct bt_mesh_cfg_mod_app_list { struct bt_mesh_cfg_mod_app_list {
u8_t status; uint8_t status;
u16_t elem_addr; uint16_t elem_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
struct net_buf_simple *app_idx; struct net_buf_simple *app_idx;
}; };
struct bt_mesh_cfg_key_refresh_status { struct bt_mesh_cfg_key_refresh_status {
u8_t status; uint8_t status;
u16_t net_idx; uint16_t net_idx;
u8_t phase; uint8_t phase;
}; };
struct bt_mesh_cfg_lpn_pollto_status { struct bt_mesh_cfg_lpn_pollto_status {
u16_t lpn_addr; uint16_t lpn_addr;
s32_t timeout; int32_t timeout;
}; };
int bt_mesh_cfg_mod_pub_va_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_pub_va_set(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, uint16_t elem_addr, uint16_t mod_id,
u16_t cid, const u8_t label[16], uint16_t cid, const uint8_t label[16],
struct bt_mesh_cfg_mod_pub *pub); struct bt_mesh_cfg_mod_pub *pub);
int bt_mesh_cfg_mod_sub_del_all(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_del_all(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid); uint16_t elem_addr, uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_sub_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id); uint16_t elem_addr, uint16_t mod_id);
int bt_mesh_cfg_mod_sub_get_vnd(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_sub_get_vnd(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid); uint16_t elem_addr, uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_net_key_update(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_net_key_update(bt_mesh_client_common_param_t *param,
u16_t net_idx, const u8_t net_key[16]); uint16_t net_idx, const uint8_t net_key[16]);
int bt_mesh_cfg_net_key_delete(bt_mesh_client_common_param_t *param, u16_t net_idx); int bt_mesh_cfg_net_key_delete(bt_mesh_client_common_param_t *param, uint16_t net_idx);
int bt_mesh_cfg_net_key_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_net_key_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_app_key_update(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_update(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx, uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]); const uint8_t app_key[16]);
int bt_mesh_cfg_app_key_delete(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_app_key_delete(bt_mesh_client_common_param_t *param,
u16_t net_idx, u16_t app_idx); uint16_t net_idx, uint16_t app_idx);
int bt_mesh_cfg_app_key_get(bt_mesh_client_common_param_t *param, u16_t net_idx); int bt_mesh_cfg_app_key_get(bt_mesh_client_common_param_t *param, uint16_t net_idx);
int bt_mesh_cfg_node_identity_get(bt_mesh_client_common_param_t *param, u16_t net_idx); int bt_mesh_cfg_node_identity_get(bt_mesh_client_common_param_t *param, uint16_t net_idx);
int bt_mesh_cfg_node_identity_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_node_identity_set(bt_mesh_client_common_param_t *param,
u16_t net_idx, u8_t identity); uint16_t net_idx, uint8_t identity);
int bt_mesh_cfg_mod_app_unbind(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_unbind(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t app_idx, uint16_t elem_addr, uint16_t app_idx,
u16_t mod_id, u16_t cid); uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_mod_app_get(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_get(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id); uint16_t elem_addr, uint16_t mod_id);
int bt_mesh_cfg_mod_app_get_vnd(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_mod_app_get_vnd(bt_mesh_client_common_param_t *param,
u16_t elem_addr, u16_t mod_id, u16_t cid); uint16_t elem_addr, uint16_t mod_id, uint16_t cid);
int bt_mesh_cfg_kr_phase_get(bt_mesh_client_common_param_t *param, u16_t net_idx); int bt_mesh_cfg_kr_phase_get(bt_mesh_client_common_param_t *param, uint16_t net_idx);
int bt_mesh_cfg_kr_phase_set(bt_mesh_client_common_param_t *param, int bt_mesh_cfg_kr_phase_set(bt_mesh_client_common_param_t *param,
u16_t net_idx, u8_t transition); uint16_t net_idx, uint8_t transition);
int bt_mesh_cfg_lpn_timeout_get(bt_mesh_client_common_param_t *param, u16_t lpn_addr); int bt_mesh_cfg_lpn_timeout_get(bt_mesh_client_common_param_t *param, uint16_t lpn_addr);
int bt_mesh_cfg_net_transmit_get(bt_mesh_client_common_param_t *param); int bt_mesh_cfg_net_transmit_get(bt_mesh_client_common_param_t *param);
int bt_mesh_cfg_net_transmit_set(bt_mesh_client_common_param_t *param, u8_t transmit); int bt_mesh_cfg_net_transmit_set(bt_mesh_client_common_param_t *param, uint8_t transmit);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -27,38 +27,38 @@ extern "C" {
struct bt_mesh_cfg_srv { struct bt_mesh_cfg_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
u8_t net_transmit; /* Network Transmit state */ uint8_t net_transmit; /* Network Transmit state */
u8_t relay; /* Relay Mode state */ uint8_t relay; /* Relay Mode state */
u8_t relay_retransmit; /* Relay Retransmit state */ uint8_t relay_retransmit; /* Relay Retransmit state */
u8_t beacon; /* Secure Network Beacon state */ uint8_t beacon; /* Secure Network Beacon state */
u8_t gatt_proxy; /* GATT Proxy state */ uint8_t gatt_proxy; /* GATT Proxy state */
u8_t frnd; /* Friend state */ uint8_t frnd; /* Friend state */
u8_t default_ttl; /* Default TTL */ uint8_t default_ttl; /* Default TTL */
/* Heartbeat Publication */ /* Heartbeat Publication */
struct bt_mesh_hb_pub { struct bt_mesh_hb_pub {
struct k_delayed_work timer; struct k_delayed_work timer;
u16_t dst; uint16_t dst;
u16_t count; uint16_t count;
u8_t period; uint8_t period;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx; uint16_t net_idx;
} hb_pub; } hb_pub;
/* Heartbeat Subscription */ /* Heartbeat Subscription */
struct bt_mesh_hb_sub { struct bt_mesh_hb_sub {
s64_t expiry; int64_t expiry;
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u16_t count; uint16_t count;
u8_t min_hops; uint8_t min_hops;
u8_t max_hops; uint8_t max_hops;
/* Optional subscription tracking function */ /* Optional subscription tracking function */
void (*func)(u8_t hops, u16_t feat); void (*func)(uint8_t hops, uint16_t feat);
} hb_sub; } hb_sub;
}; };
@ -71,144 +71,144 @@ extern const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb;
typedef union { typedef union {
struct { struct {
u8_t beacon; uint8_t beacon;
} cfg_beacon_set; } cfg_beacon_set;
struct { struct {
u8_t ttl; uint8_t ttl;
} cfg_default_ttl_set; } cfg_default_ttl_set;
struct { struct {
u8_t gatt_proxy; uint8_t gatt_proxy;
} cfg_gatt_proxy_set; } cfg_gatt_proxy_set;
struct { struct {
u8_t relay; uint8_t relay;
u8_t retransmit; uint8_t retransmit;
} cfg_relay_set; } cfg_relay_set;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t pub_addr; uint16_t pub_addr;
u16_t app_idx; uint16_t app_idx;
bool cred_flag; bool cred_flag;
u8_t ttl; uint8_t ttl;
u8_t period; uint8_t period;
u8_t transmit; uint8_t transmit;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_pub_set; } cfg_mod_pub_set;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u8_t pub_addr[16]; uint8_t pub_addr[16];
u16_t app_idx; uint16_t app_idx;
bool cred_flag; bool cred_flag;
u8_t ttl; uint8_t ttl;
u8_t period; uint8_t period;
u8_t transmit; uint8_t transmit;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_pub_va_set; } cfg_mod_pub_va_set;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t sub_addr; uint16_t sub_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_add; } cfg_mod_sub_add;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u8_t sub_addr[16]; uint8_t sub_addr[16];
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_va_add; } cfg_mod_sub_va_add;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t sub_addr; uint16_t sub_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_delete; } cfg_mod_sub_delete;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u8_t sub_addr[16]; uint8_t sub_addr[16];
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_va_delete; } cfg_mod_sub_va_delete;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t sub_addr; uint16_t sub_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_overwrite; } cfg_mod_sub_overwrite;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u8_t sub_addr[16]; uint8_t sub_addr[16];
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_va_overwrite; } cfg_mod_sub_va_overwrite;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_sub_delete_all; } cfg_mod_sub_delete_all;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u8_t net_key[16]; uint8_t net_key[16];
} cfg_netkey_add; } cfg_netkey_add;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u8_t net_key[16]; uint8_t net_key[16];
} cfg_netkey_update; } cfg_netkey_update;
struct { struct {
u16_t net_idx; uint16_t net_idx;
} cfg_netkey_delete; } cfg_netkey_delete;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u16_t app_idx; uint16_t app_idx;
u8_t app_key[16]; uint8_t app_key[16];
} cfg_appkey_add; } cfg_appkey_add;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u16_t app_idx; uint16_t app_idx;
u8_t app_key[16]; uint8_t app_key[16];
} cfg_appkey_update; } cfg_appkey_update;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u16_t app_idx; uint16_t app_idx;
} cfg_appkey_delete; } cfg_appkey_delete;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u8_t identity; uint8_t identity;
} cfg_node_identity_set; } cfg_node_identity_set;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t app_idx; uint16_t app_idx;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_app_bind; } cfg_mod_app_bind;
struct { struct {
u16_t elem_addr; uint16_t elem_addr;
u16_t app_idx; uint16_t app_idx;
u16_t cid; uint16_t cid;
u16_t mod_id; uint16_t mod_id;
} cfg_mod_app_unbind; } cfg_mod_app_unbind;
struct { struct {
u8_t frnd; uint8_t frnd;
} cfg_friend_set; } cfg_friend_set;
struct { struct {
u16_t net_idx; uint16_t net_idx;
u8_t kr_phase; uint8_t kr_phase;
} cfg_kr_phase_set; } cfg_kr_phase_set;
struct { struct {
u16_t dst; uint16_t dst;
u8_t count; uint8_t count;
u8_t period; uint8_t period;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx; uint16_t net_idx;
} cfg_hb_pub_set; } cfg_hb_pub_set;
struct { struct {
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u8_t period; uint8_t period;
} cfg_hb_sub_set; } cfg_hb_sub_set;
struct { struct {
u8_t transmit; uint8_t transmit;
} cfg_net_transmit_set; } cfg_net_transmit_set;
} bt_mesh_cfg_server_state_change_t; } bt_mesh_cfg_server_state_change_t;

View File

@ -35,35 +35,35 @@ extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb;
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_HEALTH_CLI, \ BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_HEALTH_CLI, \
bt_mesh_health_cli_op, NULL, cli_data, &bt_mesh_health_cli_cb) bt_mesh_health_cli_op, NULL, cli_data, &bt_mesh_health_cli_cb)
int bt_mesh_health_fault_get(bt_mesh_client_common_param_t *param, u16_t cid); int bt_mesh_health_fault_get(bt_mesh_client_common_param_t *param, uint16_t cid);
int bt_mesh_health_fault_clear(bt_mesh_client_common_param_t *param, int bt_mesh_health_fault_clear(bt_mesh_client_common_param_t *param,
u16_t cid, bool need_ack); uint16_t cid, bool need_ack);
int bt_mesh_health_fault_test(bt_mesh_client_common_param_t *param, int bt_mesh_health_fault_test(bt_mesh_client_common_param_t *param,
u16_t cid, u8_t test_id, bool need_ack); uint16_t cid, uint8_t test_id, bool need_ack);
int bt_mesh_health_period_get(bt_mesh_client_common_param_t *param); int bt_mesh_health_period_get(bt_mesh_client_common_param_t *param);
int bt_mesh_health_period_set(bt_mesh_client_common_param_t *param, int bt_mesh_health_period_set(bt_mesh_client_common_param_t *param,
u8_t divisor, bool need_ack); uint8_t divisor, bool need_ack);
int bt_mesh_health_attention_get(bt_mesh_client_common_param_t *param); int bt_mesh_health_attention_get(bt_mesh_client_common_param_t *param);
int bt_mesh_health_attention_set(bt_mesh_client_common_param_t *param, int bt_mesh_health_attention_set(bt_mesh_client_common_param_t *param,
u8_t attention, bool need_ack); uint8_t attention, bool need_ack);
/* Health Client Status Message Context */ /* Health Client Status Message Context */
struct bt_mesh_health_current_status { struct bt_mesh_health_current_status {
u8_t test_id; uint8_t test_id;
u16_t cid; uint16_t cid;
struct net_buf_simple *fault_array; struct net_buf_simple *fault_array;
}; };
struct bt_mesh_health_fault_status { struct bt_mesh_health_fault_status {
u8_t test_id; uint8_t test_id;
u16_t cid; uint16_t cid;
struct net_buf_simple *fault_array; struct net_buf_simple *fault_array;
}; };

View File

@ -25,14 +25,14 @@ extern "C" {
struct bt_mesh_health_srv_cb { struct bt_mesh_health_srv_cb {
/* Clear registered faults */ /* Clear registered faults */
void (*fault_clear)(struct bt_mesh_model *model, u16_t company_id); void (*fault_clear)(struct bt_mesh_model *model, uint16_t company_id);
/* Run a specific test */ /* Run a specific test */
void (*fault_test)(struct bt_mesh_model *model, u8_t test_id, void (*fault_test)(struct bt_mesh_model *model, uint8_t test_id,
u16_t company_id); uint16_t company_id);
/* Attention on */ /* Attention on */
void (*attn_on)(struct bt_mesh_model *model, u8_t time); void (*attn_on)(struct bt_mesh_model *model, uint8_t time);
/* Attention off */ /* Attention off */
void (*attn_off)(struct bt_mesh_model *model); void (*attn_off)(struct bt_mesh_model *model);
@ -49,12 +49,12 @@ struct bt_mesh_health_srv_cb {
BLE_MESH_MODEL_PUB_DEFINE(_name, NULL, (1 + 3 + (_max_faults))) BLE_MESH_MODEL_PUB_DEFINE(_name, NULL, (1 + 3 + (_max_faults)))
struct bt_mesh_health_test { struct bt_mesh_health_test {
u8_t id_count; /* Number of Health self-test ID */ uint8_t id_count; /* Number of Health self-test ID */
const u8_t *test_ids; /* Array of Health self-test IDs */ const uint8_t *test_ids; /* Array of Health self-test IDs */
u16_t company_id; /* Company ID used to identify the Health Fault state */ uint16_t company_id; /* Company ID used to identify the Health Fault state */
u8_t prev_test_id; /* Most currently performed test id */ uint8_t prev_test_id; /* Most currently performed test id */
u8_t curr_faults[32]; /* Array of current faults */ uint8_t curr_faults[32]; /* Array of current faults */
u8_t reg_faults[32]; /* Array of registered faults */ uint8_t reg_faults[32]; /* Array of registered faults */
} __attribute__((packed)); } __attribute__((packed));
/** Mesh Health Server Model Context */ /** Mesh Health Server Model Context */

View File

@ -58,13 +58,13 @@ extern "C" {
/** Abstraction that describes a Mesh Element */ /** Abstraction that describes a Mesh Element */
struct bt_mesh_elem { struct bt_mesh_elem {
/* Unicast Address. Set at runtime during provisioning. */ /* Unicast Address. Set at runtime during provisioning. */
u16_t addr; uint16_t addr;
/* Location Descriptor (GATT Bluetooth Namespace Descriptors) */ /* Location Descriptor (GATT Bluetooth Namespace Descriptors) */
const u16_t loc; const uint16_t loc;
const u8_t model_count; const uint8_t model_count;
const u8_t vnd_model_count; const uint8_t vnd_model_count;
struct bt_mesh_model *const models; struct bt_mesh_model *const models;
struct bt_mesh_model *const vnd_models; struct bt_mesh_model *const vnd_models;
@ -133,32 +133,32 @@ struct bt_mesh_elem {
/** Message sending context. */ /** Message sending context. */
struct bt_mesh_msg_ctx { struct bt_mesh_msg_ctx {
/** NetKey Index of the subnet to send the message on. */ /** NetKey Index of the subnet to send the message on. */
u16_t net_idx; uint16_t net_idx;
/** AppKey Index to encrypt the message with. */ /** AppKey Index to encrypt the message with. */
u16_t app_idx; uint16_t app_idx;
/** Remote address. */ /** Remote address. */
u16_t addr; uint16_t addr;
/** Destination address of a received message. Not used for sending. */ /** Destination address of a received message. Not used for sending. */
u16_t recv_dst; uint16_t recv_dst;
/** RSSI of received packet. Not used for sending. */ /** RSSI of received packet. Not used for sending. */
s8_t recv_rssi; int8_t recv_rssi;
/** Received TTL value. Not used for sending. */ /** Received TTL value. Not used for sending. */
u8_t recv_ttl: 7; uint8_t recv_ttl: 7;
/** Force sending reliably by using segment acknowledgement */ /** Force sending reliably by using segment acknowledgement */
u8_t send_rel: 1; uint8_t send_rel: 1;
/** TTL, or BLE_MESH_TTL_DEFAULT for default TTL. */ /** TTL, or BLE_MESH_TTL_DEFAULT for default TTL. */
u8_t send_ttl; uint8_t send_ttl;
/** Change by Espressif, opcode of a received message. /** Change by Espressif, opcode of a received message.
* Not used for sending message. */ * Not used for sending message. */
u32_t recv_op; uint32_t recv_op;
/** Change by Espressif, model corresponds to the message */ /** Change by Espressif, model corresponds to the message */
struct bt_mesh_model *model; struct bt_mesh_model *model;
@ -170,7 +170,7 @@ struct bt_mesh_msg_ctx {
struct bt_mesh_model_op { struct bt_mesh_model_op {
/* OpCode encoded using the BLE_MESH_MODEL_OP_* macros */ /* OpCode encoded using the BLE_MESH_MODEL_OP_* macros */
const u32_t opcode; const uint32_t opcode;
/* Minimum required message length */ /* Minimum required message length */
const size_t min_len; const size_t min_len;
@ -311,7 +311,7 @@ struct bt_mesh_model_op {
* *
* @return Transmission count (actual transmissions is N + 1). * @return Transmission count (actual transmissions is N + 1).
*/ */
#define BLE_MESH_TRANSMIT_COUNT(transmit) (((transmit) & (u8_t)BIT_MASK(3))) #define BLE_MESH_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3)))
/** @def BLE_MESH_TRANSMIT_INT /** @def BLE_MESH_TRANSMIT_INT
* *
@ -361,19 +361,19 @@ struct bt_mesh_model_pub {
/** The model the context belongs to. Initialized by the stack. */ /** The model the context belongs to. Initialized by the stack. */
struct bt_mesh_model *mod; struct bt_mesh_model *mod;
u16_t addr; /**< Publish Address. */ uint16_t addr; /**< Publish Address. */
u16_t key:12, /**< Publish AppKey Index. */ uint16_t key:12, /**< Publish AppKey Index. */
cred:1, /**< Friendship Credentials Flag. */ cred:1, /**< Friendship Credentials Flag. */
send_rel:1; /**< Force reliable sending (segment acks) */ send_rel:1; /**< Force reliable sending (segment acks) */
u8_t ttl; /**< Publish Time to Live. */ uint8_t ttl; /**< Publish Time to Live. */
u8_t retransmit; /**< Retransmit Count & Interval Steps. */ uint8_t retransmit; /**< Retransmit Count & Interval Steps. */
u8_t period; /**< Publish Period. */ uint8_t period; /**< Publish Period. */
u8_t period_div:4, /**< Divisor for the Period. */ uint8_t period_div:4, /**< Divisor for the Period. */
fast_period:1,/**< Use FastPeriodDivisor */ fast_period:1, /**< Use FastPeriodDivisor */
count:3; /**< Retransmissions left. */ count:3; /**< Retransmissions left. */
u32_t period_start; /**< Start of the current period. */ uint32_t period_start; /**< Start of the current period. */
/** @brief Publication buffer, containing the publication message. /** @brief Publication buffer, containing the publication message.
* *
@ -405,7 +405,7 @@ struct bt_mesh_model_pub {
struct k_delayed_work timer; struct k_delayed_work timer;
/* Change by Espressif, role of the device going to publish messages */ /* Change by Espressif, role of the device going to publish messages */
u8_t dev_role; uint8_t dev_role;
}; };
/** @def BLE_MESH_MODEL_PUB_DEFINE /** @def BLE_MESH_MODEL_PUB_DEFINE
@ -458,17 +458,17 @@ struct bt_mesh_model_cb {
/** Abstraction that describes a Mesh Model instance */ /** Abstraction that describes a Mesh Model instance */
struct bt_mesh_model { struct bt_mesh_model {
union { union {
const u16_t id; const uint16_t id;
struct { struct {
u16_t company; uint16_t company;
u16_t id; uint16_t id;
} vnd; } vnd;
}; };
/* Internal information, mainly for persistent storage */ /* Internal information, mainly for persistent storage */
u8_t elem_idx; /* Belongs to Nth element */ uint8_t elem_idx; /* Belongs to Nth element */
u8_t model_idx; /* Is the Nth model in the element */ uint8_t model_idx; /* Is the Nth model in the element */
u16_t flags; /* Information about what has changed */ uint16_t flags; /* Information about what has changed */
/* The Element this Model belongs to */ /* The Element this Model belongs to */
struct bt_mesh_elem *elem; struct bt_mesh_elem *elem;
@ -477,10 +477,10 @@ struct bt_mesh_model {
struct bt_mesh_model_pub *const pub; struct bt_mesh_model_pub *const pub;
/* AppKey List */ /* AppKey List */
u16_t keys[CONFIG_BLE_MESH_MODEL_KEY_COUNT]; uint16_t keys[CONFIG_BLE_MESH_MODEL_KEY_COUNT];
/* Subscription List (group or virtual addresses) */ /* Subscription List (group or virtual addresses) */
u16_t groups[CONFIG_BLE_MESH_MODEL_GROUP_COUNT]; uint16_t groups[CONFIG_BLE_MESH_MODEL_GROUP_COUNT];
/** Opcode handler list */ /** Opcode handler list */
const struct bt_mesh_model_op *const op; const struct bt_mesh_model_op *const op;
@ -493,11 +493,11 @@ struct bt_mesh_model {
}; };
struct bt_mesh_send_cb { struct bt_mesh_send_cb {
void (*start)(u16_t duration, int err, void *cb_data); void (*start)(uint16_t duration, int err, void *cb_data);
void (*end)(int err, void *cb_data); void (*end)(int err, void *cb_data);
}; };
void bt_mesh_model_msg_init(struct net_buf_simple *msg, u32_t opcode); void bt_mesh_model_msg_init(struct net_buf_simple *msg, uint32_t opcode);
/** Special TTL value to request using configured default TTL */ /** Special TTL value to request using configured default TTL */
#define BLE_MESH_TTL_DEFAULT 0xff #define BLE_MESH_TTL_DEFAULT 0xff
@ -555,7 +555,7 @@ struct bt_mesh_elem *bt_mesh_model_elem(struct bt_mesh_model *mod);
* @return A pointer to the Mesh model matching the given parameters, or NULL * @return A pointer to the Mesh model matching the given parameters, or NULL
* if no SIG model with the given ID exists in the given element. * if no SIG model with the given ID exists in the given element.
*/ */
struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, u16_t id); struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, uint16_t id);
/** @brief Find a vendor model. /** @brief Find a vendor model.
* *
@ -567,7 +567,7 @@ struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, u16_t id);
* if no vendor model with the given ID exists in the given element. * if no vendor model with the given ID exists in the given element.
*/ */
struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem, struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
u16_t company, u16_t id); uint16_t company, uint16_t id);
/** @brief Get whether the model is in the primary element of the device. /** @brief Get whether the model is in the primary element of the device.
* *
@ -582,9 +582,9 @@ static inline bool bt_mesh_model_in_primary(const struct bt_mesh_model *mod)
/** Node Composition */ /** Node Composition */
struct bt_mesh_comp { struct bt_mesh_comp {
u16_t cid; uint16_t cid;
u16_t pid; uint16_t pid;
u16_t vid; uint16_t vid;
size_t elem_count; size_t elem_count;
struct bt_mesh_elem *elem; struct bt_mesh_elem *elem;

View File

@ -313,7 +313,7 @@ struct bt_mesh_gatt_char {
/** Characteristic UUID. */ /** Characteristic UUID. */
const struct bt_mesh_uuid *uuid; const struct bt_mesh_uuid *uuid;
/** Characteristic properties. */ /** Characteristic properties. */
u8_t properties; uint8_t properties;
}; };
/** @brief GATT Service structure */ /** @brief GATT Service structure */
@ -321,19 +321,19 @@ struct bt_mesh_gatt_service {
/** Service Attributes */ /** Service Attributes */
struct bt_mesh_gatt_attr *attrs; struct bt_mesh_gatt_attr *attrs;
/** Service Attribute count */ /** Service Attribute count */
u16_t attr_count; uint16_t attr_count;
sys_snode_t node; sys_snode_t node;
}; };
struct bt_mesh_ecb_param { struct bt_mesh_ecb_param {
u8_t key[16]; uint8_t key[16];
u8_t clear_text[16]; uint8_t clear_text[16];
u8_t cipher_text[16]; uint8_t cipher_text[16];
} __packed; } __packed;
typedef struct { typedef struct {
u8_t type; uint8_t type;
u8_t val[6]; uint8_t val[6];
} bt_mesh_addr_t; } bt_mesh_addr_t;
/** Description of different data types that can be encoded into /** Description of different data types that can be encoded into
@ -341,9 +341,9 @@ typedef struct {
* bt_le_adv_start() function. * bt_le_adv_start() function.
*/ */
struct bt_mesh_adv_data { struct bt_mesh_adv_data {
u8_t type; uint8_t type;
u8_t data_len; uint8_t data_len;
const u8_t *data; const uint8_t *data;
}; };
/** @brief Helper to declare elements of bt_data arrays /** @brief Helper to declare elements of bt_data arrays
@ -360,7 +360,7 @@ struct bt_mesh_adv_data {
{ \ { \
.type = (_type), \ .type = (_type), \
.data_len = (_data_len), \ .data_len = (_data_len), \
.data = (const u8_t *)(_data), \ .data = (const uint8_t *)(_data), \
} }
/** @brief Helper to declare elements of bt_data arrays /** @brief Helper to declare elements of bt_data arrays
@ -372,19 +372,19 @@ struct bt_mesh_adv_data {
* @param _bytes Variable number of single-byte parameters * @param _bytes Variable number of single-byte parameters
*/ */
#define BLE_MESH_ADV_DATA_BYTES(_type, _bytes...) \ #define BLE_MESH_ADV_DATA_BYTES(_type, _bytes...) \
BLE_MESH_ADV_DATA(_type, ((u8_t []) { _bytes }), \ BLE_MESH_ADV_DATA(_type, ((uint8_t []) { _bytes }), \
sizeof((u8_t []) { _bytes })) sizeof((uint8_t []) { _bytes }))
/* BLE Mesh Advertising Parameters */ /* BLE Mesh Advertising Parameters */
struct bt_mesh_adv_param { struct bt_mesh_adv_param {
/** Bit-field of advertising options */ /** Bit-field of advertising options */
u8_t options; uint8_t options;
/** Minimum Advertising Interval (N * 0.625) */ /** Minimum Advertising Interval (N * 0.625) */
u16_t interval_min; uint16_t interval_min;
/** Maximum Advertising Interval (N * 0.625) */ /** Maximum Advertising Interval (N * 0.625) */
u16_t interval_max; uint16_t interval_max;
}; };
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV #if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
@ -394,47 +394,47 @@ enum bt_mesh_ble_adv_priority {
}; };
struct bt_mesh_ble_adv_param { struct bt_mesh_ble_adv_param {
u16_t interval; /* Advertising interval */ uint16_t interval; /* Advertising interval */
u8_t adv_type; /* Advertising type */ uint8_t adv_type; /* Advertising type */
u8_t own_addr_type; /* Own address type */ uint8_t own_addr_type; /* Own address type */
u8_t peer_addr_type; /* Peer address type */ uint8_t peer_addr_type; /* Peer address type */
u8_t peer_addr[6]; /* Peer address */ uint8_t peer_addr[6]; /* Peer address */
u16_t duration; /* Duration is milliseconds */ uint16_t duration; /* Duration is milliseconds */
u16_t period; /* Period in milliseconds */ uint16_t period; /* Period in milliseconds */
u16_t count; /* Number of advertising duration */ uint16_t count; /* Number of advertising duration */
u8_t priority:2; /* Priority of BLE advertising packet */ uint8_t priority:2; /* Priority of BLE advertising packet */
}; };
struct bt_mesh_ble_adv_data { struct bt_mesh_ble_adv_data {
u8_t adv_data_len; /* Advertising data length */ uint8_t adv_data_len; /* Advertising data length */
u8_t adv_data[31]; /* Advertising data */ uint8_t adv_data[31]; /* Advertising data */
u8_t scan_rsp_data_len; /* Scan response data length */ uint8_t scan_rsp_data_len; /* Scan response data length */
u8_t scan_rsp_data[31]; /* Scan response data */ uint8_t scan_rsp_data[31]; /* Scan response data */
}; };
#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */ #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
/* BLE Mesh scan parameters */ /* BLE Mesh scan parameters */
struct bt_mesh_scan_param { struct bt_mesh_scan_param {
/** Scan type (BLE_MESH_SCAN_ACTIVE or BLE_MESH_SCAN_PASSIVE) */ /** Scan type (BLE_MESH_SCAN_ACTIVE or BLE_MESH_SCAN_PASSIVE) */
u8_t type; uint8_t type;
/** Duplicate filtering (BLE_MESH_SCAN_FILTER_DUP_ENABLE or /** Duplicate filtering (BLE_MESH_SCAN_FILTER_DUP_ENABLE or
* BLE_MESH_SCAN_FILTER_DUP_DISABLE) * BLE_MESH_SCAN_FILTER_DUP_DISABLE)
*/ */
u8_t filter_dup; uint8_t filter_dup;
/** Scan interval (N * 0.625 ms) */ /** Scan interval (N * 0.625 ms) */
u16_t interval; uint16_t interval;
/** Scan window (N * 0.625 ms) */ /** Scan window (N * 0.625 ms) */
u16_t window; uint16_t window;
/** BLE scan filter policy */ /** BLE scan filter policy */
u8_t scan_fil_policy; uint8_t scan_fil_policy;
}; };
struct bt_mesh_conn { struct bt_mesh_conn {
u16_t handle; uint16_t handle;
bt_mesh_atomic_t ref; bt_mesh_atomic_t ref;
}; };
@ -449,8 +449,8 @@ struct bt_mesh_conn {
* @param adv_type Type of advertising response from advertiser. * @param adv_type Type of advertising response from advertiser.
* @param data Buffer containing advertiser data. * @param data Buffer containing advertiser data.
*/ */
typedef void bt_mesh_scan_cb_t(const bt_mesh_addr_t *addr, s8_t rssi, typedef void bt_mesh_scan_cb_t(const bt_mesh_addr_t *addr, int8_t rssi,
u8_t adv_type, struct net_buf_simple *buf); uint8_t adv_type, struct net_buf_simple *buf);
/* @typedef bt_mesh_dh_key_cb_t /* @typedef bt_mesh_dh_key_cb_t
* @brief Callback type for DH Key calculation. * @brief Callback type for DH Key calculation.
@ -462,7 +462,7 @@ typedef void bt_mesh_scan_cb_t(const bt_mesh_addr_t *addr, s8_t rssi,
* *
* @return The DH Key, or NULL in case of failure. * @return The DH Key, or NULL in case of failure.
*/ */
typedef void (*bt_mesh_dh_key_cb_t)(const u8_t key[32], const u8_t idx); typedef void (*bt_mesh_dh_key_cb_t)(const uint8_t key[32], const uint8_t idx);
/** @typedef bt_mesh_gatt_attr_func_t /** @typedef bt_mesh_gatt_attr_func_t
* @brief Attribute iterator callback. * @brief Attribute iterator callback.
@ -473,8 +473,8 @@ typedef void (*bt_mesh_dh_key_cb_t)(const u8_t key[32], const u8_t idx);
* @return BLE_MESH_GATT_ITER_CONTINUE if should continue to the next attribute * @return BLE_MESH_GATT_ITER_CONTINUE if should continue to the next attribute
* or BLE_MESH_GATT_ITER_STOP to stop. * or BLE_MESH_GATT_ITER_STOP to stop.
*/ */
typedef u8_t (*bt_mesh_gatt_attr_func_t)(const struct bt_mesh_gatt_attr *attr, typedef uint8_t (*bt_mesh_gatt_attr_func_t)(const struct bt_mesh_gatt_attr *attr,
void *user_data); void *user_data);
/** @brief Connection callback structure. /** @brief Connection callback structure.
* *
@ -496,7 +496,7 @@ struct bt_mesh_conn_cb {
* @param conn New connection object. * @param conn New connection object.
* @param err HCI error. Zero for success, non-zero otherwise. * @param err HCI error. Zero for success, non-zero otherwise.
*/ */
void (*connected)(struct bt_mesh_conn *conn, u8_t err); void (*connected)(struct bt_mesh_conn *conn, uint8_t err);
/** @brief A connection has been disconnected. /** @brief A connection has been disconnected.
* *
@ -506,21 +506,21 @@ struct bt_mesh_conn_cb {
* @param conn Connection object. * @param conn Connection object.
* @param reason HCI reason for the disconnection. * @param reason HCI reason for the disconnection.
*/ */
void (*disconnected)(struct bt_mesh_conn *conn, u8_t reason); void (*disconnected)(struct bt_mesh_conn *conn, uint8_t reason);
}; };
struct bt_mesh_prov_conn_cb { struct bt_mesh_prov_conn_cb {
void (*connected)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int id); void (*connected)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int id);
void (*disconnected)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, u8_t reason); void (*disconnected)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, uint8_t reason);
ssize_t (*prov_write_descr)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn); ssize_t (*prov_write_descr)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn);
ssize_t (*prov_notify)(struct bt_mesh_conn *conn, u8_t *data, u16_t len); ssize_t (*prov_notify)(struct bt_mesh_conn *conn, uint8_t *data, uint16_t len);
ssize_t (*proxy_write_descr)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn); ssize_t (*proxy_write_descr)(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn);
ssize_t (*proxy_notify)(struct bt_mesh_conn *conn, u8_t *data, u16_t len); ssize_t (*proxy_notify)(struct bt_mesh_conn *conn, uint8_t *data, uint16_t len);
}; };
/** @brief GATT Attribute structure. */ /** @brief GATT Attribute structure. */
@ -541,8 +541,8 @@ struct bt_mesh_gatt_attr {
*/ */
ssize_t (*read)(struct bt_mesh_conn *conn, ssize_t (*read)(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, void *buf, uint16_t len,
u16_t offset); uint16_t offset);
/** Attribute write callback /** Attribute write callback
* *
@ -558,15 +558,15 @@ struct bt_mesh_gatt_attr {
*/ */
ssize_t (*write)(struct bt_mesh_conn *conn, ssize_t (*write)(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *buf, u16_t len, const void *buf, uint16_t len,
u16_t offset, u8_t flags); uint16_t offset, uint8_t flags);
/** Attribute user data */ /** Attribute user data */
void *user_data; void *user_data;
/** Attribute handle */ /** Attribute handle */
u16_t handle; uint16_t handle;
/** Attribute permissions */ /** Attribute permissions */
u8_t perm; uint8_t perm;
}; };
/** @def BLE_MESH_GATT_PRIMARY_SERVICE /** @def BLE_MESH_GATT_PRIMARY_SERVICE
@ -688,12 +688,12 @@ typedef enum {
struct bt_mesh_white_list { struct bt_mesh_white_list {
bool add_remove; bool add_remove;
u8_t remote_bda[BLE_MESH_ADDR_LEN]; uint8_t remote_bda[BLE_MESH_ADDR_LEN];
u8_t addr_type; uint8_t addr_type;
/* For Bluedroid host, this callback is used to notify the /* For Bluedroid host, this callback is used to notify the
* result of updating white list. * result of updating white list.
*/ */
void (*update_wl_comp_cb)(u8_t status, bt_mesh_wl_operation wl_operation); void (*update_wl_comp_cb)(uint8_t status, bt_mesh_wl_operation wl_operation);
}; };
int bt_le_update_white_list(struct bt_mesh_white_list *wl); int bt_le_update_white_list(struct bt_mesh_white_list *wl);
@ -701,7 +701,7 @@ int bt_le_update_white_list(struct bt_mesh_white_list *wl);
void bt_mesh_gatts_conn_cb_register(struct bt_mesh_conn_cb *cb); void bt_mesh_gatts_conn_cb_register(struct bt_mesh_conn_cb *cb);
void bt_mesh_gatts_conn_cb_deregister(void); void bt_mesh_gatts_conn_cb_deregister(void);
int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, u8_t reason); int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, uint8_t reason);
int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc); int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc);
int bt_mesh_gatts_service_deregister(struct bt_mesh_gatt_service *svc); int bt_mesh_gatts_service_deregister(struct bt_mesh_gatt_service *svc);
@ -710,26 +710,26 @@ int bt_mesh_gatts_service_unregister(struct bt_mesh_gatt_service *svc);
ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset); void *buf, uint16_t len, uint16_t offset);
ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t buf_len, u16_t offset, void *buf, uint16_t buf_len, uint16_t offset,
const void *value, u16_t value_len); const void *value, uint16_t value_len);
ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset); void *buf, uint16_t len, uint16_t offset);
ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset); void *buf, uint16_t len, uint16_t offset);
int bt_mesh_gatts_notify(struct bt_mesh_conn *conn, int bt_mesh_gatts_notify(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len); const void *data, uint16_t len);
u16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn); uint16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn);
/** APIs added by Espressif */ /** APIs added by Espressif */
int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc); int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc);
@ -740,21 +740,21 @@ int bt_mesh_gatts_set_local_device_name(const char *name);
void bt_mesh_gattc_conn_cb_register(struct bt_mesh_prov_conn_cb *cb); void bt_mesh_gattc_conn_cb_register(struct bt_mesh_prov_conn_cb *cb);
void bt_mesh_gattc_conn_cb_deregister(void); void bt_mesh_gattc_conn_cb_deregister(void);
u8_t bt_mesh_gattc_get_free_conn_count(void); uint8_t bt_mesh_gattc_get_free_conn_count(void);
u16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn); uint16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn);
int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, u16_t service_uuid); int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid);
void bt_gattc_conn_close(struct bt_mesh_conn *conn); void bt_gattc_conn_close(struct bt_mesh_conn *conn);
void bt_mesh_gattc_exchange_mtu(u8_t index); void bt_mesh_gattc_exchange_mtu(uint8_t index);
u16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn); uint16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn);
int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn, int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len); const void *data, uint16_t len);
void bt_mesh_gattc_disconnect(struct bt_mesh_conn *conn); void bt_mesh_gattc_disconnect(struct bt_mesh_conn *conn);
@ -769,19 +769,19 @@ void bt_mesh_adapt_init(void);
int bt_mesh_rand(void *buf, size_t len); int bt_mesh_rand(void *buf, size_t len);
void bt_mesh_set_private_key(const u8_t pri_key[32]); void bt_mesh_set_private_key(const uint8_t pri_key[32]);
const u8_t *bt_mesh_pub_key_get(void); const uint8_t *bt_mesh_pub_key_get(void);
bool bt_mesh_check_public_key(const uint8_t key[64]); bool bt_mesh_check_public_key(const uint8_t key[64]);
int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u8_t idx); int bt_mesh_dh_key_gen(const uint8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const uint8_t idx);
int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]); uint8_t enc_data[16]);
int bt_mesh_encrypt_be(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]); uint8_t enc_data[16]);
enum { enum {
BLE_MESH_EXCEP_LIST_ADD = 0, BLE_MESH_EXCEP_LIST_ADD = 0,
@ -806,7 +806,7 @@ enum {
BLE_MESH_EXCEP_CLEAN_ALL_LIST = 0xFFFF, BLE_MESH_EXCEP_CLEAN_ALL_LIST = 0xFFFF,
}; };
int bt_mesh_update_exceptional_list(u8_t sub_code, u8_t type, void *info); int bt_mesh_update_exceptional_list(uint8_t sub_code, uint8_t type, void *info);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -43,10 +43,10 @@ enum {
struct bt_mesh_dev_le { struct bt_mesh_dev_le {
/* LE features */ /* LE features */
u8_t features[8]; uint8_t features[8];
/* LE states */ /* LE states */
u64_t states; uint64_t states;
}; };
/* State tracking for the local Bluetooth controller */ /* State tracking for the local Bluetooth controller */
@ -55,14 +55,14 @@ struct bt_mesh_dev {
BLE_MESH_ATOMIC_DEFINE(flags, BLE_MESH_DEV_NUM_FLAGS); BLE_MESH_ATOMIC_DEFINE(flags, BLE_MESH_DEV_NUM_FLAGS);
/* Controller version & manufacturer information */ /* Controller version & manufacturer information */
u8_t hci_version; uint8_t hci_version;
u8_t lmp_version; uint8_t lmp_version;
u16_t hci_revision; uint16_t hci_revision;
u16_t lmp_subversion; uint16_t lmp_subversion;
u16_t manufacturer; uint16_t manufacturer;
/* LMP features (pages 0, 1, 2) */ /* LMP features (pages 0, 1, 2) */
u8_t features[BLE_MESH_LMP_FEAT_PAGES_COUNT][8]; uint8_t features[BLE_MESH_LMP_FEAT_PAGES_COUNT][8];
/* LE controller specific features */ /* LE controller specific features */
struct bt_mesh_dev_le le; struct bt_mesh_dev_le le;
@ -100,25 +100,25 @@ struct bt_mesh_dev {
#define BLE_MESH_HCI_OP_SET_ADV_PARAM BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0006) #define BLE_MESH_HCI_OP_SET_ADV_PARAM BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0006)
struct bt_mesh_hci_cp_set_adv_param { struct bt_mesh_hci_cp_set_adv_param {
u16_t min_interval; uint16_t min_interval;
u16_t max_interval; uint16_t max_interval;
u8_t type; uint8_t type;
u8_t own_addr_type; uint8_t own_addr_type;
bt_mesh_addr_t direct_addr; bt_mesh_addr_t direct_addr;
u8_t channel_map; uint8_t channel_map;
u8_t filter_policy; uint8_t filter_policy;
} __packed; } __packed;
#define BLE_MESH_HCI_OP_SET_ADV_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0008) #define BLE_MESH_HCI_OP_SET_ADV_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0008)
struct bt_mesh_hci_cp_set_adv_data { struct bt_mesh_hci_cp_set_adv_data {
u8_t len; uint8_t len;
u8_t data[31]; uint8_t data[31];
} __packed; } __packed;
#define BLE_MESH_HCI_OP_SET_SCAN_RSP_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0009) #define BLE_MESH_HCI_OP_SET_SCAN_RSP_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0009)
struct bt_mesh_hci_cp_set_scan_rsp_data { struct bt_mesh_hci_cp_set_scan_rsp_data {
u8_t len; uint8_t len;
u8_t data[31]; uint8_t data[31];
} __packed; } __packed;
/* Added by Espressif */ /* Added by Espressif */

View File

@ -70,7 +70,7 @@ typedef enum {
struct bt_mesh_prov { struct bt_mesh_prov {
#if CONFIG_BLE_MESH_NODE #if CONFIG_BLE_MESH_NODE
/** The UUID that's used when advertising as unprovisioned */ /** The UUID that's used when advertising as unprovisioned */
const u8_t *uuid; const uint8_t *uuid;
/** Optional URI. This will be advertised separately from the /** Optional URI. This will be advertised separately from the
* unprovisioned beacon, however the unprovisioned beacon will * unprovisioned beacon, however the unprovisioned beacon will
@ -93,19 +93,19 @@ struct bt_mesh_prov {
void (*oob_pub_key_cb)(void); void (*oob_pub_key_cb)(void);
/** Static OOB value */ /** Static OOB value */
const u8_t *static_val; const uint8_t *static_val;
/** Static OOB value length */ /** Static OOB value length */
u8_t static_val_len; uint8_t static_val_len;
/** Maximum size of Output OOB supported */ /** Maximum size of Output OOB supported */
u8_t output_size; uint8_t output_size;
/** Supported Output OOB Actions */ /** Supported Output OOB Actions */
u16_t output_actions; uint16_t output_actions;
/* Maximum size of Input OOB supported */ /* Maximum size of Input OOB supported */
u8_t input_size; uint8_t input_size;
/** Supported Input OOB Actions */ /** Supported Input OOB Actions */
u16_t input_actions; uint16_t input_actions;
/** @brief Output of a number is requested. /** @brief Output of a number is requested.
* *
@ -117,7 +117,7 @@ struct bt_mesh_prov {
* *
* @return Zero on success or negative error code otherwise * @return Zero on success or negative error code otherwise
*/ */
int (*output_number)(bt_mesh_output_action_t act, u32_t num); int (*output_number)(bt_mesh_output_action_t act, uint32_t num);
/** @brief Output of a string is requested. /** @brief Output of a string is requested.
* *
@ -144,7 +144,7 @@ struct bt_mesh_prov {
* *
* @return Zero on success or negative error code otherwise * @return Zero on success or negative error code otherwise
*/ */
int (*input)(bt_mesh_input_action_t act, u8_t size); int (*input)(bt_mesh_input_action_t act, uint8_t size);
/** @brief Provisioning link has been opened. /** @brief Provisioning link has been opened.
* *
@ -176,7 +176,7 @@ struct bt_mesh_prov {
* @param flags Key Refresh & IV Update flags * @param flags Key Refresh & IV Update flags
* @param iv_index IV Index. * @param iv_index IV Index.
*/ */
void (*complete)(u16_t net_idx, const u8_t net_key[16], u16_t addr, u8_t flags, u32_t iv_index); void (*complete)(uint16_t net_idx, const uint8_t net_key[16], uint16_t addr, uint8_t flags, uint32_t iv_index);
/** @brief Node has been reset. /** @brief Node has been reset.
* *
@ -191,28 +191,28 @@ struct bt_mesh_prov {
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
/* Provisioner device uuid */ /* Provisioner device uuid */
const u8_t *prov_uuid; const uint8_t *prov_uuid;
/* /*
* Primary element address of the provisioner. * Primary element address of the provisioner.
* No need to initialize it for fast provisioning. * No need to initialize it for fast provisioning.
*/ */
const u16_t prov_unicast_addr; const uint16_t prov_unicast_addr;
/* /*
* Starting unicast address going to assigned. * Starting unicast address going to assigned.
* No need to initialize it for fast provisioning. * No need to initialize it for fast provisioning.
*/ */
u16_t prov_start_address; uint16_t prov_start_address;
/* Attention timer contained in Provisioning Invite */ /* Attention timer contained in Provisioning Invite */
u8_t prov_attention; uint8_t prov_attention;
/* Provisioner provisioning Algorithm */ /* Provisioner provisioning Algorithm */
u8_t prov_algorithm; uint8_t prov_algorithm;
/* Provisioner public key oob */ /* Provisioner public key oob */
u8_t prov_pub_key_oob; uint8_t prov_pub_key_oob;
/** @brief Input is requested. /** @brief Input is requested.
* *
@ -223,13 +223,13 @@ struct bt_mesh_prov {
* *
* @return Zero on success or negative error code otherwise * @return Zero on success or negative error code otherwise
*/ */
int (*prov_pub_key_oob_cb)(u8_t link_idx); int (*prov_pub_key_oob_cb)(uint8_t link_idx);
/* Provisioner static oob value */ /* Provisioner static oob value */
u8_t *prov_static_oob_val; uint8_t *prov_static_oob_val;
/* Provisioner static oob value length */ /* Provisioner static oob value length */
u8_t prov_static_oob_len; uint8_t prov_static_oob_len;
/** @brief Provisioner input a number read from device output /** @brief Provisioner input a number read from device output
* *
@ -243,7 +243,7 @@ struct bt_mesh_prov {
* *
* @return Zero on success or negative error code otherwise * @return Zero on success or negative error code otherwise
*/ */
int (*prov_input_num)(u8_t method, bt_mesh_output_action_t act, u8_t size, u8_t link_idx); int (*prov_input_num)(uint8_t method, bt_mesh_output_action_t act, uint8_t size, uint8_t link_idx);
/** @brief Provisioner output a number to the device /** @brief Provisioner output a number to the device
* *
@ -258,18 +258,18 @@ struct bt_mesh_prov {
* *
* @return Zero on success or negative error code otherwise * @return Zero on success or negative error code otherwise
*/ */
int (*prov_output_num)(u8_t method, bt_mesh_input_action_t act, void *data, u8_t size, u8_t link_idx); int (*prov_output_num)(uint8_t method, bt_mesh_input_action_t act, void *data, uint8_t size, uint8_t link_idx);
/* /*
* Key refresh and IV update flag. * Key refresh and IV update flag.
* No need to initialize it for fast provisioning. * No need to initialize it for fast provisioning.
*/ */
u8_t flags; uint8_t flags;
/* /*
* IV index. No need to initialize it for fast provisioning. * IV index. No need to initialize it for fast provisioning.
*/ */
u32_t iv_index; uint32_t iv_index;
/** @brief Provisioner has opened a provisioning link. /** @brief Provisioner has opened a provisioning link.
* *
@ -288,7 +288,7 @@ struct bt_mesh_prov {
* @param bearer Provisioning bearer. * @param bearer Provisioning bearer.
* @param reason Provisioning link close reason(disconnect reason) * @param reason Provisioning link close reason(disconnect reason)
*/ */
void (*prov_link_close)(bt_mesh_prov_bearer_t bearer, u8_t reason); void (*prov_link_close)(bt_mesh_prov_bearer_t bearer, uint8_t reason);
/** @brief Provision one device is complete. /** @brief Provision one device is complete.
* *
@ -302,9 +302,9 @@ struct bt_mesh_prov {
* @param element_num Provisioned device element number. * @param element_num Provisioned device element number.
* @param netkey_idx Provisioned device assigned netkey index. * @param netkey_idx Provisioned device assigned netkey index.
*/ */
void (*prov_complete)(u16_t node_idx, const u8_t device_uuid[16], void (*prov_complete)(uint16_t node_idx, const uint8_t device_uuid[16],
u16_t unicast_addr, u8_t element_num, uint16_t unicast_addr, uint8_t element_num,
u16_t netkey_idx); uint16_t netkey_idx);
#endif /* CONFIG_BLE_MESH_PROVISIONER */ #endif /* CONFIG_BLE_MESH_PROVISIONER */
}; };
@ -337,7 +337,7 @@ int bt_mesh_input_string(const char *str);
* *
* @return Zero on success or (negative) error code otherwise. * @return Zero on success or (negative) error code otherwise.
*/ */
int bt_mesh_input_number(u32_t num); int bt_mesh_input_number(uint32_t num);
/** @brief Enable specific provisioning bearers /** @brief Enable specific provisioning bearers
* *
@ -381,7 +381,7 @@ int bt_mesh_prov_input_string(const char *str);
* *
* @return Zero on success or (negative) error code otherwise. * @return Zero on success or (negative) error code otherwise.
*/ */
int bt_mesh_prov_input_number(u32_t num); int bt_mesh_prov_input_number(uint32_t num);
/** @brief Enable specific provisioning bearers /** @brief Enable specific provisioning bearers
* *
@ -527,9 +527,9 @@ int bt_mesh_resume(void);
* *
* @return Zero on success or (negative) error code otherwise. * @return Zero on success or (negative) error code otherwise.
*/ */
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx, int bt_mesh_provision(const uint8_t net_key[16], uint16_t net_idx,
u8_t flags, u32_t iv_index, u16_t addr, uint8_t flags, uint32_t iv_index, uint16_t addr,
const u8_t dev_key[16]); const uint8_t dev_key[16]);
/** @brief Check if the device is an unprovisioned device /** @brief Check if the device is an unprovisioned device
* and will act as a node once provisioned. * and will act as a node once provisioned.
@ -613,7 +613,7 @@ int bt_mesh_lpn_poll(void);
* *
* @param cb Function to call when the Friendship status changes. * @param cb Function to call when the Friendship status changes.
*/ */
void bt_mesh_lpn_set_cb(void (*cb)(u16_t friend_addr, bool established)); void bt_mesh_lpn_set_cb(void (*cb)(uint16_t friend_addr, bool established));
/** @brief Register a callback for Friendship changes of friend node. /** @brief Register a callback for Friendship changes of friend node.
* *
@ -622,7 +622,7 @@ void bt_mesh_lpn_set_cb(void (*cb)(u16_t friend_addr, bool established));
* *
* @param cb Function to call when the Friendship status of friend node changes. * @param cb Function to call when the Friendship status of friend node changes.
*/ */
void bt_mesh_friend_set_cb(void (*cb)(bool establish, u16_t lpn_addr, u8_t reason)); void bt_mesh_friend_set_cb(void (*cb)(bool establish, uint16_t lpn_addr, uint8_t reason));
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -32,22 +32,22 @@ enum {
/** @brief This is a 'tentative' type and should be used as a pointer only */ /** @brief This is a 'tentative' type and should be used as a pointer only */
struct bt_mesh_uuid { struct bt_mesh_uuid {
u8_t type; uint8_t type;
}; };
struct bt_mesh_uuid_16 { struct bt_mesh_uuid_16 {
struct bt_mesh_uuid uuid; struct bt_mesh_uuid uuid;
u16_t val; uint16_t val;
}; };
struct bt_mesh_uuid_32 { struct bt_mesh_uuid_32 {
struct bt_mesh_uuid uuid; struct bt_mesh_uuid uuid;
u32_t val; uint32_t val;
}; };
struct bt_mesh_uuid_128 { struct bt_mesh_uuid_128 {
struct bt_mesh_uuid uuid; struct bt_mesh_uuid uuid;
u8_t val[16]; uint8_t val[16];
}; };
#define BLE_MESH_UUID_INIT_16(value) \ #define BLE_MESH_UUID_INIT_16(value) \

View File

@ -18,7 +18,7 @@
#include "mesh_main.h" #include "mesh_main.h"
#include "settings.h" #include "settings.h"
static struct bt_mesh_model *find_model(u16_t elem_addr, u16_t cid, u16_t mod_id) static struct bt_mesh_model *find_model(uint16_t elem_addr, uint16_t cid, uint16_t mod_id)
{ {
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
@ -40,8 +40,8 @@ static struct bt_mesh_model *find_model(u16_t elem_addr, u16_t cid, u16_t mod_id
} }
} }
int bt_mesh_model_subscribe_group_addr(u16_t elem_addr, u16_t cid, int bt_mesh_model_subscribe_group_addr(uint16_t elem_addr, uint16_t cid,
u16_t mod_id, u16_t group_addr) uint16_t mod_id, uint16_t group_addr)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
int i; int i;
@ -83,11 +83,11 @@ int bt_mesh_model_subscribe_group_addr(u16_t elem_addr, u16_t cid,
return -ENOMEM; return -ENOMEM;
} }
int bt_mesh_model_unsubscribe_group_addr(u16_t elem_addr, u16_t cid, int bt_mesh_model_unsubscribe_group_addr(uint16_t elem_addr, uint16_t cid,
u16_t mod_id, u16_t group_addr) uint16_t mod_id, uint16_t group_addr)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
u16_t *match = NULL; uint16_t *match = NULL;
model = find_model(elem_addr, cid, mod_id); model = find_model(elem_addr, cid, mod_id);
if (model == NULL) { if (model == NULL) {
@ -122,7 +122,7 @@ int bt_mesh_model_unsubscribe_group_addr(u16_t elem_addr, u16_t cid,
#if CONFIG_BLE_MESH_NODE #if CONFIG_BLE_MESH_NODE
const u8_t *bt_mesh_node_get_local_net_key(u16_t net_idx) const uint8_t *bt_mesh_node_get_local_net_key(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
@ -140,7 +140,7 @@ const u8_t *bt_mesh_node_get_local_net_key(u16_t net_idx)
return sub->kr_flag ? sub->keys[1].net : sub->keys[0].net; return sub->kr_flag ? sub->keys[1].net : sub->keys[0].net;
} }
const u8_t *bt_mesh_node_get_local_app_key(u16_t app_idx) const uint8_t *bt_mesh_node_get_local_app_key(uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -158,7 +158,7 @@ const u8_t *bt_mesh_node_get_local_app_key(u16_t app_idx)
return key->updated ? key->keys[1].val : key->keys[0].val; return key->updated ? key->keys[1].val : key->keys[0].val;
} }
int bt_mesh_node_local_net_key_add(u16_t net_idx, const u8_t net_key[16]) int bt_mesh_node_local_net_key_add(uint16_t net_idx, const uint8_t net_key[16])
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int err = 0; int err = 0;
@ -230,8 +230,8 @@ int bt_mesh_node_local_net_key_add(u16_t net_idx, const u8_t net_key[16])
return 0; return 0;
} }
int bt_mesh_node_local_app_key_add(u16_t net_idx, u16_t app_idx, int bt_mesh_node_local_app_key_add(uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]) const uint8_t app_key[16])
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -295,8 +295,8 @@ int bt_mesh_node_local_app_key_add(u16_t net_idx, u16_t app_idx,
return -ENOMEM; return -ENOMEM;
} }
int bt_mesh_node_bind_app_key_to_model(u16_t elem_addr, u16_t mod_id, int bt_mesh_node_bind_app_key_to_model(uint16_t elem_addr, uint16_t mod_id,
u16_t cid, u16_t app_idx) uint16_t cid, uint16_t app_idx)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
int i; int i;

View File

@ -16,23 +16,23 @@
extern "C" { extern "C" {
#endif #endif
int bt_mesh_model_subscribe_group_addr(u16_t elem_addr, u16_t mod_id, int bt_mesh_model_subscribe_group_addr(uint16_t elem_addr, uint16_t mod_id,
u16_t cid, u16_t group_addr); uint16_t cid, uint16_t group_addr);
int bt_mesh_model_unsubscribe_group_addr(u16_t elem_addr, u16_t cid, int bt_mesh_model_unsubscribe_group_addr(uint16_t elem_addr, uint16_t cid,
u16_t mod_id, u16_t group_addr); uint16_t mod_id, uint16_t group_addr);
const u8_t *bt_mesh_node_get_local_net_key(u16_t net_idx); const uint8_t *bt_mesh_node_get_local_net_key(uint16_t net_idx);
const u8_t *bt_mesh_node_get_local_app_key(u16_t app_idx); const uint8_t *bt_mesh_node_get_local_app_key(uint16_t app_idx);
int bt_mesh_node_local_net_key_add(u16_t net_idx, const u8_t net_key[16]); int bt_mesh_node_local_net_key_add(uint16_t net_idx, const uint8_t net_key[16]);
int bt_mesh_node_local_app_key_add(u16_t net_idx, u16_t app_idx, int bt_mesh_node_local_app_key_add(uint16_t net_idx, uint16_t app_idx,
const u8_t app_key[16]); const uint8_t app_key[16]);
int bt_mesh_node_bind_app_key_to_model(u16_t elem_addr, u16_t mod_id, int bt_mesh_node_bind_app_key_to_model(uint16_t elem_addr, uint16_t mod_id,
u16_t cid, u16_t app_idx); uint16_t cid, uint16_t app_idx);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -31,8 +31,7 @@
#endif #endif
#define LPN_RECV_DELAY CONFIG_BLE_MESH_LPN_RECV_DELAY #define LPN_RECV_DELAY CONFIG_BLE_MESH_LPN_RECV_DELAY
#define SCAN_LATENCY MIN(CONFIG_BLE_MESH_LPN_SCAN_LATENCY, \ #define SCAN_LATENCY MIN(CONFIG_BLE_MESH_LPN_SCAN_LATENCY, LPN_RECV_DELAY)
LPN_RECV_DELAY)
#define FRIEND_REQ_RETRY_TIMEOUT K_SECONDS(CONFIG_BLE_MESH_LPN_RETRY_TIMEOUT) #define FRIEND_REQ_RETRY_TIMEOUT K_SECONDS(CONFIG_BLE_MESH_LPN_RETRY_TIMEOUT)
@ -42,34 +41,34 @@
#define POLL_RETRY_TIMEOUT K_MSEC(100) #define POLL_RETRY_TIMEOUT K_MSEC(100)
#define REQ_RETRY_DURATION(lpn) (4 * (LPN_RECV_DELAY + (lpn)->adv_duration + \ #define REQ_RETRY_DURATION(lpn) (4 * (LPN_RECV_DELAY + (lpn)->adv_duration + \
(lpn)->recv_win + POLL_RETRY_TIMEOUT)) (lpn)->recv_win + POLL_RETRY_TIMEOUT))
#define POLL_TIMEOUT_INIT (CONFIG_BLE_MESH_LPN_INIT_POLL_TIMEOUT * 100) #define POLL_TIMEOUT_INIT (CONFIG_BLE_MESH_LPN_INIT_POLL_TIMEOUT * 100)
#define POLL_TIMEOUT_MAX(lpn) ((CONFIG_BLE_MESH_LPN_POLL_TIMEOUT * 100) - \ #define POLL_TIMEOUT_MAX(lpn) ((CONFIG_BLE_MESH_LPN_POLL_TIMEOUT * 100) - \
REQ_RETRY_DURATION(lpn)) REQ_RETRY_DURATION(lpn))
/** /**
* 1. Should use 20 attempts for BQB test case MESH/NODE/FRND/LPM/BI-02-C. * 1. Should use 20 attempts for BQB test case MESH/NODE/FRND/LPM/BI-02-C.
* 2. We should use more specific value for each PollTimeout range. * 2. We should use more specific value for each PollTimeout range.
*/ */
#define REQ_ATTEMPTS(lpn) (POLL_TIMEOUT_MAX(lpn) < K_SECONDS(3) ? 2 : 6) #define REQ_ATTEMPTS(lpn) (POLL_TIMEOUT_MAX(lpn) < K_SECONDS(3) ? 2 : 6)
#define CLEAR_ATTEMPTS 2 #define CLEAR_ATTEMPTS 2
#define LPN_CRITERIA ((CONFIG_BLE_MESH_LPN_MIN_QUEUE_SIZE) | \ #define LPN_CRITERIA ((CONFIG_BLE_MESH_LPN_MIN_QUEUE_SIZE) | \
(CONFIG_BLE_MESH_LPN_RSSI_FACTOR << 3) | \ (CONFIG_BLE_MESH_LPN_RSSI_FACTOR << 3) | \
(CONFIG_BLE_MESH_LPN_RECV_WIN_FACTOR << 5)) (CONFIG_BLE_MESH_LPN_RECV_WIN_FACTOR << 5))
#define POLL_TO(to) { (u8_t)((to) >> 16), (u8_t)((to) >> 8), (u8_t)(to) } #define POLL_TO(to) { (uint8_t)((to) >> 16), (uint8_t)((to) >> 8), (uint8_t)(to) }
#define LPN_POLL_TO POLL_TO(CONFIG_BLE_MESH_LPN_POLL_TIMEOUT) #define LPN_POLL_TO POLL_TO(CONFIG_BLE_MESH_LPN_POLL_TIMEOUT)
/* 2 transmissions, 20ms interval */ /* 2 transmissions, 20ms interval */
#define POLL_XMIT BLE_MESH_TRANSMIT(1, 20) #define POLL_XMIT BLE_MESH_TRANSMIT(1, 20)
#define FIRST_POLL_ATTEMPTS 6 #define FIRST_POLL_ATTEMPTS 6
static void (*lpn_cb)(u16_t friend_addr, bool established); static void (*lpn_cb)(uint16_t friend_addr, bool established);
#if !CONFIG_BLE_MESH_NO_LOG #if !CONFIG_BLE_MESH_NO_LOG
static const char *state2str(int state) static const char *state2str(int state)
@ -272,7 +271,7 @@ static void clear_friendship(bool force, bool disable)
} }
} }
static void friend_req_sent(u16_t duration, int err, void *user_data) static void friend_req_sent(uint16_t duration, int err, void *user_data)
{ {
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
@ -331,7 +330,7 @@ static int send_friend_req(struct bt_mesh_lpn *lpn)
sizeof(req), &friend_req_sent_cb, NULL); sizeof(req), &friend_req_sent_cb, NULL);
} }
static void req_sent(u16_t duration, int err, void *user_data) static void req_sent(uint16_t duration, int err, void *user_data)
{ {
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
@ -389,7 +388,7 @@ static int send_friend_poll(void)
.friend_cred = true, .friend_cred = true,
}; };
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
u8_t fsn = lpn->fsn; uint8_t fsn = lpn->fsn;
int err = 0; int err = 0;
BT_DBG("lpn->sent_req 0x%02x", lpn->sent_req); BT_DBG("lpn->sent_req 0x%02x", lpn->sent_req);
@ -510,7 +509,7 @@ int bt_mesh_lpn_friend_offer(struct bt_mesh_net_rx *rx,
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
struct bt_mesh_subnet *sub = rx->sub; struct bt_mesh_subnet *sub = rx->sub;
struct friend_cred *cred = NULL; struct friend_cred *cred = NULL;
u16_t frnd_counter = 0U; uint16_t frnd_counter = 0U;
int err = 0; int err = 0;
if (buf->len < sizeof(*msg)) { if (buf->len < sizeof(*msg)) {
@ -572,7 +571,7 @@ int bt_mesh_lpn_friend_clear_cfm(struct bt_mesh_net_rx *rx,
{ {
struct bt_mesh_ctl_friend_clear_confirm *msg = (void *)buf->data; struct bt_mesh_ctl_friend_clear_confirm *msg = (void *)buf->data;
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
u16_t addr = 0U, counter = 0U; uint16_t addr = 0U, counter = 0U;
if (buf->len < sizeof(*msg)) { if (buf->len < sizeof(*msg)) {
BT_WARN("Too short Friend Clear Confirm"); BT_WARN("Too short Friend Clear Confirm");
@ -600,10 +599,10 @@ int bt_mesh_lpn_friend_clear_cfm(struct bt_mesh_net_rx *rx,
return 0; return 0;
} }
static void lpn_group_add(u16_t group) static void lpn_group_add(uint16_t group)
{ {
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
u16_t *free_slot = NULL; uint16_t *free_slot = NULL;
int i; int i;
for (i = 0; i < ARRAY_SIZE(lpn->groups); i++) { for (i = 0; i < ARRAY_SIZE(lpn->groups); i++) {
@ -626,7 +625,7 @@ static void lpn_group_add(u16_t group)
lpn->groups_changed = 1U; lpn->groups_changed = 1U;
} }
static void lpn_group_del(u16_t group) static void lpn_group_del(uint16_t group)
{ {
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
int i; int i;
@ -657,7 +656,7 @@ static inline int group_popcount(bt_mesh_atomic_t *target)
#endif #endif
} }
static bool sub_update(u8_t op) static bool sub_update(uint8_t op)
{ {
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
int added_count = group_popcount(lpn->added); int added_count = group_popcount(lpn->added);
@ -805,7 +804,7 @@ static void lpn_timeout(struct k_work *work)
break; break;
case BLE_MESH_LPN_ESTABLISHED: case BLE_MESH_LPN_ESTABLISHED:
if (lpn->req_attempts < REQ_ATTEMPTS(lpn)) { if (lpn->req_attempts < REQ_ATTEMPTS(lpn)) {
u8_t req = lpn->sent_req; uint8_t req = lpn->sent_req;
lpn->sent_req = 0U; lpn->sent_req = 0U;
@ -839,7 +838,7 @@ static void lpn_timeout(struct k_work *work)
} }
} }
void bt_mesh_lpn_group_add(u16_t group) void bt_mesh_lpn_group_add(uint16_t group)
{ {
BT_DBG("group 0x%04x", group); BT_DBG("group 0x%04x", group);
@ -852,7 +851,7 @@ void bt_mesh_lpn_group_add(u16_t group)
sub_update(TRANS_CTL_OP_FRIEND_SUB_ADD); sub_update(TRANS_CTL_OP_FRIEND_SUB_ADD);
} }
void bt_mesh_lpn_group_del(u16_t *groups, size_t group_count) void bt_mesh_lpn_group_del(uint16_t *groups, size_t group_count)
{ {
int i; int i;
@ -870,7 +869,7 @@ void bt_mesh_lpn_group_del(u16_t *groups, size_t group_count)
sub_update(TRANS_CTL_OP_FRIEND_SUB_REM); sub_update(TRANS_CTL_OP_FRIEND_SUB_REM);
} }
static s32_t poll_timeout(struct bt_mesh_lpn *lpn) static int32_t poll_timeout(struct bt_mesh_lpn *lpn)
{ {
/* If we're waiting for segment acks keep polling at high freq */ /* If we're waiting for segment acks keep polling at high freq */
if (bt_mesh_tx_in_progress()) { if (bt_mesh_tx_in_progress()) {
@ -959,7 +958,7 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
struct bt_mesh_ctl_friend_update *msg = (void *)buf->data; struct bt_mesh_ctl_friend_update *msg = (void *)buf->data;
struct bt_mesh_lpn *lpn = &bt_mesh.lpn; struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
struct bt_mesh_subnet *sub = rx->sub; struct bt_mesh_subnet *sub = rx->sub;
u32_t iv_index = 0U; uint32_t iv_index = 0U;
if (buf->len < sizeof(*msg)) { if (buf->len < sizeof(*msg)) {
BT_WARN("Too short Friend Update"); BT_WARN("Too short Friend Update");
@ -1058,7 +1057,7 @@ int bt_mesh_lpn_poll(void)
return send_friend_poll(); return send_friend_poll();
} }
void bt_mesh_lpn_set_cb(void (*cb)(u16_t friend_addr, bool established)) void bt_mesh_lpn_set_cb(void (*cb)(uint16_t friend_addr, bool established))
{ {
lpn_cb = cb; lpn_cb = cb;
} }

View File

@ -33,7 +33,7 @@ static inline bool bt_mesh_lpn_established(void)
#endif #endif
} }
static inline bool bt_mesh_lpn_match(u16_t addr) static inline bool bt_mesh_lpn_match(uint16_t addr)
{ {
#if defined(CONFIG_BLE_MESH_LOW_POWER) #if defined(CONFIG_BLE_MESH_LOW_POWER)
if (bt_mesh_lpn_established()) { if (bt_mesh_lpn_established()) {
@ -63,8 +63,8 @@ static inline bool bt_mesh_lpn_timer(void)
void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx); void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx);
void bt_mesh_lpn_group_add(u16_t group); void bt_mesh_lpn_group_add(uint16_t group);
void bt_mesh_lpn_group_del(u16_t *groups, size_t group_count); void bt_mesh_lpn_group_del(uint16_t *groups, size_t group_count);
void bt_mesh_lpn_disable(bool force); void bt_mesh_lpn_disable(bool force);

View File

@ -36,9 +36,9 @@ bool bt_mesh_is_initialized(void)
return mesh_init; return mesh_init;
} }
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx, int bt_mesh_provision(const uint8_t net_key[16], uint16_t net_idx,
u8_t flags, u32_t iv_index, u16_t addr, uint8_t flags, uint32_t iv_index, uint16_t addr,
const u8_t dev_key[16]) const uint8_t dev_key[16])
{ {
bool pb_gatt_enabled = false; bool pb_gatt_enabled = false;
int err = 0; int err = 0;
@ -202,7 +202,7 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
* the device as a node, which will cause the information * the device as a node, which will cause the information
* in NVS been handled incorrectly. * in NVS been handled incorrectly.
*/ */
u8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK; uint8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK;
if (role != BLE_MESH_SETTINGS_ROLE_NONE && if (role != BLE_MESH_SETTINGS_ROLE_NONE &&
role != BLE_MESH_SETTINGS_ROLE_NODE) { role != BLE_MESH_SETTINGS_ROLE_NODE) {
BT_ERR("%s, Mismatch role %u", __func__, role); BT_ERR("%s, Mismatch role %u", __func__, role);
@ -310,7 +310,7 @@ static void model_resume(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
bool vnd, bool primary, void *user_data) bool vnd, bool primary, void *user_data)
{ {
if (mod->pub && mod->pub->update) { if (mod->pub && mod->pub->update) {
s32_t period_ms = bt_mesh_model_pub_period_get(mod); int32_t period_ms = bt_mesh_model_pub_period_get(mod);
if (period_ms) { if (period_ms) {
k_delayed_work_submit(&mod->pub->timer, period_ms); k_delayed_work_submit(&mod->pub->timer, period_ms);
@ -405,8 +405,8 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
/* Changed by Espressif, add a random delay (0 ~ 3s) */ /* Changed by Espressif, add a random delay (0 ~ 3s) */
if (IS_ENABLED(CONFIG_BLE_MESH_FAST_PROV)) { if (IS_ENABLED(CONFIG_BLE_MESH_FAST_PROV)) {
u32_t delay = 0; uint32_t delay = 0;
bt_mesh_rand(&delay, sizeof(u32_t)); bt_mesh_rand(&delay, sizeof(uint32_t));
vTaskDelay((delay % 3000) / portTICK_PERIOD_MS); vTaskDelay((delay % 3000) / portTICK_PERIOD_MS);
} }
@ -564,7 +564,7 @@ int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers)
* device as a Provisioner, which will cause the information * device as a Provisioner, which will cause the information
* in NVS been handled incorrectly. * in NVS been handled incorrectly.
*/ */
u8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK; uint8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK;
if (role != BLE_MESH_SETTINGS_ROLE_NONE && if (role != BLE_MESH_SETTINGS_ROLE_NONE &&
role != BLE_MESH_SETTINGS_ROLE_PROV) { role != BLE_MESH_SETTINGS_ROLE_PROV) {
BT_ERR("%s, Mismatch role %u", __func__, role); BT_ERR("%s, Mismatch role %u", __func__, role);

View File

@ -61,10 +61,10 @@ static struct friend_cred friend_cred[FRIEND_CRED_COUNT];
#endif #endif
static struct { static struct {
u32_t src:15, /* MSB of source address is always 0 */ uint32_t src:15, /* MSB of source address is always 0 */
seq:17; seq:17;
} msg_cache[CONFIG_BLE_MESH_MSG_CACHE_SIZE]; } msg_cache[CONFIG_BLE_MESH_MSG_CACHE_SIZE];
static u16_t msg_cache_next; static uint16_t msg_cache_next;
/* Singleton network context (the implementation only supports one) */ /* Singleton network context (the implementation only supports one) */
struct bt_mesh_net bt_mesh = { struct bt_mesh_net bt_mesh = {
@ -81,8 +81,8 @@ struct bt_mesh_net bt_mesh = {
}, },
}; };
static u32_t dup_cache[4]; static uint32_t dup_cache[4];
static int dup_cache_next; static int dup_cache_next;
#if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
#define BLE_MESH_MAX_STORED_RELAY_COUNT (CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT / 2) #define BLE_MESH_MAX_STORED_RELAY_COUNT (CONFIG_BLE_MESH_RELAY_ADV_BUF_COUNT / 2)
@ -90,8 +90,8 @@ static int dup_cache_next;
static bool check_dup(struct net_buf_simple *data) static bool check_dup(struct net_buf_simple *data)
{ {
const u8_t *tail = net_buf_simple_tail(data); const uint8_t *tail = net_buf_simple_tail(data);
u32_t val = 0U; uint32_t val = 0U;
int i; int i;
val = sys_get_be32(tail - 4) ^ sys_get_be32(tail - 8); val = sys_get_be32(tail - 4) ^ sys_get_be32(tail - 8);
@ -132,7 +132,7 @@ static void msg_cache_add(struct bt_mesh_net_rx *rx)
} }
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
void bt_mesh_msg_cache_clear(u16_t unicast_addr, u8_t elem_num) void bt_mesh_msg_cache_clear(uint16_t unicast_addr, uint8_t elem_num)
{ {
int i; int i;
@ -145,7 +145,7 @@ void bt_mesh_msg_cache_clear(u16_t unicast_addr, u8_t elem_num)
} }
#endif /* CONFIG_BLE_MESH_PROVISIONER */ #endif /* CONFIG_BLE_MESH_PROVISIONER */
struct bt_mesh_subnet *bt_mesh_subnet_get(u16_t net_idx) struct bt_mesh_subnet *bt_mesh_subnet_get(uint16_t net_idx)
{ {
int i; int i;
@ -163,10 +163,10 @@ struct bt_mesh_subnet *bt_mesh_subnet_get(u16_t net_idx)
} }
int bt_mesh_net_keys_create(struct bt_mesh_subnet_keys *keys, int bt_mesh_net_keys_create(struct bt_mesh_subnet_keys *keys,
const u8_t key[16]) const uint8_t key[16])
{ {
u8_t p[] = { 0 }; uint8_t p[] = { 0 };
u8_t nid = 0U; uint8_t nid = 0U;
int err = 0; int err = 0;
err = bt_mesh_k2(key, p, sizeof(p), &nid, keys->enc, keys->privacy); err = bt_mesh_k2(key, p, sizeof(p), &nid, keys->enc, keys->privacy);
@ -213,11 +213,11 @@ int bt_mesh_net_keys_create(struct bt_mesh_subnet_keys *keys,
#if (defined(CONFIG_BLE_MESH_LOW_POWER) || \ #if (defined(CONFIG_BLE_MESH_LOW_POWER) || \
defined(CONFIG_BLE_MESH_FRIEND)) defined(CONFIG_BLE_MESH_FRIEND))
int friend_cred_set(struct friend_cred *cred, u8_t idx, const u8_t net_key[16]) int friend_cred_set(struct friend_cred *cred, uint8_t idx, const uint8_t net_key[16])
{ {
u16_t lpn_addr = 0U, frnd_addr = 0U; uint16_t lpn_addr = 0U, frnd_addr = 0U;
uint8_t p[9] = {0};
int err = 0; int err = 0;
u8_t p[9] = {0};
#if defined(CONFIG_BLE_MESH_LOW_POWER) #if defined(CONFIG_BLE_MESH_LOW_POWER)
if (cred->addr == bt_mesh.lpn.frnd) { if (cred->addr == bt_mesh.lpn.frnd) {
@ -256,7 +256,7 @@ int friend_cred_set(struct friend_cred *cred, u8_t idx, const u8_t net_key[16])
return 0; return 0;
} }
void friend_cred_refresh(u16_t net_idx) void friend_cred_refresh(uint16_t net_idx)
{ {
int i; int i;
@ -294,8 +294,8 @@ int friend_cred_update(struct bt_mesh_subnet *sub)
return 0; return 0;
} }
struct friend_cred *friend_cred_create(struct bt_mesh_subnet *sub, u16_t addr, struct friend_cred *friend_cred_create(struct bt_mesh_subnet *sub, uint16_t addr,
u16_t lpn_counter, u16_t frnd_counter) uint16_t lpn_counter, uint16_t frnd_counter)
{ {
struct friend_cred *cred = NULL; struct friend_cred *cred = NULL;
int i, err = 0; int i, err = 0;
@ -347,7 +347,7 @@ void friend_cred_clear(struct friend_cred *cred)
(void)memset(cred->cred, 0, sizeof(cred->cred)); (void)memset(cred->cred, 0, sizeof(cred->cred));
} }
int friend_cred_del(u16_t net_idx, u16_t addr) int friend_cred_del(uint16_t net_idx, uint16_t addr)
{ {
int i; int i;
@ -363,8 +363,8 @@ int friend_cred_del(u16_t net_idx, u16_t addr)
return -ENOENT; return -ENOENT;
} }
int friend_cred_get(struct bt_mesh_subnet *sub, u16_t addr, u8_t *nid, int friend_cred_get(struct bt_mesh_subnet *sub, uint16_t addr, uint8_t *nid,
const u8_t **enc, const u8_t **priv) const uint8_t **enc, const uint8_t **priv)
{ {
int i; int i;
@ -399,16 +399,16 @@ int friend_cred_get(struct bt_mesh_subnet *sub, u16_t addr, u8_t *nid,
return -ENOENT; return -ENOENT;
} }
#else #else
int friend_cred_get(struct bt_mesh_subnet *sub, u16_t addr, u8_t *nid, int friend_cred_get(struct bt_mesh_subnet *sub, uint16_t addr, uint8_t *nid,
const u8_t **enc, const u8_t **priv) const uint8_t **enc, const uint8_t **priv)
{ {
return -ENOENT; return -ENOENT;
} }
#endif /* FRIEND || LOW_POWER */ #endif /* FRIEND || LOW_POWER */
u8_t bt_mesh_net_flags(struct bt_mesh_subnet *sub) uint8_t bt_mesh_net_flags(struct bt_mesh_subnet *sub)
{ {
u8_t flags = 0x00; uint8_t flags = 0x00;
if (sub && sub->kr_flag) { if (sub && sub->kr_flag) {
flags |= BLE_MESH_NET_FLAG_KR; flags |= BLE_MESH_NET_FLAG_KR;
@ -423,7 +423,7 @@ u8_t bt_mesh_net_flags(struct bt_mesh_subnet *sub)
int bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub) int bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub)
{ {
u8_t flags = bt_mesh_net_flags(sub); uint8_t flags = bt_mesh_net_flags(sub);
struct bt_mesh_subnet_keys *keys = NULL; struct bt_mesh_subnet_keys *keys = NULL;
if (sub->kr_flag) { if (sub->kr_flag) {
@ -440,8 +440,8 @@ int bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub)
bt_mesh.iv_index, sub->auth); bt_mesh.iv_index, sub->auth);
} }
int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16], int bt_mesh_net_create(uint16_t idx, uint8_t flags, const uint8_t key[16],
u32_t iv_index) uint32_t iv_index)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int err = 0; int err = 0;
@ -524,7 +524,7 @@ void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
} }
} }
bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key) bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, uint8_t new_kr, bool new_key)
{ {
if (new_kr != sub->kr_flag && sub->kr_phase == BLE_MESH_KR_NORMAL) { if (new_kr != sub->kr_flag && sub->kr_phase == BLE_MESH_KR_NORMAL) {
BT_WARN("KR change in normal operation. Are we blacklisted?"); BT_WARN("KR change in normal operation. Are we blacklisted?");
@ -641,7 +641,7 @@ void bt_mesh_net_sec_update(struct bt_mesh_subnet *sub)
} }
} }
bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update) bool bt_mesh_net_iv_update(uint32_t iv_index, bool iv_update)
{ {
int i; int i;
@ -757,9 +757,9 @@ bool bt_mesh_primary_subnet_exist(void)
return false; return false;
} }
u32_t bt_mesh_next_seq(void) uint32_t bt_mesh_next_seq(void)
{ {
u32_t seq = bt_mesh.seq++; uint32_t seq = bt_mesh.seq++;
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) { if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
bt_mesh_store_seq(); bt_mesh_store_seq();
@ -780,9 +780,9 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
bool new_key, const struct bt_mesh_send_cb *cb, bool new_key, const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)
{ {
const u8_t *enc = NULL, *priv = NULL; const uint8_t *enc = NULL, *priv = NULL;
u32_t seq = 0U; uint32_t seq = 0U;
u16_t dst = 0U; uint16_t dst = 0U;
int err = 0; int err = 0;
BT_DBG("net_idx 0x%04x new_key %u len %u", sub->net_idx, new_key, BT_DBG("net_idx 0x%04x new_key %u len %u", sub->net_idx, new_key,
@ -848,8 +848,8 @@ int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf,
bool proxy) bool proxy)
{ {
const bool ctl = (tx->ctx->app_idx == BLE_MESH_KEY_UNUSED); const bool ctl = (tx->ctx->app_idx == BLE_MESH_KEY_UNUSED);
const u8_t *enc = NULL, *priv = NULL; const uint8_t *enc = NULL, *priv = NULL;
u8_t nid = 0U; uint8_t nid = 0U;
int err = 0; int err = 0;
if (ctl && net_buf_simple_tailroom(buf) < BLE_MESH_MIC_LONG) { if (ctl && net_buf_simple_tailroom(buf) < BLE_MESH_MIC_LONG) {
@ -982,10 +982,10 @@ done:
} }
static bool auth_match(struct bt_mesh_subnet_keys *keys, static bool auth_match(struct bt_mesh_subnet_keys *keys,
const u8_t net_id[8], u8_t flags, const uint8_t net_id[8], uint8_t flags,
u32_t iv_index, const u8_t auth[8]) uint32_t iv_index, const uint8_t auth[8])
{ {
u8_t net_auth[8] = {0}; uint8_t net_auth[8] = {0};
if (memcmp(net_id, keys->net_id, 8)) { if (memcmp(net_id, keys->net_id, 8)) {
return false; return false;
@ -1003,8 +1003,8 @@ static bool auth_match(struct bt_mesh_subnet_keys *keys,
return true; return true;
} }
struct bt_mesh_subnet *bt_mesh_subnet_find(const u8_t net_id[8], u8_t flags, struct bt_mesh_subnet *bt_mesh_subnet_find(const uint8_t net_id[8], uint8_t flags,
u32_t iv_index, const u8_t auth[8], uint32_t iv_index, const uint8_t auth[8],
bool *new_key) bool *new_key)
{ {
size_t subnet_size = 0U; size_t subnet_size = 0U;
@ -1037,8 +1037,8 @@ struct bt_mesh_subnet *bt_mesh_subnet_find(const u8_t net_id[8], u8_t flags,
return NULL; return NULL;
} }
static int net_decrypt(struct bt_mesh_subnet *sub, const u8_t *enc, static int net_decrypt(struct bt_mesh_subnet *sub, const uint8_t *enc,
const u8_t *priv, const u8_t *data, const uint8_t *priv, const uint8_t *data,
size_t data_len, struct bt_mesh_net_rx *rx, size_t data_len, struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -1078,7 +1078,7 @@ static int net_decrypt(struct bt_mesh_subnet *sub, const u8_t *enc,
#if (defined(CONFIG_BLE_MESH_LOW_POWER) || \ #if (defined(CONFIG_BLE_MESH_LOW_POWER) || \
defined(CONFIG_BLE_MESH_FRIEND)) defined(CONFIG_BLE_MESH_FRIEND))
static int friend_decrypt(struct bt_mesh_subnet *sub, const u8_t *data, static int friend_decrypt(struct bt_mesh_subnet *sub, const uint8_t *data,
size_t data_len, struct bt_mesh_net_rx *rx, size_t data_len, struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -1115,7 +1115,7 @@ static int friend_decrypt(struct bt_mesh_subnet *sub, const u8_t *data,
} }
#endif #endif
static bool net_find_and_decrypt(const u8_t *data, size_t data_len, static bool net_find_and_decrypt(const uint8_t *data, size_t data_len,
struct bt_mesh_net_rx *rx, struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
@ -1194,9 +1194,9 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
static void bt_mesh_net_relay(struct net_buf_simple *sbuf, static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
struct bt_mesh_net_rx *rx) struct bt_mesh_net_rx *rx)
{ {
const u8_t *enc = NULL, *priv = NULL; const uint8_t *enc = NULL, *priv = NULL;
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
u8_t nid = 0U, transmit = 0U; uint8_t nid = 0U, transmit = 0U;
if (rx->net_if == BLE_MESH_NET_IF_LOCAL) { if (rx->net_if == BLE_MESH_NET_IF_LOCAL) {
/* Locally originated PDUs with TTL=1 will only be delivered /* Locally originated PDUs with TTL=1 will only be delivered
@ -1405,7 +1405,7 @@ static bool ready_to_recv(void)
return false; return false;
} }
static bool ignore_net_msg(u16_t src, u16_t dst) static bool ignore_net_msg(uint16_t src, uint16_t dst)
{ {
if (IS_ENABLED(CONFIG_BLE_MESH_FAST_PROV)) { if (IS_ENABLED(CONFIG_BLE_MESH_FAST_PROV)) {
/* When fast provisioning is enabled, the node addr /* When fast provisioning is enabled, the node addr
@ -1432,7 +1432,7 @@ static bool ignore_net_msg(u16_t src, u16_t dst)
return false; return false;
} }
void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi, void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
enum bt_mesh_net_if net_if) enum bt_mesh_net_if net_if)
{ {
NET_BUF_SIMPLE_DEFINE(buf, 29); NET_BUF_SIMPLE_DEFINE(buf, 29);
@ -1552,11 +1552,11 @@ void bt_mesh_net_start(void)
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) { if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) {
u16_t net_idx = bt_mesh.sub[0].net_idx; uint16_t net_idx = bt_mesh.sub[0].net_idx;
u16_t addr = bt_mesh_primary_addr(); uint16_t addr = bt_mesh_primary_addr();
u32_t iv_index = bt_mesh.iv_index; uint32_t iv_index = bt_mesh.iv_index;
u8_t flags = (u8_t)bt_mesh.sub[0].kr_flag; uint8_t flags = (uint8_t)bt_mesh.sub[0].kr_flag;
const u8_t *net_key = bt_mesh.sub[0].keys[flags].net; const uint8_t *net_key = bt_mesh.sub[0].keys[flags].net;
if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS)) { if (bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS)) {
flags |= BLE_MESH_NET_FLAG_IVU; flags |= BLE_MESH_NET_FLAG_IVU;
} }

View File

@ -29,89 +29,84 @@ extern "C" {
/* How many hours in between updating IVU duration */ /* How many hours in between updating IVU duration */
#define BLE_MESH_IVU_MIN_HOURS 96 #define BLE_MESH_IVU_MIN_HOURS 96
#define BLE_MESH_IVU_HOURS (BLE_MESH_IVU_MIN_HOURS / \ #define BLE_MESH_IVU_HOURS (BLE_MESH_IVU_MIN_HOURS / CONFIG_BLE_MESH_IVU_DIVIDER)
CONFIG_BLE_MESH_IVU_DIVIDER)
#define BLE_MESH_IVU_TIMEOUT K_HOURS(BLE_MESH_IVU_HOURS) #define BLE_MESH_IVU_TIMEOUT K_HOURS(BLE_MESH_IVU_HOURS)
struct bt_mesh_app_key { struct bt_mesh_app_key {
u16_t net_idx; uint16_t net_idx;
u16_t app_idx; uint16_t app_idx;
bool updated; bool updated;
struct bt_mesh_app_keys { struct bt_mesh_app_keys {
u8_t id; uint8_t id;
u8_t val[16]; uint8_t val[16];
} keys[2]; } keys[2];
}; };
struct bt_mesh_subnet { struct bt_mesh_subnet {
u32_t beacon_sent; /* Timestamp of last sent beacon */ uint32_t beacon_sent; /* Timestamp of last sent beacon */
u8_t beacons_last; /* Number of beacons during last uint8_t beacons_last; /* Number of beacons during last observation window. */
* observation window uint8_t beacons_cur; /* Number of beacons observed during currently ongoing window. */
*/
u8_t beacons_cur; /* Number of beacons observed during
* currently ongoing window.
*/
u8_t beacon_cache[21]; /* Cached last authenticated beacon */ uint8_t beacon_cache[21]; /* Cached last authenticated beacon */
u16_t net_idx; /* NetKeyIndex */ uint16_t net_idx; /* NetKeyIndex */
bool kr_flag; /* Key Refresh Flag */ bool kr_flag; /* Key Refresh Flag */
u8_t kr_phase; /* Key Refresh Phase */ uint8_t kr_phase; /* Key Refresh Phase */
u8_t node_id; /* Node Identity State */ uint8_t node_id; /* Node Identity State */
u32_t node_id_start; /* Node Identity started timestamp */ uint32_t node_id_start; /* Node Identity started timestamp */
u8_t auth[8]; /* Beacon Authentication Value */ uint8_t auth[8]; /* Beacon Authentication Value */
struct bt_mesh_subnet_keys { struct bt_mesh_subnet_keys {
u8_t net[16]; /* NetKey */ uint8_t net[16]; /* NetKey */
u8_t nid; /* NID */ uint8_t nid; /* NID */
u8_t enc[16]; /* EncKey */ uint8_t enc[16]; /* EncKey */
u8_t net_id[8]; /* Network ID */ uint8_t net_id[8]; /* Network ID */
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
u8_t identity[16]; /* IdentityKey */ uint8_t identity[16]; /* IdentityKey */
#endif #endif
u8_t privacy[16]; /* PrivacyKey */ uint8_t privacy[16]; /* PrivacyKey */
u8_t beacon[16]; /* BeaconKey */ uint8_t beacon[16]; /* BeaconKey */
} keys[2]; } keys[2];
}; };
struct bt_mesh_rpl { struct bt_mesh_rpl {
u16_t src; uint16_t src;
bool old_iv; bool old_iv;
#if defined(CONFIG_BLE_MESH_SETTINGS) #if defined(CONFIG_BLE_MESH_SETTINGS)
bool store; bool store;
#endif #endif
u32_t seq; uint32_t seq;
}; };
#if defined(CONFIG_BLE_MESH_FRIEND) #if defined(CONFIG_BLE_MESH_FRIEND)
#define FRIEND_SEG_RX CONFIG_BLE_MESH_FRIEND_SEG_RX #define FRIEND_SEG_RX CONFIG_BLE_MESH_FRIEND_SEG_RX
#define FRIEND_SUB_LIST_SIZE CONFIG_BLE_MESH_FRIEND_SUB_LIST_SIZE #define FRIEND_SUB_LIST_SIZE CONFIG_BLE_MESH_FRIEND_SUB_LIST_SIZE
#else #else
#define FRIEND_SEG_RX 0 #define FRIEND_SEG_RX 0
#define FRIEND_SUB_LIST_SIZE 0 #define FRIEND_SUB_LIST_SIZE 0
#endif #endif
struct bt_mesh_friend { struct bt_mesh_friend {
u16_t lpn; uint16_t lpn;
u8_t recv_delay; uint8_t recv_delay;
u8_t fsn: 1, uint8_t fsn:1,
send_last: 1, send_last:1,
pending_req: 1, pending_req:1,
sec_update: 1, sec_update:1,
pending_buf: 1, pending_buf:1,
valid: 1, valid:1,
established: 1; established:1;
s32_t poll_to; int32_t poll_to;
u8_t num_elem; uint8_t num_elem;
u16_t lpn_counter; uint16_t lpn_counter;
u16_t counter; uint16_t counter;
u16_t net_idx; uint16_t net_idx;
u16_t sub_list[FRIEND_SUB_LIST_SIZE]; uint16_t sub_list[FRIEND_SUB_LIST_SIZE];
struct k_delayed_work timer; struct k_delayed_work timer;
@ -122,19 +117,19 @@ struct bt_mesh_friend {
* the current number of segments, in the queue. This is * the current number of segments, in the queue. This is
* used for Friend Queue free space calculations. * used for Friend Queue free space calculations.
*/ */
u8_t seg_count; uint8_t seg_count;
} seg[FRIEND_SEG_RX]; } seg[FRIEND_SEG_RX];
struct net_buf *last; struct net_buf *last;
sys_slist_t queue; sys_slist_t queue;
u32_t queue_size; uint32_t queue_size;
/* Friend Clear Procedure */ /* Friend Clear Procedure */
struct { struct {
u32_t start; /* Clear Procedure start */ uint32_t start; /* Clear Procedure start */
u16_t frnd; /* Previous Friend's address */ uint16_t frnd; /* Previous Friend's address */
u16_t repeat_sec; /* Repeat timeout in seconds */ uint16_t repeat_sec; /* Repeat timeout in seconds */
struct k_delayed_work timer; /* Repeat timer */ struct k_delayed_work timer; /* Repeat timer */
} clear; } clear;
}; };
@ -161,46 +156,46 @@ struct bt_mesh_lpn {
} state; } state;
/* Transaction Number (used for subscription list) */ /* Transaction Number (used for subscription list) */
u8_t xact_next; uint8_t xact_next;
u8_t xact_pending; uint8_t xact_pending;
u8_t sent_req; uint8_t sent_req;
/* Address of our Friend when we're a LPN. Unassigned if we don't /* Address of our Friend when we're a LPN. Unassigned if we don't
* have a friend yet. * have a friend yet.
*/ */
u16_t frnd; uint16_t frnd;
/* Value from the friend offer */ /* Value from the friend offer */
u8_t recv_win; uint8_t recv_win;
u8_t req_attempts; /* Number of Request attempts */ uint8_t req_attempts; /* Number of Request attempts */
s32_t poll_timeout; int32_t poll_timeout;
u8_t groups_changed: 1, /* Friend Subscription List needs updating */ uint8_t groups_changed: 1, /* Friend Subscription List needs updating */
pending_poll: 1, /* Poll to be sent after subscription */ pending_poll: 1, /* Poll to be sent after subscription */
disable: 1, /* Disable LPN after clearing */ disable: 1, /* Disable LPN after clearing */
fsn: 1, /* Friend Sequence Number */ fsn: 1, /* Friend Sequence Number */
established: 1, /* Friendship established */ established: 1, /* Friendship established */
clear_success: 1; /* Friend Clear Confirm received */ clear_success: 1; /* Friend Clear Confirm received */
/* Friend Queue Size */ /* Friend Queue Size */
u8_t queue_size; uint8_t queue_size;
/* LPNCounter */ /* LPNCounter */
u16_t counter; uint16_t counter;
/* Previous Friend of this LPN */ /* Previous Friend of this LPN */
u16_t old_friend; uint16_t old_friend;
/* Duration reported for last advertising packet */ /* Duration reported for last advertising packet */
u16_t adv_duration; uint16_t adv_duration;
/* Next LPN related action timer */ /* Next LPN related action timer */
struct k_delayed_work timer; struct k_delayed_work timer;
/* Subscribed groups */ /* Subscribed groups */
u16_t groups[LPN_GROUPS]; uint16_t groups[LPN_GROUPS];
/* Bit fields for tracking which groups the Friend knows about */ /* Bit fields for tracking which groups the Friend knows about */
BLE_MESH_ATOMIC_DEFINE(added, LPN_GROUPS); BLE_MESH_ATOMIC_DEFINE(added, LPN_GROUPS);
@ -236,8 +231,8 @@ enum {
}; };
struct bt_mesh_net { struct bt_mesh_net {
u32_t iv_index; /* Current IV Index */ uint32_t iv_index; /* Current IV Index */
u32_t seq; /* Next outgoing sequence number (24 bits) */ uint32_t seq; /* Next outgoing sequence number (24 bits) */
BLE_MESH_ATOMIC_DEFINE(flags, BLE_MESH_FLAG_COUNT); BLE_MESH_ATOMIC_DEFINE(flags, BLE_MESH_FLAG_COUNT);
@ -255,12 +250,12 @@ struct bt_mesh_net {
#endif #endif
/* Number of hours in current IV Update state */ /* Number of hours in current IV Update state */
u8_t ivu_duration; uint8_t ivu_duration;
/* Timer to track duration in current IV Update state */ /* Timer to track duration in current IV Update state */
struct k_delayed_work ivu_timer; struct k_delayed_work ivu_timer;
u8_t dev_key[16]; uint8_t dev_key[16];
struct bt_mesh_app_key app_keys[CONFIG_BLE_MESH_APP_KEY_COUNT]; struct bt_mesh_app_key app_keys[CONFIG_BLE_MESH_APP_KEY_COUNT];
@ -272,12 +267,12 @@ struct bt_mesh_net {
/* Application keys stored by provisioner */ /* Application keys stored by provisioner */
struct bt_mesh_app_key *p_app_keys[CONFIG_BLE_MESH_PROVISIONER_APP_KEY_COUNT]; struct bt_mesh_app_key *p_app_keys[CONFIG_BLE_MESH_PROVISIONER_APP_KEY_COUNT];
/* Next app_idx can be assigned */ /* Next app_idx can be assigned */
u16_t p_app_idx_next; uint16_t p_app_idx_next;
/* Network keys stored by provisioner */ /* Network keys stored by provisioner */
struct bt_mesh_subnet *p_sub[CONFIG_BLE_MESH_PROVISIONER_SUBNET_COUNT]; struct bt_mesh_subnet *p_sub[CONFIG_BLE_MESH_PROVISIONER_SUBNET_COUNT];
/* Next net_idx can be assigned */ /* Next net_idx can be assigned */
u16_t p_net_idx_next; uint16_t p_net_idx_next;
#endif #endif
}; };
@ -293,48 +288,48 @@ enum bt_mesh_net_if {
struct bt_mesh_net_rx { struct bt_mesh_net_rx {
struct bt_mesh_subnet *sub; struct bt_mesh_subnet *sub;
struct bt_mesh_msg_ctx ctx; struct bt_mesh_msg_ctx ctx;
u32_t seq; /* Sequence Number */ uint32_t seq; /* Sequence Number */
u8_t old_iv: 1, /* iv_index - 1 was used */ uint8_t old_iv:1, /* iv_index - 1 was used */
new_key: 1, /* Data was encrypted with updated key */ new_key:1, /* Data was encrypted with updated key */
friend_cred: 1, /* Data was encrypted with friend cred */ friend_cred:1, /* Data was encrypted with friend cred */
ctl: 1, /* Network Control */ ctl:1, /* Network Control */
net_if: 2, /* Network interface */ net_if:2, /* Network interface */
local_match: 1, /* Matched a local element */ local_match:1, /* Matched a local element */
friend_match: 1; /* Matched an LPN we're friends for */ friend_match:1; /* Matched an LPN we're friends for */
u16_t msg_cache_idx; /* Index of entry in message cache */ uint16_t msg_cache_idx; /* Index of entry in message cache */
}; };
/* Encoding context for Network/Transport data */ /* Encoding context for Network/Transport data */
struct bt_mesh_net_tx { struct bt_mesh_net_tx {
struct bt_mesh_subnet *sub; struct bt_mesh_subnet *sub;
struct bt_mesh_msg_ctx *ctx; struct bt_mesh_msg_ctx *ctx;
u16_t src; uint16_t src;
u8_t xmit; uint8_t xmit;
u8_t friend_cred: 1, uint8_t friend_cred:1,
aszmic: 1, aszmic:1,
aid: 6; aid: 6;
}; };
extern struct bt_mesh_net bt_mesh; extern struct bt_mesh_net bt_mesh;
#define BLE_MESH_NET_IVI_TX (bt_mesh.iv_index - \ #define BLE_MESH_NET_IVI_TX (bt_mesh.iv_index - \
bt_mesh_atomic_test_bit(bt_mesh.flags, \ bt_mesh_atomic_test_bit(bt_mesh.flags, \
BLE_MESH_IVU_IN_PROGRESS)) BLE_MESH_IVU_IN_PROGRESS))
#define BLE_MESH_NET_IVI_RX(rx) (bt_mesh.iv_index - (rx)->old_iv) #define BLE_MESH_NET_IVI_RX(rx) (bt_mesh.iv_index - (rx)->old_iv)
#define BLE_MESH_NET_HDR_LEN 9 #define BLE_MESH_NET_HDR_LEN 9
void bt_mesh_msg_cache_clear(u16_t unicast_addr, u8_t elem_num); void bt_mesh_msg_cache_clear(uint16_t unicast_addr, uint8_t elem_num);
int bt_mesh_net_keys_create(struct bt_mesh_subnet_keys *keys, int bt_mesh_net_keys_create(struct bt_mesh_subnet_keys *keys,
const u8_t key[16]); const uint8_t key[16]);
int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16], int bt_mesh_net_create(uint16_t idx, uint8_t flags, const uint8_t key[16],
u32_t iv_index); uint32_t iv_index);
u8_t bt_mesh_net_flags(struct bt_mesh_subnet *sub); uint8_t bt_mesh_net_flags(struct bt_mesh_subnet *sub);
bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key); bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, uint8_t new_kr, bool new_key);
void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub); void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub);
@ -342,14 +337,14 @@ int bt_mesh_net_beacon_update(struct bt_mesh_subnet *sub);
void bt_mesh_rpl_reset(void); void bt_mesh_rpl_reset(void);
bool bt_mesh_net_iv_update(u32_t iv_index, bool iv_update); bool bt_mesh_net_iv_update(uint32_t iv_index, bool iv_update);
void bt_mesh_net_sec_update(struct bt_mesh_subnet *sub); void bt_mesh_net_sec_update(struct bt_mesh_subnet *sub);
struct bt_mesh_subnet *bt_mesh_subnet_get(u16_t net_idx); struct bt_mesh_subnet *bt_mesh_subnet_get(uint16_t net_idx);
struct bt_mesh_subnet *bt_mesh_subnet_find(const u8_t net_id[8], u8_t flags, struct bt_mesh_subnet *bt_mesh_subnet_find(const uint8_t net_id[8], uint8_t flags,
u32_t iv_index, const u8_t auth[8], uint32_t iv_index, const uint8_t auth[8],
bool *new_key); bool *new_key);
int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf, int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf,
@ -365,12 +360,12 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if, int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
struct bt_mesh_net_rx *rx, struct net_buf_simple *buf); struct bt_mesh_net_rx *rx, struct net_buf_simple *buf);
void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi, void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
enum bt_mesh_net_if net_if); enum bt_mesh_net_if net_if);
bool bt_mesh_primary_subnet_exist(void); bool bt_mesh_primary_subnet_exist(void);
u32_t bt_mesh_next_seq(void); uint32_t bt_mesh_next_seq(void);
void bt_mesh_net_start(void); void bt_mesh_net_start(void);
@ -383,28 +378,28 @@ void bt_mesh_net_header_parse(struct net_buf_simple *buf,
/* Friendship Credential Management */ /* Friendship Credential Management */
struct friend_cred { struct friend_cred {
u16_t net_idx; uint16_t net_idx;
u16_t addr; uint16_t addr;
u16_t lpn_counter; uint16_t lpn_counter;
u16_t frnd_counter; uint16_t frnd_counter;
struct { struct {
u8_t nid; /* NID */ uint8_t nid; /* NID */
u8_t enc[16]; /* EncKey */ uint8_t enc[16]; /* EncKey */
u8_t privacy[16]; /* PrivacyKey */ uint8_t privacy[16]; /* PrivacyKey */
} cred[2]; } cred[2];
}; };
int friend_cred_get(struct bt_mesh_subnet *sub, u16_t addr, u8_t *nid, int friend_cred_get(struct bt_mesh_subnet *sub, uint16_t addr, uint8_t *nid,
const u8_t **enc, const u8_t **priv); const uint8_t **enc, const uint8_t **priv);
int friend_cred_set(struct friend_cred *cred, u8_t idx, const u8_t net_key[16]); int friend_cred_set(struct friend_cred *cred, uint8_t idx, const uint8_t net_key[16]);
void friend_cred_refresh(u16_t net_idx); void friend_cred_refresh(uint16_t net_idx);
int friend_cred_update(struct bt_mesh_subnet *sub); int friend_cred_update(struct bt_mesh_subnet *sub);
struct friend_cred *friend_cred_create(struct bt_mesh_subnet *sub, u16_t addr, struct friend_cred *friend_cred_create(struct bt_mesh_subnet *sub, uint16_t addr,
u16_t lpn_counter, u16_t frnd_counter); uint16_t lpn_counter, uint16_t frnd_counter);
void friend_cred_clear(struct friend_cred *cred); void friend_cred_clear(struct friend_cred *cred);
int friend_cred_del(u16_t net_idx, u16_t addr); int friend_cred_del(uint16_t net_idx, uint16_t addr);
static inline void send_cb_finalize(const struct bt_mesh_send_cb *cb, static inline void send_cb_finalize(const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)

View File

@ -57,15 +57,15 @@
*/ */
#define BT_UUID_MESH_PROXY_DATA_OUT_VAL 0x2ade #define BT_UUID_MESH_PROXY_DATA_OUT_VAL 0x2ade
#define BLE_MESH_GATT_GET_CONN_ID(conn_id) ((u16_t)(conn_id)) #define BLE_MESH_GATT_GET_CONN_ID(conn_id) ((uint16_t)(conn_id))
#define BLE_MESH_GATT_CREATE_CONN_ID(conn_id) ((u16_t)(conn_id)) #define BLE_MESH_GATT_CREATE_CONN_ID(conn_id) ((uint16_t)(conn_id))
static uint16_t proxy_svc_start_handle, prov_svc_start_handle; static uint16_t proxy_svc_start_handle, prov_svc_start_handle;
struct bt_mesh_dev bt_mesh_dev; struct bt_mesh_dev bt_mesh_dev;
/* P-256 Variables */ /* P-256 Variables */
static u8_t bt_mesh_public_key[64]; static uint8_t bt_mesh_public_key[64];
static u8_t bt_mesh_private_key[32]; static uint8_t bt_mesh_private_key[32];
/* Scan related functions */ /* Scan related functions */
static bt_mesh_scan_cb_t *bt_mesh_scan_dev_found_cb; static bt_mesh_scan_cb_t *bt_mesh_scan_dev_found_cb;
@ -78,7 +78,7 @@ static sys_slist_t bt_mesh_gatts_db;
static struct bt_mesh_conn bt_mesh_gatts_conn[BLE_MESH_MAX_CONN]; static struct bt_mesh_conn bt_mesh_gatts_conn[BLE_MESH_MAX_CONN];
static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb; static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb;
static u8_t bt_mesh_gatts_addr[6]; static uint8_t bt_mesh_gatts_addr[6];
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */ #endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
@ -129,14 +129,14 @@ static struct gattc_prov_info {
/* Service to be found depends on the type of adv pkt received */ /* Service to be found depends on the type of adv pkt received */
struct bt_mesh_conn conn; struct bt_mesh_conn conn;
bt_mesh_addr_t addr; bt_mesh_addr_t addr;
u16_t service_uuid; uint16_t service_uuid;
u16_t mtu; uint16_t mtu;
bool wr_desc_done; /* Indicate if write char descriptor event is received */ bool wr_desc_done; /* Indicate if write char descriptor event is received */
u16_t start_handle; /* Service attribute start handle */ uint16_t start_handle; /* Service attribute start handle */
u16_t end_handle; /* Service attribute end handle */ uint16_t end_handle; /* Service attribute end handle */
u16_t data_in_handle; /* Data In Characteristic attribute handle */ uint16_t data_in_handle; /* Data In Characteristic attribute handle */
u16_t data_out_handle; /* Data Out Characteristic attribute handle */ uint16_t data_out_handle; /* Data Out Characteristic attribute handle */
u16_t ccc_handle; /* Data Out Characteristic CCC attribute handle */ uint16_t ccc_handle; /* Data Out Characteristic CCC attribute handle */
} bt_mesh_gattc_info[BLE_MESH_MAX_CONN]; } bt_mesh_gattc_info[BLE_MESH_MAX_CONN];
static struct bt_mesh_prov_conn_cb *bt_mesh_gattc_conn_cb; static struct bt_mesh_prov_conn_cb *bt_mesh_gattc_conn_cb;
@ -562,7 +562,7 @@ static int disc_cb(struct ble_gap_event *event, void *arg)
return 0; return 0;
} }
static int start_le_scan(u8_t scan_type, u16_t interval, u16_t window, u8_t filter_dup) static int start_le_scan(uint8_t scan_type, uint16_t interval, uint16_t window, uint8_t filter_dup)
{ {
scan_param.filter_duplicates = filter_dup; scan_param.filter_duplicates = filter_dup;
@ -587,7 +587,7 @@ static int start_le_scan(u8_t scan_type, u16_t interval, u16_t window, u8_t filt
return 0; return 0;
} }
static int set_ad(const struct bt_mesh_adv_data *ad, size_t ad_len, u8_t *buf, u8_t *buf_len) static int set_ad(const struct bt_mesh_adv_data *ad, size_t ad_len, uint8_t *buf, uint8_t *buf_len)
{ {
int i; int i;
@ -604,7 +604,7 @@ static int set_ad(const struct bt_mesh_adv_data *ad, size_t ad_len, u8_t *buf, u
} }
#if defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE #if defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle); static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle);
static int gap_event_cb(struct ble_gap_event *event, void *arg) static int gap_event_cb(struct ble_gap_event *event, void *arg)
{ {
@ -627,7 +627,7 @@ static int gap_event_cb(struct ble_gap_event *event, void *arg)
bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING); bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING);
#endif #endif
if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->connected != NULL) { if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->connected != NULL) {
u8_t index = BLE_MESH_GATT_GET_CONN_ID(event->connect.conn_handle); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(event->connect.conn_handle);
if (index < BLE_MESH_MAX_CONN) { if (index < BLE_MESH_MAX_CONN) {
bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(event->connect.conn_handle); bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(event->connect.conn_handle);
(bt_mesh_gatts_conn_cb->connected)(&bt_mesh_gatts_conn[index], 0); (bt_mesh_gatts_conn_cb->connected)(&bt_mesh_gatts_conn[index], 0);
@ -651,7 +651,7 @@ static int gap_event_cb(struct ble_gap_event *event, void *arg)
bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING); bt_mesh_atomic_test_and_clear_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING);
#endif #endif
if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->disconnected != NULL) { if (bt_mesh_gatts_conn_cb != NULL && bt_mesh_gatts_conn_cb->disconnected != NULL) {
u8_t index = BLE_MESH_GATT_GET_CONN_ID(event->disconnect.conn.conn_handle); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(event->disconnect.conn.conn_handle);
if (index < BLE_MESH_MAX_CONN) { if (index < BLE_MESH_MAX_CONN) {
bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(event->disconnect.conn.conn_handle); bt_mesh_gatts_conn[index].handle = BLE_MESH_GATT_GET_CONN_ID(event->disconnect.conn.conn_handle);
(bt_mesh_gatts_conn_cb->disconnected)(&bt_mesh_gatts_conn[index], event->disconnect.reason); (bt_mesh_gatts_conn_cb->disconnected)(&bt_mesh_gatts_conn[index], event->disconnect.reason);
@ -695,8 +695,8 @@ static int gap_event_cb(struct ble_gap_event *event, void *arg)
event->subscribe.prev_indicate, event->subscribe.prev_indicate,
event->subscribe.cur_indicate); event->subscribe.cur_indicate);
struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(event->subscribe.attr_handle + 1); struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(event->subscribe.attr_handle + 1);
u8_t index = BLE_MESH_GATT_GET_CONN_ID(event->subscribe.conn_handle); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(event->subscribe.conn_handle);
u16_t len = 0; uint16_t len = 0;
uint16_t ccc_val = 0; uint16_t ccc_val = 0;
if (event->subscribe.prev_notify != event->subscribe.cur_notify) { if (event->subscribe.prev_notify != event->subscribe.cur_notify) {
@ -1001,7 +1001,7 @@ void bt_mesh_gatts_conn_cb_deregister(void)
bt_mesh_gatts_conn_cb = NULL; bt_mesh_gatts_conn_cb = NULL;
} }
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle) static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle)
{ {
struct bt_mesh_gatt_service *svc = NULL; struct bt_mesh_gatt_service *svc = NULL;
struct bt_mesh_gatt_attr *attr = NULL; struct bt_mesh_gatt_attr *attr = NULL;
@ -1021,7 +1021,7 @@ static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(u16_t handle)
return NULL; return NULL;
} }
static void bt_mesh_gatts_foreach_attr(u16_t start_handle, u16_t end_handle, static void bt_mesh_gatts_foreach_attr(uint16_t start_handle, uint16_t end_handle,
bt_mesh_gatt_attr_func_t func, void *user_data) bt_mesh_gatt_attr_func_t func, void *user_data)
{ {
struct bt_mesh_gatt_service *svc = NULL; struct bt_mesh_gatt_service *svc = NULL;
@ -1045,7 +1045,7 @@ static void bt_mesh_gatts_foreach_attr(u16_t start_handle, u16_t end_handle,
} }
} }
static u8_t find_next(const struct bt_mesh_gatt_attr *attr, void *user_data) static uint8_t find_next(const struct bt_mesh_gatt_attr *attr, void *user_data)
{ {
struct bt_mesh_gatt_attr **next = user_data; struct bt_mesh_gatt_attr **next = user_data;
@ -1065,10 +1065,10 @@ static struct bt_mesh_gatt_attr *bt_mesh_gatts_attr_next(const struct bt_mesh_ga
ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t buf_len, u16_t offset, void *buf, uint16_t buf_len, uint16_t offset,
const void *value, u16_t value_len) const void *value, uint16_t value_len)
{ {
u16_t len; uint16_t len;
if (offset > value_len) { if (offset > value_len) {
return BLE_MESH_GATT_ERR(BLE_MESH_ATT_ERR_INVALID_OFFSET); return BLE_MESH_GATT_ERR(BLE_MESH_ATT_ERR_INVALID_OFFSET);
@ -1084,19 +1084,19 @@ ssize_t bt_mesh_gatts_attr_read(struct bt_mesh_conn *conn,
} }
struct gatts_incl { struct gatts_incl {
u16_t start_handle; uint16_t start_handle;
u16_t end_handle; uint16_t end_handle;
u16_t uuid16; uint16_t uuid16;
} __packed; } __packed;
ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_gatt_attr *incl = attr->user_data; struct bt_mesh_gatt_attr *incl = attr->user_data;
struct bt_mesh_uuid *uuid = incl->user_data; struct bt_mesh_uuid *uuid = incl->user_data;
struct gatts_incl pdu = {0}; struct gatts_incl pdu = {0};
u8_t value_len; uint8_t value_len;
/* First attr points to the start handle */ /* First attr points to the start handle */
pdu.start_handle = sys_cpu_to_le16(incl->handle); pdu.start_handle = sys_cpu_to_le16(incl->handle);
@ -1116,12 +1116,12 @@ ssize_t bt_mesh_gatts_attr_read_included(struct bt_mesh_conn *conn,
ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_uuid *uuid = attr->user_data; struct bt_mesh_uuid *uuid = attr->user_data;
if (uuid->type == BLE_MESH_UUID_TYPE_16) { if (uuid->type == BLE_MESH_UUID_TYPE_16) {
u16_t uuid16 = sys_cpu_to_le16(BLE_MESH_UUID_16(uuid)->val); uint16_t uuid16 = sys_cpu_to_le16(BLE_MESH_UUID_16(uuid)->val);
return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, &uuid16, 2); return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, &uuid16, 2);
} }
@ -1131,22 +1131,22 @@ ssize_t bt_mesh_gatts_attr_read_service(struct bt_mesh_conn *conn,
} }
struct gatts_chrc { struct gatts_chrc {
u8_t properties; uint8_t properties;
u16_t value_handle; uint16_t value_handle;
union { union {
u16_t uuid16; uint16_t uuid16;
u8_t uuid[16]; uint8_t uuid[16];
}; };
} __packed; } __packed;
ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn, ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
struct bt_mesh_gatt_char *chrc = attr->user_data; struct bt_mesh_gatt_char *chrc = attr->user_data;
const struct bt_mesh_gatt_attr *next = NULL; const struct bt_mesh_gatt_attr *next = NULL;
struct gatts_chrc pdu = {0}; struct gatts_chrc pdu = {0};
u8_t value_len; uint8_t value_len;
pdu.properties = chrc->properties; pdu.properties = chrc->properties;
/* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534: /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534:
@ -1179,7 +1179,7 @@ ssize_t bt_mesh_gatts_attr_read_chrc(struct bt_mesh_conn *conn,
static int gatts_register(struct bt_mesh_gatt_service *svc) static int gatts_register(struct bt_mesh_gatt_service *svc)
{ {
struct bt_mesh_gatt_service *last; struct bt_mesh_gatt_service *last;
u16_t handle; uint16_t handle;
if (sys_slist_is_empty(&bt_mesh_gatts_db)) { if (sys_slist_is_empty(&bt_mesh_gatts_db)) {
handle = 0; handle = 0;
@ -1231,9 +1231,9 @@ int bt_mesh_gatts_service_deregister(struct bt_mesh_gatt_service *svc)
return 0; return 0;
} }
int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, u8_t reason) int bt_mesh_gatts_disconnect(struct bt_mesh_conn *conn, uint8_t reason)
{ {
u16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(conn->handle); uint16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(conn->handle);
ble_gap_terminate(conn_id, reason); ble_gap_terminate(conn_id, reason);
return 0; return 0;
} }
@ -1247,10 +1247,10 @@ int bt_mesh_gatts_service_unregister(struct bt_mesh_gatt_service *svc)
int bt_mesh_gatts_notify(struct bt_mesh_conn *conn, int bt_mesh_gatts_notify(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len) const void *data, uint16_t len)
{ {
struct os_mbuf *om; struct os_mbuf *om;
u16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(conn->handle); uint16_t conn_id = BLE_MESH_GATT_CREATE_CONN_ID(conn->handle);
om = ble_hs_mbuf_from_flat(data, len); om = ble_hs_mbuf_from_flat(data, len);
assert(om); assert(om);
@ -1259,7 +1259,7 @@ int bt_mesh_gatts_notify(struct bt_mesh_conn *conn,
return 0; return 0;
} }
u16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn) uint16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn)
{ {
return ble_att_preferred_mtu(); return ble_att_preferred_mtu();
} }
@ -1329,10 +1329,10 @@ void bt_mesh_gattc_conn_cb_deregister(void)
bt_mesh_gattc_conn_cb = NULL; bt_mesh_gattc_conn_cb = NULL;
} }
u8_t bt_mesh_gattc_get_free_conn_count(void) uint8_t bt_mesh_gattc_get_free_conn_count(void)
{ {
u8_t count = 0; uint8_t count = 0;
u8_t i; uint8_t i;
for (i = 0U; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { for (i = 0U; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
if (bt_mesh_gattc_info[i].conn.handle == 0xFFFF && if (bt_mesh_gattc_info[i].conn.handle == 0xFFFF &&
@ -1344,7 +1344,7 @@ u8_t bt_mesh_gattc_get_free_conn_count(void)
return count; return count;
} }
u16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn) uint16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn)
{ {
int i; int i;
@ -1371,9 +1371,9 @@ u16_t bt_mesh_gattc_get_service_uuid(struct bt_mesh_conn *conn)
* 6. Set the Notification bit of CCC * 6. Set the Notification bit of CCC
*/ */
int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, u16_t service_uuid) int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
{ {
u8_t zero[6] = {0}; uint8_t zero[6] = {0};
int i, rc; int i, rc;
if (!addr || !memcmp(addr->val, zero, BLE_MESH_ADDR_LEN) || if (!addr || !memcmp(addr->val, zero, BLE_MESH_ADDR_LEN) ||
@ -1467,7 +1467,7 @@ static int mtu_cb(uint16_t conn_handle,
void bt_mesh_gattc_exchange_mtu(u8_t index) void bt_mesh_gattc_exchange_mtu(uint8_t index)
{ {
/** Set local MTU and exchange with GATT server. /** Set local MTU and exchange with GATT server.
* ATT_MTU >= 69 for Mesh GATT Prov Service * ATT_MTU >= 69 for Mesh GATT Prov Service
@ -1477,7 +1477,7 @@ void bt_mesh_gattc_exchange_mtu(u8_t index)
ble_gattc_exchange_mtu(bt_mesh_gattc_info[index].conn.handle, mtu_cb, NULL); ble_gattc_exchange_mtu(bt_mesh_gattc_info[index].conn.handle, mtu_cb, NULL);
} }
u16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn) uint16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn)
{ {
int i; int i;
@ -1492,9 +1492,9 @@ u16_t bt_mesh_gattc_get_mtu_info(struct bt_mesh_conn *conn)
int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn, int bt_mesh_gattc_write_no_rsp(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *data, u16_t len) const void *data, uint16_t len)
{ {
u16_t conn_id; uint16_t conn_id;
int i; int i;
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
@ -1584,8 +1584,8 @@ static int proxy_char_access_cb(uint16_t conn_handle, uint16_t attr_handle,
{ {
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR || ctxt->op == BLE_GATT_ACCESS_OP_WRITE_DSC) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR || ctxt->op == BLE_GATT_ACCESS_OP_WRITE_DSC) {
struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(attr_handle); struct bt_mesh_gatt_attr *attr = bt_mesh_gatts_find_attr_by_handle(attr_handle);
u8_t index = BLE_MESH_GATT_GET_CONN_ID(conn_handle); uint8_t index = BLE_MESH_GATT_GET_CONN_ID(conn_handle);
u16_t len = 0; uint16_t len = 0;
BT_DBG("write, handle %d, len %d, data %s", attr_handle, BT_DBG("write, handle %d, len %d, data %s", attr_handle,
ctxt->om->om_len, ctxt->om->om_len,
@ -1767,23 +1767,23 @@ int bt_mesh_rand(void *buf, size_t len)
return -EAGAIN; return -EAGAIN;
} }
for (i = 0; i < (int)(len / sizeof(u32_t)); i++) { for (i = 0; i < (int)(len / sizeof(uint32_t)); i++) {
u32_t rand = esp_random(); uint32_t rand = esp_random();
memcpy(buf + i * sizeof(u32_t), &rand, sizeof(u32_t)); memcpy(buf + i * sizeof(uint32_t), &rand, sizeof(uint32_t));
} }
BT_DBG("Rand %s", bt_hex(buf, len)); BT_DBG("Rand %s", bt_hex(buf, len));
return 0; return 0;
} }
void bt_mesh_set_private_key(const u8_t pri_key[32]) void bt_mesh_set_private_key(const uint8_t pri_key[32])
{ {
memcpy(bt_mesh_private_key, pri_key, 32); memcpy(bt_mesh_private_key, pri_key, 32);
} }
int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv); int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv);
const u8_t *bt_mesh_pub_key_get(void) const uint8_t *bt_mesh_pub_key_get(void)
{ {
uint8_t pri_key[32] = {0}; uint8_t pri_key[32] = {0};
@ -1817,7 +1817,7 @@ const u8_t *bt_mesh_pub_key_get(void)
return bt_mesh_public_key; return bt_mesh_public_key;
} }
bool bt_mesh_check_public_key(const u8_t key[64]) bool bt_mesh_check_public_key(const uint8_t key[64])
{ {
struct mbedtls_ecp_point pt = {0}; struct mbedtls_ecp_point pt = {0};
mbedtls_ecp_group grp = {0}; mbedtls_ecp_group grp = {0};
@ -1857,7 +1857,7 @@ exit:
int ble_sm_alg_gen_dhkey(uint8_t *peer_pub_key_x, uint8_t *peer_pub_key_y, int ble_sm_alg_gen_dhkey(uint8_t *peer_pub_key_x, uint8_t *peer_pub_key_y,
uint8_t *our_priv_key, uint8_t *out_dhkey); uint8_t *our_priv_key, uint8_t *out_dhkey);
int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u8_t idx) int bt_mesh_dh_key_gen(const uint8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const uint8_t idx)
{ {
uint8_t dhkey[32]; uint8_t dhkey[32];
@ -1866,14 +1866,14 @@ int bt_mesh_dh_key_gen(const u8_t remote_pk[64], bt_mesh_dh_key_cb_t cb, const u
ble_sm_alg_gen_dhkey((uint8_t *)&remote_pk[0], (uint8_t *)&remote_pk[32], bt_mesh_private_key, dhkey); ble_sm_alg_gen_dhkey((uint8_t *)&remote_pk[0], (uint8_t *)&remote_pk[32], bt_mesh_private_key, dhkey);
if (cb != NULL) { if (cb != NULL) {
cb((const u8_t *)dhkey, idx); cb((const uint8_t *)dhkey, idx);
} }
return 0; return 0;
} }
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
static void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_le, static void ecb_encrypt(uint8_t const *const key_le, uint8_t const *const clear_text_le,
u8_t *const cipher_text_le, u8_t *const cipher_text_be) uint8_t *const cipher_text_le, uint8_t *const cipher_text_be)
{ {
struct bt_mesh_ecb_param ecb; struct bt_mesh_ecb_param ecb;
mbedtls_aes_context aes_ctx = {0}; mbedtls_aes_context aes_ctx = {0};
@ -1894,8 +1894,8 @@ static void ecb_encrypt(u8_t const *const key_le, u8_t const *const clear_text_l
} }
} }
static void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_text_be, static void ecb_encrypt_be(uint8_t const *const key_be, uint8_t const *const clear_text_be,
u8_t *const cipher_text_be) uint8_t *const cipher_text_be)
{ {
struct bt_mesh_ecb_param ecb; struct bt_mesh_ecb_param ecb;
mbedtls_aes_context aes_ctx = {0}; mbedtls_aes_context aes_ctx = {0};
@ -1909,8 +1909,8 @@ static void ecb_encrypt_be(u8_t const *const key_be, u8_t const *const clear_tex
} }
#endif /* CONFIG_MBEDTLS_HARDWARE_AES */ #endif /* CONFIG_MBEDTLS_HARDWARE_AES */
int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]) uint8_t enc_data[16])
{ {
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -1921,7 +1921,7 @@ int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16],
return 0; return 0;
#else /* CONFIG_MBEDTLS_HARDWARE_AES */ #else /* CONFIG_MBEDTLS_HARDWARE_AES */
struct tc_aes_key_sched_struct s; struct tc_aes_key_sched_struct s;
u8_t tmp[16]; uint8_t tmp[16];
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -1945,8 +1945,8 @@ int bt_mesh_encrypt_le(const u8_t key[16], const u8_t plaintext[16],
#endif /* CONFIG_MBEDTLS_HARDWARE_AES */ #endif /* CONFIG_MBEDTLS_HARDWARE_AES */
} }
int bt_mesh_encrypt_be(const u8_t key[16], const u8_t plaintext[16], int bt_mesh_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
u8_t enc_data[16]) uint8_t enc_data[16])
{ {
#if CONFIG_MBEDTLS_HARDWARE_AES #if CONFIG_MBEDTLS_HARDWARE_AES
BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16)); BT_DBG("key %s plaintext %s", bt_hex(key, 16), bt_hex(plaintext, 16));
@ -1976,7 +1976,7 @@ int bt_mesh_encrypt_be(const u8_t key[16], const u8_t plaintext[16],
} }
#if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN) #if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN)
int bt_mesh_update_exceptional_list(u8_t sub_code, u8_t type, void *info) int bt_mesh_update_exceptional_list(uint8_t sub_code, uint8_t type, void *info)
{ {
BT_ERR("Unsupported for NimBLE host"); BT_ERR("Unsupported for NimBLE host");
return 0; return 0;

View File

@ -110,45 +110,45 @@ enum {
struct prov_link { struct prov_link {
BLE_MESH_ATOMIC_DEFINE(flags, NUM_FLAGS); BLE_MESH_ATOMIC_DEFINE(flags, NUM_FLAGS);
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
struct bt_mesh_conn *conn; /* GATT connection */ struct bt_mesh_conn *conn; /* GATT connection */
#endif #endif
u8_t dhkey[32]; /* Calculated DHKey */ uint8_t dhkey[32]; /* Calculated DHKey */
u8_t expect; /* Next expected PDU */ uint8_t expect; /* Next expected PDU */
bool oob_pk_flag; /* Flag indicates whether using OOB public key */ bool oob_pk_flag; /* Flag indicates whether using OOB public key */
u8_t oob_method; uint8_t oob_method;
u8_t oob_action; uint8_t oob_action;
u8_t oob_size; uint8_t oob_size;
u8_t conf[16]; /* Remote Confirmation */ uint8_t conf[16]; /* Remote Confirmation */
u8_t rand[16]; /* Local Random */ uint8_t rand[16]; /* Local Random */
u8_t auth[16]; /* Authentication Value */ uint8_t auth[16]; /* Authentication Value */
u8_t conf_salt[16]; /* ConfirmationSalt */ uint8_t conf_salt[16]; /* ConfirmationSalt */
u8_t conf_key[16]; /* ConfirmationKey */ uint8_t conf_key[16]; /* ConfirmationKey */
u8_t conf_inputs[145]; /* ConfirmationInputs */ uint8_t conf_inputs[145]; /* ConfirmationInputs */
u8_t prov_salt[16]; /* Provisioning Salt */ uint8_t prov_salt[16]; /* Provisioning Salt */
#if defined(CONFIG_BLE_MESH_PB_ADV) #if defined(CONFIG_BLE_MESH_PB_ADV)
u32_t id; /* Link ID */ uint32_t id; /* Link ID */
u8_t tx_pdu_type; /* The previously transmitted Provisioning PDU type */ uint8_t tx_pdu_type; /* The previously transmitted Provisioning PDU type */
struct { struct {
u8_t id; /* Transaction ID */ uint8_t id; /* Transaction ID */
u8_t prev_id; /* Previous Transaction ID */ uint8_t prev_id; /* Previous Transaction ID */
u8_t seg; /* Bit-field of unreceived segments */ uint8_t seg; /* Bit-field of unreceived segments */
u8_t last_seg; /* Last segment (to check length) */ uint8_t last_seg; /* Last segment (to check length) */
u8_t fcs; /* Expected FCS value */ uint8_t fcs; /* Expected FCS value */
struct net_buf_simple *buf; struct net_buf_simple *buf;
} rx; } rx;
struct { struct {
/* Start timestamp of the transaction */ /* Start timestamp of the transaction */
s64_t start; int64_t start;
/* Transaction id*/ /* Transaction id*/
u8_t id; uint8_t id;
/* Pending outgoing buffer(s) */ /* Pending outgoing buffer(s) */
struct net_buf *buf[3]; struct net_buf *buf[3];
@ -162,9 +162,9 @@ struct prov_link {
}; };
struct prov_rx { struct prov_rx {
u32_t link_id; uint32_t link_id;
u8_t xact_id; uint8_t xact_id;
u8_t gpc; uint8_t gpc;
}; };
#define BUF_TIMEOUT K_MSEC(400) #define BUF_TIMEOUT K_MSEC(400)
@ -332,15 +332,15 @@ static struct net_buf *adv_buf_create(void)
return buf; return buf;
} }
static u8_t pending_ack = XACT_NVAL; static uint8_t pending_ack = XACT_NVAL;
static void ack_complete(u16_t duration, int err, void *user_data) static void ack_complete(uint16_t duration, int err, void *user_data)
{ {
BT_DBG("xact %u complete", (u8_t)pending_ack); BT_DBG("xact %u complete", (uint8_t)pending_ack);
pending_ack = XACT_NVAL; pending_ack = XACT_NVAL;
} }
static void gen_prov_ack_send(u8_t xact_id) static void gen_prov_ack_send(uint8_t xact_id)
{ {
static const struct bt_mesh_send_cb cb = { static const struct bt_mesh_send_cb cb = {
.start = ack_complete, .start = ack_complete,
@ -396,7 +396,7 @@ static void send_reliable(void)
} }
} }
static int bearer_ctl_send(u8_t op, void *data, u8_t data_len) static int bearer_ctl_send(uint8_t op, void *data, uint8_t data_len)
{ {
struct net_buf *buf = NULL; struct net_buf *buf = NULL;
@ -421,7 +421,7 @@ static int bearer_ctl_send(u8_t op, void *data, u8_t data_len)
return 0; return 0;
} }
static u8_t last_seg(u8_t len) static uint8_t last_seg(uint8_t len)
{ {
if (len <= START_PAYLOAD_MAX) { if (len <= START_PAYLOAD_MAX) {
return 0; return 0;
@ -432,7 +432,7 @@ static u8_t last_seg(u8_t len)
return 1 + (len / CONT_PAYLOAD_MAX); return 1 + (len / CONT_PAYLOAD_MAX);
} }
static inline u8_t next_transaction_id(void) static inline uint8_t next_transaction_id(void)
{ {
if (link.tx.id != 0U && link.tx.id != 0xFF) { if (link.tx.id != 0U && link.tx.id != 0xFF) {
return ++link.tx.id; return ++link.tx.id;
@ -445,9 +445,9 @@ static inline u8_t next_transaction_id(void)
static int prov_send_adv(struct net_buf_simple *msg) static int prov_send_adv(struct net_buf_simple *msg)
{ {
struct net_buf *start = NULL, *buf = NULL; struct net_buf *start = NULL, *buf = NULL;
u8_t seg_len = 0U, seg_id = 0U; uint8_t seg_len = 0U, seg_id = 0U;
u8_t xact_id = 0U; uint8_t xact_id = 0U;
s32_t timeout = PROTOCOL_TIMEOUT; int32_t timeout = PROTOCOL_TIMEOUT;
BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len)); BT_DBG("len %u: %s", msg->len, bt_hex(msg->data, msg->len));
@ -558,13 +558,13 @@ static inline int prov_send(struct net_buf_simple *buf)
#endif #endif
} }
static void prov_buf_init(struct net_buf_simple *buf, u8_t type) static void prov_buf_init(struct net_buf_simple *buf, uint8_t type)
{ {
net_buf_simple_reserve(buf, PROV_BUF_HEADROOM); net_buf_simple_reserve(buf, PROV_BUF_HEADROOM);
net_buf_simple_add_u8(buf, type); net_buf_simple_add_u8(buf, type);
} }
static void prov_send_fail_msg(u8_t err) static void prov_send_fail_msg(uint8_t err)
{ {
PROV_BUF(buf, 2); PROV_BUF(buf, 2);
@ -578,7 +578,7 @@ static void prov_send_fail_msg(u8_t err)
bt_mesh_atomic_set_bit(link.flags, LINK_INVALID); bt_mesh_atomic_set_bit(link.flags, LINK_INVALID);
} }
static void prov_invite(const u8_t *data) static void prov_invite(const uint8_t *data)
{ {
PROV_BUF(buf, 12); PROV_BUF(buf, 12);
@ -626,9 +626,9 @@ static void prov_invite(const u8_t *data)
link.expect = PROV_START; link.expect = PROV_START;
} }
static void prov_capabilities(const u8_t *data) static void prov_capabilities(const uint8_t *data)
{ {
u16_t algorithms = 0U, output_action = 0U, input_action = 0U; uint16_t algorithms = 0U, output_action = 0U, input_action = 0U;
BT_DBG("Elements: %u", data[0]); BT_DBG("Elements: %u", data[0]);
@ -652,7 +652,7 @@ static void prov_capabilities(const u8_t *data)
((void) input_action); ((void) input_action);
} }
static bt_mesh_output_action_t output_action(u8_t action) static bt_mesh_output_action_t output_action(uint8_t action)
{ {
switch (action) { switch (action) {
case OUTPUT_OOB_BLINK: case OUTPUT_OOB_BLINK:
@ -670,7 +670,7 @@ static bt_mesh_output_action_t output_action(u8_t action)
} }
} }
static bt_mesh_input_action_t input_action(u8_t action) static bt_mesh_input_action_t input_action(uint8_t action)
{ {
switch (action) { switch (action) {
case INPUT_OOB_PUSH: case INPUT_OOB_PUSH:
@ -686,7 +686,7 @@ static bt_mesh_input_action_t input_action(u8_t action)
} }
} }
static int prov_auth(u8_t method, u8_t action, u8_t size) static int prov_auth(uint8_t method, uint8_t action, uint8_t size)
{ {
bt_mesh_output_action_t output = 0U; bt_mesh_output_action_t output = 0U;
bt_mesh_input_action_t input = 0U; bt_mesh_input_action_t input = 0U;
@ -726,7 +726,7 @@ static int prov_auth(u8_t method, u8_t action, u8_t size)
if (output == BLE_MESH_DISPLAY_STRING) { if (output == BLE_MESH_DISPLAY_STRING) {
unsigned char str[9] = {'\0'}; unsigned char str[9] = {'\0'};
u8_t i = 0U; uint8_t i = 0U;
bt_mesh_rand(str, size); bt_mesh_rand(str, size);
@ -747,10 +747,10 @@ static int prov_auth(u8_t method, u8_t action, u8_t size)
return prov->output_string((char *)str); return prov->output_string((char *)str);
} else { } else {
u32_t div[8] = { 10, 100, 1000, 10000, 100000, uint32_t div[8] = { 10, 100, 1000, 10000, 100000,
1000000, 10000000, 100000000 1000000, 10000000, 100000000
}; };
u32_t num = 0U; uint32_t num = 0U;
bt_mesh_rand(&num, sizeof(num)); bt_mesh_rand(&num, sizeof(num));
num %= div[size - 1]; num %= div[size - 1];
@ -788,7 +788,7 @@ static int prov_auth(u8_t method, u8_t action, u8_t size)
} }
} }
static void prov_start(const u8_t *data) static void prov_start(const uint8_t *data)
{ {
BT_INFO("Algorithm: 0x%02x", data[0]); BT_INFO("Algorithm: 0x%02x", data[0]);
BT_INFO("Public Key: 0x%02x", data[1]); BT_INFO("Public Key: 0x%02x", data[1]);
@ -888,7 +888,7 @@ static void send_input_complete(void)
} }
} }
int bt_mesh_input_number(u32_t num) int bt_mesh_input_number(uint32_t num)
{ {
BT_INFO("%u", num); BT_INFO("%u", num);
@ -934,7 +934,7 @@ int bt_mesh_input_string(const char *str)
return 0; return 0;
} }
static void prov_dh_key_cb(const u8_t key[32], const u8_t idx) static void prov_dh_key_cb(const uint8_t key[32], const uint8_t idx)
{ {
BT_DBG("%p", key); BT_DBG("%p", key);
@ -963,7 +963,7 @@ static void prov_dh_key_cb(const u8_t key[32], const u8_t idx)
static void send_pub_key(void) static void send_pub_key(void)
{ {
PROV_BUF(buf, 65); PROV_BUF(buf, 65);
const u8_t *key = NULL; const uint8_t *key = NULL;
/* Copy remote key in little-endian for bt_mesh_dh_key_gen(). /* Copy remote key in little-endian for bt_mesh_dh_key_gen().
* X and Y halves are swapped independently. Use response * X and Y halves are swapped independently. Use response
@ -1024,8 +1024,8 @@ static int bt_mesh_calc_dh_key(void)
return 0; return 0;
} }
int bt_mesh_set_oob_pub_key(const u8_t pub_key_x[32], const u8_t pub_key_y[32], int bt_mesh_set_oob_pub_key(const uint8_t pub_key_x[32], const uint8_t pub_key_y[32],
const u8_t pri_key[32]) const uint8_t pri_key[32])
{ {
if (!pub_key_x || !pub_key_y || !pri_key) { if (!pub_key_x || !pub_key_y || !pri_key) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -1050,7 +1050,7 @@ int bt_mesh_set_oob_pub_key(const u8_t pub_key_x[32], const u8_t pub_key_y[32],
return bt_mesh_calc_dh_key(); return bt_mesh_calc_dh_key();
} }
static void prov_pub_key(const u8_t *data) static void prov_pub_key(const uint8_t *data)
{ {
BT_DBG("Remote Public Key: %s", bt_hex(data, 64)); BT_DBG("Remote Public Key: %s", bt_hex(data, 64));
@ -1085,12 +1085,12 @@ static void prov_pub_key(const u8_t *data)
} }
} }
static void prov_input_complete(const u8_t *data) static void prov_input_complete(const uint8_t *data)
{ {
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
} }
static void prov_confirm(const u8_t *data) static void prov_confirm(const uint8_t *data)
{ {
BT_DBG("Remote Confirm: %s", bt_hex(data, 16)); BT_DBG("Remote Confirm: %s", bt_hex(data, 16));
@ -1110,10 +1110,10 @@ static void prov_confirm(const u8_t *data)
} }
} }
static void prov_random(const u8_t *data) static void prov_random(const uint8_t *data)
{ {
PROV_BUF(rnd, 17); PROV_BUF(rnd, 17);
u8_t conf_verify[16] = {0}; uint8_t conf_verify[16] = {0};
BT_DBG("Remote Random: %s", bt_hex(data, 16)); BT_DBG("Remote Random: %s", bt_hex(data, 16));
@ -1160,17 +1160,17 @@ static inline bool is_pb_gatt(void)
#endif #endif
} }
static void prov_data(const u8_t *data) static void prov_data(const uint8_t *data)
{ {
PROV_BUF(msg, 1); PROV_BUF(msg, 1);
u8_t session_key[16] = {0}; uint8_t session_key[16] = {0};
u8_t nonce[13] = {0}; uint8_t nonce[13] = {0};
u8_t dev_key[16] = {0}; uint8_t dev_key[16] = {0};
u8_t pdu[25] = {0}; uint8_t pdu[25] = {0};
u8_t flags = 0U; uint8_t flags = 0U;
u32_t iv_index = 0U; uint32_t iv_index = 0U;
u16_t addr = 0U; uint16_t addr = 0U;
u16_t net_idx = 0U; uint16_t net_idx = 0U;
int err = 0; int err = 0;
bool identity_enable = false; bool identity_enable = false;
@ -1248,19 +1248,19 @@ static void prov_data(const u8_t *data)
} }
} }
static void prov_complete(const u8_t *data) static void prov_complete(const uint8_t *data)
{ {
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
} }
static void prov_failed(const u8_t *data) static void prov_failed(const uint8_t *data)
{ {
BT_WARN("Error: 0x%02x", data[0]); BT_WARN("Error: 0x%02x", data[0]);
} }
static const struct { static const struct {
void (*func)(const u8_t *data); void (*func)(const uint8_t *data);
u16_t len; uint16_t len;
} prov_handlers[] = { } prov_handlers[] = {
{ prov_invite, 1 }, { prov_invite, 1 },
{ prov_capabilities, 11 }, { prov_capabilities, 11 },
@ -1277,7 +1277,7 @@ static const struct {
#if defined(CONFIG_BLE_MESH_PB_ADV) #if defined(CONFIG_BLE_MESH_PB_ADV)
static void prov_retransmit(struct k_work *work) static void prov_retransmit(struct k_work *work)
{ {
s64_t timeout = TRANSACTION_TIMEOUT; int64_t timeout = TRANSACTION_TIMEOUT;
int i; int i;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -1412,7 +1412,7 @@ static void gen_prov_ctl(struct prov_rx *rx, struct net_buf_simple *buf)
static void prov_msg_recv(void) static void prov_msg_recv(void)
{ {
u8_t type = link.rx.buf->data[0]; uint8_t type = link.rx.buf->data[0];
BT_DBG("type 0x%02x len %u", type, link.rx.buf->len); BT_DBG("type 0x%02x len %u", type, link.rx.buf->len);
@ -1460,7 +1460,7 @@ static void prov_msg_recv(void)
static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf)
{ {
u8_t seg = CONT_SEG_INDEX(rx->gpc); uint8_t seg = CONT_SEG_INDEX(rx->gpc);
BT_DBG("len %u, seg_index %u", buf->len, seg); BT_DBG("len %u, seg_index %u", buf->len, seg);
@ -1481,7 +1481,7 @@ static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf)
prov_send_fail_msg(PROV_ERR_NVAL_FMT); prov_send_fail_msg(PROV_ERR_NVAL_FMT);
return; return;
} else if (seg == link.rx.last_seg) { } else if (seg == link.rx.last_seg) {
u8_t expect_len = 0U; uint8_t expect_len = 0U;
expect_len = (link.rx.buf->len - 20U - expect_len = (link.rx.buf->len - 20U -
((link.rx.last_seg - 1) * 23U)); ((link.rx.last_seg - 1) * 23U));
@ -1571,7 +1571,7 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf)
static const struct { static const struct {
void (*func)(struct prov_rx *rx, struct net_buf_simple *buf); void (*func)(struct prov_rx *rx, struct net_buf_simple *buf);
bool require_link; bool require_link;
u8_t min_len; uint8_t min_len;
} gen_prov[] = { } gen_prov[] = {
{ gen_prov_start, true, 3 }, { gen_prov_start, true, 3 },
{ gen_prov_ack, true, 0 }, { gen_prov_ack, true, 0 },
@ -1627,7 +1627,7 @@ void bt_mesh_pb_adv_recv(struct net_buf_simple *buf)
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf) int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf)
{ {
u8_t type = 0U; uint8_t type = 0U;
BT_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("%u bytes: %s", buf->len, bt_hex(buf->data, buf->len));
@ -1727,7 +1727,7 @@ static void protocol_timeout(struct k_work *work)
#endif #endif
#if defined(CONFIG_BLE_MESH_PB_ADV) #if defined(CONFIG_BLE_MESH_PB_ADV)
u8_t reason = CLOSE_REASON_TIMEOUT; uint8_t reason = CLOSE_REASON_TIMEOUT;
link.rx.seg = 0U; link.rx.seg = 0U;
bearer_ctl_send(LINK_CLOSE, &reason, sizeof(reason)); bearer_ctl_send(LINK_CLOSE, &reason, sizeof(reason));
@ -1738,7 +1738,7 @@ static void protocol_timeout(struct k_work *work)
int bt_mesh_prov_init(const struct bt_mesh_prov *prov_info) int bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
{ {
const u8_t *key = NULL; const uint8_t *key = NULL;
if (!prov_info) { if (!prov_info) {
BT_ERR("No provisioning context provided"); BT_ERR("No provisioning context provided");
@ -1810,8 +1810,8 @@ int bt_mesh_prov_deinit(void)
} }
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
void bt_mesh_prov_complete(u16_t net_idx, const u8_t net_key[16], void bt_mesh_prov_complete(uint16_t net_idx, const uint8_t net_key[16],
u16_t addr, u8_t flags, u32_t iv_index) uint16_t addr, uint8_t flags, uint32_t iv_index)
{ {
if (prov->complete) { if (prov->complete) {
prov->complete(net_idx, net_key, addr, flags, iv_index); prov->complete(net_idx, net_key, addr, flags, iv_index);

View File

@ -24,16 +24,16 @@ int bt_mesh_pb_gatt_open(struct bt_mesh_conn *conn);
int bt_mesh_pb_gatt_close(struct bt_mesh_conn *conn); int bt_mesh_pb_gatt_close(struct bt_mesh_conn *conn);
int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf); int bt_mesh_pb_gatt_recv(struct bt_mesh_conn *conn, struct net_buf_simple *buf);
int bt_mesh_set_oob_pub_key(const u8_t pub_key_x[32], const u8_t pub_key_y[32], int bt_mesh_set_oob_pub_key(const uint8_t pub_key_x[32], const uint8_t pub_key_y[32],
const u8_t pri_key[32]); const uint8_t pri_key[32]);
const struct bt_mesh_prov *bt_mesh_prov_get(void); const struct bt_mesh_prov *bt_mesh_prov_get(void);
int bt_mesh_prov_init(const struct bt_mesh_prov *prov); int bt_mesh_prov_init(const struct bt_mesh_prov *prov);
int bt_mesh_prov_deinit(void); int bt_mesh_prov_deinit(void);
void bt_mesh_prov_complete(u16_t net_idx, const u8_t net_key[16], void bt_mesh_prov_complete(uint16_t net_idx, const uint8_t net_key[16],
u16_t addr, u8_t flags, u32_t iv_index); uint16_t addr, uint8_t flags, uint32_t iv_index);
void bt_mesh_prov_reset(void); void bt_mesh_prov_reset(void);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -32,9 +32,9 @@
static struct bt_mesh_node *mesh_nodes[CONFIG_BLE_MESH_MAX_PROV_NODES]; static struct bt_mesh_node *mesh_nodes[CONFIG_BLE_MESH_MAX_PROV_NODES];
static bt_mesh_mutex_t provisioner_lock; static bt_mesh_mutex_t provisioner_lock;
static u16_t node_count; static uint16_t node_count;
static int provisioner_remove_node(u16_t index, bool erase); static int provisioner_remove_node(uint16_t index, bool erase);
static inline void bt_mesh_provisioner_mutex_new(void) static inline void bt_mesh_provisioner_mutex_new(void)
{ {
@ -76,7 +76,7 @@ int bt_mesh_provisioner_net_create(void)
{ {
const struct bt_mesh_prov *prov = NULL; const struct bt_mesh_prov *prov = NULL;
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t p_key[16] = {0}; uint8_t p_key[16] = {0};
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -202,12 +202,12 @@ int bt_mesh_provisioner_deinit(bool erase)
} }
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
bool bt_mesh_provisioner_check_is_addr_dup(u16_t addr, u8_t elem_num, bool comp_with_own) bool bt_mesh_provisioner_check_is_addr_dup(uint16_t addr, uint8_t elem_num, bool comp_with_own)
{ {
const struct bt_mesh_comp *comp = NULL; const struct bt_mesh_comp *comp = NULL;
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
u16_t primary_addr = BLE_MESH_ADDR_UNASSIGNED; uint16_t primary_addr = BLE_MESH_ADDR_UNASSIGNED;
u16_t comp_addr = BLE_MESH_ADDR_UNASSIGNED; uint16_t comp_addr = BLE_MESH_ADDR_UNASSIGNED;
int i; int i;
if (comp_with_own) { if (comp_with_own) {
@ -256,12 +256,12 @@ static void provisioner_node_count_dec(void)
} }
} }
u16_t bt_mesh_provisioner_get_node_count(void) uint16_t bt_mesh_provisioner_get_node_count(void)
{ {
return node_count; return node_count;
} }
static int provisioner_store_node(struct bt_mesh_node *node, bool store, u16_t *index) static int provisioner_store_node(struct bt_mesh_node *node, bool store, uint16_t *index)
{ {
int i; int i;
@ -315,11 +315,11 @@ int bt_mesh_provisioner_restore_node_info(struct bt_mesh_node *node)
return provisioner_store_node(node, false, NULL); return provisioner_store_node(node, false, NULL);
} }
int bt_mesh_provisioner_provision(const bt_mesh_addr_t *addr, const u8_t uuid[16], int bt_mesh_provisioner_provision(const bt_mesh_addr_t *addr, const uint8_t uuid[16],
u16_t oob_info, u16_t unicast_addr, uint16_t oob_info, uint16_t unicast_addr,
u8_t element_num, u16_t net_idx, uint8_t element_num, uint16_t net_idx,
u8_t flags, u32_t iv_index, uint8_t flags, uint32_t iv_index,
const u8_t dev_key[16], u16_t *index) const uint8_t dev_key[16], uint16_t *index)
{ {
struct bt_mesh_node node = {0}; struct bt_mesh_node node = {0};
@ -349,7 +349,7 @@ int bt_mesh_provisioner_provision(const bt_mesh_addr_t *addr, const u8_t uuid[16
return provisioner_store_node(&node, true, index); return provisioner_store_node(&node, true, index);
} }
static int provisioner_remove_node(u16_t index, bool erase) static int provisioner_remove_node(uint16_t index, bool erase)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
int i; int i;
@ -396,7 +396,7 @@ static int provisioner_remove_node(u16_t index, bool erase)
return 0; return 0;
} }
static struct bt_mesh_node *provisioner_find_node_with_uuid(const u8_t uuid[16], u16_t *index) static struct bt_mesh_node *provisioner_find_node_with_uuid(const uint8_t uuid[16], uint16_t *index)
{ {
int i; int i;
@ -423,10 +423,10 @@ static struct bt_mesh_node *provisioner_find_node_with_uuid(const u8_t uuid[16],
return NULL; return NULL;
} }
int bt_mesh_provisioner_remove_node(const u8_t uuid[16]) int bt_mesh_provisioner_remove_node(const uint8_t uuid[16])
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
u16_t index = 0U; uint16_t index = 0U;
int i; int i;
if (uuid == NULL) { if (uuid == NULL) {
@ -448,7 +448,7 @@ int bt_mesh_provisioner_remove_node(const u8_t uuid[16])
return 0; return 0;
} }
static struct bt_mesh_node *provisioner_find_node_with_addr(u16_t addr, u16_t *index) static struct bt_mesh_node *provisioner_find_node_with_addr(uint16_t addr, uint16_t *index)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
int i; int i;
@ -478,7 +478,7 @@ static struct bt_mesh_node *provisioner_find_node_with_addr(u16_t addr, u16_t *i
return NULL; return NULL;
} }
int bt_mesh_provisioner_restore_node_name(u16_t addr, const char *name) int bt_mesh_provisioner_restore_node_name(uint16_t addr, const char *name)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
@ -494,20 +494,20 @@ int bt_mesh_provisioner_restore_node_name(u16_t addr, const char *name)
return 0; return 0;
} }
struct bt_mesh_node *bt_mesh_provisioner_get_node_with_uuid(const u8_t uuid[16]) struct bt_mesh_node *bt_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16])
{ {
return provisioner_find_node_with_uuid(uuid, NULL); return provisioner_find_node_with_uuid(uuid, NULL);
} }
struct bt_mesh_node *bt_mesh_provisioner_get_node_with_addr(u16_t unicast_addr) struct bt_mesh_node *bt_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr)
{ {
return provisioner_find_node_with_addr(unicast_addr, NULL); return provisioner_find_node_with_addr(unicast_addr, NULL);
} }
int bt_mesh_provisioner_delete_node_with_uuid(const u8_t uuid[16]) int bt_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16])
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
u16_t index = 0U; uint16_t index = 0U;
node = provisioner_find_node_with_uuid(uuid, &index); node = provisioner_find_node_with_uuid(uuid, &index);
if (!node) { if (!node) {
@ -519,10 +519,10 @@ int bt_mesh_provisioner_delete_node_with_uuid(const u8_t uuid[16])
return 0; return 0;
} }
int bt_mesh_provisioner_delete_node_with_node_addr(u16_t unicast_addr) int bt_mesh_provisioner_delete_node_with_node_addr(uint16_t unicast_addr)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
u16_t index = 0U; uint16_t index = 0U;
node = provisioner_find_node_with_addr(unicast_addr, &index); node = provisioner_find_node_with_addr(unicast_addr, &index);
if (!node) { if (!node) {
@ -576,7 +576,7 @@ static struct bt_mesh_node **provisioner_find_node_with_name(const char *name)
return NULL; return NULL;
} }
int bt_mesh_provisioner_set_node_name(u16_t index, const char *name) int bt_mesh_provisioner_set_node_name(uint16_t index, const char *name)
{ {
if (index >= ARRAY_SIZE(mesh_nodes)) { if (index >= ARRAY_SIZE(mesh_nodes)) {
BT_ERR("Invalid node index %d", index); BT_ERR("Invalid node index %d", index);
@ -608,7 +608,7 @@ int bt_mesh_provisioner_set_node_name(u16_t index, const char *name)
return 0; return 0;
} }
const char *bt_mesh_provisioner_get_node_name(u16_t index) const char *bt_mesh_provisioner_get_node_name(uint16_t index)
{ {
if (index >= ARRAY_SIZE(mesh_nodes)) { if (index >= ARRAY_SIZE(mesh_nodes)) {
BT_ERR("Invalid node index %d", index); BT_ERR("Invalid node index %d", index);
@ -623,7 +623,7 @@ const char *bt_mesh_provisioner_get_node_name(u16_t index)
return mesh_nodes[index]->name; return mesh_nodes[index]->name;
} }
u16_t bt_mesh_provisioner_get_node_index(const char *name) uint16_t bt_mesh_provisioner_get_node_index(const char *name)
{ {
struct bt_mesh_node **node = NULL; struct bt_mesh_node **node = NULL;
@ -666,7 +666,7 @@ const struct bt_mesh_node **bt_mesh_provisioner_get_node_table_entry(void)
#define COMP_DATA_PAGE_0_MIN_LEN 16 #define COMP_DATA_PAGE_0_MIN_LEN 16
static int store_node_comp_data(u16_t addr, const u8_t *data, u16_t length, bool store) static int store_node_comp_data(uint16_t addr, const uint8_t *data, uint16_t length, bool store)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
@ -702,19 +702,19 @@ static int store_node_comp_data(u16_t addr, const u8_t *data, u16_t length, bool
return 0; return 0;
} }
int bt_mesh_provisioner_store_node_comp_data(u16_t addr, const u8_t *data, u16_t length) int bt_mesh_provisioner_store_node_comp_data(uint16_t addr, const uint8_t *data, uint16_t length)
{ {
return store_node_comp_data(addr, data, length, true); return store_node_comp_data(addr, data, length, true);
} }
int bt_mesh_provisioner_restore_node_comp_data(u16_t addr, const u8_t *data, u16_t length) int bt_mesh_provisioner_restore_node_comp_data(uint16_t addr, const uint8_t *data, uint16_t length)
{ {
return store_node_comp_data(addr, data, length, false); return store_node_comp_data(addr, data, length, false);
} }
/* Provisioner DevKey, NetKey and AppKey related functions */ /* Provisioner DevKey, NetKey and AppKey related functions */
const u8_t *bt_mesh_provisioner_net_key_get(u16_t net_idx) const uint8_t *bt_mesh_provisioner_net_key_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -735,7 +735,7 @@ const u8_t *bt_mesh_provisioner_net_key_get(u16_t net_idx)
return NULL; return NULL;
} }
struct bt_mesh_subnet *bt_mesh_provisioner_subnet_get(u16_t net_idx) struct bt_mesh_subnet *bt_mesh_provisioner_subnet_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -756,7 +756,7 @@ struct bt_mesh_subnet *bt_mesh_provisioner_subnet_get(u16_t net_idx)
return NULL; return NULL;
} }
bool bt_mesh_provisioner_check_msg_dst(u16_t dst) bool bt_mesh_provisioner_check_msg_dst(uint16_t dst)
{ {
struct bt_mesh_node *node = NULL; struct bt_mesh_node *node = NULL;
int i; int i;
@ -778,7 +778,7 @@ bool bt_mesh_provisioner_check_msg_dst(u16_t dst)
return false; return false;
} }
const u8_t *bt_mesh_provisioner_dev_key_get(u16_t dst) const uint8_t *bt_mesh_provisioner_dev_key_get(uint16_t dst)
{ {
/* Device key is only used to encrypt configuration messages. /* Device key is only used to encrypt configuration messages.
* Configuration model shall only be supported by the primary * Configuration model shall only be supported by the primary
@ -804,7 +804,7 @@ const u8_t *bt_mesh_provisioner_dev_key_get(u16_t dst)
return NULL; return NULL;
} }
struct bt_mesh_app_key *bt_mesh_provisioner_app_key_find(u16_t app_idx) struct bt_mesh_app_key *bt_mesh_provisioner_app_key_find(uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
int i; int i;
@ -822,7 +822,7 @@ struct bt_mesh_app_key *bt_mesh_provisioner_app_key_find(u16_t app_idx)
return NULL; return NULL;
} }
static int provisioner_check_app_key(const u8_t app_key[16], u16_t *app_idx) static int provisioner_check_app_key(const uint8_t app_key[16], uint16_t *app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
int i; int i;
@ -844,7 +844,7 @@ static int provisioner_check_app_key(const u8_t app_key[16], u16_t *app_idx)
return 0; return 0;
} }
static int provisioner_check_app_idx(u16_t app_idx, bool exist) static int provisioner_check_app_idx(uint16_t app_idx, bool exist)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
int i; int i;
@ -884,7 +884,7 @@ static int provisioner_check_app_key_full(void)
return -ENOMEM; return -ENOMEM;
} }
static int provisioner_check_net_key(const u8_t net_key[16], u16_t *net_idx) static int provisioner_check_net_key(const uint8_t net_key[16], uint16_t *net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -906,7 +906,7 @@ static int provisioner_check_net_key(const u8_t net_key[16], u16_t *net_idx)
return 0; return 0;
} }
static int provisioner_check_net_idx(u16_t net_idx, bool exist) static int provisioner_check_net_idx(uint16_t net_idx, bool exist)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -946,12 +946,12 @@ static int provisioner_check_net_key_full(void)
return -ENOMEM; return -ENOMEM;
} }
int bt_mesh_provisioner_local_app_key_add(const u8_t app_key[16], int bt_mesh_provisioner_local_app_key_add(const uint8_t app_key[16],
u16_t net_idx, u16_t *app_idx) uint16_t net_idx, uint16_t *app_idx)
{ {
struct bt_mesh_app_keys *keys = NULL; struct bt_mesh_app_keys *keys = NULL;
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
u8_t p_key[16] = {0}; uint8_t p_key[16] = {0};
int add = -1; int add = -1;
if (bt_mesh.p_app_idx_next >= 0x1000) { if (bt_mesh.p_app_idx_next >= 0x1000) {
@ -1043,8 +1043,8 @@ int bt_mesh_provisioner_local_app_key_add(const u8_t app_key[16],
return 0; return 0;
} }
int bt_mesh_provisioner_local_app_key_update(const u8_t app_key[16], int bt_mesh_provisioner_local_app_key_update(const uint8_t app_key[16],
u16_t net_idx, u16_t app_idx) uint16_t net_idx, uint16_t app_idx)
{ {
struct bt_mesh_app_keys *keys = NULL; struct bt_mesh_app_keys *keys = NULL;
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -1087,7 +1087,7 @@ int bt_mesh_provisioner_local_app_key_update(const u8_t app_key[16],
return 0; return 0;
} }
const u8_t *bt_mesh_provisioner_local_app_key_get(u16_t net_idx, u16_t app_idx) const uint8_t *bt_mesh_provisioner_local_app_key_get(uint16_t net_idx, uint16_t app_idx)
{ {
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
int i; int i;
@ -1147,7 +1147,7 @@ static void model_pub_clear(struct bt_mesh_model *model, bool store)
return; return;
} }
static void model_unbind(struct bt_mesh_model *model, u16_t app_idx, bool store) static void model_unbind(struct bt_mesh_model *model, uint16_t app_idx, bool store)
{ {
int i; int i;
@ -1169,7 +1169,7 @@ static void model_unbind(struct bt_mesh_model *model, u16_t app_idx, bool store)
} }
struct unbind_data { struct unbind_data {
u16_t app_idx; uint16_t app_idx;
bool store; bool store;
}; };
@ -1181,7 +1181,7 @@ static void _model_unbind(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
model_unbind(mod, data->app_idx, data->store); model_unbind(mod, data->app_idx, data->store);
} }
int bt_mesh_provisioner_local_app_key_del(u16_t net_idx, u16_t app_idx, bool store) int bt_mesh_provisioner_local_app_key_del(uint16_t net_idx, uint16_t app_idx, bool store)
{ {
struct unbind_data data = { .app_idx = app_idx, .store = store }; struct unbind_data data = { .app_idx = app_idx, .store = store };
struct bt_mesh_app_key *key = NULL; struct bt_mesh_app_key *key = NULL;
@ -1220,10 +1220,10 @@ int bt_mesh_provisioner_local_app_key_del(u16_t net_idx, u16_t app_idx, bool sto
return -ENODEV; return -ENODEV;
} }
int bt_mesh_provisioner_local_net_key_add(const u8_t net_key[16], u16_t *net_idx) int bt_mesh_provisioner_local_net_key_add(const uint8_t net_key[16], uint16_t *net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
u8_t p_key[16] = {0}; uint8_t p_key[16] = {0};
int add = -1; int add = -1;
if (bt_mesh.p_net_idx_next >= 0x1000) { if (bt_mesh.p_net_idx_next >= 0x1000) {
@ -1308,7 +1308,7 @@ int bt_mesh_provisioner_local_net_key_add(const u8_t net_key[16], u16_t *net_idx
return 0; return 0;
} }
int bt_mesh_provisioner_local_net_key_update(const u8_t net_key[16], u16_t net_idx) int bt_mesh_provisioner_local_net_key_update(const uint8_t net_key[16], uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int err = 0; int err = 0;
@ -1352,7 +1352,7 @@ int bt_mesh_provisioner_local_net_key_update(const u8_t net_key[16], u16_t net_i
return 0; return 0;
} }
const u8_t *bt_mesh_provisioner_local_net_key_get(u16_t net_idx) const uint8_t *bt_mesh_provisioner_local_net_key_get(uint16_t net_idx)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i; int i;
@ -1377,7 +1377,7 @@ const u8_t *bt_mesh_provisioner_local_net_key_get(u16_t net_idx)
return NULL; return NULL;
} }
int bt_mesh_provisioner_local_net_key_del(u16_t net_idx, bool store) int bt_mesh_provisioner_local_net_key_del(uint16_t net_idx, bool store)
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
int i, j; int i, j;
@ -1415,8 +1415,8 @@ int bt_mesh_provisioner_local_net_key_del(u16_t net_idx, bool store)
return -ENODEV; return -ENODEV;
} }
int bt_mesh_provisioner_bind_local_model_app_idx(u16_t elem_addr, u16_t mod_id, int bt_mesh_provisioner_bind_local_model_app_idx(uint16_t elem_addr, uint16_t mod_id,
u16_t cid, u16_t app_idx) uint16_t cid, uint16_t app_idx)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
struct bt_mesh_elem *elem = NULL; struct bt_mesh_elem *elem = NULL;
@ -1561,11 +1561,11 @@ int bt_mesh_provisioner_store_node_info(struct bt_mesh_node *node)
static struct heartbeat_recv { static struct heartbeat_recv {
struct heartbeat_filter { struct heartbeat_filter {
u8_t type; /* Indicate if using src or dst or both to filter heartbeat messages */ uint8_t type; /* Indicate if using src or dst or both to filter heartbeat messages */
u16_t src; /* Heartbeat source address (unicast address) */ uint16_t src; /* Heartbeat source address (unicast address) */
u16_t dst; /* Heartbeat destination address (unicast address or group address) */ uint16_t dst; /* Heartbeat destination address (unicast address or group address) */
} filter[CONFIG_BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE]; } filter[CONFIG_BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE];
u8_t type; /* Heartbeat filter type */ uint8_t type; /* Heartbeat filter type */
bt_mesh_heartbeat_recv_cb_t cb; /* Heartbeat receive callback */ bt_mesh_heartbeat_recv_cb_t cb; /* Heartbeat receive callback */
} hb_rx; } hb_rx;
@ -1580,7 +1580,7 @@ int bt_mesh_provisioner_recv_heartbeat(bt_mesh_heartbeat_recv_cb_t cb)
return 0; return 0;
} }
int bt_mesh_provisioner_set_heartbeat_filter_type(u8_t type) int bt_mesh_provisioner_set_heartbeat_filter_type(uint8_t type)
{ {
if (type > HEARTBEAT_FILTER_REJECTLIST) { if (type > HEARTBEAT_FILTER_REJECTLIST) {
BT_ERR("Invalid heartbeat filter type 0x%02x", type); BT_ERR("Invalid heartbeat filter type 0x%02x", type);
@ -1598,7 +1598,7 @@ int bt_mesh_provisioner_set_heartbeat_filter_type(u8_t type)
return 0; return 0;
} }
static inline u8_t get_filter_addr_type(u16_t src, u16_t dst) static inline uint8_t get_filter_addr_type(uint16_t src, uint16_t dst)
{ {
if (BLE_MESH_ADDR_IS_UNICAST(src)) { if (BLE_MESH_ADDR_IS_UNICAST(src)) {
if (BLE_MESH_ADDR_IS_UNICAST(dst) || BLE_MESH_ADDR_IS_GROUP(dst)) { if (BLE_MESH_ADDR_IS_UNICAST(dst) || BLE_MESH_ADDR_IS_GROUP(dst)) {
@ -1611,7 +1611,7 @@ static inline u8_t get_filter_addr_type(u16_t src, u16_t dst)
} }
} }
static int hb_filter_alloc(u16_t src, u16_t dst) static int hb_filter_alloc(uint16_t src, uint16_t dst)
{ {
int i; int i;
@ -1631,7 +1631,7 @@ static int hb_filter_alloc(u16_t src, u16_t dst)
return -ENOMEM; return -ENOMEM;
} }
static int hb_filter_add(u16_t src, u16_t dst) static int hb_filter_add(uint16_t src, uint16_t dst)
{ {
int i; int i;
@ -1655,7 +1655,7 @@ static int hb_filter_add(u16_t src, u16_t dst)
return hb_filter_alloc(src, dst); return hb_filter_alloc(src, dst);
} }
static int hb_filter_remove(u16_t src, u16_t dst) static int hb_filter_remove(uint16_t src, uint16_t dst)
{ {
int i; int i;
@ -1678,7 +1678,7 @@ static int hb_filter_remove(u16_t src, u16_t dst)
return 0; return 0;
} }
int bt_mesh_provisioner_set_heartbeat_filter_info(u8_t op, u16_t src, u16_t dst) int bt_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, uint16_t src, uint16_t dst)
{ {
switch (op) { switch (op) {
case HEARTBEAT_FILTER_ADD: case HEARTBEAT_FILTER_ADD:
@ -1692,7 +1692,7 @@ int bt_mesh_provisioner_set_heartbeat_filter_info(u8_t op, u16_t src, u16_t dst)
} }
static bool filter_with_rejectlist(struct heartbeat_filter *filter, static bool filter_with_rejectlist(struct heartbeat_filter *filter,
u16_t hb_src, u16_t hb_dst) uint16_t hb_src, uint16_t hb_dst)
{ {
switch (filter->type) { switch (filter->type) {
case HEARTBEAT_FILTER_WITH_SRC: case HEARTBEAT_FILTER_WITH_SRC:
@ -1719,7 +1719,7 @@ static bool filter_with_rejectlist(struct heartbeat_filter *filter,
} }
static bool filter_with_acceptlist(struct heartbeat_filter *filter, static bool filter_with_acceptlist(struct heartbeat_filter *filter,
u16_t hb_src, u16_t hb_dst) uint16_t hb_src, uint16_t hb_dst)
{ {
switch (filter->type) { switch (filter->type) {
case HEARTBEAT_FILTER_WITH_SRC: case HEARTBEAT_FILTER_WITH_SRC:
@ -1745,9 +1745,9 @@ static bool filter_with_acceptlist(struct heartbeat_filter *filter,
return true; return true;
} }
void bt_mesh_provisioner_heartbeat(u16_t hb_src, u16_t hb_dst, void bt_mesh_provisioner_heartbeat(uint16_t hb_src, uint16_t hb_dst,
u8_t init_ttl, u8_t rx_ttl, uint8_t init_ttl, uint8_t rx_ttl,
u8_t hops, u16_t feat, s8_t rssi) uint8_t hops, uint16_t feat, int8_t rssi)
{ {
int i; int i;

View File

@ -28,23 +28,23 @@ extern "C" {
/* Each node information stored by provisioner */ /* Each node information stored by provisioner */
struct bt_mesh_node { struct bt_mesh_node {
/* Device information */ /* Device information */
u8_t addr[6]; /* Node device address */ uint8_t addr[6]; /* Node device address */
u8_t addr_type; /* Node device address type */ uint8_t addr_type; /* Node device address type */
u8_t dev_uuid[16]; /* Node Device UUID */ uint8_t dev_uuid[16]; /* Node Device UUID */
u16_t oob_info; /* Node OOB information */ uint16_t oob_info; /* Node OOB information */
/* Provisioning information */ /* Provisioning information */
u16_t unicast_addr; /* Node unicast address */ uint16_t unicast_addr; /* Node unicast address */
u8_t element_num; /* Node element number */ uint8_t element_num; /* Node element number */
u16_t net_idx; /* Node NetKey Index */ uint16_t net_idx; /* Node NetKey Index */
u8_t flags; /* Node key refresh flag and iv update flag */ uint8_t flags; /* Node key refresh flag and iv update flag */
u32_t iv_index; /* Node IV Index */ uint32_t iv_index; /* Node IV Index */
u8_t dev_key[16]; /* Node device key */ uint8_t dev_key[16]; /* Node device key */
/* Additional information */ /* Additional information */
char name[BLE_MESH_NODE_NAME_SIZE + 1]; /* Node name */ char name[BLE_MESH_NODE_NAME_SIZE + 1]; /* Node name */
u16_t comp_length; /* Length of Composition Data */ uint16_t comp_length; /* Length of Composition Data */
u8_t *comp_data; /* Value of Composition Data */ uint8_t *comp_data; /* Value of Composition Data */
} __packed; } __packed;
int bt_mesh_provisioner_init(void); int bt_mesh_provisioner_init(void);
@ -55,91 +55,91 @@ void bt_mesh_provisioner_main_reset(bool erase);
int bt_mesh_provisioner_deinit(bool erase); int bt_mesh_provisioner_deinit(bool erase);
bool bt_mesh_provisioner_check_is_addr_dup(u16_t addr, u8_t elem_num, bool comp_with_own); bool bt_mesh_provisioner_check_is_addr_dup(uint16_t addr, uint8_t elem_num, bool comp_with_own);
u16_t bt_mesh_provisioner_get_node_count(void); uint16_t bt_mesh_provisioner_get_node_count(void);
int bt_mesh_provisioner_restore_node_info(struct bt_mesh_node *node); int bt_mesh_provisioner_restore_node_info(struct bt_mesh_node *node);
int bt_mesh_provisioner_provision(const bt_mesh_addr_t *addr, const u8_t uuid[16], int bt_mesh_provisioner_provision(const bt_mesh_addr_t *addr, const uint8_t uuid[16],
u16_t oob_info, u16_t unicast_addr, uint16_t oob_info, uint16_t unicast_addr,
u8_t element_num, u16_t net_idx, uint8_t element_num, uint16_t net_idx,
u8_t flags, u32_t iv_index, uint8_t flags, uint32_t iv_index,
const u8_t dev_key[16], u16_t *index); const uint8_t dev_key[16], uint16_t *index);
int bt_mesh_provisioner_remove_node(const u8_t uuid[16]); int bt_mesh_provisioner_remove_node(const uint8_t uuid[16]);
int bt_mesh_provisioner_restore_node_name(u16_t addr, const char *name); int bt_mesh_provisioner_restore_node_name(uint16_t addr, const char *name);
int bt_mesh_provisioner_restore_node_comp_data(u16_t addr, const u8_t *data, u16_t length); int bt_mesh_provisioner_restore_node_comp_data(uint16_t addr, const uint8_t *data, uint16_t length);
struct bt_mesh_node *bt_mesh_provisioner_get_node_with_uuid(const u8_t uuid[16]); struct bt_mesh_node *bt_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16]);
struct bt_mesh_node *bt_mesh_provisioner_get_node_with_addr(u16_t unicast_addr); struct bt_mesh_node *bt_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr);
int bt_mesh_provisioner_delete_node_with_uuid(const u8_t uuid[16]); int bt_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16]);
int bt_mesh_provisioner_delete_node_with_node_addr(u16_t unicast_addr); int bt_mesh_provisioner_delete_node_with_node_addr(uint16_t unicast_addr);
int bt_mesh_provisioner_delete_node_with_dev_addr(const bt_mesh_addr_t *addr); int bt_mesh_provisioner_delete_node_with_dev_addr(const bt_mesh_addr_t *addr);
int bt_mesh_provisioner_set_node_name(u16_t index, const char *name); int bt_mesh_provisioner_set_node_name(uint16_t index, const char *name);
const char *bt_mesh_provisioner_get_node_name(u16_t index); const char *bt_mesh_provisioner_get_node_name(uint16_t index);
u16_t bt_mesh_provisioner_get_node_index(const char *name); uint16_t bt_mesh_provisioner_get_node_index(const char *name);
struct bt_mesh_node *bt_mesh_provisioner_get_node_with_name(const char *name); struct bt_mesh_node *bt_mesh_provisioner_get_node_with_name(const char *name);
const struct bt_mesh_node **bt_mesh_provisioner_get_node_table_entry(void); const struct bt_mesh_node **bt_mesh_provisioner_get_node_table_entry(void);
int bt_mesh_provisioner_store_node_comp_data(u16_t addr, const u8_t *data, u16_t length); int bt_mesh_provisioner_store_node_comp_data(uint16_t addr, const uint8_t *data, uint16_t length);
const u8_t *bt_mesh_provisioner_net_key_get(u16_t net_idx); const uint8_t *bt_mesh_provisioner_net_key_get(uint16_t net_idx);
struct bt_mesh_subnet *bt_mesh_provisioner_subnet_get(u16_t net_idx); struct bt_mesh_subnet *bt_mesh_provisioner_subnet_get(uint16_t net_idx);
bool bt_mesh_provisioner_check_msg_dst(u16_t dst); bool bt_mesh_provisioner_check_msg_dst(uint16_t dst);
const u8_t *bt_mesh_provisioner_dev_key_get(u16_t dst); const uint8_t *bt_mesh_provisioner_dev_key_get(uint16_t dst);
struct bt_mesh_app_key *bt_mesh_provisioner_app_key_find(u16_t app_idx); struct bt_mesh_app_key *bt_mesh_provisioner_app_key_find(uint16_t app_idx);
int bt_mesh_provisioner_local_app_key_add(const u8_t app_key[16], int bt_mesh_provisioner_local_app_key_add(const uint8_t app_key[16],
u16_t net_idx, u16_t *app_idx); uint16_t net_idx, uint16_t *app_idx);
int bt_mesh_provisioner_local_app_key_update(const u8_t app_key[16], int bt_mesh_provisioner_local_app_key_update(const uint8_t app_key[16],
u16_t net_idx, u16_t app_idx); uint16_t net_idx, uint16_t app_idx);
const u8_t *bt_mesh_provisioner_local_app_key_get(u16_t net_idx, u16_t app_idx); const uint8_t *bt_mesh_provisioner_local_app_key_get(uint16_t net_idx, uint16_t app_idx);
int bt_mesh_provisioner_local_app_key_del(u16_t net_idx, u16_t app_idx, bool store); int bt_mesh_provisioner_local_app_key_del(uint16_t net_idx, uint16_t app_idx, bool store);
int bt_mesh_provisioner_local_net_key_add(const u8_t net_key[16], u16_t *net_idx); int bt_mesh_provisioner_local_net_key_add(const uint8_t net_key[16], uint16_t *net_idx);
int bt_mesh_provisioner_local_net_key_update(const u8_t net_key[16], u16_t net_idx); int bt_mesh_provisioner_local_net_key_update(const uint8_t net_key[16], uint16_t net_idx);
const u8_t *bt_mesh_provisioner_local_net_key_get(u16_t net_idx); const uint8_t *bt_mesh_provisioner_local_net_key_get(uint16_t net_idx);
int bt_mesh_provisioner_local_net_key_del(u16_t net_idx, bool store); int bt_mesh_provisioner_local_net_key_del(uint16_t net_idx, bool store);
/* Provisioner bind local client model with proper appkey index */ /* Provisioner bind local client model with proper appkey index */
int bt_mesh_provisioner_bind_local_model_app_idx(u16_t elem_addr, u16_t mod_id, int bt_mesh_provisioner_bind_local_model_app_idx(uint16_t elem_addr, uint16_t mod_id,
u16_t cid, u16_t app_idx); uint16_t cid, uint16_t app_idx);
typedef void (* bt_mesh_heartbeat_recv_cb_t)(u16_t hb_src, u16_t hb_dst, typedef void (* bt_mesh_heartbeat_recv_cb_t)(uint16_t hb_src, uint16_t hb_dst,
u8_t init_ttl, u8_t rx_ttl, uint8_t init_ttl, uint8_t rx_ttl,
u8_t hops, u16_t feat, s8_t rssi); uint8_t hops, uint16_t feat, int8_t rssi);
int bt_mesh_provisioner_recv_heartbeat(bt_mesh_heartbeat_recv_cb_t cb); int bt_mesh_provisioner_recv_heartbeat(bt_mesh_heartbeat_recv_cb_t cb);
int bt_mesh_provisioner_set_heartbeat_filter_type(u8_t filter_type); int bt_mesh_provisioner_set_heartbeat_filter_type(uint8_t filter_type);
int bt_mesh_provisioner_set_heartbeat_filter_info(u8_t op, u16_t src, u16_t dst); int bt_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, uint16_t src, uint16_t dst);
void bt_mesh_provisioner_heartbeat(u16_t hb_src, u16_t hb_dst, void bt_mesh_provisioner_heartbeat(uint16_t hb_src, uint16_t hb_dst,
u8_t init_ttl, u8_t rx_ttl, uint8_t init_ttl, uint8_t rx_ttl,
u8_t hops, u16_t feat, s8_t rssi); uint8_t hops, uint16_t feat, int8_t rssi);
/* Provisioner print own element information */ /* Provisioner print own element information */
int bt_mesh_print_local_composition_data(void); int bt_mesh_print_local_composition_data(void);

File diff suppressed because it is too large Load Diff

View File

@ -35,17 +35,17 @@ extern "C" {
#define FLUSHABLE_DEV BIT(2) #define FLUSHABLE_DEV BIT(2)
struct bt_mesh_unprov_dev_add { struct bt_mesh_unprov_dev_add {
u8_t addr[6]; uint8_t addr[6];
u8_t addr_type; uint8_t addr_type;
u8_t uuid[16]; uint8_t uuid[16];
u16_t oob_info; uint16_t oob_info;
u8_t bearer; uint8_t bearer;
}; };
struct bt_mesh_device_delete { struct bt_mesh_device_delete {
u8_t addr[6]; uint8_t addr[6];
u8_t addr_type; uint8_t addr_type;
u8_t uuid[16]; uint8_t uuid[16];
}; };
#define NET_IDX_FLAG BIT(0) #define NET_IDX_FLAG BIT(0)
@ -54,11 +54,11 @@ struct bt_mesh_device_delete {
struct bt_mesh_prov_data_info { struct bt_mesh_prov_data_info {
union { union {
u16_t net_idx; uint16_t net_idx;
u8_t flags; uint8_t flags;
u32_t iv_index; uint32_t iv_index;
}; };
u8_t flag; uint8_t flag;
}; };
/* The following APIs are for primary provisioner internal use */ /* The following APIs are for primary provisioner internal use */
@ -77,7 +77,7 @@ void bt_mesh_provisioner_pbg_count_dec(void);
* *
* @return None * @return None
*/ */
void bt_mesh_provisioner_clear_link_info(const u8_t addr[6]); void bt_mesh_provisioner_clear_link_info(const uint8_t addr[6]);
/** /**
* @brief This function handles the received PB-ADV PDUs. * @brief This function handles the received PB-ADV PDUs.
@ -97,7 +97,7 @@ void bt_mesh_provisioner_pb_adv_recv(struct net_buf_simple *buf);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_prov_conn(const u8_t addr[6], struct bt_mesh_conn *conn); int bt_mesh_provisioner_set_prov_conn(const uint8_t addr[6], struct bt_mesh_conn *conn);
/** /**
* @brief This function sends provisioning invite to start * @brief This function sends provisioning invite to start
@ -108,7 +108,7 @@ int bt_mesh_provisioner_set_prov_conn(const u8_t addr[6], struct bt_mesh_conn *c
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_pb_gatt_open(struct bt_mesh_conn *conn, u8_t *addr); int bt_mesh_provisioner_pb_gatt_open(struct bt_mesh_conn *conn, uint8_t *addr);
/** /**
* @brief This function resets the used information when * @brief This function resets the used information when
@ -119,7 +119,7 @@ int bt_mesh_provisioner_pb_gatt_open(struct bt_mesh_conn *conn, u8_t *addr);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_pb_gatt_close(struct bt_mesh_conn *conn, u8_t reason); int bt_mesh_provisioner_pb_gatt_close(struct bt_mesh_conn *conn, uint8_t reason);
/** /**
* @brief This function handles the received PB-GATT provision * @brief This function handles the received PB-GATT provision
@ -164,10 +164,10 @@ int bt_mesh_provisioner_prov_deinit(bool erase);
* *
* @return None * @return None
*/ */
void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, s8_t rssi); void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, int8_t rssi);
void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf, void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi); const bt_mesh_addr_t *addr, int8_t rssi);
/** /**
* @brief This function gets the bt_mesh_prov pointer. * @brief This function gets the bt_mesh_prov pointer.
@ -176,7 +176,7 @@ void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf,
*/ */
const struct bt_mesh_prov *bt_mesh_provisioner_get_prov_info(void); const struct bt_mesh_prov *bt_mesh_provisioner_get_prov_info(void);
void bt_mesh_provisioner_restore_prov_info(u16_t primary_addr, u16_t alloc_addr); void bt_mesh_provisioner_restore_prov_info(uint16_t primary_addr, uint16_t alloc_addr);
/* The following APIs are for primary provisioner application use */ /* The following APIs are for primary provisioner application use */
@ -196,7 +196,7 @@ void bt_mesh_provisioner_restore_prov_info(u16_t primary_addr, u16_t alloc_addr)
* will also be successful and it will update the provision bearer supported by * will also be successful and it will update the provision bearer supported by
* the device. * the device.
*/ */
int bt_mesh_provisioner_add_unprov_dev(struct bt_mesh_unprov_dev_add *add_dev, u8_t flags); int bt_mesh_provisioner_add_unprov_dev(struct bt_mesh_unprov_dev_add *add_dev, uint8_t flags);
/** @brief Provision an unprovisioned device with fixed unicast address. /** @brief Provision an unprovisioned device with fixed unicast address.
* *
@ -212,9 +212,9 @@ int bt_mesh_provisioner_add_unprov_dev(struct bt_mesh_unprov_dev_add *add_dev, u
* @note 1. Currently address type only supports public address and static random address. * @note 1. Currently address type only supports public address and static random address.
* 2. Bearer must be equal to BLE_MESH_PROV_ADV or BLE_MESH_PROV_GATT * 2. Bearer must be equal to BLE_MESH_PROV_ADV or BLE_MESH_PROV_GATT
*/ */
int bt_mesh_provisioner_prov_device_with_addr(const u8_t uuid[16], const u8_t addr[6], int bt_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16], const uint8_t addr[6],
u8_t addr_type, bt_mesh_prov_bearer_t bearer, uint8_t addr_type, bt_mesh_prov_bearer_t bearer,
u16_t oob_info, u16_t unicast_addr); uint16_t oob_info, uint16_t unicast_addr);
/** @brief Delete device from queue, reset current provisioning link and reset the node /** @brief Delete device from queue, reset current provisioning link and reset the node
* *
@ -236,8 +236,8 @@ int bt_mesh_provisioner_delete_device(struct bt_mesh_device_delete *del_dev);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_dev_uuid_match(u8_t offset, u8_t length, int bt_mesh_provisioner_set_dev_uuid_match(uint8_t offset, uint8_t length,
const u8_t *match, bool prov_flag); const uint8_t *match, bool prov_flag);
/** @brief Callback for provisioner receiving advertising packet from unprovisioned devices which are /** @brief Callback for provisioner receiving advertising packet from unprovisioned devices which are
* not in the unprovisioned device queue. * not in the unprovisioned device queue.
@ -254,9 +254,9 @@ int bt_mesh_provisioner_set_dev_uuid_match(u8_t offset, u8_t length,
* @param rssi RSSI of the received advertising packet * @param rssi RSSI of the received advertising packet
* *
*/ */
typedef void (*unprov_adv_pkt_cb_t)(const u8_t addr[6], const u8_t addr_type, typedef void (*unprov_adv_pkt_cb_t)(const uint8_t addr[6], const uint8_t addr_type,
const u8_t adv_type, const u8_t dev_uuid[16], const uint8_t adv_type, const uint8_t dev_uuid[16],
u16_t oob_info, bt_mesh_prov_bearer_t bearer, s8_t rssi); uint16_t oob_info, bt_mesh_prov_bearer_t bearer, int8_t rssi);
/** /**
* @brief This function registers the callback which notifies the application * @brief This function registers the callback which notifies the application
@ -311,14 +311,14 @@ bt_mesh_prov_bearer_t bt_mesh_provisioner_get_prov_bearer(void);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_static_oob_value(const u8_t *value, u8_t length); int bt_mesh_provisioner_set_static_oob_value(const uint8_t *value, uint8_t length);
/** /**
* @brief This function gets the unicast address of primary element of Provisioner. * @brief This function gets the unicast address of primary element of Provisioner.
* *
* @return Unicast address of primary element of Provisioner. * @return Unicast address of primary element of Provisioner.
*/ */
u16_t bt_mesh_provisioner_get_primary_elem_addr(void); uint16_t bt_mesh_provisioner_get_primary_elem_addr(void);
/** /**
* @brief This function sets the unicast address of primary element of Provisioner. * @brief This function sets the unicast address of primary element of Provisioner.
@ -327,7 +327,7 @@ u16_t bt_mesh_provisioner_get_primary_elem_addr(void);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_primary_elem_addr(u16_t addr); int bt_mesh_provisioner_set_primary_elem_addr(uint16_t addr);
/** /**
* @brief This function is used to update next allocated address by Provisioner. * @brief This function is used to update next allocated address by Provisioner.
@ -339,7 +339,7 @@ int bt_mesh_provisioner_set_primary_elem_addr(u16_t addr);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_test_provisioner_update_alloc_addr(u16_t unicast_addr, u16_t element_num); int bt_mesh_test_provisioner_update_alloc_addr(uint16_t unicast_addr, uint16_t element_num);
/** /**
* @brief This function is called to input number/string out-put by unprovisioned device. * @brief This function is called to input number/string out-put by unprovisioned device.
@ -350,7 +350,7 @@ int bt_mesh_test_provisioner_update_alloc_addr(u16_t unicast_addr, u16_t element
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_oob_input_data(const u8_t idx, const u8_t *val, bool num_flag); int bt_mesh_provisioner_set_oob_input_data(const uint8_t idx, const uint8_t *val, bool num_flag);
/** /**
* @brief This function is called to output number/string which will be input by unprovisioned device. * @brief This function is called to output number/string which will be input by unprovisioned device.
@ -362,8 +362,8 @@ int bt_mesh_provisioner_set_oob_input_data(const u8_t idx, const u8_t *val, bool
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_set_oob_output_data(const u8_t idx, const u8_t *num, int bt_mesh_provisioner_set_oob_output_data(const uint8_t idx, const uint8_t *num,
u8_t size, bool num_flag); uint8_t size, bool num_flag);
/** /**
* @brief This function is called to read unprovisioned device's oob public key. * @brief This function is called to read unprovisioned device's oob public key.
@ -374,8 +374,8 @@ int bt_mesh_provisioner_set_oob_output_data(const u8_t idx, const u8_t *num,
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_provisioner_read_oob_pub_key(const u8_t idx, const u8_t pub_key_x[32], int bt_mesh_provisioner_read_oob_pub_key(const uint8_t idx, const uint8_t pub_key_x[32],
const u8_t pub_key_y[32]); const uint8_t pub_key_y[32]);
/* The following APIs are for fast provisioning */ /* The following APIs are for fast provisioning */
@ -395,14 +395,14 @@ void bt_mesh_provisioner_fast_prov_enable(bool enable);
* *
* @return None * @return None
*/ */
void bt_mesh_provisioner_set_fast_prov_net_idx(u16_t net_idx); void bt_mesh_provisioner_set_fast_prov_net_idx(uint16_t net_idx);
/** /**
* @brief This function is called to get netkey index used for fast provisioning. * @brief This function is called to get netkey index used for fast provisioning.
* *
* @return net_idx of fast provisioning * @return net_idx of fast provisioning
*/ */
u16_t bt_mesh_provisioner_get_fast_prov_net_idx(void); uint16_t bt_mesh_provisioner_get_fast_prov_net_idx(void);
/** /**
* @brief This function is called to set unicast address range used for fast provisioning. * @brief This function is called to set unicast address range used for fast provisioning.
@ -412,7 +412,7 @@ u16_t bt_mesh_provisioner_get_fast_prov_net_idx(void);
* *
* @return status for set unicast address range message * @return status for set unicast address range message
*/ */
u8_t bt_mesh_set_fast_prov_unicast_addr_range(u16_t min, u16_t max); uint8_t bt_mesh_set_fast_prov_unicast_addr_range(uint16_t min, uint16_t max);
/** /**
* @brief This function is called to set flags & iv_index used for fast provisioning. * @brief This function is called to set flags & iv_index used for fast provisioning.
@ -422,7 +422,7 @@ u8_t bt_mesh_set_fast_prov_unicast_addr_range(u16_t min, u16_t max);
* *
* @return None * @return None
*/ */
void bt_mesh_set_fast_prov_flags_iv_index(u8_t flags, u32_t iv_index); void bt_mesh_set_fast_prov_flags_iv_index(uint8_t flags, uint32_t iv_index);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -51,14 +51,14 @@ static struct bt_mesh_proxy_server {
PROXY, PROXY,
} conn_type; } conn_type;
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT #if CONFIG_BLE_MESH_GATT_PROXY_CLIENT
u16_t net_idx; uint16_t net_idx;
#endif #endif
u8_t msg_type; uint8_t msg_type;
struct k_delayed_work sar_timer; struct k_delayed_work sar_timer;
struct net_buf_simple buf; struct net_buf_simple buf;
} servers[BLE_MESH_MAX_CONN]; } servers[BLE_MESH_MAX_CONN];
static u8_t server_buf_data[SERVER_BUF_SIZE * BLE_MESH_MAX_CONN]; static uint8_t server_buf_data[SERVER_BUF_SIZE * BLE_MESH_MAX_CONN];
static struct bt_mesh_proxy_server *find_server(struct bt_mesh_conn *conn) static struct bt_mesh_proxy_server *find_server(struct bt_mesh_conn *conn)
{ {
@ -123,8 +123,8 @@ static void filter_status(struct bt_mesh_proxy_server *server,
struct bt_mesh_net_rx *rx, struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t filter_type = 0U; uint8_t filter_type = 0U;
u16_t list_size = 0U; uint16_t list_size = 0U;
if (buf->len != 3) { if (buf->len != 3) {
BT_ERR("Invalid Proxy Filter Status length %d", buf->len); BT_ERR("Invalid Proxy Filter Status length %d", buf->len);
@ -152,7 +152,7 @@ static void proxy_cfg(struct bt_mesh_proxy_server *server)
{ {
NET_BUF_SIMPLE_DEFINE(buf, 29); NET_BUF_SIMPLE_DEFINE(buf, 29);
struct bt_mesh_net_rx rx = {0}; struct bt_mesh_net_rx rx = {0};
u8_t opcode = 0U; uint8_t opcode = 0U;
int err = 0; int err = 0;
if (server->buf.len > 29) { if (server->buf.len > 29) {
@ -238,11 +238,11 @@ static void proxy_complete_pdu(struct bt_mesh_proxy_server *server)
static ssize_t proxy_recv(struct bt_mesh_conn *conn, static ssize_t proxy_recv(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const void *buf, const struct bt_mesh_gatt_attr *attr, const void *buf,
u16_t len, u16_t offset, u8_t flags) uint16_t len, uint16_t offset, uint8_t flags)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
const u8_t *data = buf; const uint8_t *data = buf;
u16_t srvc_uuid = 0U; uint16_t srvc_uuid = 0U;
if (!server) { if (!server) {
BT_ERR("No Proxy Server object found"); BT_ERR("No Proxy Server object found");
@ -329,17 +329,17 @@ static ssize_t proxy_recv(struct bt_mesh_conn *conn,
} }
static int proxy_send(struct bt_mesh_conn *conn, const void *data, u16_t len) static int proxy_send(struct bt_mesh_conn *conn, const void *data, uint16_t len)
{ {
BT_DBG("%u bytes: %s", len, bt_hex(data, len)); BT_DBG("%u bytes: %s", len, bt_hex(data, len));
return bt_mesh_gattc_write_no_rsp(conn, NULL, data, len); return bt_mesh_gattc_write_no_rsp(conn, NULL, data, len);
} }
static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type, static int proxy_segment_and_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
u16_t mtu = 0U; uint16_t mtu = 0U;
int err = 0; int err = 0;
if (conn == NULL) { if (conn == NULL) {
@ -382,7 +382,7 @@ static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type,
return err; return err;
} }
int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
@ -425,7 +425,7 @@ static void proxy_connected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int
return; return;
} }
static void proxy_disconnected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, u8_t reason) static void proxy_disconnected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, uint8_t reason)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
@ -483,7 +483,7 @@ static ssize_t prov_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn)
return -ENOMEM; return -ENOMEM;
} }
static ssize_t prov_recv_ntf(struct bt_mesh_conn *conn, u8_t *data, u16_t len) static ssize_t prov_recv_ntf(struct bt_mesh_conn *conn, uint8_t *data, uint16_t len)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
@ -555,7 +555,7 @@ static ssize_t proxy_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn)
return -EINVAL; return -EINVAL;
} }
static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, u8_t *data, u16_t len) static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, uint8_t *data, uint16_t len)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
@ -641,7 +641,7 @@ static struct bt_mesh_prov_conn_cb conn_callbacks = {
}; };
#if defined(CONFIG_BLE_MESH_GATT_PROXY_CLIENT) #if defined(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)
static struct bt_mesh_subnet *bt_mesh_is_net_id_exist(const u8_t net_id[8]) static struct bt_mesh_subnet *bt_mesh_is_net_id_exist(const uint8_t net_id[8])
{ {
struct bt_mesh_subnet *sub = NULL; struct bt_mesh_subnet *sub = NULL;
size_t size = 0U, i = 0U; size_t size = 0U, i = 0U;
@ -659,10 +659,10 @@ static struct bt_mesh_subnet *bt_mesh_is_net_id_exist(const u8_t net_id[8])
} }
void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf, void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi) const bt_mesh_addr_t *addr, int8_t rssi)
{ {
bt_mesh_proxy_adv_ctx_t ctx = {0}; bt_mesh_proxy_adv_ctx_t ctx = {0};
u8_t type = 0U; uint8_t type = 0U;
/* Check if connection reaches the maximum limitation */ /* Check if connection reaches the maximum limitation */
if (bt_mesh_gattc_get_free_conn_count() == 0) { if (bt_mesh_gattc_get_free_conn_count() == 0) {
@ -706,7 +706,7 @@ void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf,
} }
} }
int bt_mesh_proxy_client_connect(const u8_t addr[6], u8_t addr_type, u16_t net_idx) int bt_mesh_proxy_client_connect(const uint8_t addr[6], uint8_t addr_type, uint16_t net_idx)
{ {
bt_mesh_addr_t remote_addr = {0}; bt_mesh_addr_t remote_addr = {0};
int result = 0; int result = 0;
@ -729,7 +729,7 @@ int bt_mesh_proxy_client_connect(const u8_t addr[6], u8_t addr_type, u16_t net_i
return 0; return 0;
} }
int bt_mesh_proxy_client_disconnect(u8_t conn_handle) int bt_mesh_proxy_client_disconnect(uint8_t conn_handle)
{ {
struct bt_mesh_conn *conn = NULL; struct bt_mesh_conn *conn = NULL;
@ -750,7 +750,7 @@ int bt_mesh_proxy_client_disconnect(u8_t conn_handle)
return 0; return 0;
} }
bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, u16_t dst) bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, uint16_t dst)
{ {
bool send = false; bool send = false;
int err = 0; int err = 0;
@ -837,7 +837,7 @@ bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub)
return send; return send;
} }
static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_mesh_proxy_cfg_pdu *cfg) static int send_proxy_cfg(struct bt_mesh_conn *conn, uint16_t net_idx, struct bt_mesh_proxy_cfg_pdu *cfg)
{ {
struct bt_mesh_msg_ctx ctx = { struct bt_mesh_msg_ctx ctx = {
.net_idx = net_idx, .net_idx = net_idx,
@ -850,7 +850,7 @@ static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_me
.src = bt_mesh_primary_addr(), .src = bt_mesh_primary_addr(),
}; };
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
u16_t alloc_len = 0U; uint16_t alloc_len = 0U;
int err = 0; int err = 0;
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) { if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) {
@ -911,12 +911,12 @@ static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_me
net_buf_simple_add_u8(buf, cfg->set.filter_type); net_buf_simple_add_u8(buf, cfg->set.filter_type);
break; break;
case BLE_MESH_PROXY_CFG_FILTER_ADD: case BLE_MESH_PROXY_CFG_FILTER_ADD:
for (u16_t i = 0U; i < cfg->add.addr_num; i++) { for (uint16_t i = 0U; i < cfg->add.addr_num; i++) {
net_buf_simple_add_le16(buf, cfg->add.addr[i]); net_buf_simple_add_le16(buf, cfg->add.addr[i]);
} }
break; break;
case BLE_MESH_PROXY_CFG_FILTER_REMOVE: case BLE_MESH_PROXY_CFG_FILTER_REMOVE:
for (u16_t i = 0U; i < cfg->remove.addr_num; i++) { for (uint16_t i = 0U; i < cfg->remove.addr_num; i++) {
net_buf_simple_add_le16(buf, cfg->remove.addr[i]); net_buf_simple_add_le16(buf, cfg->remove.addr[i]);
} }
break; break;
@ -940,7 +940,7 @@ static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_me
return err; return err;
} }
int bt_mesh_proxy_client_cfg_send(u8_t conn_handle, u16_t net_idx, int bt_mesh_proxy_client_cfg_send(uint8_t conn_handle, uint16_t net_idx,
struct bt_mesh_proxy_cfg_pdu *pdu) struct bt_mesh_proxy_cfg_pdu *pdu)
{ {
struct bt_mesh_conn *conn = NULL; struct bt_mesh_conn *conn = NULL;

View File

@ -37,11 +37,11 @@ extern "C" {
typedef union { typedef union {
struct { struct {
u8_t net_id[8]; uint8_t net_id[8];
u16_t net_idx; uint16_t net_idx;
} net_id; } net_id;
struct { struct {
u16_t src; uint16_t src;
} node_id; } node_id;
} bt_mesh_proxy_adv_ctx_t; } bt_mesh_proxy_adv_ctx_t;
@ -50,31 +50,31 @@ struct bt_mesh_proxy_net_pdu {
}; };
struct bt_mesh_proxy_cfg_pdu { struct bt_mesh_proxy_cfg_pdu {
u8_t opcode; uint8_t opcode;
union { union {
struct cfg_filter_set { struct cfg_filter_set {
u8_t filter_type; uint8_t filter_type;
} set; } set;
struct cfg_addr_add { struct cfg_addr_add {
u16_t *addr; uint16_t *addr;
u16_t addr_num; uint16_t addr_num;
} add; } add;
struct cfg_addr_remove { struct cfg_addr_remove {
u16_t *addr; uint16_t *addr;
u16_t addr_num; uint16_t addr_num;
} remove; } remove;
}; };
}; };
typedef struct { typedef struct {
u8_t type; uint8_t type;
union { union {
struct bt_mesh_proxy_net_pdu net; struct bt_mesh_proxy_net_pdu net;
struct bt_mesh_proxy_cfg_pdu cfg; struct bt_mesh_proxy_cfg_pdu cfg;
}; };
} bt_mesh_proxy_client_pdu_t; } bt_mesh_proxy_client_pdu_t;
int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg); struct net_buf_simple *msg);
int bt_mesh_proxy_client_prov_enable(void); int bt_mesh_proxy_client_prov_enable(void);
@ -83,14 +83,14 @@ int bt_mesh_proxy_client_prov_disable(void);
int bt_mesh_proxy_client_gatt_enable(void); int bt_mesh_proxy_client_gatt_enable(void);
int bt_mesh_proxy_client_gatt_disable(void); int bt_mesh_proxy_client_gatt_disable(void);
typedef void (*proxy_client_recv_adv_cb_t)(const bt_mesh_addr_t *addr, u8_t type, typedef void (*proxy_client_recv_adv_cb_t)(const bt_mesh_addr_t *addr, uint8_t type,
bt_mesh_proxy_adv_ctx_t *ctx, s8_t rssi); bt_mesh_proxy_adv_ctx_t *ctx, int8_t rssi);
typedef void (*proxy_client_connect_cb_t)(const bt_mesh_addr_t *addr, typedef void (*proxy_client_connect_cb_t)(const bt_mesh_addr_t *addr,
u8_t conn_handle, u16_t net_idx); uint8_t conn_handle, uint16_t net_idx);
typedef void (*proxy_client_disconnect_cb_t)(const bt_mesh_addr_t *addr, u8_t conn_handle, typedef void (*proxy_client_disconnect_cb_t)(const bt_mesh_addr_t *addr, uint8_t conn_handle,
u16_t net_idx, u8_t reason); uint16_t net_idx, uint8_t reason);
typedef void (*proxy_client_recv_filter_status_cb_t)(u8_t conn_handle, u16_t src, u16_t net_idx, typedef void (*proxy_client_recv_filter_status_cb_t)(uint8_t conn_handle, uint16_t src, uint16_t net_idx,
u8_t filter_type, u16_t list_size); uint8_t filter_type, uint16_t list_size);
void bt_mesh_proxy_client_set_adv_recv_cb(proxy_client_recv_adv_cb_t cb); void bt_mesh_proxy_client_set_adv_recv_cb(proxy_client_recv_adv_cb_t cb);
void bt_mesh_proxy_client_set_conn_cb(proxy_client_connect_cb_t cb); void bt_mesh_proxy_client_set_conn_cb(proxy_client_connect_cb_t cb);
@ -98,16 +98,16 @@ void bt_mesh_proxy_client_set_disconn_cb(proxy_client_disconnect_cb_t cb);
void bt_mesh_proxy_client_set_filter_status_cb(proxy_client_recv_filter_status_cb_t cb); void bt_mesh_proxy_client_set_filter_status_cb(proxy_client_recv_filter_status_cb_t cb);
void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf, void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi); const bt_mesh_addr_t *addr, int8_t rssi);
int bt_mesh_proxy_client_connect(const u8_t addr[6], u8_t addr_type, u16_t net_idx); int bt_mesh_proxy_client_connect(const uint8_t addr[6], uint8_t addr_type, uint16_t net_idx);
int bt_mesh_proxy_client_disconnect(u8_t conn_handle); int bt_mesh_proxy_client_disconnect(uint8_t conn_handle);
bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub); bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub);
bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, u16_t dst); bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, uint16_t dst);
int bt_mesh_proxy_client_cfg_send(u8_t conn_handle, u16_t net_idx, int bt_mesh_proxy_client_cfg_send(uint8_t conn_handle, uint16_t net_idx,
struct bt_mesh_proxy_cfg_pdu *pdu); struct bt_mesh_proxy_cfg_pdu *pdu);
int bt_mesh_proxy_client_init(void); int bt_mesh_proxy_client_init(void);

View File

@ -68,18 +68,18 @@ static bool proxy_adv_enabled;
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
static void proxy_send_beacons(struct k_work *work); static void proxy_send_beacons(struct k_work *work);
static u16_t proxy_ccc_val; static uint16_t proxy_ccc_val;
#endif #endif
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
static u16_t prov_ccc_val; static uint16_t prov_ccc_val;
static bool prov_fast_adv; static bool prov_fast_adv;
#endif #endif
static struct bt_mesh_proxy_client { static struct bt_mesh_proxy_client {
struct bt_mesh_conn *conn; struct bt_mesh_conn *conn;
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
u16_t filter[CONFIG_BLE_MESH_PROXY_FILTER_SIZE]; uint16_t filter[CONFIG_BLE_MESH_PROXY_FILTER_SIZE];
#endif #endif
enum __packed { enum __packed {
NONE, NONE,
@ -87,12 +87,12 @@ static struct bt_mesh_proxy_client {
BLACKLIST, BLACKLIST,
PROV, PROV,
} filter_type; } filter_type;
u8_t msg_type; uint8_t msg_type;
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
struct k_work send_beacons; struct k_work send_beacons;
#endif #endif
struct k_delayed_work sar_timer; struct k_delayed_work sar_timer;
struct net_buf_simple buf; struct net_buf_simple buf;
} clients[BLE_MESH_MAX_CONN] = { } clients[BLE_MESH_MAX_CONN] = {
[0 ... (BLE_MESH_MAX_CONN - 1)] = { [0 ... (BLE_MESH_MAX_CONN - 1)] = {
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
@ -101,7 +101,7 @@ static struct bt_mesh_proxy_client {
}, },
}; };
static u8_t client_buf_data[CLIENT_BUF_SIZE * BLE_MESH_MAX_CONN]; static uint8_t client_buf_data[CLIENT_BUF_SIZE * BLE_MESH_MAX_CONN];
/* Track which service is enabled */ /* Track which service is enabled */
static enum { static enum {
@ -163,13 +163,13 @@ static void proxy_sar_timeout(struct k_work *work)
/* Next subnet in queue to be advertised */ /* Next subnet in queue to be advertised */
static int next_idx; static int next_idx;
static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type, static int proxy_segment_and_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg); struct net_buf_simple *msg);
static int filter_set(struct bt_mesh_proxy_client *client, static int filter_set(struct bt_mesh_proxy_client *client,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t type = 0U; uint8_t type = 0U;
if (buf->len < 1) { if (buf->len < 1) {
BT_WARN("Too short Filter Set message"); BT_WARN("Too short Filter Set message");
@ -196,7 +196,7 @@ static int filter_set(struct bt_mesh_proxy_client *client,
return 0; return 0;
} }
static void filter_add(struct bt_mesh_proxy_client *client, u16_t addr) static void filter_add(struct bt_mesh_proxy_client *client, uint16_t addr)
{ {
int i; int i;
@ -223,7 +223,7 @@ static void filter_add(struct bt_mesh_proxy_client *client, u16_t addr)
BT_WARN("Proxy filter is full!"); BT_WARN("Proxy filter is full!");
} }
static void filter_remove(struct bt_mesh_proxy_client *client, u16_t addr) static void filter_remove(struct bt_mesh_proxy_client *client, uint16_t addr)
{ {
int i; int i;
@ -251,7 +251,7 @@ static void send_filter_status(struct bt_mesh_proxy_client *client,
.ctx = &rx->ctx, .ctx = &rx->ctx,
.src = bt_mesh_primary_addr(), .src = bt_mesh_primary_addr(),
}; };
u16_t filter_size = 0U; uint16_t filter_size = 0U;
int i, err = 0; int i, err = 0;
/* Configuration messages always have dst unassigned */ /* Configuration messages always have dst unassigned */
@ -294,7 +294,7 @@ static void proxy_cfg(struct bt_mesh_proxy_client *client)
{ {
NET_BUF_SIMPLE_DEFINE(buf, 29); NET_BUF_SIMPLE_DEFINE(buf, 29);
struct bt_mesh_net_rx rx = {0}; struct bt_mesh_net_rx rx = {0};
u8_t opcode = 0U; uint8_t opcode = 0U;
int err = 0; int err = 0;
if (client->buf.len > 29) { if (client->buf.len > 29) {
@ -335,7 +335,7 @@ static void proxy_cfg(struct bt_mesh_proxy_client *client)
break; break;
case CFG_FILTER_ADD: case CFG_FILTER_ADD:
while (buf.len >= 2) { while (buf.len >= 2) {
u16_t addr = 0U; uint16_t addr = 0U;
addr = net_buf_simple_pull_be16(&buf); addr = net_buf_simple_pull_be16(&buf);
filter_add(client, addr); filter_add(client, addr);
@ -344,7 +344,7 @@ static void proxy_cfg(struct bt_mesh_proxy_client *client)
break; break;
case CFG_FILTER_REMOVE: case CFG_FILTER_REMOVE:
while (buf.len >= 2) { while (buf.len >= 2) {
u16_t addr = 0U; uint16_t addr = 0U;
addr = net_buf_simple_pull_be16(&buf); addr = net_buf_simple_pull_be16(&buf);
filter_remove(client, addr); filter_remove(client, addr);
@ -489,10 +489,10 @@ static void proxy_complete_pdu(struct bt_mesh_proxy_client *client)
static ssize_t proxy_recv(struct bt_mesh_conn *conn, static ssize_t proxy_recv(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const void *buf, const struct bt_mesh_gatt_attr *attr, const void *buf,
u16_t len, u16_t offset, u8_t flags) uint16_t len, uint16_t offset, uint8_t flags)
{ {
struct bt_mesh_proxy_client *client = find_client(conn); struct bt_mesh_proxy_client *client = find_client(conn);
const u8_t *data = buf; const uint8_t *data = buf;
if (!client) { if (!client) {
return -ENOTCONN; return -ENOTCONN;
@ -573,7 +573,7 @@ static ssize_t proxy_recv(struct bt_mesh_conn *conn,
static int conn_count; static int conn_count;
static void proxy_connected(struct bt_mesh_conn *conn, u8_t err) static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
{ {
struct bt_mesh_proxy_client *client = NULL; struct bt_mesh_proxy_client *client = NULL;
int i; int i;
@ -610,7 +610,7 @@ static void proxy_connected(struct bt_mesh_conn *conn, u8_t err)
net_buf_simple_reset(&client->buf); net_buf_simple_reset(&client->buf);
} }
static void proxy_disconnected(struct bt_mesh_conn *conn, u8_t reason) static void proxy_disconnected(struct bt_mesh_conn *conn, uint8_t reason)
{ {
int i; int i;
@ -649,11 +649,11 @@ struct net_buf_simple *bt_mesh_proxy_server_get_buf(void)
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
static ssize_t prov_ccc_write(struct bt_mesh_conn *conn, static ssize_t prov_ccc_write(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *buf, u16_t len, const void *buf, uint16_t len,
u16_t offset, u8_t flags) uint16_t offset, uint8_t flags)
{ {
struct bt_mesh_proxy_client *client = NULL; struct bt_mesh_proxy_client *client = NULL;
u16_t *value = attr->user_data; uint16_t *value = attr->user_data;
BT_DBG("len %u: %s", len, bt_hex(buf, len)); BT_DBG("len %u: %s", len, bt_hex(buf, len));
@ -684,9 +684,9 @@ static ssize_t prov_ccc_write(struct bt_mesh_conn *conn,
static ssize_t prov_ccc_read(struct bt_mesh_conn *conn, static ssize_t prov_ccc_read(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
u16_t *value = attr->user_data; uint16_t *value = attr->user_data;
return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, value, return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, value,
sizeof(*value)); sizeof(*value));
@ -787,11 +787,11 @@ int bt_mesh_proxy_server_prov_disable(bool disconnect)
#if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER)
static ssize_t proxy_ccc_write(struct bt_mesh_conn *conn, static ssize_t proxy_ccc_write(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
const void *buf, u16_t len, const void *buf, uint16_t len,
u16_t offset, u8_t flags) uint16_t offset, uint8_t flags)
{ {
struct bt_mesh_proxy_client *client = NULL; struct bt_mesh_proxy_client *client = NULL;
u16_t value = 0U; uint16_t value = 0U;
BT_DBG("len %u: %s", len, bt_hex(buf, len)); BT_DBG("len %u: %s", len, bt_hex(buf, len));
@ -822,9 +822,9 @@ static ssize_t proxy_ccc_write(struct bt_mesh_conn *conn,
static ssize_t proxy_ccc_read(struct bt_mesh_conn *conn, static ssize_t proxy_ccc_read(struct bt_mesh_conn *conn,
const struct bt_mesh_gatt_attr *attr, const struct bt_mesh_gatt_attr *attr,
void *buf, u16_t len, u16_t offset) void *buf, uint16_t len, uint16_t offset)
{ {
u16_t *value = attr->user_data; uint16_t *value = attr->user_data;
return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, value, return bt_mesh_gatts_attr_read(conn, attr, buf, len, offset, value,
sizeof(*value)); sizeof(*value));
@ -918,7 +918,7 @@ int bt_mesh_proxy_server_gatt_disable(void)
return 0; return 0;
} }
void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, u16_t addr) void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, uint16_t addr)
{ {
struct bt_mesh_proxy_client *client = struct bt_mesh_proxy_client *client =
CONTAINER_OF(buf, struct bt_mesh_proxy_client, buf); CONTAINER_OF(buf, struct bt_mesh_proxy_client, buf);
@ -933,7 +933,7 @@ void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, u16_t addr)
} }
static bool client_filter_match(struct bt_mesh_proxy_client *client, static bool client_filter_match(struct bt_mesh_proxy_client *client,
u16_t addr) uint16_t addr)
{ {
int i; int i;
@ -964,7 +964,7 @@ static bool client_filter_match(struct bt_mesh_proxy_client *client,
return false; return false;
} }
bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, u16_t dst) bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, uint16_t dst)
{ {
bool relayed = false; bool relayed = false;
int i; int i;
@ -998,7 +998,7 @@ bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, u16_t dst)
#endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */ #endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */
static int proxy_send(struct bt_mesh_conn *conn, const void *data, u16_t len) static int proxy_send(struct bt_mesh_conn *conn, const void *data, uint16_t len)
{ {
BT_DBG("%u bytes: %s", len, bt_hex(data, len)); BT_DBG("%u bytes: %s", len, bt_hex(data, len));
@ -1017,10 +1017,10 @@ static int proxy_send(struct bt_mesh_conn *conn, const void *data, u16_t len)
return 0; return 0;
} }
static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type, static int proxy_segment_and_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
u16_t mtu = 0U; uint16_t mtu = 0U;
BT_DBG("conn %p type 0x%02x len %u: %s", conn, type, msg->len, BT_DBG("conn %p type 0x%02x len %u: %s", conn, type, msg->len,
bt_hex(msg->data, msg->len)); bt_hex(msg->data, msg->len));
@ -1051,7 +1051,7 @@ static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type,
return 0; return 0;
} }
int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
struct bt_mesh_proxy_client *client = find_client(conn); struct bt_mesh_proxy_client *client = find_client(conn);
@ -1070,7 +1070,7 @@ int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, u8_t type,
} }
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
static u8_t prov_svc_data[20] = { 0x27, 0x18, }; static uint8_t prov_svc_data[20] = { 0x27, 0x18, };
static const struct bt_mesh_adv_data prov_ad[] = { static const struct bt_mesh_adv_data prov_ad[] = {
BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_FLAGS, (BLE_MESH_AD_GENERAL | BLE_MESH_AD_NO_BREDR)), BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_FLAGS, (BLE_MESH_AD_GENERAL | BLE_MESH_AD_NO_BREDR)),
@ -1089,7 +1089,7 @@ static const struct bt_mesh_adv_data prov_ad[] = {
#define NODE_ID_TIMEOUT K_SECONDS(CONFIG_BLE_MESH_NODE_ID_TIMEOUT) #define NODE_ID_TIMEOUT K_SECONDS(CONFIG_BLE_MESH_NODE_ID_TIMEOUT)
static u8_t proxy_svc_data[NODE_ID_LEN] = { 0x28, 0x18, }; static uint8_t proxy_svc_data[NODE_ID_LEN] = { 0x28, 0x18, };
static const struct bt_mesh_adv_data node_id_ad[] = { static const struct bt_mesh_adv_data node_id_ad[] = {
BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_FLAGS, (BLE_MESH_AD_GENERAL | BLE_MESH_AD_NO_BREDR)), BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_FLAGS, (BLE_MESH_AD_GENERAL | BLE_MESH_AD_NO_BREDR)),
@ -1118,7 +1118,7 @@ static size_t gatt_proxy_adv_create(struct bt_mesh_adv_data *proxy_sd)
proxy_sd->data_len = name_len; proxy_sd->data_len = name_len;
} }
proxy_sd->data = (const u8_t *)name; proxy_sd->data = (const uint8_t *)name;
return 1; return 1;
} }
@ -1127,7 +1127,7 @@ static int node_id_adv(struct bt_mesh_subnet *sub)
{ {
struct bt_mesh_adv_data proxy_sd = {0}; struct bt_mesh_adv_data proxy_sd = {0};
size_t proxy_sd_len = 0U; size_t proxy_sd_len = 0U;
u8_t tmp[16] = {0}; uint8_t tmp[16] = {0};
int err = 0; int err = 0;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -1244,9 +1244,9 @@ static int sub_count(void)
return count; return count;
} }
static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub) static int32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub)
{ {
s32_t remaining = K_FOREVER; int32_t remaining = K_FOREVER;
int subnet_count = 0; int subnet_count = 0;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -1262,7 +1262,7 @@ static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub)
} }
if (sub->node_id == BLE_MESH_NODE_IDENTITY_RUNNING) { if (sub->node_id == BLE_MESH_NODE_IDENTITY_RUNNING) {
u32_t active = k_uptime_get_32() - sub->node_id_start; uint32_t active = k_uptime_get_32() - sub->node_id_start;
if (active < NODE_ID_TIMEOUT) { if (active < NODE_ID_TIMEOUT) {
remaining = NODE_ID_TIMEOUT - active; remaining = NODE_ID_TIMEOUT - active;
@ -1282,7 +1282,7 @@ static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub)
subnet_count = sub_count(); subnet_count = sub_count();
BT_DBG("sub_count %u", subnet_count); BT_DBG("sub_count %u", subnet_count);
if (subnet_count > 1) { if (subnet_count > 1) {
s32_t max_timeout = 0; int32_t max_timeout = 0;
/* We use NODE_ID_TIMEOUT as a starting point since it may /* We use NODE_ID_TIMEOUT as a starting point since it may
* be less than 60 seconds. Divide this period into at least * be less than 60 seconds. Divide this period into at least
@ -1324,7 +1324,7 @@ static size_t gatt_prov_adv_create(struct bt_mesh_adv_data prov_sd[2])
} else { } else {
prov_sd[0].type = BLE_MESH_DATA_URI; prov_sd[0].type = BLE_MESH_DATA_URI;
prov_sd[0].data_len = uri_len; prov_sd[0].data_len = uri_len;
prov_sd[0].data = (const u8_t *)prov->uri; prov_sd[0].data = (const uint8_t *)prov->uri;
sd_space -= 2 + uri_len; sd_space -= 2 + uri_len;
prov_sd_len++; prov_sd_len++;
} }
@ -1341,7 +1341,7 @@ static size_t gatt_prov_adv_create(struct bt_mesh_adv_data prov_sd[2])
prov_sd[prov_sd_len].data_len = name_len; prov_sd[prov_sd_len].data_len = name_len;
} }
prov_sd[prov_sd_len].data = (const u8_t *)name; prov_sd[prov_sd_len].data = (const uint8_t *)name;
prov_sd_len++; prov_sd_len++;
} }
@ -1349,7 +1349,7 @@ static size_t gatt_prov_adv_create(struct bt_mesh_adv_data prov_sd[2])
} }
#endif /* CONFIG_BLE_MESH_PB_GATT */ #endif /* CONFIG_BLE_MESH_PB_GATT */
s32_t bt_mesh_proxy_server_adv_start(void) int32_t bt_mesh_proxy_server_adv_start(void)
{ {
BT_DBG("%s", __func__); BT_DBG("%s", __func__);

View File

@ -40,7 +40,7 @@ extern "C" {
int bt_mesh_set_device_name(const char *name); int bt_mesh_set_device_name(const char *name);
int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, uint8_t type,
struct net_buf_simple *msg); struct net_buf_simple *msg);
int bt_mesh_proxy_server_prov_enable(void); int bt_mesh_proxy_server_prov_enable(void);
@ -55,14 +55,14 @@ void bt_mesh_proxy_server_beacon_send(struct bt_mesh_subnet *sub);
struct net_buf_simple *bt_mesh_proxy_server_get_buf(void); struct net_buf_simple *bt_mesh_proxy_server_get_buf(void);
s32_t bt_mesh_proxy_server_adv_start(void); int32_t bt_mesh_proxy_server_adv_start(void);
void bt_mesh_proxy_server_adv_stop(void); void bt_mesh_proxy_server_adv_stop(void);
void bt_mesh_proxy_server_identity_start(struct bt_mesh_subnet *sub); void bt_mesh_proxy_server_identity_start(struct bt_mesh_subnet *sub);
void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub); void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub);
bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, u16_t dst); bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, uint16_t dst);
void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, u16_t addr); void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, uint16_t addr);
int bt_mesh_proxy_server_init(void); int bt_mesh_proxy_server_init(void);
int bt_mesh_proxy_server_deinit(void); int bt_mesh_proxy_server_deinit(void);

View File

@ -59,10 +59,10 @@
* gets deleted its struct becomes invalid and may be reused for other keys. * gets deleted its struct becomes invalid and may be reused for other keys.
*/ */
static struct key_update { static struct key_update {
u16_t key_idx: 12, /* AppKey or NetKey Index */ uint16_t key_idx:12, /* AppKey or NetKey Index */
valid: 1, /* 1 if this entry is valid, 0 if not */ valid:1, /* 1 if this entry is valid, 0 if not */
app_key: 1, /* 1 if this is an AppKey, 0 if a NetKey */ app_key:1, /* 1 if this is an AppKey, 0 if a NetKey */
clear: 1; /* 1 if key needs clearing, 0 if storing */ clear:1; /* 1 if key needs clearing, 0 if storing */
} key_updates[CONFIG_BLE_MESH_APP_KEY_COUNT + CONFIG_BLE_MESH_SUBNET_COUNT]; } key_updates[CONFIG_BLE_MESH_APP_KEY_COUNT + CONFIG_BLE_MESH_SUBNET_COUNT];
static struct k_delayed_work pending_store; static struct k_delayed_work pending_store;
@ -70,78 +70,78 @@ static void store_pending(struct k_work *work);
/* Mesh network storage information */ /* Mesh network storage information */
struct net_val { struct net_val {
u16_t primary_addr; uint16_t primary_addr;
u8_t dev_key[16]; uint8_t dev_key[16];
} __packed; } __packed;
/* Sequence number storage */ /* Sequence number storage */
struct seq_val { struct seq_val {
u8_t val[3]; uint8_t val[3];
} __packed; } __packed;
/* Heartbeat Publication storage */ /* Heartbeat Publication storage */
struct hb_pub_val { struct hb_pub_val {
u16_t dst; uint16_t dst;
u8_t period; uint8_t period;
u8_t ttl; uint8_t ttl;
u16_t feat; uint16_t feat;
u16_t net_idx: 12, uint16_t net_idx:12,
indefinite: 1; indefinite:1;
}; };
/* Miscellaneous configuration server model states */ /* Miscellaneous configuration server model states */
struct cfg_val { struct cfg_val {
u8_t net_transmit; uint8_t net_transmit;
u8_t relay; uint8_t relay;
u8_t relay_retransmit; uint8_t relay_retransmit;
u8_t beacon; uint8_t beacon;
u8_t gatt_proxy; uint8_t gatt_proxy;
u8_t frnd; uint8_t frnd;
u8_t default_ttl; uint8_t default_ttl;
}; };
/* IV Index & IV Update storage */ /* IV Index & IV Update storage */
struct iv_val { struct iv_val {
u32_t iv_index; uint32_t iv_index;
u8_t iv_update: 1, uint8_t iv_update:1,
iv_duration: 7; iv_duration:7;
} __packed; } __packed;
/* Replay Protection List storage */ /* Replay Protection List storage */
struct rpl_val { struct rpl_val {
u32_t seq: 24, uint32_t seq:24,
old_iv: 1; old_iv:1;
}; };
/* NetKey storage information */ /* NetKey storage information */
struct net_key_val { struct net_key_val {
u8_t kr_flag: 1, uint8_t kr_flag:1,
kr_phase: 7; kr_phase:7;
u8_t val[2][16]; uint8_t val[2][16];
} __packed; } __packed;
/* AppKey storage information */ /* AppKey storage information */
struct app_key_val { struct app_key_val {
u16_t net_idx; uint16_t net_idx;
bool updated; bool updated;
u8_t val[2][16]; uint8_t val[2][16];
} __packed; } __packed;
struct mod_pub_val { struct mod_pub_val {
u16_t addr; uint16_t addr;
u16_t key; uint16_t key;
u8_t ttl; uint8_t ttl;
u8_t retransmit; uint8_t retransmit;
u8_t period; uint8_t period;
u8_t period_div: 4, uint8_t period_div:4,
cred: 1; cred:1;
}; };
/* Virtual Address information */ /* Virtual Address information */
struct va_val { struct va_val {
u16_t ref; uint16_t ref;
u16_t addr; uint16_t addr;
u8_t uuid[16]; uint8_t uuid[16];
} __packed; } __packed;
/* We need this so we don't overwrite app-hardcoded values in case FCB /* We need this so we don't overwrite app-hardcoded values in case FCB
@ -153,21 +153,21 @@ static struct {
} stored_cfg; } stored_cfg;
struct prov_info { struct prov_info {
u16_t primary_addr; uint16_t primary_addr;
u16_t alloc_addr; uint16_t alloc_addr;
}; };
struct node_info { struct node_info {
u8_t addr[6]; uint8_t addr[6];
u8_t addr_type; uint8_t addr_type;
u8_t dev_uuid[16]; uint8_t dev_uuid[16];
u16_t oob_info; uint16_t oob_info;
u16_t unicast_addr; uint16_t unicast_addr;
u8_t element_num; uint8_t element_num;
u16_t net_idx; uint16_t net_idx;
u8_t flags; uint8_t flags;
u32_t iv_index; uint32_t iv_index;
u8_t dev_key[16]; uint8_t dev_key[16];
} __packed; } __packed;
static bt_mesh_mutex_t settings_lock; static bt_mesh_mutex_t settings_lock;
@ -203,7 +203,7 @@ static int role_set(const char *name)
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)bt_mesh.flags, sizeof(bt_mesh.flags), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)bt_mesh.flags, sizeof(bt_mesh.flags), &exist);
if (err) { if (err) {
BT_ERR("Failed to load mesh device role"); BT_ERR("Failed to load mesh device role");
return err; return err;
@ -231,7 +231,7 @@ static int net_set(const char *name)
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&net, sizeof(net), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&net, sizeof(net), &exist);
if (err) { if (err) {
BT_ERR("Failed to load node net info"); BT_ERR("Failed to load node net info");
memset(bt_mesh.dev_key, 0, sizeof(bt_mesh.dev_key)); memset(bt_mesh.dev_key, 0, sizeof(bt_mesh.dev_key));
@ -260,7 +260,7 @@ static int iv_set(const char *name)
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&iv, sizeof(iv), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&iv, sizeof(iv), &exist);
if (err) { if (err) {
BT_ERR("Failed to load iv_index"); BT_ERR("Failed to load iv_index");
bt_mesh.iv_index = 0U; bt_mesh.iv_index = 0U;
@ -290,7 +290,7 @@ static int seq_set(const char *name)
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&seq, sizeof(seq), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&seq, sizeof(seq), &exist);
if (err) { if (err) {
BT_ERR("Failed to load sequence number"); BT_ERR("Failed to load sequence number");
bt_mesh.seq = 0U; bt_mesh.seq = 0U;
@ -318,7 +318,7 @@ static int seq_set(const char *name)
return 0; return 0;
} }
static struct bt_mesh_rpl *rpl_find(u16_t src) static struct bt_mesh_rpl *rpl_find(uint16_t src)
{ {
int i; int i;
@ -331,7 +331,7 @@ static struct bt_mesh_rpl *rpl_find(u16_t src)
return NULL; return NULL;
} }
static struct bt_mesh_rpl *rpl_alloc(u16_t src) static struct bt_mesh_rpl *rpl_alloc(uint16_t src)
{ {
int i; int i;
@ -366,7 +366,7 @@ static int rpl_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t src = net_buf_simple_pull_le16(buf); uint16_t src = net_buf_simple_pull_le16(buf);
if (!BLE_MESH_ADDR_IS_UNICAST(src)) { if (!BLE_MESH_ADDR_IS_UNICAST(src)) {
BT_ERR("Invalid source address 0x%04x", src); BT_ERR("Invalid source address 0x%04x", src);
@ -375,7 +375,7 @@ static int rpl_set(const char *name)
sprintf(get, "mesh/rpl/%04x", src); sprintf(get, "mesh/rpl/%04x", src);
err = bt_mesh_load_core_settings(get, (u8_t *)&rpl, sizeof(rpl), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&rpl, sizeof(rpl), &exist);
if (err) { if (err) {
BT_ERR("Failed to load RPL entry 0x%04x", src); BT_ERR("Failed to load RPL entry 0x%04x", src);
continue; continue;
@ -407,7 +407,7 @@ free:
return err; return err;
} }
static struct bt_mesh_subnet *subnet_alloc(u16_t net_idx) static struct bt_mesh_subnet *subnet_alloc(uint16_t net_idx)
{ {
int i; int i;
@ -442,10 +442,10 @@ static int net_key_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t net_idx = net_buf_simple_pull_le16(buf); uint16_t net_idx = net_buf_simple_pull_le16(buf);
sprintf(get, "mesh/nk/%04x", net_idx); sprintf(get, "mesh/nk/%04x", net_idx);
err = bt_mesh_load_core_settings(get, (u8_t *)&key, sizeof(key), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&key, sizeof(key), &exist);
if (err) { if (err) {
BT_ERR("Failed to load NetKey 0x%03x", net_idx); BT_ERR("Failed to load NetKey 0x%03x", net_idx);
continue; continue;
@ -502,10 +502,10 @@ static int app_key_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t app_idx = net_buf_simple_pull_le16(buf); uint16_t app_idx = net_buf_simple_pull_le16(buf);
sprintf(get, "mesh/ak/%04x", app_idx); sprintf(get, "mesh/ak/%04x", app_idx);
err = bt_mesh_load_core_settings(get, (u8_t *)&key, sizeof(key), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&key, sizeof(key), &exist);
if (err) { if (err) {
BT_ERR("Failed to load AppKey 0x%03x", app_idx); BT_ERR("Failed to load AppKey 0x%03x", app_idx);
continue; continue;
@ -563,7 +563,7 @@ static int hb_pub_set(const char *name)
return -EINVAL; return -EINVAL;
} }
err = bt_mesh_load_core_settings(name, (u8_t *)&hb_val, sizeof(hb_val), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&hb_val, sizeof(hb_val), &exist);
if (err) { if (err) {
BT_ERR("Failed to load heartbeat publication"); BT_ERR("Failed to load heartbeat publication");
hb_pub->dst = BLE_MESH_ADDR_UNASSIGNED; hb_pub->dst = BLE_MESH_ADDR_UNASSIGNED;
@ -610,7 +610,7 @@ static int cfg_set(const char *name)
return -EINVAL; return -EINVAL;
} }
err = bt_mesh_load_core_settings(name, (u8_t *)&val, sizeof(val), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&val, sizeof(val), &exist);
if (err) { if (err) {
BT_ERR("Failed to load configuration state"); BT_ERR("Failed to load configuration state");
stored_cfg.valid = false; stored_cfg.valid = false;
@ -630,7 +630,7 @@ static int cfg_set(const char *name)
return 0; return 0;
} }
static int model_set_bind(bool vnd, struct bt_mesh_model *model, u16_t model_key) static int model_set_bind(bool vnd, struct bt_mesh_model *model, uint16_t model_key)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
bool exist = false; bool exist = false;
@ -643,7 +643,7 @@ static int model_set_bind(bool vnd, struct bt_mesh_model *model, u16_t model_key
} }
sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key);
err = bt_mesh_load_core_settings(name, (u8_t *)model->keys, sizeof(model->keys), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)model->keys, sizeof(model->keys), &exist);
if (err) { if (err) {
BT_ERR("Failed to load model bound keys"); BT_ERR("Failed to load model bound keys");
return -EIO; return -EIO;
@ -656,7 +656,7 @@ static int model_set_bind(bool vnd, struct bt_mesh_model *model, u16_t model_key
return 0; return 0;
} }
static int model_set_sub(bool vnd, struct bt_mesh_model *model, u16_t model_key) static int model_set_sub(bool vnd, struct bt_mesh_model *model, uint16_t model_key)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
bool exist = false; bool exist = false;
@ -669,7 +669,7 @@ static int model_set_sub(bool vnd, struct bt_mesh_model *model, u16_t model_key)
} }
sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key);
err = bt_mesh_load_core_settings(name, (u8_t *)model->groups, sizeof(model->groups), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)model->groups, sizeof(model->groups), &exist);
if (err) { if (err) {
BT_ERR("Failed to load model subscriptions"); BT_ERR("Failed to load model subscriptions");
return -EIO; return -EIO;
@ -682,7 +682,7 @@ static int model_set_sub(bool vnd, struct bt_mesh_model *model, u16_t model_key)
return 0; return 0;
} }
static int model_set_pub(bool vnd, struct bt_mesh_model *model, u16_t model_key) static int model_set_pub(bool vnd, struct bt_mesh_model *model, uint16_t model_key)
{ {
struct mod_pub_val pub = {0}; struct mod_pub_val pub = {0};
char name[16] = {'\0'}; char name[16] = {'\0'};
@ -696,7 +696,7 @@ static int model_set_pub(bool vnd, struct bt_mesh_model *model, u16_t model_key)
} }
sprintf(name, "mesh/%s/%04x/p", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/p", vnd ? "v" : "s", model_key);
err = bt_mesh_load_core_settings(name, (u8_t *)&pub, sizeof(pub), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&pub, sizeof(pub), &exist);
if (err) { if (err) {
BT_ERR("Failed to load model publication"); BT_ERR("Failed to load model publication");
model->pub->addr = BLE_MESH_ADDR_UNASSIGNED; model->pub->addr = BLE_MESH_ADDR_UNASSIGNED;
@ -730,7 +730,7 @@ static int model_set(bool vnd, const char *name)
{ {
struct bt_mesh_model *model = NULL; struct bt_mesh_model *model = NULL;
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
u8_t elem_idx = 0U, model_idx = 0U; uint8_t elem_idx = 0U, model_idx = 0U;
size_t length = 0U; size_t length = 0U;
int i; int i;
@ -744,7 +744,7 @@ static int model_set(bool vnd, const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t model_key = net_buf_simple_pull_le16(buf); uint16_t model_key = net_buf_simple_pull_le16(buf);
elem_idx = BLE_MESH_GET_ELEM_IDX(model_key); elem_idx = BLE_MESH_GET_ELEM_IDX(model_key);
model_idx = BLE_MESH_GET_MODEL_IDX(model_key); model_idx = BLE_MESH_GET_MODEL_IDX(model_key);
@ -797,10 +797,10 @@ static int va_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t index = net_buf_simple_pull_le16(buf); uint16_t index = net_buf_simple_pull_le16(buf);
sprintf(get, "mesh/va/%04x", index); sprintf(get, "mesh/va/%04x", index);
err = bt_mesh_load_core_settings(get, (u8_t *)&va, sizeof(va), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&va, sizeof(va), &exist);
if (err) { if (err) {
BT_ERR("Failed to load virtual address 0x%04x", index); BT_ERR("Failed to load virtual address 0x%04x", index);
continue; continue;
@ -844,7 +844,7 @@ static int p_prov_set(const char *name)
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&val, sizeof(val), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&val, sizeof(val), &exist);
if (err) { if (err) {
BT_ERR("Failed to load next address allocation"); BT_ERR("Failed to load next address allocation");
return 0; return 0;
@ -864,13 +864,13 @@ static int p_prov_set(const char *name)
static int p_net_idx_set(const char *name) static int p_net_idx_set(const char *name)
{ {
u16_t net_idx = 0U; uint16_t net_idx = 0U;
bool exist = false; bool exist = false;
int err = 0; int err = 0;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&net_idx, sizeof(net_idx), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&net_idx, sizeof(net_idx), &exist);
if (err) { if (err) {
BT_ERR("Failed to load next NetKeyIndex alloc"); BT_ERR("Failed to load next NetKeyIndex alloc");
return 0; return 0;
@ -889,13 +889,13 @@ static int p_net_idx_set(const char *name)
static int p_app_idx_set(const char *name) static int p_app_idx_set(const char *name)
{ {
u16_t app_idx = 0U; uint16_t app_idx = 0U;
bool exist = false; bool exist = false;
int err = 0; int err = 0;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
err = bt_mesh_load_core_settings(name, (u8_t *)&app_idx, sizeof(app_idx), &exist); err = bt_mesh_load_core_settings(name, (uint8_t *)&app_idx, sizeof(app_idx), &exist);
if (err) { if (err) {
BT_ERR("Failed to load next AppKeyIndex alloc"); BT_ERR("Failed to load next AppKeyIndex alloc");
return 0; return 0;
@ -971,10 +971,10 @@ static int p_net_key_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t net_idx = net_buf_simple_pull_le16(buf); uint16_t net_idx = net_buf_simple_pull_le16(buf);
sprintf(get, "mesh/pnk/%04x", net_idx); sprintf(get, "mesh/pnk/%04x", net_idx);
err = bt_mesh_load_core_settings(get, (u8_t *)&key, sizeof(key), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&key, sizeof(key), &exist);
if (err) { if (err) {
BT_ERR("Failed to load NetKey 0x%03x", net_idx); BT_ERR("Failed to load NetKey 0x%03x", net_idx);
continue; continue;
@ -1031,10 +1031,10 @@ static int p_app_key_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t app_idx = net_buf_simple_pull_le16(buf); uint16_t app_idx = net_buf_simple_pull_le16(buf);
sprintf(get, "mesh/pak/%04x", app_idx); sprintf(get, "mesh/pak/%04x", app_idx);
err = bt_mesh_load_core_settings(get, (u8_t *)&key, sizeof(key), &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&key, sizeof(key), &exist);
if (err) { if (err) {
BT_ERR("Failed to load AppKey 0x%03x", app_idx); BT_ERR("Failed to load AppKey 0x%03x", app_idx);
continue; continue;
@ -1078,7 +1078,7 @@ free:
return err; return err;
} }
static int node_info_set(u16_t addr, bool *exist) static int node_info_set(uint16_t addr, bool *exist)
{ {
struct bt_mesh_node node = {0}; struct bt_mesh_node node = {0};
struct node_info info = {0}; struct node_info info = {0};
@ -1086,7 +1086,7 @@ static int node_info_set(u16_t addr, bool *exist)
int err = 0; int err = 0;
sprintf(get, "mesh/pn/%04x/i", addr); sprintf(get, "mesh/pn/%04x/i", addr);
err = bt_mesh_load_core_settings(get, (u8_t *)&info, sizeof(info), exist); err = bt_mesh_load_core_settings(get, (uint8_t *)&info, sizeof(info), exist);
if (err) { if (err) {
BT_ERR("Failed to load node 0x%04x info", addr); BT_ERR("Failed to load node 0x%04x info", addr);
return -EIO; return -EIO;
@ -1118,7 +1118,7 @@ static int node_info_set(u16_t addr, bool *exist)
return 0; return 0;
} }
static int node_name_set(u16_t addr) static int node_name_set(uint16_t addr)
{ {
char name[BLE_MESH_NODE_NAME_SIZE + 1] = {0}; char name[BLE_MESH_NODE_NAME_SIZE + 1] = {0};
char get[16] = {'\0'}; char get[16] = {'\0'};
@ -1126,7 +1126,7 @@ static int node_name_set(u16_t addr)
int err = 0; int err = 0;
sprintf(get, "mesh/pn/%04x/n", addr); sprintf(get, "mesh/pn/%04x/n", addr);
err = bt_mesh_load_core_settings(get, (u8_t *)name, BLE_MESH_NODE_NAME_SIZE, &exist); err = bt_mesh_load_core_settings(get, (uint8_t *)name, BLE_MESH_NODE_NAME_SIZE, &exist);
if (err) { if (err) {
BT_ERR("Failed to load node 0x%04x name", addr); BT_ERR("Failed to load node 0x%04x name", addr);
return -EIO; return -EIO;
@ -1147,7 +1147,7 @@ static int node_name_set(u16_t addr)
return 0; return 0;
} }
static int node_comp_data_set(u16_t addr) static int node_comp_data_set(uint16_t addr)
{ {
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
char get[16] = {'\0'}; char get[16] = {'\0'};
@ -1185,7 +1185,7 @@ static int p_node_set(const char *name)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t addr = net_buf_simple_pull_le16(buf); uint16_t addr = net_buf_simple_pull_le16(buf);
if (!BLE_MESH_ADDR_IS_UNICAST(addr)) { if (!BLE_MESH_ADDR_IS_UNICAST(addr)) {
BT_ERR("Invalid unicast address 0x%04x", addr); BT_ERR("Invalid unicast address 0x%04x", addr);
continue; continue;
@ -1288,7 +1288,7 @@ int settings_core_load(void)
settings[i].func(settings[i].name); settings[i].func(settings[i].name);
if (!strcmp(settings[i].name, "mesh/role")) { if (!strcmp(settings[i].name, "mesh/role")) {
u8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK; uint8_t role = bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK;
switch (role) { switch (role) {
case BLE_MESH_SETTINGS_ROLE_NONE: case BLE_MESH_SETTINGS_ROLE_NONE:
BT_INFO("Mesh device just starts up, no restore"); BT_INFO("Mesh device just starts up, no restore");
@ -1345,7 +1345,7 @@ static void commit_model(struct bt_mesh_model *model, struct bt_mesh_elem *elem,
{ {
if (model->pub && model->pub->update && if (model->pub && model->pub->update &&
model->pub->addr != BLE_MESH_ADDR_UNASSIGNED) { model->pub->addr != BLE_MESH_ADDR_UNASSIGNED) {
s32_t ms = bt_mesh_model_pub_period_get(model); int32_t ms = bt_mesh_model_pub_period_get(model);
if (ms) { if (ms) {
BT_DBG("Starting publish timer (period %u ms)", ms); BT_DBG("Starting publish timer (period %u ms)", ms);
k_delayed_work_submit(&model->pub->timer, ms); k_delayed_work_submit(&model->pub->timer, ms);
@ -1463,7 +1463,7 @@ int settings_core_commit(void)
static void schedule_store(int flag) static void schedule_store(int flag)
{ {
s32_t timeout = 0, remaining = 0; int32_t timeout = 0, remaining = 0;
bt_mesh_atomic_set_bit(bt_mesh.flags, flag); bt_mesh_atomic_set_bit(bt_mesh.flags, flag);
@ -1516,14 +1516,14 @@ static void store_pending_net(void)
net.primary_addr = bt_mesh_primary_addr(); net.primary_addr = bt_mesh_primary_addr();
memcpy(net.dev_key, bt_mesh.dev_key, 16); memcpy(net.dev_key, bt_mesh.dev_key, 16);
bt_mesh_save_core_settings("mesh/net", (const u8_t *)&net, sizeof(net)); bt_mesh_save_core_settings("mesh/net", (const uint8_t *)&net, sizeof(net));
} }
void bt_mesh_store_role(void) void bt_mesh_store_role(void)
{ {
BT_DBG("Store, device role %lu", bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK); BT_DBG("Store, device role %lu", bt_mesh_atomic_get(bt_mesh.flags) & BLE_MESH_SETTINGS_ROLE_BIT_MASK);
bt_mesh_save_core_settings("mesh/role", (const u8_t *)bt_mesh.flags, sizeof(bt_mesh.flags)); bt_mesh_save_core_settings("mesh/role", (const uint8_t *)bt_mesh.flags, sizeof(bt_mesh.flags));
} }
void bt_mesh_store_net(void) void bt_mesh_store_net(void)
@ -1539,7 +1539,7 @@ static void store_pending_iv(void)
iv.iv_update = bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS); iv.iv_update = bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS);
iv.iv_duration = bt_mesh.ivu_duration; iv.iv_duration = bt_mesh.ivu_duration;
bt_mesh_save_core_settings("mesh/iv", (const u8_t *)&iv, sizeof(iv)); bt_mesh_save_core_settings("mesh/iv", (const uint8_t *)&iv, sizeof(iv));
} }
void bt_mesh_store_iv(bool only_duration) void bt_mesh_store_iv(bool only_duration)
@ -1564,7 +1564,7 @@ static void store_pending_seq(void)
sys_put_le24(bt_mesh.seq, seq.val); sys_put_le24(bt_mesh.seq, seq.val);
bt_mesh_save_core_settings("mesh/seq", (const u8_t *)&seq, sizeof(seq)); bt_mesh_save_core_settings("mesh/seq", (const uint8_t *)&seq, sizeof(seq));
} }
void bt_mesh_store_seq(void) void bt_mesh_store_seq(void)
@ -1595,7 +1595,7 @@ static void store_rpl(struct bt_mesh_rpl *entry)
rpl.old_iv = entry->old_iv; rpl.old_iv = entry->old_iv;
sprintf(name, "mesh/rpl/%04x", entry->src); sprintf(name, "mesh/rpl/%04x", entry->src);
err = bt_mesh_save_core_settings(name, (const u8_t *)&rpl, sizeof(rpl)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&rpl, sizeof(rpl));
if (err) { if (err) {
BT_ERR("Failed to store RPL entry 0x%04x", entry->src); BT_ERR("Failed to store RPL entry 0x%04x", entry->src);
return; return;
@ -1614,7 +1614,7 @@ static void clear_rpl(void)
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
char name[16] = {'\0'}; char name[16] = {'\0'};
size_t length = 0U; size_t length = 0U;
u16_t src = 0U; uint16_t src = 0U;
int i; int i;
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -1678,7 +1678,7 @@ static void store_pending_hb_pub(void)
val.feat = hb_pub->feat; val.feat = hb_pub->feat;
val.net_idx = hb_pub->net_idx; val.net_idx = hb_pub->net_idx;
bt_mesh_save_core_settings("mesh/hb_pub", (const u8_t *)&val, sizeof(val)); bt_mesh_save_core_settings("mesh/hb_pub", (const uint8_t *)&val, sizeof(val));
} }
static void clear_hb_pub(void) static void clear_hb_pub(void)
@ -1705,7 +1705,7 @@ static void store_pending_cfg(void)
val.frnd = cfg->frnd; val.frnd = cfg->frnd;
val.default_ttl = cfg->default_ttl; val.default_ttl = cfg->default_ttl;
bt_mesh_save_core_settings("mesh/cfg", (const u8_t *)&val, sizeof(val)); bt_mesh_save_core_settings("mesh/cfg", (const uint8_t *)&val, sizeof(val));
} }
static void clear_cfg(void) static void clear_cfg(void)
@ -1714,7 +1714,7 @@ static void clear_cfg(void)
bt_mesh_erase_core_settings("mesh/cfg"); bt_mesh_erase_core_settings("mesh/cfg");
} }
static void clear_app_key(u16_t app_idx) static void clear_app_key(uint16_t app_idx)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -1732,7 +1732,7 @@ static void clear_app_key(u16_t app_idx)
return; return;
} }
static void clear_net_key(u16_t net_idx) static void clear_net_key(uint16_t net_idx)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -1765,7 +1765,7 @@ static void store_net_key(struct bt_mesh_subnet *sub)
key.kr_phase = sub->kr_phase; key.kr_phase = sub->kr_phase;
sprintf(name, "mesh/nk/%04x", sub->net_idx); sprintf(name, "mesh/nk/%04x", sub->net_idx);
err = bt_mesh_save_core_settings(name, (const u8_t *)&key, sizeof(key)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&key, sizeof(key));
if (err) { if (err) {
BT_ERR("Failed to store NetKey 0x%03x", sub->net_idx); BT_ERR("Failed to store NetKey 0x%03x", sub->net_idx);
return; return;
@ -1791,7 +1791,7 @@ static void store_app_key(struct bt_mesh_app_key *app)
memcpy(key.val[1], app->keys[1].val, 16); memcpy(key.val[1], app->keys[1].val, 16);
sprintf(name, "mesh/ak/%04x", app->app_idx); sprintf(name, "mesh/ak/%04x", app->app_idx);
err = bt_mesh_save_core_settings(name, (const u8_t *)&key, sizeof(key)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&key, sizeof(key));
if (err) { if (err) {
BT_ERR("Failed to store AppKey 0x%03x", app->app_idx); BT_ERR("Failed to store AppKey 0x%03x", app->app_idx);
return; return;
@ -1849,13 +1849,13 @@ static void store_pending_keys(void)
static void store_pending_mod_bind(struct bt_mesh_model *model, bool vnd) static void store_pending_mod_bind(struct bt_mesh_model *model, bool vnd)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
int err = 0; int err = 0;
model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx); model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx);
sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key);
err = bt_mesh_save_core_settings(name, (const u8_t *)model->keys, sizeof(model->keys)); err = bt_mesh_save_core_settings(name, (const uint8_t *)model->keys, sizeof(model->keys));
if (err) { if (err) {
BT_ERR("Failed to store %s", name); BT_ERR("Failed to store %s", name);
return; return;
@ -1873,13 +1873,13 @@ static void store_pending_mod_bind(struct bt_mesh_model *model, bool vnd)
static void store_pending_mod_sub(struct bt_mesh_model *model, bool vnd) static void store_pending_mod_sub(struct bt_mesh_model *model, bool vnd)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
int err = 0; int err = 0;
model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx); model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx);
sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key);
err = bt_mesh_save_core_settings(name, (const u8_t *)model->groups, sizeof(model->groups)); err = bt_mesh_save_core_settings(name, (const uint8_t *)model->groups, sizeof(model->groups));
if (err) { if (err) {
BT_ERR("Failed to store %s", name); BT_ERR("Failed to store %s", name);
return; return;
@ -1898,7 +1898,7 @@ static void store_pending_mod_pub(struct bt_mesh_model *model, bool vnd)
{ {
struct mod_pub_val pub = {0}; struct mod_pub_val pub = {0};
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
int err = 0; int err = 0;
if (!model->pub) { if (!model->pub) {
@ -1917,7 +1917,7 @@ static void store_pending_mod_pub(struct bt_mesh_model *model, bool vnd)
pub.period_div = model->pub->period_div; pub.period_div = model->pub->period_div;
pub.cred = model->pub->cred; pub.cred = model->pub->cred;
err = bt_mesh_save_core_settings(name, (const u8_t *)&pub, sizeof(pub)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&pub, sizeof(pub));
if (err) { if (err) {
BT_ERR("Failed to store %s", name); BT_ERR("Failed to store %s", name);
return; return;
@ -1959,7 +1959,7 @@ static void store_pending_mod(struct bt_mesh_model *model,
static void clear_mod_bind(struct bt_mesh_model *model, bool vnd) static void clear_mod_bind(struct bt_mesh_model *model, bool vnd)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx); model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx);
sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/b", vnd ? "v" : "s", model_key);
@ -1971,7 +1971,7 @@ static void clear_mod_bind(struct bt_mesh_model *model, bool vnd)
static void clear_mod_sub(struct bt_mesh_model *model, bool vnd) static void clear_mod_sub(struct bt_mesh_model *model, bool vnd)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx); model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx);
sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/s", vnd ? "v" : "s", model_key);
@ -1983,7 +1983,7 @@ static void clear_mod_sub(struct bt_mesh_model *model, bool vnd)
static void clear_mod_pub(struct bt_mesh_model *model, bool vnd) static void clear_mod_pub(struct bt_mesh_model *model, bool vnd)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
u16_t model_key = 0U; uint16_t model_key = 0U;
model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx); model_key = BLE_MESH_GET_MODEL_KEY(model->elem_idx, model->model_idx);
sprintf(name, "mesh/%s/%04x/p", vnd ? "v" : "s", model_key); sprintf(name, "mesh/%s/%04x/p", vnd ? "v" : "s", model_key);
@ -2022,7 +2022,7 @@ static void store_pending_va(void)
struct va_val va = {0}; struct va_val va = {0};
char name[16] = {'\0'}; char name[16] = {'\0'};
struct label *lab = NULL; struct label *lab = NULL;
u16_t i = 0U; uint16_t i = 0U;
int err = 0; int err = 0;
for (i = 0U; (lab = get_label(i)) != NULL; i++) { for (i = 0U; (lab = get_label(i)) != NULL; i++) {
@ -2039,7 +2039,7 @@ static void store_pending_va(void)
va.ref = lab->ref; va.ref = lab->ref;
va.addr = lab->addr; va.addr = lab->addr;
memcpy(va.uuid, lab->uuid, 16); memcpy(va.uuid, lab->uuid, 16);
err = bt_mesh_save_core_settings(name, (const u8_t *)&va, sizeof(va)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&va, sizeof(va));
} }
if (err) { if (err) {
BT_ERR("Failed to %s virtual address %s", BT_ERR("Failed to %s virtual address %s",
@ -2144,8 +2144,8 @@ void bt_mesh_store_rpl(struct bt_mesh_rpl *entry)
schedule_store(BLE_MESH_RPL_PENDING); schedule_store(BLE_MESH_RPL_PENDING);
} }
static struct key_update *key_update_find(bool app_key, u16_t key_idx, static struct key_update *key_update_find(bool app_key, uint16_t key_idx,
struct key_update **free_slot) struct key_update **free_slot)
{ {
struct key_update *match = NULL; struct key_update *match = NULL;
int i; int i;
@ -2345,7 +2345,7 @@ void bt_mesh_store_label(void)
* key: "mesh/pn/xxxx/n" -> write/read to set/get the "xxxx" provisioned node name * key: "mesh/pn/xxxx/n" -> write/read to set/get the "xxxx" provisioned node name
* key: "mesh/pn/xxxx/c" -> write/read to set/get the "xxxx" provisioned node composition data * key: "mesh/pn/xxxx/c" -> write/read to set/get the "xxxx" provisioned node composition data
*/ */
void bt_mesh_store_prov_info(u16_t primary_addr, u16_t alloc_addr) void bt_mesh_store_prov_info(uint16_t primary_addr, uint16_t alloc_addr)
{ {
struct prov_info val = {0}; struct prov_info val = {0};
@ -2354,7 +2354,7 @@ void bt_mesh_store_prov_info(u16_t primary_addr, u16_t alloc_addr)
val.primary_addr = primary_addr; val.primary_addr = primary_addr;
val.alloc_addr = alloc_addr; val.alloc_addr = alloc_addr;
bt_mesh_save_core_settings("mesh/p_prov", (const u8_t *)&val, sizeof(val)); bt_mesh_save_core_settings("mesh/p_prov", (const uint8_t *)&val, sizeof(val));
} }
void bt_mesh_clear_prov_info(void) void bt_mesh_clear_prov_info(void)
@ -2375,7 +2375,7 @@ static void store_p_net_key(struct bt_mesh_subnet *sub)
key.kr_phase = sub->kr_phase; key.kr_phase = sub->kr_phase;
sprintf(name, "mesh/pnk/%04x", sub->net_idx); sprintf(name, "mesh/pnk/%04x", sub->net_idx);
err = bt_mesh_save_core_settings(name, (const u8_t *)&key, sizeof(key)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&key, sizeof(key));
if (err) { if (err) {
BT_ERR("Failed to store NetKey 0x%03x", sub->net_idx); BT_ERR("Failed to store NetKey 0x%03x", sub->net_idx);
return; return;
@ -2399,7 +2399,7 @@ static void store_p_app_key(struct bt_mesh_app_key *app)
memcpy(key.val[1], app->keys[1].val, 16); memcpy(key.val[1], app->keys[1].val, 16);
sprintf(name, "mesh/pak/%04x", app->app_idx); sprintf(name, "mesh/pak/%04x", app->app_idx);
err = bt_mesh_save_core_settings(name, (const u8_t *)&key, sizeof(key)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&key, sizeof(key));
if (err) { if (err) {
BT_ERR("Failed to store AppKey 0x%03x", app->app_idx); BT_ERR("Failed to store AppKey 0x%03x", app->app_idx);
return; return;
@ -2416,7 +2416,7 @@ void bt_mesh_store_p_net_idx(void)
BT_DBG("Store, p_net_idx_next 0x%03x", bt_mesh.p_net_idx_next); BT_DBG("Store, p_net_idx_next 0x%03x", bt_mesh.p_net_idx_next);
bt_mesh_save_core_settings("mesh/p_netidx", bt_mesh_save_core_settings("mesh/p_netidx",
(const u8_t *)&bt_mesh.p_net_idx_next, sizeof(bt_mesh.p_net_idx_next)); (const uint8_t *)&bt_mesh.p_net_idx_next, sizeof(bt_mesh.p_net_idx_next));
} }
void bt_mesh_clear_p_net_idx(void) void bt_mesh_clear_p_net_idx(void)
@ -2430,7 +2430,7 @@ void bt_mesh_store_p_app_idx(void)
BT_DBG("Store, p_app_idx_next 0x%03x", bt_mesh.p_app_idx_next); BT_DBG("Store, p_app_idx_next 0x%03x", bt_mesh.p_app_idx_next);
bt_mesh_save_core_settings("mesh/p_appidx", bt_mesh_save_core_settings("mesh/p_appidx",
(const u8_t *)&bt_mesh.p_app_idx_next, sizeof(bt_mesh.p_app_idx_next)); (const uint8_t *)&bt_mesh.p_app_idx_next, sizeof(bt_mesh.p_app_idx_next));
} }
void bt_mesh_clear_p_app_idx(void) void bt_mesh_clear_p_app_idx(void)
@ -2465,7 +2465,7 @@ void bt_mesh_store_p_app_key(struct bt_mesh_app_key *key)
store_p_app_key(key); store_p_app_key(key);
} }
void bt_mesh_clear_p_subnet(u16_t net_idx) void bt_mesh_clear_p_subnet(uint16_t net_idx)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -2481,7 +2481,7 @@ void bt_mesh_clear_p_subnet(u16_t net_idx)
} }
} }
void bt_mesh_clear_p_app_key(u16_t app_idx) void bt_mesh_clear_p_app_key(uint16_t app_idx)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -2497,7 +2497,7 @@ void bt_mesh_clear_p_app_key(u16_t app_idx)
} }
} }
void bt_mesh_clear_rpl_single(u16_t src) void bt_mesh_clear_rpl_single(uint16_t src)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -2539,7 +2539,7 @@ void bt_mesh_store_node_info(struct bt_mesh_node *node)
memcpy(val.dev_key, node->dev_key, 16); memcpy(val.dev_key, node->dev_key, 16);
sprintf(name, "mesh/pn/%04x/i", node->unicast_addr); sprintf(name, "mesh/pn/%04x/i", node->unicast_addr);
err = bt_mesh_save_core_settings(name, (const u8_t *)&val, sizeof(val)); err = bt_mesh_save_core_settings(name, (const uint8_t *)&val, sizeof(val));
if (err) { if (err) {
BT_ERR("Failed to store node 0x%04x info", node->unicast_addr); BT_ERR("Failed to store node 0x%04x info", node->unicast_addr);
return; return;
@ -2551,7 +2551,7 @@ void bt_mesh_store_node_info(struct bt_mesh_node *node)
} }
} }
static void clear_node(u16_t addr) static void clear_node(uint16_t addr)
{ {
char name[16] = {'\0'}; char name[16] = {'\0'};
int err = 0; int err = 0;
@ -2574,7 +2574,7 @@ static void clear_node(u16_t addr)
} }
} }
void bt_mesh_clear_node_info(u16_t unicast_addr) void bt_mesh_clear_node_info(uint16_t unicast_addr)
{ {
if (!BLE_MESH_ADDR_IS_UNICAST(unicast_addr)) { if (!BLE_MESH_ADDR_IS_UNICAST(unicast_addr)) {
BT_ERR("Invalid unicast address 0x%04x", unicast_addr); BT_ERR("Invalid unicast address 0x%04x", unicast_addr);
@ -2600,7 +2600,7 @@ void bt_mesh_store_node_name(struct bt_mesh_node *node)
strncpy(node_name, node->name, BLE_MESH_NODE_NAME_SIZE + 1); strncpy(node_name, node->name, BLE_MESH_NODE_NAME_SIZE + 1);
sprintf(name, "mesh/pn/%04x/n", node->unicast_addr); sprintf(name, "mesh/pn/%04x/n", node->unicast_addr);
err = bt_mesh_save_core_settings(name, (const u8_t *)node_name, BLE_MESH_NODE_NAME_SIZE); err = bt_mesh_save_core_settings(name, (const uint8_t *)node_name, BLE_MESH_NODE_NAME_SIZE);
if (err) { if (err) {
BT_ERR("Failed to store node 0x%04x name", node->unicast_addr); BT_ERR("Failed to store node 0x%04x name", node->unicast_addr);
} }
@ -2617,7 +2617,7 @@ void bt_mesh_store_node_comp_data(struct bt_mesh_node *node)
} }
sprintf(name, "mesh/pn/%04x/c", node->unicast_addr); sprintf(name, "mesh/pn/%04x/c", node->unicast_addr);
err = bt_mesh_save_core_settings(name, (const u8_t *)node->comp_data, node->comp_length); err = bt_mesh_save_core_settings(name, (const uint8_t *)node->comp_data, node->comp_length);
if (err) { if (err) {
BT_ERR("Failed to store node 0x%04x comp data", node->unicast_addr); BT_ERR("Failed to store node 0x%04x comp data", node->unicast_addr);
} }

View File

@ -42,7 +42,7 @@ void bt_mesh_clear_app_key(struct bt_mesh_app_key *key);
void bt_mesh_clear_rpl(void); void bt_mesh_clear_rpl(void);
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
void bt_mesh_store_prov_info(u16_t primary_addr, u16_t alloc_addr); void bt_mesh_store_prov_info(uint16_t primary_addr, uint16_t alloc_addr);
void bt_mesh_clear_prov_info(void); void bt_mesh_clear_prov_info(void);
void bt_mesh_store_p_net_idx(void); void bt_mesh_store_p_net_idx(void);
void bt_mesh_clear_p_net_idx(void); void bt_mesh_clear_p_net_idx(void);
@ -50,11 +50,11 @@ void bt_mesh_store_p_app_idx(void);
void bt_mesh_clear_p_app_idx(void); void bt_mesh_clear_p_app_idx(void);
void bt_mesh_store_p_subnet(struct bt_mesh_subnet *sub); void bt_mesh_store_p_subnet(struct bt_mesh_subnet *sub);
void bt_mesh_store_p_app_key(struct bt_mesh_app_key *key); void bt_mesh_store_p_app_key(struct bt_mesh_app_key *key);
void bt_mesh_clear_p_subnet(u16_t net_idx); void bt_mesh_clear_p_subnet(uint16_t net_idx);
void bt_mesh_clear_p_app_key(u16_t app_idx); void bt_mesh_clear_p_app_key(uint16_t app_idx);
void bt_mesh_clear_rpl_single(u16_t src); void bt_mesh_clear_rpl_single(uint16_t src);
void bt_mesh_store_node_info(struct bt_mesh_node *node); void bt_mesh_store_node_info(struct bt_mesh_node *node);
void bt_mesh_clear_node_info(u16_t unicast_addr); void bt_mesh_clear_node_info(uint16_t unicast_addr);
void bt_mesh_store_node_name(struct bt_mesh_node *node); void bt_mesh_store_node_name(struct bt_mesh_node *node);
void bt_mesh_store_node_comp_data(struct bt_mesh_node *node); void bt_mesh_store_node_comp_data(struct bt_mesh_node *node);
#endif #endif

View File

@ -41,7 +41,7 @@ static struct settings_uid {
bt_mesh_nvs_handle_t handle; /* Core Settings nvs handle */ bt_mesh_nvs_handle_t handle; /* Core Settings nvs handle */
} user_ids[CONFIG_BLE_MESH_MAX_NVS_NAMESPACE]; } user_ids[CONFIG_BLE_MESH_MAX_NVS_NAMESPACE];
static int settings_direct_erase(u8_t index); static int settings_direct_erase(uint8_t index);
static inline bool settings_uid_empty(struct settings_uid *uid) static inline bool settings_uid_empty(struct settings_uid *uid)
{ {
@ -95,11 +95,11 @@ int settings_uid_load(void)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t index = net_buf_simple_pull_le16(buf); uint16_t index = net_buf_simple_pull_le16(buf);
sprintf(name, "mesh/id/%04x", index); sprintf(name, "mesh/id/%04x", index);
err = bt_mesh_load_uid_settings(name, (u8_t *)user_ids[index].id, err = bt_mesh_load_uid_settings(name, (uint8_t *)user_ids[index].id,
SETTINGS_UID_SIZE, &exist); SETTINGS_UID_SIZE, &exist);
if (err) { if (err) {
continue; continue;
@ -159,7 +159,7 @@ int settings_uid_erase(void)
} }
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
static int settings_direct_erase(u8_t index) static int settings_direct_erase(uint8_t index)
{ {
bt_mesh_nvs_handle_t handle = 0; bt_mesh_nvs_handle_t handle = 0;
char name[16] = {'\0'}; char name[16] = {'\0'};
@ -193,9 +193,9 @@ static int settings_direct_erase(u8_t index)
return 0; return 0;
} }
static u8_t settings_index_get(const char *id, u8_t *index) static uint8_t settings_index_get(const char *id, uint8_t *index)
{ {
u8_t idx = 0; uint8_t idx = 0;
int i; int i;
for (i = 0; i < ARRAY_SIZE(user_ids); i++) { for (i = 0; i < ARRAY_SIZE(user_ids); i++) {
@ -219,7 +219,7 @@ static u8_t settings_index_get(const char *id, u8_t *index)
return idx; return idx;
} }
static int settings_open(u8_t index) static int settings_open(uint8_t index)
{ {
struct settings_uid *uid = &user_ids[index]; struct settings_uid *uid = &user_ids[index];
char name[16] = {'\0'}; char name[16] = {'\0'};
@ -261,7 +261,7 @@ static int settings_open(u8_t index)
BT_INFO("Open settings, index %d, uid %s", index, uid->id); BT_INFO("Open settings, index %d, uid %s", index, uid->id);
sprintf(name, "mesh/id/%04x", index); sprintf(name, "mesh/id/%04x", index);
err = bt_mesh_save_uid_settings(name, (const u8_t *)uid->id, SETTINGS_UID_SIZE); err = bt_mesh_save_uid_settings(name, (const uint8_t *)uid->id, SETTINGS_UID_SIZE);
if (err) { if (err) {
BT_ERR("Save uid failed, name %s", name); BT_ERR("Save uid failed, name %s", name);
return err; return err;
@ -293,7 +293,7 @@ static int settings_open(u8_t index)
return 0; return 0;
} }
int bt_mesh_provisioner_open_settings_with_index(u8_t index) int bt_mesh_provisioner_open_settings_with_index(uint8_t index)
{ {
if (index >= ARRAY_SIZE(user_ids)) { if (index >= ARRAY_SIZE(user_ids)) {
BT_ERR("Invalid settings index %d", index); BT_ERR("Invalid settings index %d", index);
@ -303,9 +303,9 @@ int bt_mesh_provisioner_open_settings_with_index(u8_t index)
return settings_open(index); return settings_open(index);
} }
int bt_mesh_provisioner_open_settings_with_uid(const char *id, u8_t *index) int bt_mesh_provisioner_open_settings_with_uid(const char *id, uint8_t *index)
{ {
u8_t idx = 0; uint8_t idx = 0;
int i; int i;
if (!id || strlen(id) > SETTINGS_UID_SIZE) { if (!id || strlen(id) > SETTINGS_UID_SIZE) {
@ -338,7 +338,7 @@ int bt_mesh_provisioner_open_settings_with_uid(const char *id, u8_t *index)
return settings_open(idx); return settings_open(idx);
} }
static int settings_close(u8_t index, bool erase) static int settings_close(uint8_t index, bool erase)
{ {
struct settings_uid *uid = &user_ids[index]; struct settings_uid *uid = &user_ids[index];
char name[16] = {'\0'}; char name[16] = {'\0'};
@ -382,7 +382,7 @@ static int settings_close(u8_t index, bool erase)
return 0; return 0;
} }
int bt_mesh_provisioner_close_settings_with_index(u8_t index, bool erase) int bt_mesh_provisioner_close_settings_with_index(uint8_t index, bool erase)
{ {
if (index >= ARRAY_SIZE(user_ids)) { if (index >= ARRAY_SIZE(user_ids)) {
BT_ERR("Invalid settings index %d", index); BT_ERR("Invalid settings index %d", index);
@ -392,9 +392,9 @@ int bt_mesh_provisioner_close_settings_with_index(u8_t index, bool erase)
return settings_close(index, erase); return settings_close(index, erase);
} }
int bt_mesh_provisioner_close_settings_with_uid(const char *id, bool erase, u8_t *index) int bt_mesh_provisioner_close_settings_with_uid(const char *id, bool erase, uint8_t *index)
{ {
u8_t idx = 0; uint8_t idx = 0;
if (!id || strlen(id) > SETTINGS_UID_SIZE) { if (!id || strlen(id) > SETTINGS_UID_SIZE) {
BT_ERR("Invalid settings uid"); BT_ERR("Invalid settings uid");
@ -410,7 +410,7 @@ int bt_mesh_provisioner_close_settings_with_uid(const char *id, bool erase, u8_t
return settings_close(idx, erase); return settings_close(idx, erase);
} }
static int settings_delete(u8_t index) static int settings_delete(uint8_t index)
{ {
/* The function is used to erase mesh information from /* The function is used to erase mesh information from
* the nvs namespace when it is not open and restored, * the nvs namespace when it is not open and restored,
@ -433,7 +433,7 @@ static int settings_delete(u8_t index)
return 0; return 0;
} }
int bt_mesh_provisioner_delete_settings_with_index(u8_t index) int bt_mesh_provisioner_delete_settings_with_index(uint8_t index)
{ {
if (index >= ARRAY_SIZE(user_ids)) { if (index >= ARRAY_SIZE(user_ids)) {
BT_ERR("Invalid settings index %d", index); BT_ERR("Invalid settings index %d", index);
@ -443,9 +443,9 @@ int bt_mesh_provisioner_delete_settings_with_index(u8_t index)
return settings_delete(index); return settings_delete(index);
} }
int bt_mesh_provisioner_delete_settings_with_uid(const char *id, u8_t *index) int bt_mesh_provisioner_delete_settings_with_uid(const char *id, uint8_t *index)
{ {
u8_t idx = 0; uint8_t idx = 0;
if (!id || strlen(id) > SETTINGS_UID_SIZE) { if (!id || strlen(id) > SETTINGS_UID_SIZE) {
BT_ERR("Invalid settings uid"); BT_ERR("Invalid settings uid");
@ -461,7 +461,7 @@ int bt_mesh_provisioner_delete_settings_with_uid(const char *id, u8_t *index)
return settings_delete(idx); return settings_delete(idx);
} }
const char *bt_mesh_provisioner_get_settings_uid(u8_t index) const char *bt_mesh_provisioner_get_settings_uid(uint8_t index)
{ {
if (index >= ARRAY_SIZE(user_ids)) { if (index >= ARRAY_SIZE(user_ids)) {
BT_ERR("Invalid settings index %d", index); BT_ERR("Invalid settings index %d", index);
@ -471,9 +471,9 @@ const char *bt_mesh_provisioner_get_settings_uid(u8_t index)
return user_ids[index].id; return user_ids[index].id;
} }
u8_t bt_mesh_provisioner_get_settings_index(const char *id) uint8_t bt_mesh_provisioner_get_settings_index(const char *id)
{ {
u8_t idx = 0; uint8_t idx = 0;
if (!id || strlen(id) > SETTINGS_UID_SIZE) { if (!id || strlen(id) > SETTINGS_UID_SIZE) {
BT_ERR("Invalid settings uid"); BT_ERR("Invalid settings uid");
@ -488,9 +488,9 @@ u8_t bt_mesh_provisioner_get_settings_index(const char *id)
return idx; return idx;
} }
u8_t bt_mesh_provisioner_get_free_settings_count(void) uint8_t bt_mesh_provisioner_get_free_settings_count(void)
{ {
u8_t count = 0; uint8_t count = 0;
int i; int i;
for (i = 0; i < ARRAY_SIZE(user_ids); i++) { for (i = 0; i < ARRAY_SIZE(user_ids); i++) {

View File

@ -27,16 +27,16 @@ int settings_uid_load(void);
int settings_uid_deinit(void); int settings_uid_deinit(void);
int settings_uid_erase(void); int settings_uid_erase(void);
int bt_mesh_provisioner_open_settings_with_index(u8_t index); int bt_mesh_provisioner_open_settings_with_index(uint8_t index);
int bt_mesh_provisioner_open_settings_with_uid(const char *id, u8_t *index); int bt_mesh_provisioner_open_settings_with_uid(const char *id, uint8_t *index);
int bt_mesh_provisioner_close_settings_with_index(u8_t index, bool erase); int bt_mesh_provisioner_close_settings_with_index(uint8_t index, bool erase);
int bt_mesh_provisioner_close_settings_with_uid(const char *id, bool erase, u8_t *index); int bt_mesh_provisioner_close_settings_with_uid(const char *id, bool erase, uint8_t *index);
int bt_mesh_provisioner_delete_settings_with_index(u8_t index); int bt_mesh_provisioner_delete_settings_with_index(uint8_t index);
int bt_mesh_provisioner_delete_settings_with_uid(const char *id, u8_t *index); int bt_mesh_provisioner_delete_settings_with_uid(const char *id, uint8_t *index);
const char *bt_mesh_provisioner_get_settings_uid(u8_t index); const char *bt_mesh_provisioner_get_settings_uid(uint8_t index);
u8_t bt_mesh_provisioner_get_settings_index(const char *id); uint8_t bt_mesh_provisioner_get_settings_index(const char *id);
u8_t bt_mesh_provisioner_get_free_settings_count(void); uint8_t bt_mesh_provisioner_get_free_settings_count(void);
int bt_mesh_provisioner_direct_erase_settings(void); int bt_mesh_provisioner_direct_erase_settings(void);

View File

@ -222,7 +222,7 @@ static inline bt_mesh_nvs_handle_t settings_get_nvs_handle(enum settings_type ty
/* API used to store/erase BLE Mesh related settings */ /* API used to store/erase BLE Mesh related settings */
static int settings_save(bt_mesh_nvs_handle_t handle, const char *key, const u8_t *val, size_t len) static int settings_save(bt_mesh_nvs_handle_t handle, const char *key, const uint8_t *val, size_t len)
{ {
int err = 0; int err = 0;
@ -258,7 +258,7 @@ static int settings_save(bt_mesh_nvs_handle_t handle, const char *key, const u8_
} }
int bt_mesh_save_settings(bt_mesh_nvs_handle_t handle, const char *key, int bt_mesh_save_settings(bt_mesh_nvs_handle_t handle, const char *key,
const u8_t *val, size_t len) const uint8_t *val, size_t len)
{ {
int err = 0; int err = 0;
bt_mesh_settings_lock(); bt_mesh_settings_lock();
@ -267,14 +267,14 @@ int bt_mesh_save_settings(bt_mesh_nvs_handle_t handle, const char *key,
return err; return err;
} }
int bt_mesh_save_core_settings(const char *key, const u8_t *val, size_t len) int bt_mesh_save_core_settings(const char *key, const uint8_t *val, size_t len)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE);
return bt_mesh_save_settings(handle, key, val, len); return bt_mesh_save_settings(handle, key, val, len);
} }
#if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE #if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE
int bt_mesh_save_uid_settings(const char *key, const u8_t *val, size_t len) int bt_mesh_save_uid_settings(const char *key, const uint8_t *val, size_t len)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID);
return bt_mesh_save_settings(handle, key, val, len); return bt_mesh_save_settings(handle, key, val, len);
@ -301,7 +301,7 @@ int bt_mesh_erase_uid_settings(const char *name)
/* API used to load BLE Mesh related settings */ /* API used to load BLE Mesh related settings */
static int settings_load(bt_mesh_nvs_handle_t handle, const char *key, static int settings_load(bt_mesh_nvs_handle_t handle, const char *key,
u8_t *buf, size_t buf_len, bool *exist) uint8_t *buf, size_t buf_len, bool *exist)
{ {
int err = 0; int err = 0;
@ -327,7 +327,7 @@ static int settings_load(bt_mesh_nvs_handle_t handle, const char *key,
} }
int bt_mesh_load_settings(bt_mesh_nvs_handle_t handle, const char *key, int bt_mesh_load_settings(bt_mesh_nvs_handle_t handle, const char *key,
u8_t *buf, size_t buf_len, bool *exist) uint8_t *buf, size_t buf_len, bool *exist)
{ {
int err = 0; int err = 0;
bt_mesh_settings_lock(); bt_mesh_settings_lock();
@ -336,14 +336,14 @@ int bt_mesh_load_settings(bt_mesh_nvs_handle_t handle, const char *key,
return err; return err;
} }
int bt_mesh_load_core_settings(const char *key, u8_t *buf, size_t buf_len, bool *exist) int bt_mesh_load_core_settings(const char *key, uint8_t *buf, size_t buf_len, bool *exist)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE);
return bt_mesh_load_settings(handle, key, buf, buf_len, exist); return bt_mesh_load_settings(handle, key, buf, buf_len, exist);
} }
#if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE #if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE
int bt_mesh_load_uid_settings(const char *key, u8_t *buf, size_t buf_len, bool *exist) int bt_mesh_load_uid_settings(const char *key, uint8_t *buf, size_t buf_len, bool *exist)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID);
return bt_mesh_load_settings(handle, key, buf, buf_len, exist); return bt_mesh_load_settings(handle, key, buf, buf_len, exist);
@ -440,7 +440,7 @@ struct net_buf_simple *bt_mesh_get_uid_settings_item(const char *key)
/* API used to check if the settings item exists */ /* API used to check if the settings item exists */
static bool is_settings_item_exist(struct net_buf_simple *buf, const u16_t val) static bool is_settings_item_exist(struct net_buf_simple *buf, const uint16_t val)
{ {
struct net_buf_simple_state state = {0}; struct net_buf_simple_state state = {0};
size_t length = 0U; size_t length = 0U;
@ -454,7 +454,7 @@ static bool is_settings_item_exist(struct net_buf_simple *buf, const u16_t val)
length = buf->len; length = buf->len;
for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < length / SETTINGS_ITEM_SIZE; i++) {
u16_t item = net_buf_simple_pull_le16(buf); uint16_t item = net_buf_simple_pull_le16(buf);
if (item == val) { if (item == val) {
net_buf_simple_restore(buf, &state); net_buf_simple_restore(buf, &state);
return true; return true;
@ -467,7 +467,7 @@ static bool is_settings_item_exist(struct net_buf_simple *buf, const u16_t val)
/* API used to add the settings item */ /* API used to add the settings item */
static int settings_add_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val) static int settings_add_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val)
{ {
struct net_buf_simple *store = NULL; struct net_buf_simple *store = NULL;
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
@ -504,7 +504,7 @@ static int settings_add_item(bt_mesh_nvs_handle_t handle, const char *key, const
return err; return err;
} }
int bt_mesh_add_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val) int bt_mesh_add_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val)
{ {
int err = 0; int err = 0;
bt_mesh_settings_lock(); bt_mesh_settings_lock();
@ -513,14 +513,14 @@ int bt_mesh_add_settings_item(bt_mesh_nvs_handle_t handle, const char *key, cons
return err; return err;
} }
int bt_mesh_add_core_settings_item(const char *key, const u16_t val) int bt_mesh_add_core_settings_item(const char *key, const uint16_t val)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE);
return bt_mesh_add_settings_item(handle, key, val); return bt_mesh_add_settings_item(handle, key, val);
} }
#if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE #if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE
int bt_mesh_add_uid_settings_item(const char *key, const u16_t val) int bt_mesh_add_uid_settings_item(const char *key, const uint16_t val)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID);
return bt_mesh_add_settings_item(handle, key, val); return bt_mesh_add_settings_item(handle, key, val);
@ -529,7 +529,7 @@ int bt_mesh_add_uid_settings_item(const char *key, const u16_t val)
/* API used to remove the settings item */ /* API used to remove the settings item */
static int settings_remove_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val) static int settings_remove_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val)
{ {
struct net_buf_simple *store = NULL; struct net_buf_simple *store = NULL;
struct net_buf_simple *buf = NULL; struct net_buf_simple *buf = NULL;
@ -563,7 +563,7 @@ static int settings_remove_item(bt_mesh_nvs_handle_t handle, const char *key, co
buf_len = buf->len; buf_len = buf->len;
for (i = 0; i < buf_len / SETTINGS_ITEM_SIZE; i++) { for (i = 0; i < buf_len / SETTINGS_ITEM_SIZE; i++) {
u16_t item = net_buf_simple_pull_le16(buf); uint16_t item = net_buf_simple_pull_le16(buf);
if (item != val) { if (item != val) {
net_buf_simple_add_le16(store, item); net_buf_simple_add_le16(store, item);
} }
@ -576,7 +576,7 @@ static int settings_remove_item(bt_mesh_nvs_handle_t handle, const char *key, co
return err; return err;
} }
int bt_mesh_remove_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val) int bt_mesh_remove_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val)
{ {
int err = 0; int err = 0;
bt_mesh_settings_lock(); bt_mesh_settings_lock();
@ -585,14 +585,14 @@ int bt_mesh_remove_settings_item(bt_mesh_nvs_handle_t handle, const char *key, c
return err; return err;
} }
int bt_mesh_remove_core_settings_item(const char *key, const u16_t val) int bt_mesh_remove_core_settings_item(const char *key, const uint16_t val)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_CORE);
return bt_mesh_remove_settings_item(handle, key, val); return bt_mesh_remove_settings_item(handle, key, val);
} }
#if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE #if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE
int bt_mesh_remove_uid_settings_item(const char *key, const u16_t val) int bt_mesh_remove_uid_settings_item(const char *key, const uint16_t val)
{ {
bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID); bt_mesh_nvs_handle_t handle = settings_get_nvs_handle(SETTINGS_UID);
return bt_mesh_remove_settings_item(handle, key, val); return bt_mesh_remove_settings_item(handle, key, val);

View File

@ -24,11 +24,11 @@ extern "C" {
typedef nvs_handle_t bt_mesh_nvs_handle_t; typedef nvs_handle_t bt_mesh_nvs_handle_t;
#define SETTINGS_ITEM_SIZE sizeof(u16_t) #define SETTINGS_ITEM_SIZE sizeof(uint16_t)
#define BLE_MESH_GET_ELEM_IDX(x) ((u8_t)((x) >> 8)) #define BLE_MESH_GET_ELEM_IDX(x) ((uint8_t)((x) >> 8))
#define BLE_MESH_GET_MODEL_IDX(x) ((u8_t)(x)) #define BLE_MESH_GET_MODEL_IDX(x) ((uint8_t)(x))
#define BLE_MESH_GET_MODEL_KEY(a, b) ((u16_t)(((u16_t)((a) << 8)) | (b))) #define BLE_MESH_GET_MODEL_KEY(a, b) ((uint16_t)(((uint16_t)((a) << 8)) | (b)))
int bt_mesh_settings_nvs_open(const char* name, bt_mesh_nvs_handle_t *handle); int bt_mesh_settings_nvs_open(const char* name, bt_mesh_nvs_handle_t *handle);
void bt_mesh_settings_nvs_close(bt_mesh_nvs_handle_t handle); void bt_mesh_settings_nvs_close(bt_mesh_nvs_handle_t handle);
@ -40,30 +40,30 @@ int bt_mesh_settings_direct_open(bt_mesh_nvs_handle_t *handle);
void bt_mesh_settings_direct_close(void); void bt_mesh_settings_direct_close(void);
int bt_mesh_save_settings(bt_mesh_nvs_handle_t handle, const char *key, int bt_mesh_save_settings(bt_mesh_nvs_handle_t handle, const char *key,
const u8_t *val, size_t len); const uint8_t *val, size_t len);
int bt_mesh_save_core_settings(const char *key, const u8_t *val, size_t len); int bt_mesh_save_core_settings(const char *key, const uint8_t *val, size_t len);
int bt_mesh_save_uid_settings(const char *key, const u8_t *val, size_t len); int bt_mesh_save_uid_settings(const char *key, const uint8_t *val, size_t len);
int bt_mesh_erase_settings(bt_mesh_nvs_handle_t handle, const char *key); int bt_mesh_erase_settings(bt_mesh_nvs_handle_t handle, const char *key);
int bt_mesh_erase_core_settings(const char *key); int bt_mesh_erase_core_settings(const char *key);
int bt_mesh_erase_uid_settings(const char *name); int bt_mesh_erase_uid_settings(const char *name);
int bt_mesh_load_settings(bt_mesh_nvs_handle_t handle, const char *key, int bt_mesh_load_settings(bt_mesh_nvs_handle_t handle, const char *key,
u8_t *buf, size_t buf_len, bool *exist); uint8_t *buf, size_t buf_len, bool *exist);
int bt_mesh_load_core_settings(const char *key, u8_t *buf, size_t buf_len, bool *exist); int bt_mesh_load_core_settings(const char *key, uint8_t *buf, size_t buf_len, bool *exist);
int bt_mesh_load_uid_settings(const char *key, u8_t *buf, size_t buf_len, bool *exist); int bt_mesh_load_uid_settings(const char *key, uint8_t *buf, size_t buf_len, bool *exist);
struct net_buf_simple *bt_mesh_get_settings_item(bt_mesh_nvs_handle_t handle, const char *key); struct net_buf_simple *bt_mesh_get_settings_item(bt_mesh_nvs_handle_t handle, const char *key);
struct net_buf_simple *bt_mesh_get_core_settings_item(const char *key); struct net_buf_simple *bt_mesh_get_core_settings_item(const char *key);
struct net_buf_simple *bt_mesh_get_uid_settings_item(const char *key); struct net_buf_simple *bt_mesh_get_uid_settings_item(const char *key);
int bt_mesh_add_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val); int bt_mesh_add_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val);
int bt_mesh_add_core_settings_item(const char *key, const u16_t val); int bt_mesh_add_core_settings_item(const char *key, const uint16_t val);
int bt_mesh_add_uid_settings_item(const char *key, const u16_t val); int bt_mesh_add_uid_settings_item(const char *key, const uint16_t val);
int bt_mesh_remove_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const u16_t val); int bt_mesh_remove_settings_item(bt_mesh_nvs_handle_t handle, const char *key, const uint16_t val);
int bt_mesh_remove_core_settings_item(const char *key, const u16_t val); int bt_mesh_remove_core_settings_item(const char *key, const uint16_t val);
int bt_mesh_remove_uid_settings_item(const char *key, const u16_t val); int bt_mesh_remove_uid_settings_item(const char *key, const uint16_t val);
int bt_mesh_settings_erase_key(bt_mesh_nvs_handle_t handle, const char *key); int bt_mesh_settings_erase_key(bt_mesh_nvs_handle_t handle, const char *key);
int bt_mesh_settings_erase_all(bt_mesh_nvs_handle_t handle); int bt_mesh_settings_erase_all(bt_mesh_nvs_handle_t handle);

View File

@ -19,15 +19,15 @@ extern "C" {
int bt_mesh_test(void); int bt_mesh_test(void);
struct bt_mesh_device_network_info { struct bt_mesh_device_network_info {
u8_t net_key[16]; uint8_t net_key[16];
u16_t net_idx; uint16_t net_idx;
u8_t flags; uint8_t flags;
u32_t iv_index; uint32_t iv_index;
u16_t unicast_addr; uint16_t unicast_addr;
u8_t dev_key[16]; uint8_t dev_key[16];
u8_t app_key[16]; uint8_t app_key[16];
u16_t app_idx; uint16_t app_idx;
u16_t group_addr; uint16_t group_addr;
}; };
int bt_mesh_device_auto_enter_network(struct bt_mesh_device_network_info *info); int bt_mesh_device_auto_enter_network(struct bt_mesh_device_network_info *info);

View File

@ -33,7 +33,7 @@
_Static_assert(CONFIG_BLE_MESH_ADV_BUF_COUNT >= (CONFIG_BLE_MESH_TX_SEG_MAX + 3), _Static_assert(CONFIG_BLE_MESH_ADV_BUF_COUNT >= (CONFIG_BLE_MESH_TX_SEG_MAX + 3),
"Too small BLE Mesh adv buffer count"); "Too small BLE Mesh adv buffer count");
#define AID_MASK ((u8_t)(BIT_MASK(6))) #define AID_MASK ((uint8_t)(BIT_MASK(6)))
#define SEG(data) ((data)[0] >> 7) #define SEG(data) ((data)[0] >> 7)
#define AKF(data) (((data)[0] >> 6) & 0x01) #define AKF(data) (((data)[0] >> 6) & 0x01)
@ -45,9 +45,9 @@ _Static_assert(CONFIG_BLE_MESH_ADV_BUF_COUNT >= (CONFIG_BLE_MESH_TX_SEG_MAX + 3)
#define UNSEG_HDR(akf, aid) ((akf << 6) | (aid & AID_MASK)) #define UNSEG_HDR(akf, aid) ((akf << 6) | (aid & AID_MASK))
#define SEG_HDR(akf, aid) (UNSEG_HDR(akf, aid) | 0x80) #define SEG_HDR(akf, aid) (UNSEG_HDR(akf, aid) | 0x80)
#define BLOCK_COMPLETE(seg_n) (u32_t)(((u64_t)1 << (seg_n + 1)) - 1) #define BLOCK_COMPLETE(seg_n) (uint32_t)(((uint64_t)1 << (seg_n + 1)) - 1)
#define SEQ_AUTH(iv_index, seq) (((u64_t)iv_index) << 24 | (u64_t)seq) #define SEQ_AUTH(iv_index, seq) (((uint64_t)iv_index) << 24 | (uint64_t)seq)
/* Number of retransmit attempts (after the initial transmit) per segment */ /* Number of retransmit attempts (after the initial transmit) per segment */
#define SEG_RETRANSMIT_ATTEMPTS 4 #define SEG_RETRANSMIT_ATTEMPTS 4
@ -72,46 +72,46 @@ _Static_assert(CONFIG_BLE_MESH_ADV_BUF_COUNT >= (CONFIG_BLE_MESH_TX_SEG_MAX + 3)
#define BUF_TIMEOUT K_NO_WAIT #define BUF_TIMEOUT K_NO_WAIT
static struct seg_tx { static struct seg_tx {
struct bt_mesh_subnet *sub; struct bt_mesh_subnet *sub;
struct net_buf *seg[CONFIG_BLE_MESH_TX_SEG_MAX]; struct net_buf *seg[CONFIG_BLE_MESH_TX_SEG_MAX];
u64_t seq_auth; uint64_t seq_auth;
u16_t dst; uint16_t dst;
u8_t seg_n:5, /* Last segment index */ uint8_t seg_n:5, /* Last segment index */
new_key:1; /* New/old key */ new_key:1; /* New/old key */
u8_t nack_count; /* Number of unacked segs */ uint8_t nack_count; /* Number of unacked segs */
u8_t ttl; uint8_t ttl;
u8_t seg_pending; /* Number of segments pending */ uint8_t seg_pending; /* Number of segments pending */
u8_t attempts; /* Transmit attempts */ uint8_t attempts; /* Transmit attempts */
const struct bt_mesh_send_cb *cb; const struct bt_mesh_send_cb *cb;
void *cb_data; void *cb_data;
struct k_delayed_work retransmit; /* Retransmit timer */ struct k_delayed_work retransmit; /* Retransmit timer */
} seg_tx[CONFIG_BLE_MESH_TX_SEG_MSG_COUNT]; } seg_tx[CONFIG_BLE_MESH_TX_SEG_MSG_COUNT];
static struct seg_rx { static struct seg_rx {
struct bt_mesh_subnet *sub; struct bt_mesh_subnet *sub;
u64_t seq_auth; uint64_t seq_auth;
u8_t seg_n: 5, uint8_t seg_n:5,
ctl: 1, ctl:1,
in_use: 1, in_use:1,
obo: 1; obo:1;
u8_t hdr; uint8_t hdr;
u8_t ttl; uint8_t ttl;
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
u32_t block; uint32_t block;
u32_t last; uint32_t last;
struct k_delayed_work ack; struct k_delayed_work ack;
struct net_buf_simple buf; struct net_buf_simple buf;
} seg_rx[CONFIG_BLE_MESH_RX_SEG_MSG_COUNT] = { } seg_rx[CONFIG_BLE_MESH_RX_SEG_MSG_COUNT] = {
[0 ... (CONFIG_BLE_MESH_RX_SEG_MSG_COUNT - 1)] = { [0 ... (CONFIG_BLE_MESH_RX_SEG_MSG_COUNT - 1)] = {
.buf.size = CONFIG_BLE_MESH_RX_SDU_MAX, .buf.size = CONFIG_BLE_MESH_RX_SDU_MAX,
}, },
}; };
static u8_t seg_rx_buf_data[(CONFIG_BLE_MESH_RX_SEG_MSG_COUNT * static uint8_t seg_rx_buf_data[(CONFIG_BLE_MESH_RX_SEG_MSG_COUNT *
CONFIG_BLE_MESH_RX_SDU_MAX)]; CONFIG_BLE_MESH_RX_SDU_MAX)];
static u16_t hb_sub_dst = BLE_MESH_ADDR_UNASSIGNED; static uint16_t hb_sub_dst = BLE_MESH_ADDR_UNASSIGNED;
static bt_mesh_mutex_t tx_seg_lock; static bt_mesh_mutex_t tx_seg_lock;
static bt_mesh_mutex_t rx_seg_lock; static bt_mesh_mutex_t rx_seg_lock;
@ -164,12 +164,12 @@ static inline void bt_mesh_rx_seg_unlock(void)
bt_mesh_mutex_unlock(&rx_seg_lock); bt_mesh_mutex_unlock(&rx_seg_lock);
} }
u8_t bt_mesh_get_seg_retrans_num(void) uint8_t bt_mesh_get_seg_retrans_num(void)
{ {
return SEG_RETRANSMIT_ATTEMPTS; return SEG_RETRANSMIT_ATTEMPTS;
} }
s32_t bt_mesh_get_seg_retrans_timeout(u8_t ttl) int32_t bt_mesh_get_seg_retrans_timeout(uint8_t ttl)
{ {
/* This function will be used when a client model sending an /* This function will be used when a client model sending an
* acknowledged message. And if the dst of a message is not * acknowledged message. And if the dst of a message is not
@ -183,7 +183,7 @@ s32_t bt_mesh_get_seg_retrans_timeout(u8_t ttl)
return SEG_RETRANSMIT_TIMEOUT_UNICAST(&tx); return SEG_RETRANSMIT_TIMEOUT_UNICAST(&tx);
} }
void bt_mesh_set_hb_sub_dst(u16_t addr) void bt_mesh_set_hb_sub_dst(uint16_t addr)
{ {
hb_sub_dst = addr; hb_sub_dst = addr;
} }
@ -255,7 +255,7 @@ bool bt_mesh_tx_in_progress(void)
return false; return false;
} }
static void seg_tx_done(struct seg_tx *tx, u8_t seg_idx) static void seg_tx_done(struct seg_tx *tx, uint8_t seg_idx)
{ {
bt_mesh_adv_buf_ref_debug(__func__, tx->seg[seg_idx], 3U, BLE_MESH_BUF_REF_SMALL); bt_mesh_adv_buf_ref_debug(__func__, tx->seg[seg_idx], 3U, BLE_MESH_BUF_REF_SMALL);
@ -329,7 +329,7 @@ static void schedule_retransmit(struct seg_tx *tx)
k_delayed_work_submit(&tx->retransmit, SEG_RETRANSMIT_TIMEOUT(tx)); k_delayed_work_submit(&tx->retransmit, SEG_RETRANSMIT_TIMEOUT(tx));
} }
static void seg_first_send_start(u16_t duration, int err, void *user_data) static void seg_first_send_start(uint16_t duration, int err, void *user_data)
{ {
struct seg_tx *tx = user_data; struct seg_tx *tx = user_data;
@ -338,7 +338,7 @@ static void seg_first_send_start(u16_t duration, int err, void *user_data)
} }
} }
static void seg_send_start(u16_t duration, int err, void *user_data) static void seg_send_start(uint16_t duration, int err, void *user_data)
{ {
struct seg_tx *tx = user_data; struct seg_tx *tx = user_data;
@ -422,8 +422,8 @@ static void seg_retransmit(struct k_work *work)
static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu, static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
const struct bt_mesh_send_cb *cb, void *cb_data) const struct bt_mesh_send_cb *cb, void *cb_data)
{ {
u8_t seg_hdr = 0U, seg_o = 0U; uint8_t seg_hdr = 0U, seg_o = 0U;
u16_t seq_zero = 0U; uint16_t seq_zero = 0U;
struct seg_tx *tx = NULL; struct seg_tx *tx = NULL;
int i; int i;
@ -494,7 +494,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
for (seg_o = 0U; sdu->len; seg_o++) { for (seg_o = 0U; sdu->len; seg_o++) {
struct net_buf *seg = NULL; struct net_buf *seg = NULL;
u16_t len = 0U; uint16_t len = 0U;
int err = 0; int err = 0;
seg = bt_mesh_adv_create(BLE_MESH_ADV_DATA, net_tx->xmit, seg = bt_mesh_adv_create(BLE_MESH_ADV_DATA, net_tx->xmit,
@ -572,7 +572,7 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
return 0; return 0;
} }
struct bt_mesh_app_key *bt_mesh_app_key_find(u16_t app_idx) struct bt_mesh_app_key *bt_mesh_app_key_find(uint16_t app_idx)
{ {
int i; int i;
@ -591,9 +591,9 @@ struct bt_mesh_app_key *bt_mesh_app_key_find(u16_t app_idx)
int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg, int bt_mesh_trans_send(struct bt_mesh_net_tx *tx, struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data) const struct bt_mesh_send_cb *cb, void *cb_data)
{ {
const u8_t *key = NULL; const uint8_t *key = NULL;
u8_t *ad = NULL, role = 0U; uint8_t *ad = NULL, role = 0U;
u8_t aid = 0U; uint8_t aid = 0U;
int err = 0; int err = 0;
if (net_buf_simple_tailroom(msg) < BLE_MESH_MIC_SHORT) { if (net_buf_simple_tailroom(msg) < BLE_MESH_MIC_SHORT) {
@ -722,13 +722,13 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match)
return true; return true;
} }
static int sdu_recv(struct bt_mesh_net_rx *rx, u32_t seq, u8_t hdr, static int sdu_recv(struct bt_mesh_net_rx *rx, uint32_t seq, uint8_t hdr,
u8_t aszmic, struct net_buf_simple *buf) uint8_t aszmic, struct net_buf_simple *buf)
{ {
struct net_buf_simple *sdu = NULL; struct net_buf_simple *sdu = NULL;
size_t array_size = 0U; size_t array_size = 0U;
uint8_t *ad = NULL;
size_t i = 0U; size_t i = 0U;
u8_t *ad = NULL;
int err = 0; int err = 0;
BT_DBG("ASZMIC %u AKF %u AID 0x%02x", aszmic, AKF(&hdr), AID(&hdr)); BT_DBG("ASZMIC %u AKF %u AID 0x%02x", aszmic, AKF(&hdr), AID(&hdr));
@ -767,7 +767,7 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, u32_t seq, u8_t hdr,
array_size = bt_mesh_rx_devkey_size(); array_size = bt_mesh_rx_devkey_size();
for (i = 0U; i < array_size; i++) { for (i = 0U; i < array_size; i++) {
const u8_t *dev_key = NULL; const uint8_t *dev_key = NULL;
dev_key = bt_mesh_rx_devkey_get(i, rx->ctx.addr); dev_key = bt_mesh_rx_devkey_get(i, rx->ctx.addr);
if (!dev_key) { if (!dev_key) {
@ -849,7 +849,7 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, u32_t seq, u8_t hdr,
return 0; return 0;
} }
static struct seg_tx *seg_tx_lookup(u16_t seq_zero, u8_t obo, u16_t addr) static struct seg_tx *seg_tx_lookup(uint16_t seq_zero, uint8_t obo, uint16_t addr)
{ {
struct seg_tx *tx = NULL; struct seg_tx *tx = NULL;
int i; int i;
@ -879,14 +879,14 @@ static struct seg_tx *seg_tx_lookup(u16_t seq_zero, u8_t obo, u16_t addr)
return NULL; return NULL;
} }
static int trans_ack(struct bt_mesh_net_rx *rx, u8_t hdr, static int trans_ack(struct bt_mesh_net_rx *rx, uint8_t hdr,
struct net_buf_simple *buf, u64_t *seq_auth) struct net_buf_simple *buf, uint64_t *seq_auth)
{ {
struct seg_tx *tx = NULL; struct seg_tx *tx = NULL;
unsigned int bit = 0; unsigned int bit = 0;
u32_t ack = 0U; uint32_t ack = 0U;
u16_t seq_zero = 0U; uint16_t seq_zero = 0U;
u8_t obo = 0U; uint8_t obo = 0U;
if (buf->len < 6) { if (buf->len < 6) {
BT_ERR("Too short ack message (len %u)", buf->len); BT_ERR("Too short ack message (len %u)", buf->len);
@ -958,8 +958,8 @@ static int trans_ack(struct bt_mesh_net_rx *rx, u8_t hdr,
static int trans_heartbeat(struct bt_mesh_net_rx *rx, static int trans_heartbeat(struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
u8_t init_ttl = 0U, hops = 0U; uint8_t init_ttl = 0U, hops = 0U;
u16_t feat = 0U; uint16_t feat = 0U;
if (buf->len < 3) { if (buf->len < 3) {
BT_ERR("Too short heartbeat message (len %u)", buf->len); BT_ERR("Too short heartbeat message (len %u)", buf->len);
@ -992,10 +992,10 @@ static int trans_heartbeat(struct bt_mesh_net_rx *rx,
return 0; return 0;
} }
static int ctl_recv(struct bt_mesh_net_rx *rx, u8_t hdr, static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr,
struct net_buf_simple *buf, u64_t *seq_auth) struct net_buf_simple *buf, uint64_t *seq_auth)
{ {
u8_t ctl_op = TRANS_CTL_OP(&hdr); uint8_t ctl_op = TRANS_CTL_OP(&hdr);
BT_DBG("OpCode 0x%02x len %u", ctl_op, buf->len); BT_DBG("OpCode 0x%02x len %u", ctl_op, buf->len);
@ -1058,9 +1058,9 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, u8_t hdr,
} }
static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx, static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx,
u64_t *seq_auth) uint64_t *seq_auth)
{ {
u8_t hdr = 0U; uint8_t hdr = 0U;
BT_DBG("AFK %u AID 0x%02x", AKF(buf->data), AID(buf->data)); BT_DBG("AFK %u AID 0x%02x", AKF(buf->data), AID(buf->data));
@ -1089,10 +1089,10 @@ static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx,
} }
} }
static inline s32_t ack_timeout(struct seg_rx *rx) static inline int32_t ack_timeout(struct seg_rx *rx)
{ {
s32_t to = 0; int32_t to = 0;
u8_t ttl = 0U; uint8_t ttl = 0U;
if (rx->ttl == BLE_MESH_TTL_DEFAULT) { if (rx->ttl == BLE_MESH_TTL_DEFAULT) {
ttl = bt_mesh_default_ttl_get(); ttl = bt_mesh_default_ttl_get();
@ -1114,7 +1114,7 @@ static inline s32_t ack_timeout(struct seg_rx *rx)
return MAX(to, K_MSEC(400)); return MAX(to, K_MSEC(400));
} }
static int ctl_send_unseg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data, static int ctl_send_unseg(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
size_t data_len, const struct bt_mesh_send_cb *cb, size_t data_len, const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)
{ {
@ -1147,14 +1147,14 @@ static int ctl_send_unseg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data,
return bt_mesh_net_send(tx, buf, cb, cb_data); return bt_mesh_net_send(tx, buf, cb, cb_data);
} }
static int ctl_send_seg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data, static int ctl_send_seg(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
size_t data_len, const struct bt_mesh_send_cb *cb, size_t data_len, const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)
{ {
struct seg_tx *tx_seg = NULL; struct seg_tx *tx_seg = NULL;
u16_t unsent = data_len; uint16_t unsent = data_len;
u16_t seq_zero = 0; uint16_t seq_zero = 0;
u8_t seg_o = 0; uint8_t seg_o = 0;
int i; int i;
for (tx_seg = NULL, i = 0; i < ARRAY_SIZE(seg_tx); i++) { for (tx_seg = NULL, i = 0; i < ARRAY_SIZE(seg_tx); i++) {
@ -1192,7 +1192,7 @@ static int ctl_send_seg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data,
for (seg_o = 0; seg_o <= tx_seg->seg_n; seg_o++) { for (seg_o = 0; seg_o <= tx_seg->seg_n; seg_o++) {
struct net_buf *seg = NULL; struct net_buf *seg = NULL;
u16_t len = 0; uint16_t len = 0;
int err = 0; int err = 0;
seg = bt_mesh_adv_create(BLE_MESH_ADV_DATA, tx->xmit, seg = bt_mesh_adv_create(BLE_MESH_ADV_DATA, tx->xmit,
@ -1211,7 +1211,7 @@ static int ctl_send_seg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data,
net_buf_add_u8(seg, ((seg_o & 0x07) << 5) | tx_seg->seg_n); net_buf_add_u8(seg, ((seg_o & 0x07) << 5) | tx_seg->seg_n);
len = MIN(unsent, BLE_MESH_CTL_SEG_SDU_MAX); len = MIN(unsent, BLE_MESH_CTL_SEG_SDU_MAX);
net_buf_add_mem(seg, (u8_t *)data + (data_len - unsent), len); net_buf_add_mem(seg, (uint8_t *)data + (data_len - unsent), len);
unsent -= len; unsent -= len;
tx_seg->seg[seg_o] = net_buf_ref(seg); tx_seg->seg[seg_o] = net_buf_ref(seg);
@ -1232,7 +1232,7 @@ static int ctl_send_seg(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data,
return 0; return 0;
} }
int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data, int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
size_t data_len, const struct bt_mesh_send_cb *cb, size_t data_len, const struct bt_mesh_send_cb *cb,
void *cb_data) void *cb_data)
{ {
@ -1249,8 +1249,8 @@ int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data,
} }
} }
static int send_ack(struct bt_mesh_subnet *sub, u16_t src, u16_t dst, static int send_ack(struct bt_mesh_subnet *sub, uint16_t src, uint16_t dst,
u8_t ttl, u64_t *seq_auth, u32_t block, u8_t obo) uint8_t ttl, uint64_t *seq_auth, uint32_t block, uint8_t obo)
{ {
struct bt_mesh_msg_ctx ctx = { struct bt_mesh_msg_ctx ctx = {
.net_idx = sub->net_idx, .net_idx = sub->net_idx,
@ -1264,8 +1264,8 @@ static int send_ack(struct bt_mesh_subnet *sub, u16_t src, u16_t dst,
.src = obo ? bt_mesh_primary_addr() : src, .src = obo ? bt_mesh_primary_addr() : src,
.xmit = bt_mesh_net_transmit_get(), .xmit = bt_mesh_net_transmit_get(),
}; };
u16_t seq_zero = *seq_auth & TRANS_SEQ_ZERO_MASK; uint16_t seq_zero = *seq_auth & TRANS_SEQ_ZERO_MASK;
u8_t buf[6] = {0}; uint8_t buf[6] = {0};
BT_DBG("SeqZero 0x%04x Block 0x%08x OBO %u", seq_zero, block, obo); BT_DBG("SeqZero 0x%04x Block 0x%08x OBO %u", seq_zero, block, obo);
@ -1320,10 +1320,10 @@ static void seg_rx_reset(struct seg_rx *rx, bool full_reset)
bt_mesh_rx_seg_unlock(); bt_mesh_rx_seg_unlock();
} }
static u32_t incomplete_timeout(struct seg_rx *rx) static uint32_t incomplete_timeout(struct seg_rx *rx)
{ {
u32_t timeout = 0U; uint32_t timeout = 0U;
u8_t ttl = 0U; uint8_t ttl = 0U;
if (rx->ttl == BLE_MESH_TTL_DEFAULT) { if (rx->ttl == BLE_MESH_TTL_DEFAULT) {
ttl = bt_mesh_default_ttl_get(); ttl = bt_mesh_default_ttl_get();
@ -1371,7 +1371,7 @@ static void seg_ack(struct k_work *work)
bt_mesh_rx_seg_unlock(); bt_mesh_rx_seg_unlock();
} }
static inline u8_t seg_len(bool ctl) static inline uint8_t seg_len(bool ctl)
{ {
if (ctl) { if (ctl) {
return BLE_MESH_CTL_SEG_SDU_MAX; return BLE_MESH_CTL_SEG_SDU_MAX;
@ -1380,13 +1380,13 @@ static inline u8_t seg_len(bool ctl)
} }
} }
static inline bool sdu_len_is_ok(bool ctl, u8_t seg_n) static inline bool sdu_len_is_ok(bool ctl, uint8_t seg_n)
{ {
return ((seg_n * seg_len(ctl) + 1) <= CONFIG_BLE_MESH_RX_SDU_MAX); return ((seg_n * seg_len(ctl) + 1) <= CONFIG_BLE_MESH_RX_SDU_MAX);
} }
static struct seg_rx *seg_rx_find(struct bt_mesh_net_rx *net_rx, static struct seg_rx *seg_rx_find(struct bt_mesh_net_rx *net_rx,
const u64_t *seq_auth) const uint64_t *seq_auth)
{ {
int i; int i;
@ -1426,7 +1426,7 @@ static struct seg_rx *seg_rx_find(struct bt_mesh_net_rx *net_rx,
} }
static bool seg_rx_is_valid(struct seg_rx *rx, struct bt_mesh_net_rx *net_rx, static bool seg_rx_is_valid(struct seg_rx *rx, struct bt_mesh_net_rx *net_rx,
const u8_t *hdr, u8_t seg_n) const uint8_t *hdr, uint8_t seg_n)
{ {
if (rx->hdr != *hdr || rx->seg_n != seg_n) { if (rx->hdr != *hdr || rx->seg_n != seg_n) {
BT_ERR("Invalid segment for ongoing session"); BT_ERR("Invalid segment for ongoing session");
@ -1447,8 +1447,8 @@ static bool seg_rx_is_valid(struct seg_rx *rx, struct bt_mesh_net_rx *net_rx,
} }
static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx, static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
const u8_t *hdr, const u64_t *seq_auth, const uint8_t *hdr, const uint64_t *seq_auth,
u8_t seg_n) uint8_t seg_n)
{ {
int i; int i;
@ -1481,15 +1481,15 @@ static struct seg_rx *seg_rx_alloc(struct bt_mesh_net_rx *net_rx,
} }
static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx, static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
enum bt_mesh_friend_pdu_type *pdu_type, u64_t *seq_auth, enum bt_mesh_friend_pdu_type *pdu_type, uint64_t *seq_auth,
u8_t *seg_count) uint8_t *seg_count)
{ {
struct bt_mesh_rpl *rpl = NULL; struct bt_mesh_rpl *rpl = NULL;
struct seg_rx *rx = NULL; struct seg_rx *rx = NULL;
u8_t *hdr = buf->data; uint8_t *hdr = buf->data;
u16_t seq_zero = 0U; uint16_t seq_zero = 0U;
u8_t seg_n = 0U; uint8_t seg_n = 0U;
u8_t seg_o = 0U; uint8_t seg_o = 0U;
int err = 0; int err = 0;
if (buf->len < 5) { if (buf->len < 5) {
@ -1696,10 +1696,10 @@ found_rx:
int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx) int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx)
{ {
u64_t seq_auth = TRANS_SEQ_AUTH_NVAL; uint64_t seq_auth = TRANS_SEQ_AUTH_NVAL;
enum bt_mesh_friend_pdu_type pdu_type = BLE_MESH_FRIEND_PDU_SINGLE; enum bt_mesh_friend_pdu_type pdu_type = BLE_MESH_FRIEND_PDU_SINGLE;
struct net_buf_simple_state state = {0}; struct net_buf_simple_state state = {0};
u8_t seg_count = 0U; uint8_t seg_count = 0U;
int err = 0; int err = 0;
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) { if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) {
@ -1808,7 +1808,7 @@ void bt_mesh_tx_reset(void)
} }
#if CONFIG_BLE_MESH_PROVISIONER #if CONFIG_BLE_MESH_PROVISIONER
void bt_mesh_rx_reset_single(u16_t src) void bt_mesh_rx_reset_single(uint16_t src)
{ {
int i; int i;
@ -1834,7 +1834,7 @@ void bt_mesh_rx_reset_single(u16_t src)
} }
} }
void bt_mesh_tx_reset_single(u16_t dst) void bt_mesh_tx_reset_single(uint16_t dst)
{ {
int i; int i;
@ -1894,10 +1894,10 @@ void bt_mesh_trans_deinit(bool erase)
void bt_mesh_heartbeat_send(void) void bt_mesh_heartbeat_send(void)
{ {
struct bt_mesh_cfg_srv *cfg = bt_mesh_cfg_get(); struct bt_mesh_cfg_srv *cfg = bt_mesh_cfg_get();
u16_t feat = 0U; uint16_t feat = 0U;
struct __packed { struct __packed {
u8_t init_ttl; uint8_t init_ttl;
u16_t feat; uint16_t feat;
} hb; } hb;
struct bt_mesh_msg_ctx ctx = { struct bt_mesh_msg_ctx ctx = {
.net_idx = cfg->hb_pub.net_idx, .net_idx = cfg->hb_pub.net_idx,
@ -1943,8 +1943,8 @@ void bt_mesh_heartbeat_send(void)
NULL, NULL); NULL, NULL);
} }
int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx, int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, uint16_t app_idx,
const u8_t **key, u8_t *aid, u8_t role, u16_t dst) const uint8_t **key, uint8_t *aid, uint8_t role, uint16_t dst)
{ {
struct bt_mesh_app_key *app_key = NULL; struct bt_mesh_app_key *app_key = NULL;

View File

@ -23,8 +23,8 @@ extern "C" {
#define BLE_MESH_APP_SEG_SDU_MAX 12 #define BLE_MESH_APP_SEG_SDU_MAX 12
#define BLE_MESH_TX_SDU_MAX (CONFIG_BLE_MESH_TX_SEG_MAX * 12) #define BLE_MESH_TX_SDU_MAX (CONFIG_BLE_MESH_TX_SEG_MAX * 12)
#define TRANS_SEQ_ZERO_MASK ((u16_t)BIT_MASK(13)) #define TRANS_SEQ_ZERO_MASK ((uint16_t)BIT_MASK(13))
#define TRANS_CTL_OP_MASK ((u8_t)BIT_MASK(7)) #define TRANS_CTL_OP_MASK ((uint8_t)BIT_MASK(7))
#define TRANS_CTL_OP(data) ((data)[0] & TRANS_CTL_OP_MASK) #define TRANS_CTL_OP(data) ((data)[0] & TRANS_CTL_OP_MASK)
#define TRANS_CTL_HDR(op, seg) ((op & TRANS_CTL_OP_MASK) | (seg << 7)) #define TRANS_CTL_HDR(op, seg) ((op & TRANS_CTL_OP_MASK) | (seg << 7))
@ -41,68 +41,68 @@ extern "C" {
#define TRANS_CTL_OP_HEARTBEAT 0x0a #define TRANS_CTL_OP_HEARTBEAT 0x0a
struct bt_mesh_ctl_friend_poll { struct bt_mesh_ctl_friend_poll {
u8_t fsn; uint8_t fsn;
} __packed; } __packed;
struct bt_mesh_ctl_friend_update { struct bt_mesh_ctl_friend_update {
u8_t flags; uint8_t flags;
u32_t iv_index; uint32_t iv_index;
u8_t md; uint8_t md;
} __packed; } __packed;
struct bt_mesh_ctl_friend_req { struct bt_mesh_ctl_friend_req {
u8_t criteria; uint8_t criteria;
u8_t recv_delay; uint8_t recv_delay;
u8_t poll_to[3]; uint8_t poll_to[3];
u16_t prev_addr; uint16_t prev_addr;
u8_t num_elem; uint8_t num_elem;
u16_t lpn_counter; uint16_t lpn_counter;
} __packed; } __packed;
struct bt_mesh_ctl_friend_offer { struct bt_mesh_ctl_friend_offer {
u8_t recv_win; uint8_t recv_win;
u8_t queue_size; uint8_t queue_size;
u8_t sub_list_size; uint8_t sub_list_size;
s8_t rssi; int8_t rssi;
u16_t frnd_counter; uint16_t frnd_counter;
} __packed; } __packed;
struct bt_mesh_ctl_friend_clear { struct bt_mesh_ctl_friend_clear {
u16_t lpn_addr; uint16_t lpn_addr;
u16_t lpn_counter; uint16_t lpn_counter;
} __packed; } __packed;
struct bt_mesh_ctl_friend_clear_confirm { struct bt_mesh_ctl_friend_clear_confirm {
u16_t lpn_addr; uint16_t lpn_addr;
u16_t lpn_counter; uint16_t lpn_counter;
} __packed; } __packed;
#define BLE_MESH_FRIEND_SUB_MIN_LEN (1 + 2) #define BLE_MESH_FRIEND_SUB_MIN_LEN (1 + 2)
struct bt_mesh_ctl_friend_sub { struct bt_mesh_ctl_friend_sub {
u8_t xact; uint8_t xact;
u16_t addr_list[5]; uint16_t addr_list[5];
} __packed; } __packed;
struct bt_mesh_ctl_friend_sub_confirm { struct bt_mesh_ctl_friend_sub_confirm {
u8_t xact; uint8_t xact;
} __packed; } __packed;
u8_t bt_mesh_get_seg_retrans_num(void); uint8_t bt_mesh_get_seg_retrans_num(void);
s32_t bt_mesh_get_seg_retrans_timeout(u8_t ttl); int32_t bt_mesh_get_seg_retrans_timeout(uint8_t ttl);
void bt_mesh_set_hb_sub_dst(u16_t addr); void bt_mesh_set_hb_sub_dst(uint16_t addr);
struct bt_mesh_app_key *bt_mesh_app_key_find(u16_t app_idx); struct bt_mesh_app_key *bt_mesh_app_key_find(uint16_t app_idx);
bool bt_mesh_tx_in_progress(void); bool bt_mesh_tx_in_progress(void);
void bt_mesh_rx_reset(bool erase); void bt_mesh_rx_reset(bool erase);
void bt_mesh_tx_reset(void); void bt_mesh_tx_reset(void);
void bt_mesh_rx_reset_single(u16_t src); void bt_mesh_rx_reset_single(uint16_t src);
void bt_mesh_tx_reset_single(u16_t dst); void bt_mesh_tx_reset_single(uint16_t dst);
int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, u8_t ctl_op, void *data, int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
size_t data_len, const struct bt_mesh_send_cb *cb, size_t data_len, const struct bt_mesh_send_cb *cb,
void *cb_data); void *cb_data);
@ -118,8 +118,8 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match);
void bt_mesh_heartbeat_send(void); void bt_mesh_heartbeat_send(void);
int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx, int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, uint16_t app_idx,
const u8_t **key, u8_t *aid, u8_t role, u16_t dst); const uint8_t **key, uint8_t *aid, uint8_t role, uint16_t dst);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -24,7 +24,7 @@
#define HCI_TIME_FOR_START_ADV K_MSEC(5) /* Three adv related hci commands may take 4 ~ 5ms */ #define HCI_TIME_FOR_START_ADV K_MSEC(5) /* Three adv related hci commands may take 4 ~ 5ms */
static bt_mesh_client_node_t *bt_mesh_client_pick_node(sys_slist_t *list, u16_t tx_dst) static bt_mesh_client_node_t *bt_mesh_client_pick_node(sys_slist_t *list, uint16_t tx_dst)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
sys_snode_t *cur = NULL; sys_snode_t *cur = NULL;
@ -117,7 +117,7 @@ bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(struct bt_mesh_model *
return node; return node;
} }
static bool bt_mesh_client_check_node_in_list(sys_slist_t *list, u16_t tx_dst) static bool bt_mesh_client_check_node_in_list(sys_slist_t *list, uint16_t tx_dst)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
sys_snode_t *cur = NULL; sys_snode_t *cur = NULL;
@ -141,8 +141,8 @@ static bool bt_mesh_client_check_node_in_list(sys_slist_t *list, u16_t tx_dst)
return false; return false;
} }
static u32_t bt_mesh_client_get_status_op(const bt_mesh_client_op_pair_t *op_pair, static uint32_t bt_mesh_client_get_status_op(const bt_mesh_client_op_pair_t *op_pair,
int size, u32_t opcode) int size, uint32_t opcode)
{ {
if (!op_pair || size == 0) { if (!op_pair || size == 0) {
return 0; return 0;
@ -159,26 +159,26 @@ static u32_t bt_mesh_client_get_status_op(const bt_mesh_client_op_pair_t *op_pai
return 0; return 0;
} }
static s32_t bt_mesh_get_adv_duration(void) static int32_t bt_mesh_get_adv_duration(void)
{ {
u16_t duration, adv_int; uint16_t duration, adv_int;
u8_t xmit; uint8_t xmit;
xmit = bt_mesh_net_transmit_get(); /* Network transmit */ xmit = bt_mesh_net_transmit_get(); /* Network transmit */
adv_int = BLE_MESH_TRANSMIT_INT(xmit); adv_int = BLE_MESH_TRANSMIT_INT(xmit);
duration = (BLE_MESH_TRANSMIT_COUNT(xmit) + 1) * (adv_int + 10); duration = (BLE_MESH_TRANSMIT_COUNT(xmit) + 1) * (adv_int + 10);
return (s32_t)duration; return (int32_t)duration;
} }
static s32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx, static int32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg, struct net_buf_simple *msg,
u32_t opcode, s32_t timeout) uint32_t opcode, int32_t timeout)
{ {
s32_t seg_retrans_to = 0, duration = 0, time = 0; int32_t seg_retrans_to = 0, duration = 0, time = 0;
u8_t seg_count = 0, seg_retrans_num = 0; uint8_t seg_count = 0, seg_retrans_num = 0;
bool need_seg = false; bool need_seg = false;
u8_t mic_size = 0; uint8_t mic_size = 0;
if (msg->len > BLE_MESH_SDU_UNSEG_MAX || ctx->send_rel) { if (msg->len > BLE_MESH_SDU_UNSEG_MAX || ctx->send_rel) {
need_seg = true; /* Needs segmentation */ need_seg = true; /* Needs segmentation */
@ -207,7 +207,7 @@ static s32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx,
* calculation here. And the retransmit timer will be started event if * calculation here. And the retransmit timer will be started event if
* the attempts reaches ZERO when the dst is a unicast address. * the attempts reaches ZERO when the dst is a unicast address.
*/ */
s32_t seg_duration = seg_count * (duration + HCI_TIME_FOR_START_ADV); int32_t seg_duration = seg_count * (duration + HCI_TIME_FOR_START_ADV);
time = (seg_duration + seg_retrans_to) * seg_retrans_num; time = (seg_duration + seg_retrans_to) * seg_retrans_num;
BT_INFO("Original timeout %dms, calculated timeout %dms", timeout, time); BT_INFO("Original timeout %dms, calculated timeout %dms", timeout, time);
@ -230,7 +230,7 @@ static s32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx,
return time; return time;
} }
static void msg_send_start(u16_t duration, int err, void *cb_data) static void msg_send_start(uint16_t duration, int err, void *cb_data)
{ {
bt_mesh_client_node_t *node = cb_data; bt_mesh_client_node_t *node = cb_data;
@ -503,7 +503,7 @@ int bt_mesh_client_clear_list(void *data)
return 0; return 0;
} }
int bt_mesh_set_client_model_role(struct bt_mesh_model *model, u8_t role) int bt_mesh_set_client_model_role(struct bt_mesh_model *model, uint8_t role)
{ {
bt_mesh_client_user_data_t *client = NULL; bt_mesh_client_user_data_t *client = NULL;

View File

@ -143,7 +143,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive generic status message timeout"); BT_WARN("Receive generic status message timeout");
@ -172,8 +172,8 @@ static void generic_status(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
u8_t *val = NULL; uint8_t *val = NULL;
u8_t evt = 0xFF; uint8_t evt = 0xFF;
size_t len = 0U; size_t len = 0U;
BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len));
@ -196,7 +196,7 @@ static void generic_status(struct bt_mesh_model *model,
status->target_onoff = net_buf_simple_pull_u8(buf); status->target_onoff = net_buf_simple_pull_u8(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_onoff_status); len = sizeof(struct bt_mesh_gen_onoff_status);
break; break;
} }
@ -217,7 +217,7 @@ static void generic_status(struct bt_mesh_model *model,
status->target_level = net_buf_simple_pull_le16(buf); status->target_level = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_level_status); len = sizeof(struct bt_mesh_gen_level_status);
break; break;
} }
@ -233,7 +233,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
status->trans_time = net_buf_simple_pull_u8(buf); status->trans_time = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_def_trans_time_status); len = sizeof(struct bt_mesh_gen_def_trans_time_status);
break; break;
} }
@ -249,7 +249,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
status->onpowerup = net_buf_simple_pull_u8(buf); status->onpowerup = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_onpowerup_status); len = sizeof(struct bt_mesh_gen_onpowerup_status);
break; break;
} }
@ -270,7 +270,7 @@ static void generic_status(struct bt_mesh_model *model,
status->target_power = net_buf_simple_pull_le16(buf); status->target_power = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_power_level_status); len = sizeof(struct bt_mesh_gen_power_level_status);
break; break;
} }
@ -286,7 +286,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
status->power = net_buf_simple_pull_le16(buf); status->power = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_power_last_status); len = sizeof(struct bt_mesh_gen_power_last_status);
break; break;
} }
@ -302,7 +302,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
status->power = net_buf_simple_pull_le16(buf); status->power = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_power_default_status); len = sizeof(struct bt_mesh_gen_power_default_status);
break; break;
} }
@ -320,7 +320,7 @@ static void generic_status(struct bt_mesh_model *model,
status->status_code = net_buf_simple_pull_u8(buf); status->status_code = net_buf_simple_pull_u8(buf);
status->range_min = net_buf_simple_pull_le16(buf); status->range_min = net_buf_simple_pull_le16(buf);
status->range_max = net_buf_simple_pull_le16(buf); status->range_max = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_power_range_status); len = sizeof(struct bt_mesh_gen_power_range_status);
break; break;
} }
@ -335,14 +335,14 @@ static void generic_status(struct bt_mesh_model *model,
BT_ERR("%s, Out of memory", __func__); BT_ERR("%s, Out of memory", __func__);
return; return;
} }
u32_t value = 0; uint32_t value = 0;
value = net_buf_simple_pull_le32(buf); value = net_buf_simple_pull_le32(buf);
status->battery_level = (u8_t)value; status->battery_level = (uint8_t)value;
status->time_to_discharge = (value >> 8); status->time_to_discharge = (value >> 8);
value = net_buf_simple_pull_le32(buf); value = net_buf_simple_pull_le32(buf);
status->time_to_charge = (value & 0xffffff); status->time_to_charge = (value & 0xffffff);
status->flags = (u8_t)(value >> 24); status->flags = (uint8_t)(value >> 24);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_battery_status); len = sizeof(struct bt_mesh_gen_battery_status);
break; break;
} }
@ -360,7 +360,7 @@ static void generic_status(struct bt_mesh_model *model,
status->global_latitude = net_buf_simple_pull_le32(buf); status->global_latitude = net_buf_simple_pull_le32(buf);
status->global_longitude = net_buf_simple_pull_le32(buf); status->global_longitude = net_buf_simple_pull_le32(buf);
status->global_altitude = net_buf_simple_pull_le16(buf); status->global_altitude = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_loc_global_status); len = sizeof(struct bt_mesh_gen_loc_global_status);
break; break;
} }
@ -380,7 +380,7 @@ static void generic_status(struct bt_mesh_model *model,
status->local_altitude = net_buf_simple_pull_le16(buf); status->local_altitude = net_buf_simple_pull_le16(buf);
status->floor_number = net_buf_simple_pull_u8(buf); status->floor_number = net_buf_simple_pull_u8(buf);
status->uncertainty = net_buf_simple_pull_le16(buf); status->uncertainty = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_loc_local_status); len = sizeof(struct bt_mesh_gen_loc_local_status);
break; break;
} }
@ -398,7 +398,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->user_property_ids, buf->data, buf->len); net_buf_simple_add_mem(status->user_property_ids, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_user_properties_status); len = sizeof(struct bt_mesh_gen_user_properties_status);
break; break;
} }
@ -421,7 +421,7 @@ static void generic_status(struct bt_mesh_model *model,
} }
net_buf_simple_add_mem(status->user_property_value, buf->data, buf->len); net_buf_simple_add_mem(status->user_property_value, buf->data, buf->len);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_user_property_status); len = sizeof(struct bt_mesh_gen_user_property_status);
break; break;
} }
@ -439,7 +439,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->admin_property_ids, buf->data, buf->len); net_buf_simple_add_mem(status->admin_property_ids, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_admin_properties_status); len = sizeof(struct bt_mesh_gen_admin_properties_status);
break; break;
} }
@ -462,7 +462,7 @@ static void generic_status(struct bt_mesh_model *model,
} }
net_buf_simple_add_mem(status->admin_property_value, buf->data, buf->len); net_buf_simple_add_mem(status->admin_property_value, buf->data, buf->len);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_admin_property_status); len = sizeof(struct bt_mesh_gen_admin_property_status);
break; break;
} }
@ -480,7 +480,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->manu_property_ids, buf->data, buf->len); net_buf_simple_add_mem(status->manu_property_ids, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_manu_properties_status); len = sizeof(struct bt_mesh_gen_manu_properties_status);
break; break;
} }
@ -503,7 +503,7 @@ static void generic_status(struct bt_mesh_model *model,
} }
net_buf_simple_add_mem(status->manu_property_value, buf->data, buf->len); net_buf_simple_add_mem(status->manu_property_value, buf->data, buf->len);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_manu_property_status); len = sizeof(struct bt_mesh_gen_manu_property_status);
break; break;
} }
@ -521,7 +521,7 @@ static void generic_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->client_property_ids, buf->data, buf->len); net_buf_simple_add_mem(status->client_property_ids, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_gen_client_properties_status); len = sizeof(struct bt_mesh_gen_client_properties_status);
break; break;
} }
@ -581,7 +581,7 @@ static void generic_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_generic_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len); bt_mesh_generic_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len);
} }
@ -733,7 +733,7 @@ static int gen_get_state(bt_mesh_client_common_param_t *common, void *value)
} }
static int gen_set_state(bt_mesh_client_common_param_t *common, static int gen_set_state(bt_mesh_client_common_param_t *common,
void *value, u16_t value_len, bool need_ack) void *value, uint16_t value_len, bool need_ack)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
int err = 0; int err = 0;
@ -974,7 +974,7 @@ int bt_mesh_generic_client_get_state(bt_mesh_client_common_param_t *common, void
int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set) int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set)
{ {
bt_mesh_generic_client_t *client = NULL; bt_mesh_generic_client_t *client = NULL;
u16_t length = 0U; uint16_t length = 0U;
bool need_ack = false; bool need_ack = false;
if (!common || !common->model || !set) { if (!common || !common->model || !set) {
@ -1048,7 +1048,7 @@ int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void
case BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET: case BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET:
need_ack = true; need_ack = true;
case BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK: { case BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK: {
u8_t value = *(u8_t *)set; uint8_t value = *(uint8_t *)set;
if ((value & 0x3F) > 0x3E) { if ((value & 0x3F) > 0x3E) {
BT_ERR("Invalid Generic Default Trans Time Set transition time"); BT_ERR("Invalid Generic Default Trans Time Set transition time");
return -EINVAL; return -EINVAL;

View File

@ -23,8 +23,8 @@ extern "C" {
/** Client model opcode pair table */ /** Client model opcode pair table */
typedef struct { typedef struct {
u32_t cli_op; /* Client message opcode */ uint32_t cli_op; /* Client message opcode */
u32_t status_op; /* Corresponding status message opcode */ uint32_t status_op; /* Corresponding status message opcode */
} bt_mesh_client_op_pair_t; } bt_mesh_client_op_pair_t;
/** Client model user data context */ /** Client model user data context */
@ -49,13 +49,13 @@ typedef struct {
* *
* @return None * @return None
*/ */
void (*publish_status)(u32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf); void (*publish_status)(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
/** Pointer to the internal data of client model */ /** Pointer to the internal data of client model */
void *internal_data; void *internal_data;
/** Role of the device to which the client model belongs */ /** Role of the device to which the client model belongs */
u8_t msg_role; uint8_t msg_role;
} bt_mesh_client_user_data_t; } bt_mesh_client_user_data_t;
/** Client model internal data context */ /** Client model internal data context */
@ -67,19 +67,19 @@ typedef struct {
typedef struct { typedef struct {
sys_snode_t client_node; sys_snode_t client_node;
struct bt_mesh_msg_ctx ctx; /* Message context */ struct bt_mesh_msg_ctx ctx; /* Message context */
u32_t opcode; /* Message opcode */ uint32_t opcode; /* Message opcode */
u32_t op_pending; /* Expected status message opcode */ uint32_t op_pending; /* Expected status message opcode */
s32_t timeout; /* Calculated message timeout value */ int32_t timeout; /* Calculated message timeout value */
struct k_delayed_work timer; /* Time used to get response. Only for internal use. */ struct k_delayed_work timer; /* Time used to get response. Only for internal use. */
} bt_mesh_client_node_t; } bt_mesh_client_node_t;
/** Client model sending message parameters */ /** Client model sending message parameters */
typedef struct { typedef struct {
u32_t opcode; /* Message opcode */ uint32_t opcode; /* Message opcode */
struct bt_mesh_model *model; /* Pointer to the client model */ struct bt_mesh_model *model; /* Pointer to the client model */
struct bt_mesh_msg_ctx ctx; /* Message context */ struct bt_mesh_msg_ctx ctx; /* Message context */
s32_t msg_timeout; /* Time to get corresponding response */ int32_t msg_timeout; /* Time to get corresponding response */
u8_t msg_role; /* Role (Node/Provisioner) of the device */ uint8_t msg_role; /* Role (Node/Provisioner) of the device */
const struct bt_mesh_send_cb *cb; /* User defined callback function */ const struct bt_mesh_send_cb *cb; /* User defined callback function */
void *cb_data; /* User defined callback value */ void *cb_data; /* User defined callback value */
} bt_mesh_client_common_param_t; } bt_mesh_client_common_param_t;
@ -121,7 +121,7 @@ int bt_mesh_client_clear_list(void *data);
* *
* @return Zero - success, otherwise - fail * @return Zero - success, otherwise - fail
*/ */
int bt_mesh_set_client_model_role(struct bt_mesh_model *model, u8_t role); int bt_mesh_set_client_model_role(struct bt_mesh_model *model, uint8_t role);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -52,18 +52,18 @@ extern const struct bt_mesh_model_op bt_mesh_gen_onoff_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_onoff_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_onoff_client_t;
struct bt_mesh_gen_onoff_status { struct bt_mesh_gen_onoff_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u8_t present_onoff; /* Present value of Generic OnOff state */ uint8_t present_onoff; /* Present value of Generic OnOff state */
u8_t target_onoff; /* Target value of Generic OnOff state (optional) */ uint8_t target_onoff; /* Target value of Generic OnOff state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_gen_onoff_set { struct bt_mesh_gen_onoff_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u8_t onoff; /* Target value of Generic OnOff state */ uint8_t onoff; /* Target value of Generic OnOff state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
/* Generic Level Client Model Context */ /* Generic Level Client Model Context */
@ -86,34 +86,34 @@ extern const struct bt_mesh_model_op bt_mesh_gen_level_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_level_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_level_client_t;
struct bt_mesh_gen_level_status { struct bt_mesh_gen_level_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
s16_t present_level; /* Present value of Generic Level state */ int16_t present_level; /* Present value of Generic Level state */
s16_t target_level; /* Target value of the Generic Level state (optional) */ int16_t target_level; /* Target value of the Generic Level state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_gen_level_set { struct bt_mesh_gen_level_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
s16_t level; /* Target value of Generic Level state */ int16_t level; /* Target value of Generic Level state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_gen_delta_set { struct bt_mesh_gen_delta_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
s32_t delta_level; /* Delta change of Generic Level state */ int32_t delta_level; /* Delta change of Generic Level state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_gen_move_set { struct bt_mesh_gen_move_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
s16_t delta_level; /* Delta Level step to calculate Move speed for Generic Level state */ int16_t delta_level; /* Delta Level step to calculate Move speed for Generic Level state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
/* Generic Default Transition Time Client Model Context */ /* Generic Default Transition Time Client Model Context */
@ -137,11 +137,11 @@ extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_def_trans_time_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_def_trans_time_client_t;
struct bt_mesh_gen_def_trans_time_set { struct bt_mesh_gen_def_trans_time_set {
u8_t trans_time; /* The value of the Generic Default Transition Time state */ uint8_t trans_time; /* The value of the Generic Default Transition Time state */
}; };
struct bt_mesh_gen_def_trans_time_status { struct bt_mesh_gen_def_trans_time_status {
u8_t trans_time; /* The value of the Generic Default Transition Time state */ uint8_t trans_time; /* The value of the Generic Default Transition Time state */
}; };
/* Generic Power OnOff Client Model Context */ /* Generic Power OnOff Client Model Context */
@ -164,11 +164,11 @@ extern const struct bt_mesh_model_op bt_mesh_gen_power_onoff_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_power_onoff_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_power_onoff_client_t;
struct bt_mesh_gen_onpowerup_set { struct bt_mesh_gen_onpowerup_set {
u8_t onpowerup; /* The value of the Generic OnPowerUp state */ uint8_t onpowerup; /* The value of the Generic OnPowerUp state */
}; };
struct bt_mesh_gen_onpowerup_status { struct bt_mesh_gen_onpowerup_status {
u8_t onpowerup; /* The value of the Generic OnPowerUp state */ uint8_t onpowerup; /* The value of the Generic OnPowerUp state */
}; };
/* Generic Power Level Client Model Context */ /* Generic Power Level Client Model Context */
@ -191,41 +191,41 @@ extern const struct bt_mesh_model_op bt_mesh_gen_power_level_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_power_level_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_power_level_client_t;
struct bt_mesh_gen_power_level_status { struct bt_mesh_gen_power_level_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_power; /* Present value of Generic Power Actual state */ uint16_t present_power; /* Present value of Generic Power Actual state */
u16_t target_power; /* Target value of Generic Power Actual state (optional) */ uint16_t target_power; /* Target value of Generic Power Actual state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_gen_power_last_status { struct bt_mesh_gen_power_last_status {
u16_t power; /* The value of the Generic Power Last state */ uint16_t power; /* The value of the Generic Power Last state */
}; };
struct bt_mesh_gen_power_default_status { struct bt_mesh_gen_power_default_status {
u16_t power; /* The value of the Generic Default Last state */ uint16_t power; /* The value of the Generic Default Last state */
}; };
struct bt_mesh_gen_power_range_status { struct bt_mesh_gen_power_range_status {
u8_t status_code; /* Status Code for the requesting message */ uint8_t status_code; /* Status Code for the requesting message */
u16_t range_min; /* Value of Range Min field of Generic Power Range state */ uint16_t range_min; /* Value of Range Min field of Generic Power Range state */
u16_t range_max; /* Value of Range Max field of Generic Power Range state */ uint16_t range_max; /* Value of Range Max field of Generic Power Range state */
}; };
struct bt_mesh_gen_power_level_set { struct bt_mesh_gen_power_level_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t power; /* Target value of Generic Power Actual state */ uint16_t power; /* Target value of Generic Power Actual state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_gen_power_default_set { struct bt_mesh_gen_power_default_set {
u16_t power; /* The value of the Generic Power Default state */ uint16_t power; /* The value of the Generic Power Default state */
}; };
struct bt_mesh_gen_power_range_set { struct bt_mesh_gen_power_range_set {
u16_t range_min; /* Value of Range Min field of Generic Power Range state */ uint16_t range_min; /* Value of Range Min field of Generic Power Range state */
u16_t range_max; /* Value of Range Max field of Generic Power Range state */ uint16_t range_max; /* Value of Range Max field of Generic Power Range state */
}; };
/* Generic Battery Client Model Context */ /* Generic Battery Client Model Context */
@ -248,10 +248,10 @@ extern const struct bt_mesh_model_op bt_mesh_gen_battery_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_battery_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_battery_client_t;
struct bt_mesh_gen_battery_status { struct bt_mesh_gen_battery_status {
u32_t battery_level : 8; /* Value of Generic Battery Level state */ uint32_t battery_level : 8; /* Value of Generic Battery Level state */
u32_t time_to_discharge : 24; /* Value of Generic Battery Time to Discharge state */ uint32_t time_to_discharge : 24; /* Value of Generic Battery Time to Discharge state */
u32_t time_to_charge : 24; /* Value of Generic Battery Time to Charge state */ uint32_t time_to_charge : 24; /* Value of Generic Battery Time to Charge state */
u32_t flags : 8; /* Value of Generic Battery Flags state */ uint32_t flags : 8; /* Value of Generic Battery Flags state */
}; };
/* Generic Location Client Model Context */ /* Generic Location Client Model Context */
@ -274,31 +274,31 @@ extern const struct bt_mesh_model_op bt_mesh_gen_location_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_gen_location_client_t; typedef bt_mesh_client_user_data_t bt_mesh_gen_location_client_t;
struct bt_mesh_gen_loc_global_status { struct bt_mesh_gen_loc_global_status {
s32_t global_latitude; /* Global Coordinates (Latitude) */ int32_t global_latitude; /* Global Coordinates (Latitude) */
s32_t global_longitude; /* Global Coordinates (Longitude) */ int32_t global_longitude; /* Global Coordinates (Longitude) */
s16_t global_altitude; /* Global Altitude */ int16_t global_altitude; /* Global Altitude */
}; };
struct bt_mesh_gen_loc_local_status { struct bt_mesh_gen_loc_local_status {
s16_t local_north; /* Local Coordinates (North) */ int16_t local_north; /* Local Coordinates (North) */
s16_t local_east; /* Local Coordinates (East) */ int16_t local_east; /* Local Coordinates (East) */
s16_t local_altitude; /* Local Altitude */ int16_t local_altitude; /* Local Altitude */
u8_t floor_number; /* Floor Number */ uint8_t floor_number; /* Floor Number */
u16_t uncertainty; /* Uncertainty */ uint16_t uncertainty; /* Uncertainty */
}; };
struct bt_mesh_gen_loc_global_set { struct bt_mesh_gen_loc_global_set {
s32_t global_latitude; /* Global Coordinates (Latitude) */ int32_t global_latitude; /* Global Coordinates (Latitude) */
s32_t global_longitude; /* Global Coordinates (Longitude) */ int32_t global_longitude; /* Global Coordinates (Longitude) */
s16_t global_altitude; /* Global Altitude */ int16_t global_altitude; /* Global Altitude */
}; };
struct bt_mesh_gen_loc_local_set { struct bt_mesh_gen_loc_local_set {
s16_t local_north; /* Local Coordinates (North) */ int16_t local_north; /* Local Coordinates (North) */
s16_t local_east; /* Local Coordinates (East) */ int16_t local_east; /* Local Coordinates (East) */
s16_t local_altitude; /* Local Altitude */ int16_t local_altitude; /* Local Altitude */
u8_t floor_number; /* Floor Number */ uint8_t floor_number; /* Floor Number */
u16_t uncertainty; /* Uncertainty */ uint16_t uncertainty; /* Uncertainty */
}; };
/* Generic Property Client Model Context */ /* Generic Property Client Model Context */
@ -325,9 +325,9 @@ struct bt_mesh_gen_user_properties_status {
}; };
struct bt_mesh_gen_user_property_status { struct bt_mesh_gen_user_property_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t user_property_id; /* Property ID identifying a Generic User Property */ uint16_t user_property_id; /* Property ID identifying a Generic User Property */
u8_t user_access; /* Enumeration indicating user access (optional) */ uint8_t user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *user_property_value; /* Raw value for the User Property (C.1) */ struct net_buf_simple *user_property_value; /* Raw value for the User Property (C.1) */
}; };
@ -336,9 +336,9 @@ struct bt_mesh_gen_admin_properties_status {
}; };
struct bt_mesh_gen_admin_property_status { struct bt_mesh_gen_admin_property_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */ uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
u8_t admin_user_access; /* Enumeration indicating user access (optional) */ uint8_t admin_user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property (C.1) */ struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property (C.1) */
}; };
@ -347,9 +347,9 @@ struct bt_mesh_gen_manu_properties_status {
}; };
struct bt_mesh_gen_manu_property_status { struct bt_mesh_gen_manu_property_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */ uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
u8_t manu_user_access; /* Enumeration indicating user access (optional) */ uint8_t manu_user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *manu_property_value; /* Raw value for the Manufacturer Property (C.1) */ struct net_buf_simple *manu_property_value; /* Raw value for the Manufacturer Property (C.1) */
}; };
@ -358,35 +358,35 @@ struct bt_mesh_gen_client_properties_status {
}; };
struct bt_mesh_gen_user_property_get { struct bt_mesh_gen_user_property_get {
u16_t user_property_id; /* Property ID identifying a Generic User Property */ uint16_t user_property_id; /* Property ID identifying a Generic User Property */
}; };
struct bt_mesh_gen_user_property_set { struct bt_mesh_gen_user_property_set {
u16_t user_property_id; /* Property ID identifying a Generic User Property */ uint16_t user_property_id; /* Property ID identifying a Generic User Property */
struct net_buf_simple *user_property_value; /* Raw value for the User Property */ struct net_buf_simple *user_property_value; /* Raw value for the User Property */
}; };
struct bt_mesh_gen_admin_property_get { struct bt_mesh_gen_admin_property_get {
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */ uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
}; };
struct bt_mesh_gen_admin_property_set { struct bt_mesh_gen_admin_property_set {
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */ uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
u8_t admin_user_access; /* Enumeration indicating user access */ uint8_t admin_user_access; /* Enumeration indicating user access */
struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property */ struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property */
}; };
struct bt_mesh_gen_manu_property_get { struct bt_mesh_gen_manu_property_get {
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */ uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
}; };
struct bt_mesh_gen_manu_property_set { struct bt_mesh_gen_manu_property_set {
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */ uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
u8_t manu_user_access; /* Enumeration indicating user access */ uint8_t manu_user_access; /* Enumeration indicating user access */
}; };
struct bt_mesh_gen_client_properties_get { struct bt_mesh_gen_client_properties_get {
u16_t client_property_id; /* A starting Client Property ID present within an element */ uint16_t client_property_id; /* A starting Client Property ID present within an element */
}; };
/** /**

View File

@ -52,56 +52,56 @@ extern const struct bt_mesh_model_op bt_mesh_light_lightness_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_light_lightness_client_t; typedef bt_mesh_client_user_data_t bt_mesh_light_lightness_client_t;
struct bt_mesh_light_lightness_status { struct bt_mesh_light_lightness_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_lightness; /* Present value of light lightness actual state */ uint16_t present_lightness; /* Present value of light lightness actual state */
u16_t target_lightness; /* Target value of light lightness actual state (optional) */ uint16_t target_lightness; /* Target value of light lightness actual state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_lightness_linear_status { struct bt_mesh_light_lightness_linear_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_lightness; /* Present value of light lightness linear state */ uint16_t present_lightness; /* Present value of light lightness linear state */
u16_t target_lightness; /* Target value of light lightness linear state (optional) */ uint16_t target_lightness; /* Target value of light lightness linear state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_lightness_last_status { struct bt_mesh_light_lightness_last_status {
u16_t lightness; /* The value of the Light Lightness Last state */ uint16_t lightness; /* The value of the Light Lightness Last state */
}; };
struct bt_mesh_light_lightness_default_status { struct bt_mesh_light_lightness_default_status {
u16_t lightness; /* The value of the Light Lightness default state */ uint16_t lightness; /* The value of the Light Lightness default state */
}; };
struct bt_mesh_light_lightness_range_status { struct bt_mesh_light_lightness_range_status {
u8_t status_code; /* Status Code for the requesting message */ uint8_t status_code; /* Status Code for the requesting message */
u16_t range_min; /* Value of range min field of light lightness range state */ uint16_t range_min; /* Value of range min field of light lightness range state */
u16_t range_max; /* Value of range max field of light lightness range state */ uint16_t range_max; /* Value of range max field of light lightness range state */
}; };
struct bt_mesh_light_lightness_set { struct bt_mesh_light_lightness_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t lightness; /* Target value of light lightness actual state */ uint16_t lightness; /* Target value of light lightness actual state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_lightness_linear_set { struct bt_mesh_light_lightness_linear_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t lightness; /* Target value of light lightness linear state */ uint16_t lightness; /* Target value of light lightness linear state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_lightness_default_set { struct bt_mesh_light_lightness_default_set {
u16_t lightness; /* The value of the Light Lightness Default state */ uint16_t lightness; /* The value of the Light Lightness Default state */
}; };
struct bt_mesh_light_lightness_range_set { struct bt_mesh_light_lightness_range_set {
u16_t range_min; /* Value of range min field of light lightness range state */ uint16_t range_min; /* Value of range min field of light lightness range state */
u16_t range_max; /* Value of range max field of light lightness range state */ uint16_t range_max; /* Value of range max field of light lightness range state */
}; };
/* Light CTL Client Model Context */ /* Light CTL Client Model Context */
@ -124,63 +124,63 @@ extern const struct bt_mesh_model_op bt_mesh_light_ctl_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_light_ctl_client_t; typedef bt_mesh_client_user_data_t bt_mesh_light_ctl_client_t;
struct bt_mesh_light_ctl_status { struct bt_mesh_light_ctl_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_ctl_lightness; /* Present value of light ctl lightness state */ uint16_t present_ctl_lightness; /* Present value of light ctl lightness state */
u16_t present_ctl_temperature; /* Present value of light ctl temperature state */ uint16_t present_ctl_temperature; /* Present value of light ctl temperature state */
u16_t target_ctl_lightness; /* Target value of light ctl lightness state (optional) */ uint16_t target_ctl_lightness; /* Target value of light ctl lightness state (optional) */
u16_t target_ctl_temperature; /* Target value of light ctl temperature state (C.1) */ uint16_t target_ctl_temperature; /* Target value of light ctl temperature state (C.1) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_ctl_temperature_status { struct bt_mesh_light_ctl_temperature_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_ctl_temperature; /* Present value of light ctl temperature state */ uint16_t present_ctl_temperature; /* Present value of light ctl temperature state */
u16_t present_ctl_delta_uv; /* Present value of light ctl delta UV state */ uint16_t present_ctl_delta_uv; /* Present value of light ctl delta UV state */
u16_t target_ctl_temperature; /* Target value of light ctl temperature state (optional) */ uint16_t target_ctl_temperature; /* Target value of light ctl temperature state (optional) */
u16_t target_ctl_delta_uv; /* Target value of light ctl delta UV state (C.1) */ uint16_t target_ctl_delta_uv; /* Target value of light ctl delta UV state (C.1) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_ctl_temperature_range_status { struct bt_mesh_light_ctl_temperature_range_status {
u8_t status_code; /* Status code for the requesting message */ uint8_t status_code; /* Status code for the requesting message */
u16_t range_min; /* Value of temperature range min field of light ctl temperature range state */ uint16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
u16_t range_max; /* Value of temperature range max field of light ctl temperature range state */ uint16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
}; };
struct bt_mesh_light_ctl_default_status { struct bt_mesh_light_ctl_default_status {
u16_t lightness; /* Value of light lightness default state */ uint16_t lightness; /* Value of light lightness default state */
u16_t temperature; /* Value of light temperature default state */ uint16_t temperature; /* Value of light temperature default state */
s16_t delta_uv; /* Value of light delta UV default state */ int16_t delta_uv; /* Value of light delta UV default state */
}; };
struct bt_mesh_light_ctl_set { struct bt_mesh_light_ctl_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t ctl_lightness; /* Target value of light ctl lightness state */ uint16_t ctl_lightness; /* Target value of light ctl lightness state */
u16_t ctl_temperature; /* Target value of light ctl temperature state */ uint16_t ctl_temperature; /* Target value of light ctl temperature state */
s16_t ctl_delta_uv; /* Target value of light ctl delta UV state */ int16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_ctl_temperature_set { struct bt_mesh_light_ctl_temperature_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t ctl_temperature; /* Target value of light ctl temperature state */ uint16_t ctl_temperature; /* Target value of light ctl temperature state */
s16_t ctl_delta_uv; /* Target value of light ctl delta UV state */ int16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_ctl_temperature_range_set { struct bt_mesh_light_ctl_temperature_range_set {
u16_t range_min; /* Value of temperature range min field of light ctl temperature range state */ uint16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
u16_t range_max; /* Value of temperature range max field of light ctl temperature range state */ uint16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
}; };
struct bt_mesh_light_ctl_default_set { struct bt_mesh_light_ctl_default_set {
u16_t lightness; /* Value of light lightness default state */ uint16_t lightness; /* Value of light lightness default state */
u16_t temperature; /* Value of light temperature default state */ uint16_t temperature; /* Value of light temperature default state */
s16_t delta_uv; /* Value of light delta UV default state */ int16_t delta_uv; /* Value of light delta UV default state */
}; };
/* Light HSL Client Model Context */ /* Light HSL Client Model Context */
@ -203,86 +203,86 @@ extern const struct bt_mesh_model_op bt_mesh_light_hsl_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_light_hsl_client_t; typedef bt_mesh_client_user_data_t bt_mesh_light_hsl_client_t;
struct bt_mesh_light_hsl_status { struct bt_mesh_light_hsl_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t hsl_lightness; /* Present value of light hsl lightness state */ uint16_t hsl_lightness; /* Present value of light hsl lightness state */
u16_t hsl_hue; /* Present value of light hsl hue state */ uint16_t hsl_hue; /* Present value of light hsl hue state */
u16_t hsl_saturation; /* Present value of light hsl saturation state */ uint16_t hsl_saturation; /* Present value of light hsl saturation state */
u8_t remain_time; /* Time to complete state transition (optional) */ uint8_t remain_time; /* Time to complete state transition (optional) */
}; };
struct bt_mesh_light_hsl_target_status { struct bt_mesh_light_hsl_target_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t hsl_lightness_target; /* Target value of light hsl lightness state */ uint16_t hsl_lightness_target; /* Target value of light hsl lightness state */
u16_t hsl_hue_target; /* Target value of light hsl hue state */ uint16_t hsl_hue_target; /* Target value of light hsl hue state */
u16_t hsl_saturation_target; /* Target value of light hsl saturation state */ uint16_t hsl_saturation_target; /* Target value of light hsl saturation state */
u8_t remain_time; /* Time to complete state transition (optional) */ uint8_t remain_time; /* Time to complete state transition (optional) */
}; };
struct bt_mesh_light_hsl_hue_status { struct bt_mesh_light_hsl_hue_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_hue; /* Present value of light hsl hue state */ uint16_t present_hue; /* Present value of light hsl hue state */
u16_t target_hue; /* Target value of light hsl hue state (optional) */ uint16_t target_hue; /* Target value of light hsl hue state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_hsl_saturation_status { struct bt_mesh_light_hsl_saturation_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t present_saturation; /* Present value of light hsl saturation state */ uint16_t present_saturation; /* Present value of light hsl saturation state */
u16_t target_saturation; /* Target value of light hsl saturation state (optional) */ uint16_t target_saturation; /* Target value of light hsl saturation state (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_hsl_default_status { struct bt_mesh_light_hsl_default_status {
u16_t lightness; /* Value of light lightness default state */ uint16_t lightness; /* Value of light lightness default state */
u16_t hue; /* Value of light hue default state */ uint16_t hue; /* Value of light hue default state */
u16_t saturation; /* Value of light saturation default state */ uint16_t saturation; /* Value of light saturation default state */
}; };
struct bt_mesh_light_hsl_range_status { struct bt_mesh_light_hsl_range_status {
u8_t status_code; /* Status code for the requesting message */ uint8_t status_code; /* Status code for the requesting message */
u16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */ uint16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
u16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */ uint16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
u16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */ uint16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
u16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */ uint16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */
}; };
struct bt_mesh_light_hsl_set { struct bt_mesh_light_hsl_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t hsl_lightness; /* Target value of light hsl lightness state */ uint16_t hsl_lightness; /* Target value of light hsl lightness state */
u16_t hsl_hue; /* Target value of light hsl hue state */ uint16_t hsl_hue; /* Target value of light hsl hue state */
u16_t hsl_saturation; /* Target value of light hsl saturation state */ uint16_t hsl_saturation; /* Target value of light hsl saturation state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_hsl_hue_set { struct bt_mesh_light_hsl_hue_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t hue; /* Target value of light hsl hue state */ uint16_t hue; /* Target value of light hsl hue state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_hsl_saturation_set { struct bt_mesh_light_hsl_saturation_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t saturation; /* Target value of light hsl hue state */ uint16_t saturation; /* Target value of light hsl hue state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_hsl_default_set { struct bt_mesh_light_hsl_default_set {
u16_t lightness; /* Value of light lightness default state */ uint16_t lightness; /* Value of light lightness default state */
u16_t hue; /* Value of light hue default state */ uint16_t hue; /* Value of light hue default state */
u16_t saturation; /* Value of light saturation default state */ uint16_t saturation; /* Value of light saturation default state */
}; };
struct bt_mesh_light_hsl_range_set { struct bt_mesh_light_hsl_range_set {
u16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */ uint16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
u16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */ uint16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
u16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */ uint16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
u16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */ uint16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */
}; };
/* Light xyL Client Model Context */ /* Light xyL Client Model Context */
@ -305,56 +305,56 @@ extern const struct bt_mesh_model_op bt_mesh_light_xyl_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_light_xyl_client_t; typedef bt_mesh_client_user_data_t bt_mesh_light_xyl_client_t;
struct bt_mesh_light_xyl_status { struct bt_mesh_light_xyl_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t xyl_lightness; /* The present value of the Light xyL Lightness state */ uint16_t xyl_lightness; /* The present value of the Light xyL Lightness state */
u16_t xyl_x; /* The present value of the Light xyL x state */ uint16_t xyl_x; /* The present value of the Light xyL x state */
u16_t xyl_y; /* The present value of the Light xyL y state */ uint16_t xyl_y; /* The present value of the Light xyL y state */
u8_t remain_time; /* Time to complete state transition (optional) */ uint8_t remain_time; /* Time to complete state transition (optional) */
}; };
struct bt_mesh_light_xyl_target_status { struct bt_mesh_light_xyl_target_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t target_xyl_lightness; /* The target value of the Light xyL Lightness state */ uint16_t target_xyl_lightness; /* The target value of the Light xyL Lightness state */
u16_t target_xyl_x; /* The target value of the Light xyL x state */ uint16_t target_xyl_x; /* The target value of the Light xyL x state */
u16_t target_xyl_y; /* The target value of the Light xyL y state */ uint16_t target_xyl_y; /* The target value of the Light xyL y state */
u8_t remain_time; /* Time to complete state transition (optional) */ uint8_t remain_time; /* Time to complete state transition (optional) */
}; };
struct bt_mesh_light_xyl_default_status { struct bt_mesh_light_xyl_default_status {
u16_t lightness; /* The value of the Light Lightness Default state */ uint16_t lightness; /* The value of the Light Lightness Default state */
u16_t xyl_x; /* The value of the Light xyL x Default state */ uint16_t xyl_x; /* The value of the Light xyL x Default state */
u16_t xyl_y; /* The value of the Light xyL y Default state */ uint16_t xyl_y; /* The value of the Light xyL y Default state */
}; };
struct bt_mesh_light_xyl_range_status { struct bt_mesh_light_xyl_range_status {
u8_t status_code; /* Status Code for the requesting message */ uint8_t status_code; /* Status Code for the requesting message */
u16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */ uint16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
u16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */ uint16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
u16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */ uint16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
u16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */ uint16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */
}; };
struct bt_mesh_light_xyl_set { struct bt_mesh_light_xyl_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t xyl_lightness; /* The target value of the Light xyL Lightness state */ uint16_t xyl_lightness; /* The target value of the Light xyL Lightness state */
u16_t xyl_x; /* The target value of the Light xyL x state */ uint16_t xyl_x; /* The target value of the Light xyL x state */
u16_t xyl_y; /* The target value of the Light xyL y state */ uint16_t xyl_y; /* The target value of the Light xyL y state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_xyl_default_set { struct bt_mesh_light_xyl_default_set {
u16_t lightness; /* The value of the Light Lightness Default state */ uint16_t lightness; /* The value of the Light Lightness Default state */
u16_t xyl_x; /* The value of the Light xyL x Default state */ uint16_t xyl_x; /* The value of the Light xyL x Default state */
u16_t xyl_y; /* The value of the Light xyL y Default state */ uint16_t xyl_y; /* The value of the Light xyL y Default state */
}; };
struct bt_mesh_light_xyl_range_set { struct bt_mesh_light_xyl_range_set {
u16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */ uint16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
u16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */ uint16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
u16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */ uint16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
u16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */ uint16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */
}; };
/* Light LC Client Model Context */ /* Light LC Client Model Context */
@ -377,47 +377,47 @@ extern const struct bt_mesh_model_op bt_mesh_light_lc_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_light_lc_client_t; typedef bt_mesh_client_user_data_t bt_mesh_light_lc_client_t;
struct bt_mesh_light_lc_mode_status { struct bt_mesh_light_lc_mode_status {
u8_t mode; /* The present value of the Light LC Mode state */ uint8_t mode; /* The present value of the Light LC Mode state */
}; };
struct bt_mesh_light_lc_om_status { struct bt_mesh_light_lc_om_status {
u8_t mode; /* The present value of the Light LC Occupancy Mode state */ uint8_t mode; /* The present value of the Light LC Occupancy Mode state */
}; };
struct bt_mesh_light_lc_light_onoff_status { struct bt_mesh_light_lc_light_onoff_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u8_t present_light_onoff; /* The present value of the Light LC Light OnOff state */ uint8_t present_light_onoff; /* The present value of the Light LC Light OnOff state */
u8_t target_light_onoff; /* The target value of the Light LC Light OnOff state (Optional) */ uint8_t target_light_onoff; /* The target value of the Light LC Light OnOff state (Optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_light_lc_property_status { struct bt_mesh_light_lc_property_status {
u16_t light_lc_property_id; /* Property ID identifying a Light LC Property */ uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */ struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */
}; };
struct bt_mesh_light_lc_mode_set { struct bt_mesh_light_lc_mode_set {
u8_t mode; /* The target value of the Light LC Mode state */ uint8_t mode; /* The target value of the Light LC Mode state */
}; };
struct bt_mesh_light_lc_om_set { struct bt_mesh_light_lc_om_set {
u8_t mode; /* The target value of the Light LC Occupancy Mode state */ uint8_t mode; /* The target value of the Light LC Occupancy Mode state */
}; };
struct bt_mesh_light_lc_light_onoff_set { struct bt_mesh_light_lc_light_onoff_set {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u8_t light_onoff; /* The target value of the Light LC Light OnOff state */ uint8_t light_onoff; /* The target value of the Light LC Light OnOff state */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_light_lc_property_get { struct bt_mesh_light_lc_property_get {
u16_t light_lc_property_id; /* Property ID identifying a Light LC Property */ uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
}; };
struct bt_mesh_light_lc_property_set { struct bt_mesh_light_lc_property_set {
u16_t light_lc_property_id; /* Property ID identifying a Light LC Property */ uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */ struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */
}; };

View File

@ -53,20 +53,20 @@ struct bt_mesh_sensor_descriptor_status {
}; };
struct bt_mesh_sensor_cadence_status { struct bt_mesh_sensor_cadence_status {
u16_t property_id; /* Property for the sensor */ uint16_t property_id; /* Property for the sensor */
struct net_buf_simple *sensor_cadence_value; /* Value of sensor cadence state */ struct net_buf_simple *sensor_cadence_value; /* Value of sensor cadence state */
}; };
struct bt_mesh_sensor_settings_status { struct bt_mesh_sensor_settings_status {
u16_t sensor_property_id; /* Property ID identifying a sensor */ uint16_t sensor_property_id; /* Property ID identifying a sensor */
struct net_buf_simple *sensor_setting_property_ids; /* A sequence of N sensor setting property IDs (optional) */ struct net_buf_simple *sensor_setting_property_ids; /* A sequence of N sensor setting property IDs (optional) */
}; };
struct bt_mesh_sensor_setting_status { struct bt_mesh_sensor_setting_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t sensor_property_id; /* Property ID identifying a sensor */ uint16_t sensor_property_id; /* Property ID identifying a sensor */
u16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */ uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
u8_t sensor_setting_access; /* Read/Write access rights for the setting (optional) */ uint8_t sensor_setting_access; /* Read/Write access rights for the setting (optional) */
struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */ struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */
}; };
@ -75,63 +75,63 @@ struct bt_mesh_sensor_status {
}; };
struct bt_mesh_sensor_column_status { struct bt_mesh_sensor_column_status {
u16_t property_id; /* Property identifying a sensor and the Y axis */ uint16_t property_id; /* Property identifying a sensor and the Y axis */
struct net_buf_simple *sensor_column_value; /* Left values of sensor column status */ struct net_buf_simple *sensor_column_value; /* Left values of sensor column status */
}; };
struct bt_mesh_sensor_series_status { struct bt_mesh_sensor_series_status {
u16_t property_id; /* Property identifying a sensor and the Y axis */ uint16_t property_id; /* Property identifying a sensor and the Y axis */
struct net_buf_simple *sensor_series_value; /* Left values of sensor series status */ struct net_buf_simple *sensor_series_value; /* Left values of sensor series status */
}; };
struct bt_mesh_sensor_descriptor_get { struct bt_mesh_sensor_descriptor_get {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t property_id; /* Property ID for the sensor (optional) */ uint16_t property_id; /* Property ID for the sensor (optional) */
}; };
struct bt_mesh_sensor_cadence_get { struct bt_mesh_sensor_cadence_get {
u16_t property_id; /* Property ID for the sensor */ uint16_t property_id; /* Property ID for the sensor */
}; };
struct bt_mesh_sensor_cadence_set { struct bt_mesh_sensor_cadence_set {
u16_t property_id; /* Property ID for the sensor */ uint16_t property_id; /* Property ID for the sensor */
u8_t fast_cadence_period_divisor : 7, /* Divisor for the publish period */ uint8_t fast_cadence_period_divisor : 7, /* Divisor for the publish period */
status_trigger_type : 1; /* The unit and format of the Status Trigger Delta fields */ status_trigger_type : 1; /* The unit and format of the Status Trigger Delta fields */
struct net_buf_simple *status_trigger_delta_down; /* Delta down value that triggers a status message */ struct net_buf_simple *status_trigger_delta_down; /* Delta down value that triggers a status message */
struct net_buf_simple *status_trigger_delta_up; /* Delta up value that triggers a status message */ struct net_buf_simple *status_trigger_delta_up; /* Delta up value that triggers a status message */
u8_t status_min_interval; /* Minimum interval between two consecutive Status messages */ uint8_t status_min_interval; /* Minimum interval between two consecutive Status messages */
struct net_buf_simple *fast_cadence_low; /* Low value for the fast cadence range */ struct net_buf_simple *fast_cadence_low; /* Low value for the fast cadence range */
struct net_buf_simple *fast_cadence_high; /* Fast value for the fast cadence range */ struct net_buf_simple *fast_cadence_high; /* Fast value for the fast cadence range */
}; };
struct bt_mesh_sensor_settings_get { struct bt_mesh_sensor_settings_get {
u16_t sensor_property_id; /* Property ID for the sensor */ uint16_t sensor_property_id; /* Property ID for the sensor */
}; };
struct bt_mesh_sensor_setting_get { struct bt_mesh_sensor_setting_get {
u16_t sensor_property_id; /* Property ID identifying a sensor */ uint16_t sensor_property_id; /* Property ID identifying a sensor */
u16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */ uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
}; };
struct bt_mesh_sensor_setting_set { struct bt_mesh_sensor_setting_set {
u16_t sensor_property_id; /* Property ID identifying a sensor */ uint16_t sensor_property_id; /* Property ID identifying a sensor */
u16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */ uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */ struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */
}; };
struct bt_mesh_sensor_get { struct bt_mesh_sensor_get {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t property_id; /* Property ID for the sensor (optional) */ uint16_t property_id; /* Property ID for the sensor (optional) */
}; };
struct bt_mesh_sensor_column_get { struct bt_mesh_sensor_column_get {
u16_t property_id; /* Property identifying a sensor */ uint16_t property_id; /* Property identifying a sensor */
struct net_buf_simple *raw_value_x; /* Raw value identifying a column */ struct net_buf_simple *raw_value_x; /* Raw value identifying a column */
}; };
struct bt_mesh_sensor_series_get { struct bt_mesh_sensor_series_get {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t property_id; /* Property identifying a sensor */ uint16_t property_id; /* Property identifying a sensor */
struct net_buf_simple *raw_value_x1; /* Raw value identifying a starting column (optional) */ struct net_buf_simple *raw_value_x1; /* Raw value identifying a starting column (optional) */
struct net_buf_simple *raw_value_x2; /* Raw value identifying a ending column (C.1) */ struct net_buf_simple *raw_value_x2; /* Raw value identifying a ending column (C.1) */
}; };

View File

@ -52,54 +52,54 @@ extern const struct bt_mesh_model_op bt_mesh_time_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_time_client_t; typedef bt_mesh_client_user_data_t bt_mesh_time_client_t;
struct bt_mesh_time_status { struct bt_mesh_time_status {
u8_t tai_seconds[5]; /* The current TAI time in seconds */ uint8_t tai_seconds[5]; /* The current TAI time in seconds */
u8_t sub_second; /* The sub-second time in units of 1/256 second */ uint8_t sub_second; /* The sub-second time in units of 1/256 second */
u8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */ uint8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
u16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */ uint16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
u16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */ uint16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
u8_t time_zone_offset; /* The local time zone offset in 15-minute increments */ uint8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
}; };
struct bt_mesh_time_zone_status { struct bt_mesh_time_zone_status {
u8_t time_zone_offset_curr; /* Current local time zone offset */ uint8_t time_zone_offset_curr; /* Current local time zone offset */
u8_t time_zone_offset_new; /* Upcoming local time zone offset */ uint8_t time_zone_offset_new; /* Upcoming local time zone offset */
u8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */ uint8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
}; };
struct bt_mesh_tai_utc_delta_status { struct bt_mesh_tai_utc_delta_status {
u16_t tai_utc_delta_curr : 15; /* Current difference between TAI and UTC in seconds */ uint16_t tai_utc_delta_curr : 15; /* Current difference between TAI and UTC in seconds */
u16_t padding_1 : 1; /* Always 0b0. Other values are Prohibited. */ uint16_t padding_1 : 1; /* Always 0b0. Other values are Prohibited. */
u16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */ uint16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
u16_t padding_2 : 1; /* Always 0b0. Other values are Prohibited. */ uint16_t padding_2 : 1; /* Always 0b0. Other values are Prohibited. */
u8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */ uint8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
}; };
struct bt_mesh_time_role_status { struct bt_mesh_time_role_status {
u8_t time_role; /* The Time Role for the element */ uint8_t time_role; /* The Time Role for the element */
}; };
struct bt_mesh_time_set { struct bt_mesh_time_set {
u8_t tai_seconds[5]; /* The current TAI time in seconds */ uint8_t tai_seconds[5]; /* The current TAI time in seconds */
u8_t sub_second; /* The sub-second time in units of 1/256 second */ uint8_t sub_second; /* The sub-second time in units of 1/256 second */
u8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */ uint8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
u16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */ uint16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
u16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */ uint16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
u8_t time_zone_offset; /* The local time zone offset in 15-minute increments */ uint8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
}; };
struct bt_mesh_time_zone_set { struct bt_mesh_time_zone_set {
u8_t time_zone_offset_new; /* Upcoming local time zone offset */ uint8_t time_zone_offset_new; /* Upcoming local time zone offset */
u8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */ uint8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
}; };
struct bt_mesh_tai_utc_delta_set { struct bt_mesh_tai_utc_delta_set {
u16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */ uint16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
u16_t padding : 1; /* Always 0b0. Other values are Prohibited. */ uint16_t padding : 1; /* Always 0b0. Other values are Prohibited. */
u8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */ uint8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
}; };
struct bt_mesh_time_role_set { struct bt_mesh_time_role_set {
u8_t time_role; /* The Time Role for the element */ uint8_t time_role; /* The Time Role for the element */
}; };
/* Scene Client Model Context */ /* Scene Client Model Context */
@ -122,33 +122,33 @@ extern const struct bt_mesh_model_op bt_mesh_scene_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_scene_client_t; typedef bt_mesh_client_user_data_t bt_mesh_scene_client_t;
struct bt_mesh_scene_status { struct bt_mesh_scene_status {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u8_t status_code; /* Status code for the last operation */ uint8_t status_code; /* Status code for the last operation */
u16_t current_scene; /* Scene Number of a current scene */ uint16_t current_scene; /* Scene Number of a current scene */
u16_t target_scene; /* Scene Number of a target scene (optional) */ uint16_t target_scene; /* Scene Number of a target scene (optional) */
u8_t remain_time; /* Time to complete state transition (C.1) */ uint8_t remain_time; /* Time to complete state transition (C.1) */
}; };
struct bt_mesh_scene_register_status { struct bt_mesh_scene_register_status {
u8_t status_code; /* Status code for the previous operation */ uint8_t status_code; /* Status code for the previous operation */
u16_t current_scene; /* Scene Number of a current scene */ uint16_t current_scene; /* Scene Number of a current scene */
struct net_buf_simple *scenes; /* A list of scenes stored within an element */ struct net_buf_simple *scenes; /* A list of scenes stored within an element */
}; };
struct bt_mesh_scene_store { struct bt_mesh_scene_store {
u16_t scene_number; /* The number of the scene to be stored */ uint16_t scene_number; /* The number of the scene to be stored */
}; };
struct bt_mesh_scene_recall { struct bt_mesh_scene_recall {
bool op_en; /* Indicate whether optional parameters included */ bool op_en; /* Indicate whether optional parameters included */
u16_t scene_number; /* The number of the scene to be recalled */ uint16_t scene_number; /* The number of the scene to be recalled */
u8_t tid; /* Transaction Identifier */ uint8_t tid; /* Transaction Identifier */
u8_t trans_time; /* Time to complete state transition (optional) */ uint8_t trans_time; /* Time to complete state transition (optional) */
u8_t delay; /* Indicate message execution delay (C.1) */ uint8_t delay; /* Indicate message execution delay (C.1) */
}; };
struct bt_mesh_scene_delete { struct bt_mesh_scene_delete {
u16_t scene_number; /* The number of the scene to be deleted */ uint16_t scene_number; /* The number of the scene to be deleted */
}; };
/* Scheduler Client Model Context */ /* Scheduler Client Model Context */
@ -171,39 +171,39 @@ extern const struct bt_mesh_model_op bt_mesh_scheduler_cli_op[];
typedef bt_mesh_client_user_data_t bt_mesh_scheduler_client_t; typedef bt_mesh_client_user_data_t bt_mesh_scheduler_client_t;
struct bt_mesh_scheduler_status { struct bt_mesh_scheduler_status {
u16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */ uint16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */
}; };
struct bt_mesh_scheduler_act_status { struct bt_mesh_scheduler_act_status {
u64_t index : 4; /* Enumerates (selects) a Schedule Register entry */ uint64_t index : 4; /* Enumerates (selects) a Schedule Register entry */
u64_t year : 7; /* Scheduled year for the action */ uint64_t year : 7; /* Scheduled year for the action */
u64_t month : 12; /* Scheduled month for the action */ uint64_t month : 12; /* Scheduled month for the action */
u64_t day : 5; /* Scheduled day of the month for the action */ uint64_t day : 5; /* Scheduled day of the month for the action */
u64_t hour : 5; /* Scheduled hour for the action */ uint64_t hour : 5; /* Scheduled hour for the action */
u64_t minute : 6; /* Scheduled minute for the action */ uint64_t minute : 6; /* Scheduled minute for the action */
u64_t second : 6; /* Scheduled second for the action */ uint64_t second : 6; /* Scheduled second for the action */
u64_t day_of_week : 7; /* Schedule days of the week for the action */ uint64_t day_of_week : 7; /* Schedule days of the week for the action */
u64_t action : 4; /* Action to be performed at the scheduled time */ uint64_t action : 4; /* Action to be performed at the scheduled time */
u64_t trans_time : 8; /* Transition time for this action */ uint64_t trans_time : 8; /* Transition time for this action */
u16_t scene_number; /* Transition time for this action */ uint16_t scene_number; /* Transition time for this action */
}; };
struct bt_mesh_scheduler_act_get { struct bt_mesh_scheduler_act_get {
u8_t index; /* Index of the Schedule Register entry to get */ uint8_t index; /* Index of the Schedule Register entry to get */
}; };
struct bt_mesh_scheduler_act_set { struct bt_mesh_scheduler_act_set {
u64_t index : 4; /* Index of the Schedule Register entry to set */ uint64_t index : 4; /* Index of the Schedule Register entry to set */
u64_t year : 7; /* Scheduled year for the action */ uint64_t year : 7; /* Scheduled year for the action */
u64_t month : 12; /* Scheduled month for the action */ uint64_t month : 12; /* Scheduled month for the action */
u64_t day : 5; /* Scheduled day of the month for the action */ uint64_t day : 5; /* Scheduled day of the month for the action */
u64_t hour : 5; /* Scheduled hour for the action */ uint64_t hour : 5; /* Scheduled hour for the action */
u64_t minute : 6; /* Scheduled minute for the action */ uint64_t minute : 6; /* Scheduled minute for the action */
u64_t second : 6; /* Scheduled second for the action */ uint64_t second : 6; /* Scheduled second for the action */
u64_t day_of_week : 7; /* Schedule days of the week for the action */ uint64_t day_of_week : 7; /* Schedule days of the week for the action */
u64_t action : 4; /* Action to be performed at the scheduled time */ uint64_t action : 4; /* Action to be performed at the scheduled time */
u64_t trans_time : 8; /* Transition time for this action */ uint64_t trans_time : 8; /* Transition time for this action */
u16_t scene_number; /* Transition time for this action */ uint16_t scene_number; /* Transition time for this action */
}; };
/** /**

View File

@ -152,7 +152,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive light status message timeout"); BT_WARN("Receive light status message timeout");
@ -181,8 +181,8 @@ static void light_status(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
u8_t *val = NULL; uint8_t *val = NULL;
u8_t evt = 0xFF; uint8_t evt = 0xFF;
size_t len = 0U; size_t len = 0U;
BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len));
@ -205,7 +205,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_lightness = net_buf_simple_pull_le16(buf); status->target_lightness = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lightness_status); len = sizeof(struct bt_mesh_light_lightness_status);
break; break;
} }
@ -226,7 +226,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_lightness = net_buf_simple_pull_le16(buf); status->target_lightness = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lightness_linear_status); len = sizeof(struct bt_mesh_light_lightness_linear_status);
break; break;
} }
@ -242,7 +242,7 @@ static void light_status(struct bt_mesh_model *model,
return; return;
} }
status->lightness = net_buf_simple_pull_le16(buf); status->lightness = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lightness_last_status); len = sizeof(struct bt_mesh_light_lightness_last_status);
break; break;
} }
@ -258,7 +258,7 @@ static void light_status(struct bt_mesh_model *model,
return; return;
} }
status->lightness = net_buf_simple_pull_le16(buf); status->lightness = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lightness_default_status); len = sizeof(struct bt_mesh_light_lightness_default_status);
break; break;
} }
@ -276,7 +276,7 @@ static void light_status(struct bt_mesh_model *model,
status->status_code = net_buf_simple_pull_u8(buf); status->status_code = net_buf_simple_pull_u8(buf);
status->range_min = net_buf_simple_pull_le16(buf); status->range_min = net_buf_simple_pull_le16(buf);
status->range_max = net_buf_simple_pull_le16(buf); status->range_max = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lightness_range_status); len = sizeof(struct bt_mesh_light_lightness_range_status);
break; break;
} }
@ -299,7 +299,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_ctl_temperature = net_buf_simple_pull_le16(buf); status->target_ctl_temperature = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_ctl_status); len = sizeof(struct bt_mesh_light_ctl_status);
break; break;
} }
@ -322,7 +322,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_ctl_delta_uv = net_buf_simple_pull_le16(buf); status->target_ctl_delta_uv = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_ctl_temperature_status); len = sizeof(struct bt_mesh_light_ctl_temperature_status);
break; break;
} }
@ -340,7 +340,7 @@ static void light_status(struct bt_mesh_model *model,
status->status_code = net_buf_simple_pull_u8(buf); status->status_code = net_buf_simple_pull_u8(buf);
status->range_min = net_buf_simple_pull_le16(buf); status->range_min = net_buf_simple_pull_le16(buf);
status->range_max = net_buf_simple_pull_le16(buf); status->range_max = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_ctl_temperature_range_status); len = sizeof(struct bt_mesh_light_ctl_temperature_range_status);
break; break;
} }
@ -358,7 +358,7 @@ static void light_status(struct bt_mesh_model *model,
status->lightness = net_buf_simple_pull_le16(buf); status->lightness = net_buf_simple_pull_le16(buf);
status->temperature = net_buf_simple_pull_le16(buf); status->temperature = net_buf_simple_pull_le16(buf);
status->delta_uv = net_buf_simple_pull_le16(buf); status->delta_uv = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_ctl_default_status); len = sizeof(struct bt_mesh_light_ctl_default_status);
break; break;
} }
@ -380,7 +380,7 @@ static void light_status(struct bt_mesh_model *model,
status->op_en = true; status->op_en = true;
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_status); len = sizeof(struct bt_mesh_light_hsl_status);
break; break;
} }
@ -402,7 +402,7 @@ static void light_status(struct bt_mesh_model *model,
status->op_en = true; status->op_en = true;
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_target_status); len = sizeof(struct bt_mesh_light_hsl_target_status);
break; break;
} }
@ -423,7 +423,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_hue = net_buf_simple_pull_le16(buf); status->target_hue = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_hue_status); len = sizeof(struct bt_mesh_light_hsl_hue_status);
break; break;
} }
@ -444,7 +444,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_saturation = net_buf_simple_pull_le16(buf); status->target_saturation = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_saturation_status); len = sizeof(struct bt_mesh_light_hsl_saturation_status);
break; break;
} }
@ -462,7 +462,7 @@ static void light_status(struct bt_mesh_model *model,
status->lightness = net_buf_simple_pull_le16(buf); status->lightness = net_buf_simple_pull_le16(buf);
status->hue = net_buf_simple_pull_le16(buf); status->hue = net_buf_simple_pull_le16(buf);
status->saturation = net_buf_simple_pull_le16(buf); status->saturation = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_default_status); len = sizeof(struct bt_mesh_light_hsl_default_status);
break; break;
} }
@ -482,7 +482,7 @@ static void light_status(struct bt_mesh_model *model,
status->hue_range_max = net_buf_simple_pull_le16(buf); status->hue_range_max = net_buf_simple_pull_le16(buf);
status->saturation_range_min = net_buf_simple_pull_le16(buf); status->saturation_range_min = net_buf_simple_pull_le16(buf);
status->saturation_range_max = net_buf_simple_pull_le16(buf); status->saturation_range_max = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_hsl_range_status); len = sizeof(struct bt_mesh_light_hsl_range_status);
break; break;
} }
@ -504,7 +504,7 @@ static void light_status(struct bt_mesh_model *model,
status->op_en = true; status->op_en = true;
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_xyl_status); len = sizeof(struct bt_mesh_light_xyl_status);
break; break;
} }
@ -526,7 +526,7 @@ static void light_status(struct bt_mesh_model *model,
status->op_en = true; status->op_en = true;
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_xyl_target_status); len = sizeof(struct bt_mesh_light_xyl_target_status);
break; break;
} }
@ -544,7 +544,7 @@ static void light_status(struct bt_mesh_model *model,
status->lightness = net_buf_simple_pull_le16(buf); status->lightness = net_buf_simple_pull_le16(buf);
status->xyl_x = net_buf_simple_pull_le16(buf); status->xyl_x = net_buf_simple_pull_le16(buf);
status->xyl_y = net_buf_simple_pull_le16(buf); status->xyl_y = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_xyl_default_status); len = sizeof(struct bt_mesh_light_xyl_default_status);
break; break;
} }
@ -564,7 +564,7 @@ static void light_status(struct bt_mesh_model *model,
status->xyl_x_range_max = net_buf_simple_pull_le16(buf); status->xyl_x_range_max = net_buf_simple_pull_le16(buf);
status->xyl_y_range_min = net_buf_simple_pull_le16(buf); status->xyl_y_range_min = net_buf_simple_pull_le16(buf);
status->xyl_y_range_max = net_buf_simple_pull_le16(buf); status->xyl_y_range_max = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_xyl_range_status); len = sizeof(struct bt_mesh_light_xyl_range_status);
break; break;
} }
@ -580,7 +580,7 @@ static void light_status(struct bt_mesh_model *model,
return; return;
} }
status->mode = net_buf_simple_pull_u8(buf); status->mode = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lc_mode_status); len = sizeof(struct bt_mesh_light_lc_mode_status);
break; break;
} }
@ -596,7 +596,7 @@ static void light_status(struct bt_mesh_model *model,
return; return;
} }
status->mode = net_buf_simple_pull_u8(buf); status->mode = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lc_om_status); len = sizeof(struct bt_mesh_light_lc_om_status);
break; break;
} }
@ -617,7 +617,7 @@ static void light_status(struct bt_mesh_model *model,
status->target_light_onoff = net_buf_simple_pull_u8(buf); status->target_light_onoff = net_buf_simple_pull_u8(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lc_light_onoff_status); len = sizeof(struct bt_mesh_light_lc_light_onoff_status);
break; break;
} }
@ -636,7 +636,7 @@ static void light_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->light_lc_property_value, buf->data, buf->len); net_buf_simple_add_mem(status->light_lc_property_value, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_light_lc_property_status); len = sizeof(struct bt_mesh_light_lc_property_status);
break; break;
} }
@ -707,7 +707,7 @@ static void light_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_lighting_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len); bt_mesh_lighting_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len);
} }
@ -798,7 +798,7 @@ static int light_get_state(bt_mesh_client_common_param_t *common, void *value)
} }
static int light_set_state(bt_mesh_client_common_param_t *common, static int light_set_state(bt_mesh_client_common_param_t *common,
void *value, u16_t value_len, bool need_ack) void *value, uint16_t value_len, bool need_ack)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
int err = 0; int err = 0;
@ -1088,7 +1088,7 @@ int bt_mesh_light_client_get_state(bt_mesh_client_common_param_t *common, void *
int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set) int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set)
{ {
bt_mesh_light_client_t *client = NULL; bt_mesh_light_client_t *client = NULL;
u16_t length = 0U; uint16_t length = 0U;
bool need_ack = false; bool need_ack = false;
if (!common || !common->model || !set) { if (!common || !common->model || !set) {

View File

@ -81,7 +81,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive sensor status message timeout"); BT_WARN("Receive sensor status message timeout");
@ -110,8 +110,8 @@ static void sensor_status(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
u8_t *val = NULL; uint8_t *val = NULL;
u8_t evt = 0xFF; uint8_t evt = 0xFF;
size_t len = 0U; size_t len = 0U;
BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len));
@ -131,7 +131,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->descriptor, buf->data, buf->len); net_buf_simple_add_mem(status->descriptor, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_descriptor_status); len = sizeof(struct bt_mesh_sensor_descriptor_status);
break; break;
} }
@ -150,7 +150,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->sensor_cadence_value, buf->data, buf->len); net_buf_simple_add_mem(status->sensor_cadence_value, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_cadence_status); len = sizeof(struct bt_mesh_sensor_cadence_status);
break; break;
} }
@ -169,7 +169,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->sensor_setting_property_ids, buf->data, buf->len); net_buf_simple_add_mem(status->sensor_setting_property_ids, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_settings_status); len = sizeof(struct bt_mesh_sensor_settings_status);
break; break;
} }
@ -193,7 +193,7 @@ static void sensor_status(struct bt_mesh_model *model,
} }
net_buf_simple_add_mem(status->sensor_setting_raw, buf->data, buf->len); net_buf_simple_add_mem(status->sensor_setting_raw, buf->data, buf->len);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_setting_status); len = sizeof(struct bt_mesh_sensor_setting_status);
break; break;
} }
@ -211,7 +211,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->marshalled_sensor_data, buf->data, buf->len); net_buf_simple_add_mem(status->marshalled_sensor_data, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_status); len = sizeof(struct bt_mesh_sensor_status);
break; break;
} }
@ -230,7 +230,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->sensor_column_value, buf->data, buf->len); net_buf_simple_add_mem(status->sensor_column_value, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_column_status); len = sizeof(struct bt_mesh_sensor_column_status);
break; break;
} }
@ -249,7 +249,7 @@ static void sensor_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->sensor_series_value, buf->data, buf->len); net_buf_simple_add_mem(status->sensor_series_value, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_sensor_series_status); len = sizeof(struct bt_mesh_sensor_series_status);
break; break;
} }
@ -286,7 +286,7 @@ static void sensor_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_sensor_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len); bt_mesh_sensor_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len);
} }
@ -358,7 +358,7 @@ const struct bt_mesh_model_op bt_mesh_sensor_cli_op[] = {
}; };
static int sensor_act_state(bt_mesh_client_common_param_t *common, static int sensor_act_state(bt_mesh_client_common_param_t *common,
void *value, u16_t value_len, bool need_ack) void *value, uint16_t value_len, bool need_ack)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
int err = 0; int err = 0;
@ -462,7 +462,7 @@ end:
int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get) int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get)
{ {
bt_mesh_sensor_client_t *client = NULL; bt_mesh_sensor_client_t *client = NULL;
u16_t length = 0U; uint16_t length = 0U;
if (!common || !common->model || !get) { if (!common || !common->model || !get) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -527,7 +527,7 @@ int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void
int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set) int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set)
{ {
bt_mesh_sensor_client_t *client = NULL; bt_mesh_sensor_client_t *client = NULL;
u16_t length = 0U; uint16_t length = 0U;
bool need_ack = false; bool need_ack = false;
if (!common || !common->model || !set) { if (!common || !common->model || !set) {

View File

@ -97,7 +97,7 @@ static void timeout_handler(struct k_work *work)
struct k_delayed_work *timer = NULL; struct k_delayed_work *timer = NULL;
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
struct bt_mesh_msg_ctx ctx = {0}; struct bt_mesh_msg_ctx ctx = {0};
u32_t opcode = 0U; uint32_t opcode = 0U;
BT_WARN("Receive time scene status message timeout"); BT_WARN("Receive time scene status message timeout");
@ -126,8 +126,8 @@ static void time_scene_status(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
bt_mesh_client_node_t *node = NULL; bt_mesh_client_node_t *node = NULL;
u8_t *val = NULL; uint8_t *val = NULL;
u8_t evt = 0xFF; uint8_t evt = 0xFF;
size_t len = 0U; size_t len = 0U;
BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len)); BT_DBG("len %d, bytes %s", buf->len, bt_hex(buf->data, buf->len));
@ -148,11 +148,11 @@ static void time_scene_status(struct bt_mesh_model *model,
net_buf_simple_pull(buf, 5); net_buf_simple_pull(buf, 5);
status->sub_second = net_buf_simple_pull_u8(buf); status->sub_second = net_buf_simple_pull_u8(buf);
status->uncertainty = net_buf_simple_pull_u8(buf); status->uncertainty = net_buf_simple_pull_u8(buf);
u16_t temp = net_buf_simple_pull_le16(buf); uint16_t temp = net_buf_simple_pull_le16(buf);
status->time_authority = temp & BIT(0); status->time_authority = temp & BIT(0);
status->tai_utc_delta = temp >> 15; status->tai_utc_delta = temp >> 15;
status->time_zone_offset = net_buf_simple_pull_u8(buf); status->time_zone_offset = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_time_status); len = sizeof(struct bt_mesh_time_status);
break; break;
} }
@ -171,7 +171,7 @@ static void time_scene_status(struct bt_mesh_model *model,
status->time_zone_offset_new = net_buf_simple_pull_u8(buf); status->time_zone_offset_new = net_buf_simple_pull_u8(buf);
memcpy(status->tai_zone_change, buf->data, 5); memcpy(status->tai_zone_change, buf->data, 5);
net_buf_simple_pull(buf, 5); net_buf_simple_pull(buf, 5);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_time_zone_status); len = sizeof(struct bt_mesh_time_zone_status);
break; break;
} }
@ -186,7 +186,7 @@ static void time_scene_status(struct bt_mesh_model *model,
BT_ERR("%s, Out of memory", __func__); BT_ERR("%s, Out of memory", __func__);
return; return;
} }
u16_t temp = net_buf_simple_pull_le16(buf); uint16_t temp = net_buf_simple_pull_le16(buf);
status->tai_utc_delta_curr = temp & BIT_MASK(15); status->tai_utc_delta_curr = temp & BIT_MASK(15);
status->padding_1 = (temp >> 15) & BIT(0); status->padding_1 = (temp >> 15) & BIT(0);
temp = net_buf_simple_pull_le16(buf); temp = net_buf_simple_pull_le16(buf);
@ -194,7 +194,7 @@ static void time_scene_status(struct bt_mesh_model *model,
status->padding_2 = (temp >> 15) & BIT(0); status->padding_2 = (temp >> 15) & BIT(0);
memcpy(status->tai_delta_change, buf->data, 5); memcpy(status->tai_delta_change, buf->data, 5);
net_buf_simple_pull(buf, 5); net_buf_simple_pull(buf, 5);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_tai_utc_delta_status); len = sizeof(struct bt_mesh_tai_utc_delta_status);
break; break;
} }
@ -210,7 +210,7 @@ static void time_scene_status(struct bt_mesh_model *model,
return; return;
} }
status->time_role = net_buf_simple_pull_u8(buf); status->time_role = net_buf_simple_pull_u8(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_time_role_status); len = sizeof(struct bt_mesh_time_role_status);
break; break;
} }
@ -232,7 +232,7 @@ static void time_scene_status(struct bt_mesh_model *model,
status->target_scene = net_buf_simple_pull_le16(buf); status->target_scene = net_buf_simple_pull_le16(buf);
status->remain_time = net_buf_simple_pull_u8(buf); status->remain_time = net_buf_simple_pull_u8(buf);
} }
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_scene_status); len = sizeof(struct bt_mesh_scene_status);
break; break;
} }
@ -252,7 +252,7 @@ static void time_scene_status(struct bt_mesh_model *model,
return; return;
} }
net_buf_simple_add_mem(status->scenes, buf->data, buf->len); net_buf_simple_add_mem(status->scenes, buf->data, buf->len);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_scene_register_status); len = sizeof(struct bt_mesh_scene_register_status);
break; break;
} }
@ -268,7 +268,7 @@ static void time_scene_status(struct bt_mesh_model *model,
return; return;
} }
status->schedules = net_buf_simple_pull_le16(buf); status->schedules = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_scheduler_status); len = sizeof(struct bt_mesh_scheduler_status);
break; break;
} }
@ -286,7 +286,7 @@ static void time_scene_status(struct bt_mesh_model *model,
memcpy(status, buf->data, offsetof(struct bt_mesh_scheduler_act_status, scene_number)); memcpy(status, buf->data, offsetof(struct bt_mesh_scheduler_act_status, scene_number));
net_buf_simple_pull(buf, offsetof(struct bt_mesh_scheduler_act_status, scene_number)); net_buf_simple_pull(buf, offsetof(struct bt_mesh_scheduler_act_status, scene_number));
status->scene_number = net_buf_simple_pull_le16(buf); status->scene_number = net_buf_simple_pull_le16(buf);
val = (u8_t *)status; val = (uint8_t *)status;
len = sizeof(struct bt_mesh_scheduler_act_status); len = sizeof(struct bt_mesh_scheduler_act_status);
break; break;
} }
@ -330,7 +330,7 @@ static void time_scene_status(struct bt_mesh_model *model,
} }
if (!k_delayed_work_free(&node->timer)) { if (!k_delayed_work_free(&node->timer)) {
u32_t opcode = node->opcode; uint32_t opcode = node->opcode;
bt_mesh_client_free_node(node); bt_mesh_client_free_node(node);
bt_mesh_time_scene_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len); bt_mesh_time_scene_client_cb_evt_to_btc(opcode, evt, model, ctx, val, len);
} }
@ -398,7 +398,7 @@ static int time_scene_get_state(bt_mesh_client_common_param_t *common, void *val
} }
static int time_scene_set_state(bt_mesh_client_common_param_t *common, static int time_scene_set_state(bt_mesh_client_common_param_t *common,
void *value, u16_t value_len, bool need_ack) void *value, uint16_t value_len, bool need_ack)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
int err = 0; int err = 0;
@ -530,7 +530,7 @@ int bt_mesh_time_scene_client_get_state(bt_mesh_client_common_param_t *common, v
int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set) int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set)
{ {
bt_mesh_time_scene_client_t *client = NULL; bt_mesh_time_scene_client_t *client = NULL;
u16_t length = 0U; uint16_t length = 0U;
bool need_ack = false; bool need_ack = false;
if (!common || !common->model || !set) { if (!common || !common->model || !set) {

View File

@ -17,8 +17,8 @@
#include "device_property.h" #include "device_property.h"
static struct bt_mesh_dev_prop { static struct bt_mesh_dev_prop {
u16_t prop_id; uint16_t prop_id;
u8_t len; uint8_t len;
} device_properties[] = { } device_properties[] = {
{ BLE_MESH_INVALID_DEVICE_PROPERTY_ID, 0xFF }, /* Prohibited */ { BLE_MESH_INVALID_DEVICE_PROPERTY_ID, 0xFF }, /* Prohibited */
{ BLE_MESH_AVERAGE_AMBIENT_TEMPERATURE_IN_A_PERIOD_OF_DAY, 0x03 }, { BLE_MESH_AVERAGE_AMBIENT_TEMPERATURE_IN_A_PERIOD_OF_DAY, 0x03 },
@ -206,7 +206,7 @@ static struct bt_mesh_dev_prop {
{ BLE_MESH_OUTPUT_CURRENT_PERCENT, 0x01 }, { BLE_MESH_OUTPUT_CURRENT_PERCENT, 0x01 },
}; };
u8_t bt_mesh_get_dev_prop_len(u16_t prop_id) uint8_t bt_mesh_get_dev_prop_len(uint16_t prop_id)
{ {
if (prop_id > BLE_MESH_OUTPUT_CURRENT_PERCENT) { if (prop_id > BLE_MESH_OUTPUT_CURRENT_PERCENT) {
BT_ERR("Unknown Device Property ID 0x%04x", prop_id); BT_ERR("Unknown Device Property ID 0x%04x", prop_id);

View File

@ -824,9 +824,9 @@ extern "C" {
*/ */
/* Unit is in degrees Celsius with a resolution of 0.01 degrees Celsius. */ /* Unit is in degrees Celsius with a resolution of 0.01 degrees Celsius. */
typedef s16_t bt_mesh_temperature_t; typedef int16_t bt_mesh_temperature_t;
typedef u16_t bt_mesh_gap_appearance_t; typedef uint16_t bt_mesh_gap_appearance_t;
/* Mesh Characteristics Type Definitions */ /* Mesh Characteristics Type Definitions */
@ -835,7 +835,7 @@ typedef u16_t bt_mesh_gap_appearance_t;
* Minimum value: 0, maximum value: 655.34; * Minimum value: 0, maximum value: 655.34;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_electric_current_t; typedef uint16_t bt_mesh_electric_current_t;
/* The Time Exponential 8 characteristic is used to represent a measure of period of /* The Time Exponential 8 characteristic is used to represent a measure of period of
* time in seconds. * time in seconds.
@ -845,7 +845,7 @@ typedef u16_t bt_mesh_electric_current_t;
* A raw value of 0x00 represents 0 seconds, and a raw value of 0xFF represents * A raw value of 0x00 represents 0 seconds, and a raw value of 0xFF represents
* the total life of the device. * the total life of the device.
*/ */
typedef u8_t bt_mesh_time_exponential_8_t; typedef uint8_t bt_mesh_time_exponential_8_t;
/* The Voltage characteristic is used to represent a measure of positive electric /* The Voltage characteristic is used to represent a measure of positive electric
* potential difference in units of volts. * potential difference in units of volts.
@ -855,7 +855,7 @@ typedef u8_t bt_mesh_time_exponential_8_t;
* value represents the minimum value or lower, the maximum representable value * value represents the minimum value or lower, the maximum representable value
* represents the maximum value or higher. * represents the maximum value or higher.
*/ */
typedef u16_t bt_mesh_voltage_t; typedef uint16_t bt_mesh_voltage_t;
/* This characteristic aggregates the Electric Current characteristic and instance of /* This characteristic aggregates the Electric Current characteristic and instance of
* the Time Exponential 8 characteristic. * the Time Exponential 8 characteristic.
@ -879,7 +879,7 @@ typedef struct __packed average_voltage {
* 1 | True * 1 | True
* 2 to 255 | Prohibited * 2 to 255 | Prohibited
*/ */
typedef u8_t bt_mesh_boolean_t; typedef uint8_t bt_mesh_boolean_t;
/* The Chromatic Distance From Planckian characteristic represents a distance of a /* The Chromatic Distance From Planckian characteristic represents a distance of a
* chromaticity coordinate from the Planckian locus in the (u',2/3 v') diagram as * chromaticity coordinate from the Planckian locus in the (u',2/3 v') diagram as
@ -892,14 +892,14 @@ typedef u8_t bt_mesh_boolean_t;
* A value of 0xFFFF represents 'value is not known'; * A value of 0xFFFF represents 'value is not known';
* A value of 0xFFFE represents 'value is not valid'. * A value of 0xFFFE represents 'value is not valid'.
*/ */
typedef s16_t bt_mesh_chromatic_distance_from_planckian_t; typedef int16_t bt_mesh_chromatic_distance_from_planckian_t;
/* This characteristic represents a chromaticity coordinate in a color diagram such as /* This characteristic represents a chromaticity coordinate in a color diagram such as
* the CIE1931 diagram. It can represent an x or y coordinate. * the CIE1931 diagram. It can represent an x or y coordinate.
* Note: Unit is unitless with a resolution of 1/65535; * Note: Unit is unitless with a resolution of 1/65535;
* Minimum value: 0, maximum value: 1.0. * Minimum value: 0, maximum value: 1.0.
*/ */
typedef u16_t bt_mesh_chromaticity_coordinate_t; typedef uint16_t bt_mesh_chromaticity_coordinate_t;
/* This characteristic represents a chromaticity coordinate as a tuple with an x and /* This characteristic represents a chromaticity coordinate as a tuple with an x and
* y coordinate. * y coordinate.
@ -915,7 +915,7 @@ typedef struct __packed chromaticity_coordinates {
* Minimum value: 800, maximum value: 65534; * Minimum value: 800, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_correlated_color_temperature_t; typedef uint16_t bt_mesh_correlated_color_temperature_t;
/* The Chromaticity In CCT And Duv Values characteristic is a composite characteristic /* The Chromaticity In CCT And Duv Values characteristic is a composite characteristic
* consisting of the Correlated Color Temperature characteristic and the Chromatic * consisting of the Correlated Color Temperature characteristic and the Chromatic
@ -932,14 +932,14 @@ typedef struct __packed chromaticity_in_cct_and_duv_values {
* Note: Unit is unitless with a resolution of 0.0001; * Note: Unit is unitless with a resolution of 0.0001;
* Minimum value: 0, maximum value: 0.0255. * Minimum value: 0, maximum value: 0.0255.
*/ */
typedef u8_t bt_mesh_chromaticity_tolerance_t; typedef uint8_t bt_mesh_chromaticity_tolerance_t;
/* The CIE 13.3-1995 Color Rendering Index characteristic is a color rendition index value /* The CIE 13.3-1995 Color Rendering Index characteristic is a color rendition index value
* for a color patch as calculated in accordance with the CIE 13.3-1995 standard. * for a color patch as calculated in accordance with the CIE 13.3-1995 standard.
* Note: Unit is unitless with a resolution of 1; * Note: Unit is unitless with a resolution of 1;
* Minimum value: -128, maximum value: 100. * Minimum value: -128, maximum value: 100.
*/ */
typedef s8_t bt_mesh_cie_13_3_1995_color_rendering_index_t; typedef int8_t bt_mesh_cie_13_3_1995_color_rendering_index_t;
/* The Coefficient characteristic is used to represent a general coefficient value. */ /* The Coefficient characteristic is used to represent a general coefficient value. */
typedef float bt_mesh_coefficient_t; typedef float bt_mesh_coefficient_t;
@ -949,14 +949,14 @@ typedef float bt_mesh_coefficient_t;
* Minimum value: 0, maximum value 65534; * Minimum value: 0, maximum value 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_count_16_t; typedef uint16_t bt_mesh_count_16_t;
/* The Count 24 characteristic is used to represent a general count value. /* The Count 24 characteristic is used to represent a general count value.
* Note: Unit is unitless with a resolution of 1; * Note: Unit is unitless with a resolution of 1;
* Minimum value: 0, maximum value 16777214; * Minimum value: 0, maximum value 16777214;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_count_24_t[3]; typedef uint8_t bt_mesh_count_24_t[3];
/* This characteristic represents a country or dependent areas in accordance with /* This characteristic represents a country or dependent areas in accordance with
* the ISO 3166-1 Numeric standard. * the ISO 3166-1 Numeric standard.
@ -964,7 +964,7 @@ typedef u8_t bt_mesh_count_24_t[3];
* Minimum value: 0, maximum value: 4095; * Minimum value: 0, maximum value: 4095;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_country_code_t; typedef uint16_t bt_mesh_country_code_t;
/* Date as days elapsed since the Epoch (Jan 1, 1970) in the Coordinated Universal /* Date as days elapsed since the Epoch (Jan 1, 1970) in the Coordinated Universal
* Time (UTC) time zone. * Time (UTC) time zone.
@ -972,7 +972,7 @@ typedef u16_t bt_mesh_country_code_t;
* Minimum value: 1, maximum value: 16777214; * Minimum value: 1, maximum value: 16777214;
* A value of 0x000000 represents 'value is not known'. * A value of 0x000000 represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_date_utc_t[3]; typedef uint8_t bt_mesh_date_utc_t[3];
/* This characteristic aggregates two instances of the Electric Current characteristic /* This characteristic aggregates two instances of the Electric Current characteristic
* to represent a range of Electric Current values. * to represent a range of Electric Current values.
@ -1008,7 +1008,7 @@ typedef struct __packed electric_current_statistics {
* Minimum value: 0, maximum value: 16777214; * Minimum value: 0, maximum value: 16777214;
* A value of 0xFFFFFF represents value is not known. * A value of 0xFFFFFF represents value is not known.
*/ */
typedef u8_t bt_mesh_energy_t[3]; typedef uint8_t bt_mesh_energy_t[3];
/* The Time Decihour 8 characteristic is used to represent a period of time in /* The Time Decihour 8 characteristic is used to represent a period of time in
* tenths of an hour. * tenths of an hour.
@ -1016,7 +1016,7 @@ typedef u8_t bt_mesh_energy_t[3];
* Minimum value: 0.0, maximum value: 24.0; * Minimum value: 0.0, maximum value: 24.0;
* A value of 0xFF represents 'value is not known'. All other values are Prohibited. * A value of 0xFF represents 'value is not known'. All other values are Prohibited.
*/ */
typedef u8_t bt_mesh_time_decihour_8_t; typedef uint8_t bt_mesh_time_decihour_8_t;
/* This characteristic aggregates the Energy characteristic, and two instances of /* This characteristic aggregates the Energy characteristic, and two instances of
* the Time Decihour 8 characteristic, to represent energy use in a period of day. * the Time Decihour 8 characteristic, to represent energy use in a period of day.
@ -1033,7 +1033,7 @@ typedef struct __packed energy_in_a_period_of_day {
* Minimum value: 0, maximum value: 65534; * Minimum value: 0, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_time_second_16_t; typedef uint16_t bt_mesh_time_second_16_t;
/* This characteristic aggregates the Count 16 characteristic, two instances of the /* This characteristic aggregates the Count 16 characteristic, two instances of the
* Time Decihour 8 characteristic and an instance of the Sensing Duration characteristic, * Time Decihour 8 characteristic and an instance of the Sensing Duration characteristic,
@ -1063,13 +1063,13 @@ typedef char bt_mesh_fixed_string_8_t[8];
* Note: Unit is unitless with a resolution of 1; * Note: Unit is unitless with a resolution of 1;
* Minimum value: 0, maximum value: 65535. * Minimum value: 0, maximum value: 65535.
*/ */
typedef u16_t bt_mesh_generic_level_t; typedef uint16_t bt_mesh_generic_level_t;
/* The Global Trade Item Number characteristic represents an identifier as /* The Global Trade Item Number characteristic represents an identifier as
* issued by GS1 General Specifications, which may consist up to 14 digits, * issued by GS1 General Specifications, which may consist up to 14 digits,
* and is here represented as a 48-bit unsigned integer. * and is here represented as a 48-bit unsigned integer.
*/ */
typedef u8_t bt_mesh_global_trade_item_number_t[6]; typedef uint8_t bt_mesh_global_trade_item_number_t[6];
/* The Illuminance characteristic is used to represent a measure of illuminance /* The Illuminance characteristic is used to represent a measure of illuminance
* in units of lux. * in units of lux.
@ -1077,7 +1077,7 @@ typedef u8_t bt_mesh_global_trade_item_number_t[6];
* Minimum value: 0, maximum value: 167772.14; * Minimum value: 0, maximum value: 167772.14;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_illuminance_t[3]; typedef uint8_t bt_mesh_illuminance_t[3];
/* The Luminous Efficacy characteristic is used to represent a measure of luminous /* The Luminous Efficacy characteristic is used to represent a measure of luminous
* efficacy in units of lumen per watt. * efficacy in units of lumen per watt.
@ -1085,7 +1085,7 @@ typedef u8_t bt_mesh_illuminance_t[3];
* Minimum value: 0, maximum value: 1800; * Minimum value: 0, maximum value: 1800;
* A value of 0xFFFF represents 'value is not known'. All other values are Prohibited. * A value of 0xFFFF represents 'value is not known'. All other values are Prohibited.
*/ */
typedef u16_t bt_mesh_luminous_efficacy_t; typedef uint16_t bt_mesh_luminous_efficacy_t;
/* The Luminous Energy characteristic is used to represent a measure of luminous /* The Luminous Energy characteristic is used to represent a measure of luminous
* energy in units of lumen hour. * energy in units of lumen hour.
@ -1093,7 +1093,7 @@ typedef u16_t bt_mesh_luminous_efficacy_t;
* Minimum value: 0, maximum value: 16777214000; * Minimum value: 0, maximum value: 16777214000;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_luminous_energy_t[3]; typedef uint8_t bt_mesh_luminous_energy_t[3];
/* The Luminous Exposure characteristic is used to represent a measure of luminous /* The Luminous Exposure characteristic is used to represent a measure of luminous
* exposure in units of lux-hour. * exposure in units of lux-hour.
@ -1101,7 +1101,7 @@ typedef u8_t bt_mesh_luminous_energy_t[3];
* Minimum value: 0, maximum value: 16777214000; * Minimum value: 0, maximum value: 16777214000;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_luminous_exposure_t[3]; typedef uint8_t bt_mesh_luminous_exposure_t[3];
/* The Luminous Flux characteristic is used to represent a measure of luminous flux /* The Luminous Flux characteristic is used to represent a measure of luminous flux
* in units of lumen. * in units of lumen.
@ -1109,7 +1109,7 @@ typedef u8_t bt_mesh_luminous_exposure_t[3];
* Minimum value: 0, maximum value: 65534; * Minimum value: 0, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_luminous_flux_t; typedef uint16_t bt_mesh_luminous_flux_t;
/* This characteristic aggregates two instances of the Luminous Flux characteristic /* This characteristic aggregates two instances of the Luminous Flux characteristic
* to represent a luminous flux range. * to represent a luminous flux range.
@ -1125,14 +1125,14 @@ typedef struct __packed luminous_flux_range {
* Minimum value: 0, maximum value: 65534; * Minimum value: 0, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_luminous_intensity_t; typedef uint16_t bt_mesh_luminous_intensity_t;
/* The Mass Flow characteristic is used to represent a flow of mass. /* The Mass Flow characteristic is used to represent a flow of mass.
* Note: Unit is gram/second with a resolution of 1; * Note: Unit is gram/second with a resolution of 1;
* Minimum value: 0, maximum value: 65534; * Minimum value: 0, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_mass_flow_t; typedef uint16_t bt_mesh_mass_flow_t;
/* The Mesh Provisioning Data In characteristic can be written to send a Proxy PDU /* The Mesh Provisioning Data In characteristic can be written to send a Proxy PDU
* message containing Provisioning PDU to the Provisioning Server. * message containing Provisioning PDU to the Provisioning Server.
@ -1167,21 +1167,21 @@ struct mesh_proxy_data_out {
* Note: Unit is unitless with a resolution of 1; * Note: Unit is unitless with a resolution of 1;
* Minimum value: 0, maximum value: 65535. * Minimum value: 0, maximum value: 65535.
*/ */
typedef u16_t bt_mesh_perceived_lightness_t; typedef uint16_t bt_mesh_perceived_lightness_t;
/* The Percentage 8 characteristic is used to represent a measure of percentage. /* The Percentage 8 characteristic is used to represent a measure of percentage.
* Note: Unit is a percentage with a resolution of 0.5; * Note: Unit is a percentage with a resolution of 0.5;
* Minimum value: 0, maximum value: 100; * Minimum value: 0, maximum value: 100;
* A value of 0xFF represents 'value is not known'. All other values are Prohibited. * A value of 0xFF represents 'value is not known'. All other values are Prohibited.
*/ */
typedef u8_t bt_mesh_percentage_8_t; typedef uint8_t bt_mesh_percentage_8_t;
/* The Power characteristic is used to represent a measure of power in units of watts. /* The Power characteristic is used to represent a measure of power in units of watts.
* Note: Unit is watt with a resolution of 0.1; * Note: Unit is watt with a resolution of 0.1;
* Minimum value: 0, maximum value: 1677721.4; * Minimum value: 0, maximum value: 1677721.4;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_power_t[3]; typedef uint8_t bt_mesh_power_t[3];
/* This characteristic aggregates three instances of the Power characteristic to /* This characteristic aggregates three instances of the Power characteristic to
* represent a specification of Power values. * represent a specification of Power values.
@ -1253,7 +1253,7 @@ typedef struct __packed relative_value_in_an_illuminance_range {
* Minimum value: -64.0, maximum value: 63.5; * Minimum value: -64.0, maximum value: 63.5;
* A value of 0xFF represents 'value is not known'. * A value of 0xFF represents 'value is not known'.
*/ */
typedef s8_t bt_mesh_temperature_8_t; typedef int8_t bt_mesh_temperature_8_t;
/* This characteristic aggregates the Temperature 8 characteristic, and two instances /* This characteristic aggregates the Temperature 8 characteristic, and two instances
* of the Time Decihour 8 characteristic, to represent a temperature value in a period * of the Time Decihour 8 characteristic, to represent a temperature value in a period
@ -1300,7 +1300,7 @@ typedef struct __packed temperature_statistics {
* Minimum value: 0, maximum value: 16777214; * Minimum value: 0, maximum value: 16777214;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_time_hour_24_t[3]; typedef uint8_t bt_mesh_time_hour_24_t[3];
/* The Time Millisecond 24 characteristic is used to represent a period of time with /* The Time Millisecond 24 characteristic is used to represent a period of time with
* a resolution of 1 millisecond. * a resolution of 1 millisecond.
@ -1308,7 +1308,7 @@ typedef u8_t bt_mesh_time_hour_24_t[3];
* Minimum value: 0, maximum value: 16777.214; * Minimum value: 0, maximum value: 16777.214;
* A value of 0xFFFFFF represents 'value is not known'. * A value of 0xFFFFFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_time_millisecond_24_t[3]; typedef uint8_t bt_mesh_time_millisecond_24_t[3];
/* The Time Second 8 characteristic is used to represent a period of time with a unit /* The Time Second 8 characteristic is used to represent a period of time with a unit
* of 1 second. * of 1 second.
@ -1316,7 +1316,7 @@ typedef u8_t bt_mesh_time_millisecond_24_t[3];
* Minimum value: 0, maximum value: 254; * Minimum value: 0, maximum value: 254;
* A value of 0xFF represents 'value is not known'. * A value of 0xFF represents 'value is not known'.
*/ */
typedef u8_t bt_mesh_time_second_8_t; typedef uint8_t bt_mesh_time_second_8_t;
/* This characteristic aggregates three instances of the Voltage characteristic to /* This characteristic aggregates three instances of the Voltage characteristic to
* represent a specification of voltage values. * represent a specification of voltage values.
@ -1345,11 +1345,11 @@ typedef struct __packed voltage_statistics {
* Minimum value: 0, maximum value: 65534; * Minimum value: 0, maximum value: 65534;
* A value of 0xFFFF represents 'value is not known'. * A value of 0xFFFF represents 'value is not known'.
*/ */
typedef u16_t bt_mesh_volume_flow_t; typedef uint16_t bt_mesh_volume_flow_t;
/* Mesh Device Property related function */ /* Mesh Device Property related function */
u8_t bt_mesh_get_dev_prop_len(u16_t prop_id); uint8_t bt_mesh_get_dev_prop_len(uint16_t prop_id);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -54,7 +54,7 @@ static void send_gen_onoff_status(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_onoff_srv *srv = model->user_data; struct bt_mesh_gen_onoff_srv *srv = model->user_data;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 2 + 3; uint8_t length = 2 + 3;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -129,9 +129,9 @@ static void gen_onoff_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_onoff_srv *srv = model->user_data; struct bt_mesh_gen_onoff_srv *srv = model->user_data;
u8_t tid = 0U, onoff = 0U, trans_time = 0U, delay = 0U; uint8_t tid = 0U, onoff = 0U, trans_time = 0U, delay = 0U;
bool optional = false; bool optional = false;
s64_t now = 0; int64_t now = 0;
if (srv == NULL) { if (srv == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -159,7 +159,7 @@ static void gen_onoff_set(struct bt_mesh_model *model,
.onoff_set.delay = delay, .onoff_set.delay = delay,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -186,7 +186,7 @@ static void gen_onoff_set(struct bt_mesh_model *model,
.gen_onoff_set.onoff = srv->state.onoff, .gen_onoff_set.onoff = srv->state.onoff,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ONOFF_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ONOFF_SET) {
send_gen_onoff_status(model, ctx, false); send_gen_onoff_status(model, ctx, false);
@ -226,7 +226,7 @@ static void send_gen_level_status(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_level_srv *srv = model->user_data; struct bt_mesh_gen_level_srv *srv = model->user_data;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 2 + 5; uint8_t length = 2 + 5;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -310,17 +310,17 @@ static void gen_level_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_level_srv *srv = model->user_data; struct bt_mesh_gen_level_srv *srv = model->user_data;
u8_t tid = 0U, trans_time = 0U, delay = 0U; uint8_t tid = 0U, trans_time = 0U, delay = 0U;
bool optional = false; bool optional = false;
s16_t level = 0; int16_t level = 0;
s64_t now = 0; int64_t now = 0;
if (srv == NULL) { if (srv == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
return; return;
} }
level = (s16_t) net_buf_simple_pull_le16(buf); level = (int16_t) net_buf_simple_pull_le16(buf);
tid = net_buf_simple_pull_u8(buf); tid = net_buf_simple_pull_u8(buf);
if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) { if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) {
@ -337,7 +337,7 @@ static void gen_level_set(struct bt_mesh_model *model,
.level_set.delay = delay, .level_set.delay = delay,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -368,7 +368,7 @@ static void gen_level_set(struct bt_mesh_model *model,
.gen_level_set.level = srv->state.level, .gen_level_set.level = srv->state.level,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_LEVEL_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_LEVEL_SET) {
send_gen_level_status(model, ctx, false); send_gen_level_status(model, ctx, false);
@ -406,17 +406,17 @@ static void gen_delta_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_level_srv *srv = model->user_data; struct bt_mesh_gen_level_srv *srv = model->user_data;
u8_t tid = 0U, trans_time = 0U, delay = 0U; uint8_t tid = 0U, trans_time = 0U, delay = 0U;
s32_t tmp32 = 0, delta = 0; int32_t tmp32 = 0, delta = 0;
bool optional = false; bool optional = false;
s64_t now = 0; int64_t now = 0;
if (srv == NULL) { if (srv == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
return; return;
} }
delta = (s32_t)net_buf_simple_pull_le32(buf); delta = (int32_t)net_buf_simple_pull_le32(buf);
tid = net_buf_simple_pull_u8(buf); tid = net_buf_simple_pull_u8(buf);
if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) { if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) {
@ -433,7 +433,7 @@ static void gen_delta_set(struct bt_mesh_model *model,
.delta_set.delay = delay, .delta_set.delay = delay,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -489,7 +489,7 @@ static void gen_delta_set(struct bt_mesh_model *model,
.gen_delta_set.level = srv->state.level, .gen_delta_set.level = srv->state.level,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_DELTA_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_DELTA_SET) {
send_gen_level_status(model, ctx, false); send_gen_level_status(model, ctx, false);
@ -527,18 +527,18 @@ static void gen_move_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_level_srv *srv = model->user_data; struct bt_mesh_gen_level_srv *srv = model->user_data;
u8_t tid = 0U, trans_time = 0U, delay = 0U; uint8_t tid = 0U, trans_time = 0U, delay = 0U;
bool optional = false; bool optional = false;
s16_t delta = 0; int16_t delta = 0;
s32_t tmp32 = 0; int32_t tmp32 = 0;
s64_t now = 0; int64_t now = 0;
if (srv == NULL) { if (srv == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
return; return;
} }
delta = (s16_t) net_buf_simple_pull_le16(buf); delta = (int16_t) net_buf_simple_pull_le16(buf);
tid = net_buf_simple_pull_u8(buf); tid = net_buf_simple_pull_u8(buf);
if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) { if (bt_mesh_server_get_optional(model, ctx, buf, &trans_time, &delay, &optional)) {
@ -555,7 +555,7 @@ static void gen_move_set(struct bt_mesh_model *model,
.move_set.delay = delay, .move_set.delay = delay,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -594,7 +594,7 @@ static void gen_move_set(struct bt_mesh_model *model,
.gen_move_set.level = srv->state.level, .gen_move_set.level = srv->state.level,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MOVE_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MOVE_SET) {
send_gen_level_status(model, ctx, false); send_gen_level_status(model, ctx, false);
@ -640,7 +640,7 @@ static void gen_move_set(struct bt_mesh_model *model,
.gen_move_set.level = srv->state.level, .gen_move_set.level = srv->state.level,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
return; return;
} }
@ -655,7 +655,7 @@ static void send_gen_def_trans_time_status(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_def_trans_time_srv *srv = model->user_data; struct bt_mesh_gen_def_trans_time_srv *srv = model->user_data;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 2 + 1; uint8_t length = 2 + 1;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -714,7 +714,7 @@ static void gen_def_trans_time_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_def_trans_time_srv *srv = model->user_data; struct bt_mesh_gen_def_trans_time_srv *srv = model->user_data;
u8_t trans_time = 0U; uint8_t trans_time = 0U;
if (srv == NULL) { if (srv == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -733,7 +733,7 @@ static void gen_def_trans_time_set(struct bt_mesh_model *model,
.def_trans_time_set.trans_time = trans_time, .def_trans_time_set.trans_time = trans_time,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -745,7 +745,7 @@ static void gen_def_trans_time_set(struct bt_mesh_model *model,
.gen_def_trans_time_set.trans_time = trans_time, .gen_def_trans_time_set.trans_time = trans_time,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET) {
send_gen_def_trans_time_status(model, ctx, false); send_gen_def_trans_time_status(model, ctx, false);
@ -761,7 +761,7 @@ static void send_gen_onpowerup_status(struct bt_mesh_model *model,
bool publish) bool publish)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 2 + 1; uint8_t length = 2 + 1;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -871,7 +871,7 @@ static void gen_onpowerup_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_power_onoff_setup_srv *srv = model->user_data; struct bt_mesh_gen_power_onoff_setup_srv *srv = model->user_data;
u8_t onpowerup = 0U; uint8_t onpowerup = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -890,7 +890,7 @@ static void gen_onpowerup_set(struct bt_mesh_model *model,
.onpowerup_set.onpowerup = onpowerup, .onpowerup_set.onpowerup = onpowerup,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -902,7 +902,7 @@ static void gen_onpowerup_set(struct bt_mesh_model *model,
.gen_onpowerup_set.onpowerup = onpowerup, .gen_onpowerup_set.onpowerup = onpowerup,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET) {
send_gen_onpowerup_status(model, ctx, false); send_gen_onpowerup_status(model, ctx, false);
@ -915,10 +915,10 @@ static void gen_onpowerup_set(struct bt_mesh_model *model,
/* Generic Power Level Server message handlers */ /* Generic Power Level Server message handlers */
static void send_gen_power_level_status(struct bt_mesh_model *model, static void send_gen_power_level_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
bool publish, u16_t opcode) bool publish, uint16_t opcode)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 2 + 5; uint8_t length = 2 + 5;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -999,7 +999,7 @@ static void gen_power_level_get(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_power_level_srv *srv = model->user_data; struct bt_mesh_gen_power_level_srv *srv = model->user_data;
u16_t opcode = 0U; uint16_t opcode = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1035,7 +1035,7 @@ static void gen_power_level_get(struct bt_mesh_model *model,
return; return;
} }
void gen_power_level_publish(struct bt_mesh_model *model, u16_t opcode) void gen_power_level_publish(struct bt_mesh_model *model, uint16_t opcode)
{ {
if (model->user_data == NULL) { if (model->user_data == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1073,10 +1073,10 @@ static void gen_power_level_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_power_level_srv *srv = model->user_data; struct bt_mesh_gen_power_level_srv *srv = model->user_data;
u8_t tid = 0U, trans_time = 0U, delay = 0U; uint8_t tid = 0U, trans_time = 0U, delay = 0U;
bool optional = false; bool optional = false;
u16_t power = 0U; uint16_t power = 0U;
s64_t now = 0; int64_t now = 0;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1100,7 +1100,7 @@ static void gen_power_level_set(struct bt_mesh_model *model,
.power_level_set.delay = delay, .power_level_set.delay = delay,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1137,7 +1137,7 @@ static void gen_power_level_set(struct bt_mesh_model *model,
.gen_power_level_set.power = srv->state->power_actual, .gen_power_level_set.power = srv->state->power_actual,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET) {
send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS); send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS);
@ -1184,7 +1184,7 @@ static void gen_power_default_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_power_level_setup_srv *srv = model->user_data; struct bt_mesh_gen_power_level_setup_srv *srv = model->user_data;
u16_t power = 0U; uint16_t power = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1199,7 +1199,7 @@ static void gen_power_default_set(struct bt_mesh_model *model,
.power_default_set.power = power, /* Just callback the actual received value */ .power_default_set.power = power, /* Just callback the actual received value */
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1219,7 +1219,7 @@ static void gen_power_default_set(struct bt_mesh_model *model,
.gen_power_default_set.power = power, .gen_power_default_set.power = power,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET) {
send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS); send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS);
@ -1234,7 +1234,7 @@ static void gen_power_range_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_power_level_setup_srv *srv = model->user_data; struct bt_mesh_gen_power_level_setup_srv *srv = model->user_data;
u16_t range_min = 0U, range_max = 0U; uint16_t range_min = 0U, range_max = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1257,7 +1257,7 @@ static void gen_power_range_set(struct bt_mesh_model *model,
.power_range_set.range_max = range_max, .power_range_set.range_max = range_max,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1282,7 +1282,7 @@ static void gen_power_range_set(struct bt_mesh_model *model,
.gen_power_range_set.range_max = srv->state->power_range_max, .gen_power_range_set.range_max = srv->state->power_range_max,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET) {
send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS); send_gen_power_level_status(model, ctx, false, BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS);
@ -1323,10 +1323,10 @@ static void gen_battery_get(struct bt_mesh_model *model,
/* Generic Location Server message handlers */ /* Generic Location Server message handlers */
static void send_gen_location_status(struct bt_mesh_model *model, static void send_gen_location_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
bool publish, u16_t opcode) bool publish, uint16_t opcode)
{ {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t length = 1 + 10; uint8_t length = 1 + 10;
if (ctx == NULL && publish == false) { if (ctx == NULL && publish == false) {
BT_ERR("%s, Invalid parameter", __func__); BT_ERR("%s, Invalid parameter", __func__);
@ -1400,7 +1400,7 @@ static void gen_location_get(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_location_srv *srv = model->user_data; struct bt_mesh_gen_location_srv *srv = model->user_data;
u16_t opcode = 0U; uint16_t opcode = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1436,7 +1436,7 @@ static void gen_location_set(struct bt_mesh_model *model,
struct net_buf_simple *buf) struct net_buf_simple *buf)
{ {
struct bt_mesh_gen_location_setup_srv *srv = model->user_data; struct bt_mesh_gen_location_setup_srv *srv = model->user_data;
u16_t opcode = 0U; uint16_t opcode = 0U;
if (srv == NULL || srv->state == NULL) { if (srv == NULL || srv->state == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1447,9 +1447,9 @@ static void gen_location_set(struct bt_mesh_model *model,
case BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET: case BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET:
case BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK: { case BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK: {
opcode = BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS; opcode = BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS;
s32_t latitude = net_buf_simple_pull_le32(buf); int32_t latitude = net_buf_simple_pull_le32(buf);
s32_t longitude = net_buf_simple_pull_le32(buf); int32_t longitude = net_buf_simple_pull_le32(buf);
s16_t altitude = net_buf_simple_pull_le16(buf); int16_t altitude = net_buf_simple_pull_le16(buf);
/* Callback the received message to the application layer */ /* Callback the received message to the application layer */
if (srv->rsp_ctrl.set_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) { if (srv->rsp_ctrl.set_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) {
@ -1459,7 +1459,7 @@ static void gen_location_set(struct bt_mesh_model *model,
.loc_global_set.altitude = altitude, .loc_global_set.altitude = altitude,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1479,17 +1479,17 @@ static void gen_location_set(struct bt_mesh_model *model,
.gen_loc_global_set.altitude = srv->state->global_altitude, .gen_loc_global_set.altitude = srv->state->global_altitude,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
break; break;
} }
case BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET: case BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET:
case BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK: { case BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK: {
opcode = BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS; opcode = BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS;
u16_t north = net_buf_simple_pull_le16(buf); uint16_t north = net_buf_simple_pull_le16(buf);
u16_t east = net_buf_simple_pull_le16(buf); uint16_t east = net_buf_simple_pull_le16(buf);
u16_t altitude = net_buf_simple_pull_le16(buf); uint16_t altitude = net_buf_simple_pull_le16(buf);
u8_t floor = net_buf_simple_pull_u8(buf); uint8_t floor = net_buf_simple_pull_u8(buf);
u16_t uncertainty = net_buf_simple_pull_le16(buf); uint16_t uncertainty = net_buf_simple_pull_le16(buf);
/* Callback the received message to the application layer */ /* Callback the received message to the application layer */
if (srv->rsp_ctrl.set_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) { if (srv->rsp_ctrl.set_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) {
@ -1501,7 +1501,7 @@ static void gen_location_set(struct bt_mesh_model *model,
.loc_local_set.uncertainty = uncertainty, .loc_local_set.uncertainty = uncertainty,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1527,7 +1527,7 @@ static void gen_location_set(struct bt_mesh_model *model,
.gen_loc_local_set.uncertainty = srv->state->uncertainty, .gen_loc_local_set.uncertainty = srv->state->uncertainty,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
break; break;
} }
default: default:
@ -1546,7 +1546,7 @@ static void gen_location_set(struct bt_mesh_model *model,
/* Generic User Property Server message handlers */ /* Generic User Property Server message handlers */
static struct bt_mesh_generic_property *gen_get_user_property(struct bt_mesh_model *model, static struct bt_mesh_generic_property *gen_get_user_property(struct bt_mesh_model *model,
u16_t property_id) uint16_t property_id)
{ {
struct bt_mesh_gen_user_prop_srv *srv = model->user_data; struct bt_mesh_gen_user_prop_srv *srv = model->user_data;
int i; int i;
@ -1562,11 +1562,11 @@ static struct bt_mesh_generic_property *gen_get_user_property(struct bt_mesh_mod
static void send_gen_user_prop_status(struct bt_mesh_model *model, static void send_gen_user_prop_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t property_id, bool publish) uint16_t property_id, bool publish)
{ {
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u16_t length = 0U; uint16_t length = 0U;
if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) { if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) {
BT_ERR("Invalid User Property ID 0x%04x", property_id); BT_ERR("Invalid User Property ID 0x%04x", property_id);
@ -1638,11 +1638,11 @@ static void gen_user_prop_get(struct bt_mesh_model *model,
* and directly callback with buf->data & buf->len. * and directly callback with buf->data & buf->len.
*/ */
bt_mesh_gen_server_recv_get_msg_t get = {0}; bt_mesh_gen_server_recv_get_msg_t get = {0};
const u8_t *param = NULL; const uint8_t *param = NULL;
size_t len = 0; size_t len = 0;
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET) {
get.user_property_get.id = net_buf_simple_pull_le16(buf); get.user_property_get.id = net_buf_simple_pull_le16(buf);
param = (const u8_t *)&get; param = (const uint8_t *)&get;
len = sizeof(get); len = sizeof(get);
} }
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
@ -1653,7 +1653,7 @@ static void gen_user_prop_get(struct bt_mesh_model *model,
switch (ctx->recv_op) { switch (ctx->recv_op) {
case BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_GET: { case BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_GET: {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t i; uint8_t i;
msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE); msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE);
if (msg == NULL) { if (msg == NULL) {
BT_ERR("%s, Out of memory", __func__); BT_ERR("%s, Out of memory", __func__);
@ -1671,7 +1671,7 @@ static void gen_user_prop_get(struct bt_mesh_model *model,
return; return;
} }
case BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET: { case BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET: {
u16_t property_id = net_buf_simple_pull_le16(buf); uint16_t property_id = net_buf_simple_pull_le16(buf);
send_gen_user_prop_status(model, ctx, property_id, false); send_gen_user_prop_status(model, ctx, property_id, false);
return; return;
} }
@ -1687,8 +1687,8 @@ static void gen_user_prop_set(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_user_prop_srv *srv = model->user_data; struct bt_mesh_gen_user_prop_srv *srv = model->user_data;
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
u16_t property_id = 0U; uint16_t property_id = 0U;
u8_t expect_len = 0U; uint8_t expect_len = 0U;
if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) { if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1704,7 +1704,7 @@ static void gen_user_prop_set(struct bt_mesh_model *model,
.user_property_set.value = buf, .user_property_set.value = buf,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1738,7 +1738,7 @@ static void gen_user_prop_set(struct bt_mesh_model *model,
.gen_user_prop_set.value = property->val, .gen_user_prop_set.value = property->val,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET) {
send_gen_user_prop_status(model, ctx, property_id, false); send_gen_user_prop_status(model, ctx, property_id, false);
@ -1750,7 +1750,7 @@ static void gen_user_prop_set(struct bt_mesh_model *model,
/* Generic Admin Property Server message handlers */ /* Generic Admin Property Server message handlers */
static struct bt_mesh_generic_property *gen_get_admin_property(struct bt_mesh_model *model, static struct bt_mesh_generic_property *gen_get_admin_property(struct bt_mesh_model *model,
u16_t property_id) uint16_t property_id)
{ {
struct bt_mesh_gen_admin_prop_srv *srv = model->user_data; struct bt_mesh_gen_admin_prop_srv *srv = model->user_data;
int i; int i;
@ -1766,11 +1766,11 @@ static struct bt_mesh_generic_property *gen_get_admin_property(struct bt_mesh_mo
static void send_gen_admin_prop_status(struct bt_mesh_model *model, static void send_gen_admin_prop_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t property_id, bool publish) uint16_t property_id, bool publish)
{ {
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u16_t length = 0U; uint16_t length = 0U;
if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) { if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) {
BT_ERR("Invalid Admin Property ID 0x%04x", property_id); BT_ERR("Invalid Admin Property ID 0x%04x", property_id);
@ -1833,11 +1833,11 @@ static void gen_admin_prop_get(struct bt_mesh_model *model,
/* Callback the received message to the application layer */ /* Callback the received message to the application layer */
if (srv->rsp_ctrl.get_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) { if (srv->rsp_ctrl.get_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) {
bt_mesh_gen_server_recv_get_msg_t get = {0}; bt_mesh_gen_server_recv_get_msg_t get = {0};
const u8_t *param = NULL; const uint8_t *param = NULL;
size_t len = 0U; size_t len = 0U;
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET) {
get.admin_property_get.id = net_buf_simple_pull_le16(buf); get.admin_property_get.id = net_buf_simple_pull_le16(buf);
param = (const u8_t *)&get; param = (const uint8_t *)&get;
len = sizeof(get); len = sizeof(get);
} }
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
@ -1848,7 +1848,7 @@ static void gen_admin_prop_get(struct bt_mesh_model *model,
switch (ctx->recv_op) { switch (ctx->recv_op) {
case BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_GET: { case BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_GET: {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t i = 0U; uint8_t i = 0U;
msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE); msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE);
if (msg == NULL) { if (msg == NULL) {
BT_ERR("%s, Out of memory", __func__); BT_ERR("%s, Out of memory", __func__);
@ -1863,7 +1863,7 @@ static void gen_admin_prop_get(struct bt_mesh_model *model,
return; return;
} }
case BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET: { case BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET: {
u16_t property_id = net_buf_simple_pull_le16(buf); uint16_t property_id = net_buf_simple_pull_le16(buf);
send_gen_admin_prop_status(model, ctx, property_id, false); send_gen_admin_prop_status(model, ctx, property_id, false);
return; return;
} }
@ -1879,8 +1879,8 @@ static void gen_admin_prop_set(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_admin_prop_srv *srv = model->user_data; struct bt_mesh_gen_admin_prop_srv *srv = model->user_data;
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
u16_t property_id = 0U; uint16_t property_id = 0U;
u8_t access = 0U; uint8_t access = 0U;
if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) { if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -1902,7 +1902,7 @@ static void gen_admin_prop_set(struct bt_mesh_model *model,
.admin_property_set.value = buf, .admin_property_set.value = buf,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -1926,7 +1926,7 @@ static void gen_admin_prop_set(struct bt_mesh_model *model,
.gen_admin_prop_set.value = property->val, .gen_admin_prop_set.value = property->val,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET) {
send_gen_admin_prop_status(model, ctx, property_id, false); send_gen_admin_prop_status(model, ctx, property_id, false);
@ -1938,7 +1938,7 @@ static void gen_admin_prop_set(struct bt_mesh_model *model,
/* Generic Manufacturer Property Server message handlers */ /* Generic Manufacturer Property Server message handlers */
static struct bt_mesh_generic_property *gen_get_manu_property(struct bt_mesh_model *model, static struct bt_mesh_generic_property *gen_get_manu_property(struct bt_mesh_model *model,
u16_t property_id) uint16_t property_id)
{ {
struct bt_mesh_gen_manu_prop_srv *srv = model->user_data; struct bt_mesh_gen_manu_prop_srv *srv = model->user_data;
int i; int i;
@ -1954,11 +1954,11 @@ static struct bt_mesh_generic_property *gen_get_manu_property(struct bt_mesh_mod
static void send_gen_manu_prop_status(struct bt_mesh_model *model, static void send_gen_manu_prop_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
u16_t property_id, bool publish) uint16_t property_id, bool publish)
{ {
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u16_t length = 0U; uint16_t length = 0U;
if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) { if (property_id == BLE_MESH_INVALID_DEVICE_PROPERTY_ID) {
BT_ERR("Invalid Manu Property ID 0x%04x", property_id); BT_ERR("Invalid Manu Property ID 0x%04x", property_id);
@ -2018,11 +2018,11 @@ static void gen_manu_prop_get(struct bt_mesh_model *model,
/* Callback the received message to the application layer */ /* Callback the received message to the application layer */
if (srv->rsp_ctrl.get_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) { if (srv->rsp_ctrl.get_auto_rsp == BLE_MESH_SERVER_RSP_BY_APP) {
bt_mesh_gen_server_recv_get_msg_t get = {0}; bt_mesh_gen_server_recv_get_msg_t get = {0};
const u8_t *param = NULL; const uint8_t *param = NULL;
size_t len = 0U; size_t len = 0U;
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_GET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_GET) {
get.manu_property_get.id = net_buf_simple_pull_le16(buf); get.manu_property_get.id = net_buf_simple_pull_le16(buf);
param = (const u8_t *)&get; param = (const uint8_t *)&get;
len = sizeof(get); len = sizeof(get);
} }
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
@ -2033,7 +2033,7 @@ static void gen_manu_prop_get(struct bt_mesh_model *model,
switch (ctx->recv_op) { switch (ctx->recv_op) {
case BLE_MESH_MODEL_OP_GEN_MANU_PROPERTIES_GET: { case BLE_MESH_MODEL_OP_GEN_MANU_PROPERTIES_GET: {
struct net_buf_simple *msg = NULL; struct net_buf_simple *msg = NULL;
u8_t i = 0U; uint8_t i = 0U;
msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE); msg = bt_mesh_alloc_buf(1 + srv->property_count * 2 + BLE_MESH_SERVER_TRANS_MIC_SIZE);
if (msg == NULL) { if (msg == NULL) {
BT_ERR("%s, Out of memory", __func__); BT_ERR("%s, Out of memory", __func__);
@ -2048,7 +2048,7 @@ static void gen_manu_prop_get(struct bt_mesh_model *model,
return; return;
} }
case BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_GET: { case BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_GET: {
u16_t property_id = net_buf_simple_pull_le16(buf); uint16_t property_id = net_buf_simple_pull_le16(buf);
send_gen_manu_prop_status(model, ctx, property_id, false); send_gen_manu_prop_status(model, ctx, property_id, false);
return; return;
} }
@ -2064,8 +2064,8 @@ static void gen_manu_prop_set(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_manu_prop_srv *srv = model->user_data; struct bt_mesh_gen_manu_prop_srv *srv = model->user_data;
struct bt_mesh_generic_property *property = NULL; struct bt_mesh_generic_property *property = NULL;
u16_t property_id = 0U; uint16_t property_id = 0U;
u8_t access = 0U; uint8_t access = 0U;
if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) { if (srv == NULL || srv->property_count == 0U || srv->properties == NULL) {
BT_ERR("%s, Invalid model user data", __func__); BT_ERR("%s, Invalid model user data", __func__);
@ -2086,7 +2086,7 @@ static void gen_manu_prop_set(struct bt_mesh_model *model,
.manu_property_set.access = access, .manu_property_set.access = access,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const u8_t *)&set, sizeof(set)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_SET_MSG, model, ctx, (const uint8_t *)&set, sizeof(set));
return; return;
} }
@ -2106,7 +2106,7 @@ static void gen_manu_prop_set(struct bt_mesh_model *model,
.gen_manu_prop_set.access = property->manu_access, .gen_manu_prop_set.access = property->manu_access,
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const u8_t *)&change, sizeof(change)); BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE, model, ctx, (const uint8_t *)&change, sizeof(change));
if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_SET) { if (ctx->recv_op == BLE_MESH_MODEL_OP_GEN_MANU_PROPERTY_SET) {
send_gen_manu_prop_status(model, ctx, property_id, false); send_gen_manu_prop_status(model, ctx, property_id, false);
@ -2117,11 +2117,11 @@ static void gen_manu_prop_set(struct bt_mesh_model *model,
} }
/* Generic Client Property Server message handlers */ /* Generic Client Property Server message handlers */
static int search_prop_id_index(const u16_t *array, u8_t array_idx, u16_t id) static int search_prop_id_index(const uint16_t *array, uint8_t array_idx, uint16_t id)
{ {
static const u16_t *start = NULL; static const uint16_t *start = NULL;
u8_t index = 0U; uint8_t index = 0U;
u16_t temp = 0U; uint16_t temp = 0U;
if (start == NULL) { if (start == NULL) {
start = array; start = array;
@ -2153,8 +2153,8 @@ static void gen_client_prop_get(struct bt_mesh_model *model,
{ {
struct bt_mesh_gen_client_prop_srv *srv = model->user_data; struct bt_mesh_gen_client_prop_srv *srv = model->user_data;
struct net_buf_simple *sdu = NULL; struct net_buf_simple *sdu = NULL;
u16_t total_len = 5U; uint16_t total_len = 5U;
u16_t property_id = 0U; uint16_t property_id = 0U;
int i, index = 0; int i, index = 0;
if (srv == NULL || srv->id_count == 0U || srv->property_ids == NULL) { if (srv == NULL || srv->id_count == 0U || srv->property_ids == NULL) {
@ -2168,7 +2168,7 @@ static void gen_client_prop_get(struct bt_mesh_model *model,
.client_properties_get.id = net_buf_simple_pull_le16(buf), .client_properties_get.id = net_buf_simple_pull_le16(buf),
}; };
bt_mesh_generic_server_cb_evt_to_btc( bt_mesh_generic_server_cb_evt_to_btc(
BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_GET_MSG, model, ctx, (const u8_t *)&get, sizeof(get)); BTC_BLE_MESH_EVT_GENERIC_SERVER_RECV_GET_MSG, model, ctx, (const uint8_t *)&get, sizeof(get));
return; return;
} }
@ -2195,7 +2195,7 @@ static void gen_client_prop_get(struct bt_mesh_model *model,
bt_mesh_model_msg_init(sdu, BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS); bt_mesh_model_msg_init(sdu, BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS);
for (i = index; i < srv->id_count; i++) { for (i = index; i < srv->id_count; i++) {
total_len += sizeof(u16_t); total_len += sizeof(uint16_t);
if (total_len > MIN(BLE_MESH_TX_SDU_MAX, BLE_MESH_SERVER_RSP_MAX_LEN)) { if (total_len > MIN(BLE_MESH_TX_SDU_MAX, BLE_MESH_SERVER_RSP_MAX_LEN)) {
/* Add this in case the message is too long */ /* Add this in case the message is too long */
BT_WARN("Too large generic client properties status"); BT_WARN("Too large generic client properties status");
@ -2329,10 +2329,10 @@ const struct bt_mesh_model_op bt_mesh_gen_client_prop_srv_op[] = {
static inline int property_id_compare(const void *p1, const void *p2) static inline int property_id_compare(const void *p1, const void *p2)
{ {
if (*(u16_t *)p1 < * (u16_t *)p2) { if (*(uint16_t *)p1 < * (uint16_t *)p2) {
return -1; return -1;
} }
if (*(u16_t *)p1 > *(u16_t *)p2) { if (*(uint16_t *)p1 > *(uint16_t *)p2) {
return 1; return 1;
} }
return 0; return 0;
@ -2466,7 +2466,7 @@ static int generic_server_init(struct bt_mesh_model *model)
return -EINVAL; return -EINVAL;
} }
/* Quick sort the Client Property IDs in ascending order */ /* Quick sort the Client Property IDs in ascending order */
qsort(srv->property_ids, srv->id_count, sizeof(u16_t), property_id_compare); qsort(srv->property_ids, srv->id_count, sizeof(uint16_t), property_id_compare);
srv->model = model; srv->model = model;
break; break;
} }

View File

@ -16,8 +16,8 @@ extern "C" {
#endif #endif
struct bt_mesh_gen_onoff_state { struct bt_mesh_gen_onoff_state {
u8_t onoff; uint8_t onoff;
u8_t target_onoff; uint8_t target_onoff;
}; };
struct bt_mesh_gen_onoff_srv { struct bt_mesh_gen_onoff_srv {
@ -29,11 +29,11 @@ struct bt_mesh_gen_onoff_srv {
}; };
struct bt_mesh_gen_level_state { struct bt_mesh_gen_level_state {
s16_t level; int16_t level;
s16_t target_level; int16_t target_level;
s16_t last_level; int16_t last_level;
s32_t last_delta; int32_t last_delta;
bool move_start; bool move_start;
bool positive; bool positive;
@ -45,11 +45,11 @@ struct bt_mesh_gen_level_srv {
struct bt_mesh_gen_level_state state; struct bt_mesh_gen_level_state state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_level; int32_t tt_delta_level;
}; };
struct bt_mesh_gen_def_trans_time_state { struct bt_mesh_gen_def_trans_time_state {
u8_t trans_time; uint8_t trans_time;
}; };
struct bt_mesh_gen_def_trans_time_srv { struct bt_mesh_gen_def_trans_time_srv {
@ -59,7 +59,7 @@ struct bt_mesh_gen_def_trans_time_srv {
}; };
struct bt_mesh_gen_onpowerup_state { struct bt_mesh_gen_onpowerup_state {
u8_t onpowerup; uint8_t onpowerup;
}; };
struct bt_mesh_gen_power_onoff_srv { struct bt_mesh_gen_power_onoff_srv {
@ -75,15 +75,15 @@ struct bt_mesh_gen_power_onoff_setup_srv {
}; };
struct bt_mesh_gen_power_level_state { struct bt_mesh_gen_power_level_state {
u16_t power_actual; uint16_t power_actual;
u16_t target_power_actual; uint16_t target_power_actual;
u16_t power_last; uint16_t power_last;
u16_t power_default; uint16_t power_default;
u8_t status_code; uint8_t status_code;
u16_t power_range_min; uint16_t power_range_min;
u16_t power_range_max; uint16_t power_range_max;
}; };
struct bt_mesh_gen_power_level_srv { struct bt_mesh_gen_power_level_srv {
@ -92,7 +92,7 @@ struct bt_mesh_gen_power_level_srv {
struct bt_mesh_gen_power_level_state *state; struct bt_mesh_gen_power_level_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_level; int32_t tt_delta_level;
}; };
struct bt_mesh_gen_power_level_setup_srv { struct bt_mesh_gen_power_level_setup_srv {
@ -102,10 +102,10 @@ struct bt_mesh_gen_power_level_setup_srv {
}; };
struct bt_mesh_gen_battery_state { struct bt_mesh_gen_battery_state {
u32_t battery_level : 8, uint32_t battery_level : 8,
time_to_discharge : 24; time_to_discharge : 24;
u32_t time_to_charge : 24, uint32_t time_to_charge : 24,
battery_flags : 8; battery_flags : 8;
}; };
struct bt_mesh_gen_battery_srv { struct bt_mesh_gen_battery_srv {
@ -115,14 +115,14 @@ struct bt_mesh_gen_battery_srv {
}; };
struct bt_mesh_gen_location_state { struct bt_mesh_gen_location_state {
s32_t global_latitude; int32_t global_latitude;
s32_t global_longitude; int32_t global_longitude;
s16_t global_altitude; int16_t global_altitude;
s16_t local_north; int16_t local_north;
s16_t local_east; int16_t local_east;
s16_t local_altitude; int16_t local_altitude;
u8_t floor_number; uint8_t floor_number;
u16_t uncertainty; uint16_t uncertainty;
}; };
struct bt_mesh_gen_location_srv { struct bt_mesh_gen_location_srv {
@ -170,185 +170,185 @@ enum bt_mesh_gen_manu_prop_access {
}; };
struct bt_mesh_generic_property { struct bt_mesh_generic_property {
u16_t id; uint16_t id;
u8_t user_access; uint8_t user_access;
u8_t admin_access; uint8_t admin_access;
u8_t manu_access; uint8_t manu_access;
struct net_buf_simple *val; struct net_buf_simple *val;
}; };
struct bt_mesh_gen_user_prop_srv { struct bt_mesh_gen_user_prop_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
u8_t property_count; uint8_t property_count;
struct bt_mesh_generic_property *properties; struct bt_mesh_generic_property *properties;
}; };
struct bt_mesh_gen_admin_prop_srv { struct bt_mesh_gen_admin_prop_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
u8_t property_count; uint8_t property_count;
struct bt_mesh_generic_property *properties; struct bt_mesh_generic_property *properties;
}; };
struct bt_mesh_gen_manu_prop_srv { struct bt_mesh_gen_manu_prop_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
u8_t property_count; uint8_t property_count;
struct bt_mesh_generic_property *properties; struct bt_mesh_generic_property *properties;
}; };
struct bt_mesh_gen_client_prop_srv { struct bt_mesh_gen_client_prop_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
u8_t id_count; uint8_t id_count;
u16_t *property_ids; uint16_t *property_ids;
}; };
typedef union { typedef union {
struct { struct {
u8_t onoff; uint8_t onoff;
} gen_onoff_set; } gen_onoff_set;
struct { struct {
s16_t level; int16_t level;
} gen_level_set; } gen_level_set;
struct { struct {
s16_t level; int16_t level;
} gen_delta_set; } gen_delta_set;
struct { struct {
s16_t level; int16_t level;
} gen_move_set; } gen_move_set;
struct { struct {
u8_t trans_time; uint8_t trans_time;
} gen_def_trans_time_set; } gen_def_trans_time_set;
struct { struct {
u8_t onpowerup; uint8_t onpowerup;
} gen_onpowerup_set; } gen_onpowerup_set;
struct { struct {
u16_t power; uint16_t power;
} gen_power_level_set; } gen_power_level_set;
struct { struct {
u16_t power; uint16_t power;
} gen_power_default_set; } gen_power_default_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} gen_power_range_set; } gen_power_range_set;
struct { struct {
s32_t latitude; int32_t latitude;
s32_t longitude; int32_t longitude;
s16_t altitude; int16_t altitude;
} gen_loc_global_set; } gen_loc_global_set;
struct { struct {
s16_t north; int16_t north;
s16_t east; int16_t east;
s16_t altitude; int16_t altitude;
u8_t floor_number; uint8_t floor_number;
u16_t uncertainty; uint16_t uncertainty;
} gen_loc_local_set; } gen_loc_local_set;
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *value; struct net_buf_simple *value;
} gen_user_prop_set; } gen_user_prop_set;
struct { struct {
u16_t id; uint16_t id;
u8_t access; uint8_t access;
struct net_buf_simple *value; struct net_buf_simple *value;
} gen_admin_prop_set; } gen_admin_prop_set;
struct { struct {
u16_t id; uint16_t id;
u8_t access; uint8_t access;
} gen_manu_prop_set; } gen_manu_prop_set;
} bt_mesh_gen_server_state_change_t; } bt_mesh_gen_server_state_change_t;
typedef union { typedef union {
struct { struct {
u16_t id; uint16_t id;
} user_property_get; } user_property_get;
struct { struct {
u16_t id; uint16_t id;
} admin_property_get; } admin_property_get;
struct { struct {
u16_t id; uint16_t id;
} manu_property_get; } manu_property_get;
struct { struct {
u16_t id; uint16_t id;
} client_properties_get; } client_properties_get;
} bt_mesh_gen_server_recv_get_msg_t; } bt_mesh_gen_server_recv_get_msg_t;
typedef union { typedef union {
struct { struct {
bool op_en; bool op_en;
u8_t onoff; uint8_t onoff;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} onoff_set; } onoff_set;
struct { struct {
bool op_en; bool op_en;
s16_t level; int16_t level;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} level_set; } level_set;
struct { struct {
bool op_en; bool op_en;
s32_t delta_level; int32_t delta_level;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} delta_set; } delta_set;
struct { struct {
bool op_en; bool op_en;
s16_t delta_level; int16_t delta_level;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} move_set; } move_set;
struct { struct {
u8_t trans_time; uint8_t trans_time;
} def_trans_time_set; } def_trans_time_set;
struct { struct {
u8_t onpowerup; uint8_t onpowerup;
} onpowerup_set; } onpowerup_set;
struct { struct {
bool op_en; bool op_en;
u16_t power; uint16_t power;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} power_level_set; } power_level_set;
struct { struct {
u16_t power; uint16_t power;
} power_default_set; } power_default_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} power_range_set; } power_range_set;
struct { struct {
s32_t latitude; int32_t latitude;
s32_t longitude; int32_t longitude;
s16_t altitude; int16_t altitude;
} loc_global_set; } loc_global_set;
struct { struct {
s16_t north; int16_t north;
s16_t east; int16_t east;
s16_t altitude; int16_t altitude;
u8_t floor_number; uint8_t floor_number;
u16_t uncertainty; uint16_t uncertainty;
} loc_local_set; } loc_local_set;
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *value; struct net_buf_simple *value;
} user_property_set; } user_property_set;
struct { struct {
u16_t id; uint16_t id;
u8_t access; uint8_t access;
struct net_buf_simple *value; struct net_buf_simple *value;
} admin_property_set; } admin_property_set;
struct { struct {
u16_t id; uint16_t id;
u8_t access; uint8_t access;
} manu_property_set; } manu_property_set;
} bt_mesh_gen_server_recv_set_msg_t; } bt_mesh_gen_server_recv_set_msg_t;
@ -358,7 +358,7 @@ void bt_mesh_generic_server_unlock(void);
void gen_onoff_publish(struct bt_mesh_model *model); void gen_onoff_publish(struct bt_mesh_model *model);
void gen_level_publish(struct bt_mesh_model *model); void gen_level_publish(struct bt_mesh_model *model);
void gen_onpowerup_publish(struct bt_mesh_model *model); void gen_onpowerup_publish(struct bt_mesh_model *model);
void gen_power_level_publish(struct bt_mesh_model *model, u16_t opcode); void gen_power_level_publish(struct bt_mesh_model *model, uint16_t opcode);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -16,18 +16,18 @@ extern "C" {
#endif #endif
struct bt_mesh_light_lightness_state { struct bt_mesh_light_lightness_state {
u16_t lightness_linear; uint16_t lightness_linear;
u16_t target_lightness_linear; uint16_t target_lightness_linear;
u16_t lightness_actual; uint16_t lightness_actual;
u16_t target_lightness_actual; uint16_t target_lightness_actual;
u16_t lightness_last; uint16_t lightness_last;
u16_t lightness_default; uint16_t lightness_default;
u8_t status_code; uint8_t status_code;
u16_t lightness_range_min; uint16_t lightness_range_min;
u16_t lightness_range_max; uint16_t lightness_range_max;
}; };
struct bt_mesh_light_lightness_srv { struct bt_mesh_light_lightness_srv {
@ -37,8 +37,8 @@ struct bt_mesh_light_lightness_srv {
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition actual_transition; struct bt_mesh_state_transition actual_transition;
struct bt_mesh_state_transition linear_transition; struct bt_mesh_state_transition linear_transition;
s32_t tt_delta_lightness_actual; int32_t tt_delta_lightness_actual;
s32_t tt_delta_lightness_linear; int32_t tt_delta_lightness_linear;
}; };
struct bt_mesh_light_lightness_setup_srv { struct bt_mesh_light_lightness_setup_srv {
@ -48,22 +48,22 @@ struct bt_mesh_light_lightness_setup_srv {
}; };
struct bt_mesh_light_ctl_state { struct bt_mesh_light_ctl_state {
u16_t lightness; uint16_t lightness;
u16_t target_lightness; uint16_t target_lightness;
u16_t temperature; uint16_t temperature;
u16_t target_temperature; uint16_t target_temperature;
s16_t delta_uv; int16_t delta_uv;
s16_t target_delta_uv; int16_t target_delta_uv;
u8_t status_code; uint8_t status_code;
u16_t temperature_range_min; uint16_t temperature_range_min;
u16_t temperature_range_max; uint16_t temperature_range_max;
u16_t lightness_default; uint16_t lightness_default;
u16_t temperature_default; uint16_t temperature_default;
s16_t delta_uv_default; int16_t delta_uv_default;
}; };
struct bt_mesh_light_ctl_srv { struct bt_mesh_light_ctl_srv {
@ -72,9 +72,9 @@ struct bt_mesh_light_ctl_srv {
struct bt_mesh_light_ctl_state *state; struct bt_mesh_light_ctl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_lightness; int32_t tt_delta_lightness;
s32_t tt_delta_temperature; int32_t tt_delta_temperature;
s32_t tt_delta_delta_uv; int32_t tt_delta_delta_uv;
}; };
struct bt_mesh_light_ctl_setup_srv { struct bt_mesh_light_ctl_setup_srv {
@ -89,29 +89,29 @@ struct bt_mesh_light_ctl_temp_srv {
struct bt_mesh_light_ctl_state *state; struct bt_mesh_light_ctl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_temperature; int32_t tt_delta_temperature;
s32_t tt_delta_delta_uv; int32_t tt_delta_delta_uv;
}; };
struct bt_mesh_light_hsl_state { struct bt_mesh_light_hsl_state {
u16_t lightness; uint16_t lightness;
u16_t target_lightness; uint16_t target_lightness;
u16_t hue; uint16_t hue;
u16_t target_hue; uint16_t target_hue;
u16_t saturation; uint16_t saturation;
u16_t target_saturation; uint16_t target_saturation;
u16_t lightness_default; uint16_t lightness_default;
u16_t hue_default; uint16_t hue_default;
u16_t saturation_default; uint16_t saturation_default;
u8_t status_code; uint8_t status_code;
u16_t hue_range_min; uint16_t hue_range_min;
u16_t hue_range_max; uint16_t hue_range_max;
u16_t saturation_range_min; uint16_t saturation_range_min;
u16_t saturation_range_max; uint16_t saturation_range_max;
}; };
struct bt_mesh_light_hsl_srv { struct bt_mesh_light_hsl_srv {
@ -120,9 +120,9 @@ struct bt_mesh_light_hsl_srv {
struct bt_mesh_light_hsl_state *state; struct bt_mesh_light_hsl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_lightness; int32_t tt_delta_lightness;
s32_t tt_delta_hue; int32_t tt_delta_hue;
s32_t tt_delta_saturation; int32_t tt_delta_saturation;
}; };
struct bt_mesh_light_hsl_setup_srv { struct bt_mesh_light_hsl_setup_srv {
@ -137,7 +137,7 @@ struct bt_mesh_light_hsl_hue_srv {
struct bt_mesh_light_hsl_state *state; struct bt_mesh_light_hsl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_hue; int32_t tt_delta_hue;
}; };
struct bt_mesh_light_hsl_sat_srv { struct bt_mesh_light_hsl_sat_srv {
@ -146,28 +146,28 @@ struct bt_mesh_light_hsl_sat_srv {
struct bt_mesh_light_hsl_state *state; struct bt_mesh_light_hsl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_saturation; int32_t tt_delta_saturation;
}; };
struct bt_mesh_light_xyl_state { struct bt_mesh_light_xyl_state {
u16_t lightness; uint16_t lightness;
u16_t target_lightness; uint16_t target_lightness;
u16_t x; uint16_t x;
u16_t target_x; uint16_t target_x;
u16_t y; uint16_t y;
u16_t target_y; uint16_t target_y;
u16_t lightness_default; uint16_t lightness_default;
u16_t x_default; uint16_t x_default;
u16_t y_default; uint16_t y_default;
u8_t status_code; uint8_t status_code;
u16_t x_range_min; uint16_t x_range_min;
u16_t x_range_max; uint16_t x_range_max;
u16_t y_range_min; uint16_t y_range_min;
u16_t y_range_max; uint16_t y_range_max;
}; };
struct bt_mesh_light_xyl_srv { struct bt_mesh_light_xyl_srv {
@ -176,9 +176,9 @@ struct bt_mesh_light_xyl_srv {
struct bt_mesh_light_xyl_state *state; struct bt_mesh_light_xyl_state *state;
struct bt_mesh_last_msg_info last; struct bt_mesh_last_msg_info last;
struct bt_mesh_state_transition transition; struct bt_mesh_state_transition transition;
s32_t tt_delta_lightness; int32_t tt_delta_lightness;
s32_t tt_delta_x; int32_t tt_delta_x;
s32_t tt_delta_y; int32_t tt_delta_y;
}; };
struct bt_mesh_light_xyl_setup_srv { struct bt_mesh_light_xyl_setup_srv {
@ -188,40 +188,40 @@ struct bt_mesh_light_xyl_setup_srv {
}; };
struct bt_mesh_light_lc_state { struct bt_mesh_light_lc_state {
u32_t mode : 1, /* default 0 */ uint32_t mode : 1, /* default 0 */
occupancy_mode : 1, /* default 1 */ occupancy_mode : 1, /* default 1 */
light_onoff : 1, light_onoff : 1,
target_light_onoff : 1, target_light_onoff : 1,
occupancy : 1, occupancy : 1,
ambient_luxlevel : 24; /* 0x000000 ~ 0xFFFFFF */ ambient_luxlevel : 24; /* 0x000000 ~ 0xFFFFFF */
u16_t linear_output; /* 0x0000 ~ 0xFFFF */ uint16_t linear_output; /* 0x0000 ~ 0xFFFF */
}; };
struct bt_mesh_light_lc_property_state { struct bt_mesh_light_lc_property_state {
u32_t time_occupancy_delay; /* 0x003A */ uint32_t time_occupancy_delay; /* 0x003A */
u32_t time_fade_on; /* 0x0037 */ uint32_t time_fade_on; /* 0x0037 */
u32_t time_run_on; /* 0x003C */ uint32_t time_run_on; /* 0x003C */
u32_t time_fade; /* 0x0036 */ uint32_t time_fade; /* 0x0036 */
u32_t time_prolong; /* 0x003B */ uint32_t time_prolong; /* 0x003B */
u32_t time_fade_standby_auto; /* 0x0038 */ uint32_t time_fade_standby_auto; /* 0x0038 */
u32_t time_fade_standby_manual; /* 0x0039 */ uint32_t time_fade_standby_manual; /* 0x0039 */
u16_t lightness_on; /* 0x002E */ uint16_t lightness_on; /* 0x002E */
u16_t lightness_prolong; /* 0x002F */ uint16_t lightness_prolong; /* 0x002F */
u16_t lightness_standby; /* 0x0030 */ uint16_t lightness_standby; /* 0x0030 */
u16_t ambient_luxlevel_on; /* 0x002B, 0x0000 ~ 0xFFFF */ uint16_t ambient_luxlevel_on; /* 0x002B, 0x0000 ~ 0xFFFF */
u16_t ambient_luxlevel_prolong; /* 0x002C, 0x0000 ~ 0xFFFF */ uint16_t ambient_luxlevel_prolong; /* 0x002C, 0x0000 ~ 0xFFFF */
u16_t ambient_luxlevel_standby; /* 0x002D, 0x0000 ~ 0xFFFF */ uint16_t ambient_luxlevel_standby; /* 0x002D, 0x0000 ~ 0xFFFF */
float regulator_kiu; /* 0x0033, 0.0 ~ 1000.0, default 250.0 */ float regulator_kiu; /* 0x0033, 0.0 ~ 1000.0, default 250.0 */
float regulator_kid; /* 0x0032, 0.0 ~ 1000.0, default 25.0 */ float regulator_kid; /* 0x0032, 0.0 ~ 1000.0, default 25.0 */
float regulator_kpu; /* 0x0035, 0.0 ~ 1000.0, default 80.0 */ float regulator_kpu; /* 0x0035, 0.0 ~ 1000.0, default 80.0 */
float regulator_kpd; /* 0x0034, 0.0 ~ 1000.0, default 80.0 */ float regulator_kpd; /* 0x0034, 0.0 ~ 1000.0, default 80.0 */
s8_t regulator_accuracy; /* 0x0031, 0.0 ~ 100.0, default 2.0 */ int8_t regulator_accuracy; /* 0x0031, 0.0 ~ 100.0, default 2.0 */
u32_t set_occupancy_to_1_delay; uint32_t set_occupancy_to_1_delay;
}; };
typedef enum { typedef enum {
@ -237,10 +237,10 @@ typedef enum {
struct bt_mesh_light_lc_state_machine { struct bt_mesh_light_lc_state_machine {
struct { struct {
u8_t fade_on; uint8_t fade_on;
u8_t fade; uint8_t fade;
u8_t fade_standby_auto; uint8_t fade_standby_auto;
u8_t fade_standby_manual; uint8_t fade_standby_manual;
} trans_time; } trans_time;
bt_mesh_lc_state state; bt_mesh_lc_state state;
struct k_delayed_work timer; struct k_delayed_work timer;
@ -268,220 +268,220 @@ struct bt_mesh_light_lc_setup_srv {
typedef union { typedef union {
struct { struct {
u16_t lightness; uint16_t lightness;
} lightness_set; } lightness_set;
struct { struct {
u16_t lightness; uint16_t lightness;
} lightness_linear_set; } lightness_linear_set;
struct { struct {
u16_t lightness; uint16_t lightness;
} lightness_default_set; } lightness_default_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} lightness_range_set; } lightness_range_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
} ctl_set; } ctl_set;
struct { struct {
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
} ctl_temp_set; } ctl_temp_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} ctl_temp_range_set; } ctl_temp_range_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
} ctl_default_set; } ctl_default_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t hue; uint16_t hue;
u16_t saturation; uint16_t saturation;
} hsl_set; } hsl_set;
struct { struct {
u16_t hue; uint16_t hue;
} hsl_hue_set; } hsl_hue_set;
struct { struct {
u16_t saturation; uint16_t saturation;
} hsl_saturation_set; } hsl_saturation_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t hue; uint16_t hue;
u16_t saturation; uint16_t saturation;
} hsl_default_set; } hsl_default_set;
struct { struct {
u16_t hue_range_min; uint16_t hue_range_min;
u16_t hue_range_max; uint16_t hue_range_max;
u16_t sat_range_min; uint16_t sat_range_min;
u16_t sat_range_max; uint16_t sat_range_max;
} hsl_range_set; } hsl_range_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t x; uint16_t x;
u16_t y; uint16_t y;
} xyl_set; } xyl_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t x; uint16_t x;
u16_t y; uint16_t y;
} xyl_default_set; } xyl_default_set;
struct { struct {
u16_t x_range_min; uint16_t x_range_min;
u16_t x_range_max; uint16_t x_range_max;
u16_t y_range_min; uint16_t y_range_min;
u16_t y_range_max; uint16_t y_range_max;
} xyl_range_set; } xyl_range_set;
struct { struct {
u8_t mode; uint8_t mode;
} lc_mode_set; } lc_mode_set;
struct { struct {
u8_t mode; uint8_t mode;
} lc_om_set; } lc_om_set;
struct { struct {
u8_t onoff; uint8_t onoff;
} lc_light_onoff_set; } lc_light_onoff_set;
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *value; struct net_buf_simple *value;
} lc_property_set; } lc_property_set;
struct { struct {
u16_t property_id; uint16_t property_id;
union { union {
u8_t occupancy; uint8_t occupancy;
u32_t set_occupancy_to_1_delay; uint32_t set_occupancy_to_1_delay;
u32_t ambient_luxlevel; uint32_t ambient_luxlevel;
} state; } state;
} sensor_status; } sensor_status;
} bt_mesh_light_server_state_change_t; } bt_mesh_light_server_state_change_t;
typedef union { typedef union {
struct { struct {
u16_t id; uint16_t id;
} lc_property_get; } lc_property_get;
} bt_mesh_light_server_recv_get_msg_t; } bt_mesh_light_server_recv_get_msg_t;
typedef union { typedef union {
struct { struct {
bool op_en; bool op_en;
u16_t lightness; uint16_t lightness;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} lightness_set; } lightness_set;
struct { struct {
bool op_en; bool op_en;
u16_t lightness; uint16_t lightness;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} lightness_linear_set; } lightness_linear_set;
struct { struct {
u16_t lightness; uint16_t lightness;
} lightness_default_set; } lightness_default_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} lightness_range_set; } lightness_range_set;
struct { struct {
bool op_en; bool op_en;
u16_t lightness; uint16_t lightness;
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} ctl_set; } ctl_set;
struct { struct {
bool op_en; bool op_en;
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} ctl_temp_set; } ctl_temp_set;
struct { struct {
u16_t range_min; uint16_t range_min;
u16_t range_max; uint16_t range_max;
} ctl_temp_range_set; } ctl_temp_range_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
} ctl_default_set; } ctl_default_set;
struct { struct {
bool op_en; bool op_en;
u16_t lightness; uint16_t lightness;
u16_t hue; uint16_t hue;
u16_t saturation; uint16_t saturation;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} hsl_set; } hsl_set;
struct { struct {
bool op_en; bool op_en;
u16_t hue; uint16_t hue;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} hsl_hue_set; } hsl_hue_set;
struct { struct {
bool op_en; bool op_en;
u16_t saturation; uint16_t saturation;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} hsl_saturation_set; } hsl_saturation_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t hue; uint16_t hue;
u16_t saturation; uint16_t saturation;
} hsl_default_set; } hsl_default_set;
struct { struct {
u16_t hue_range_min; uint16_t hue_range_min;
u16_t hue_range_max; uint16_t hue_range_max;
u16_t sat_range_min; uint16_t sat_range_min;
u16_t sat_range_max; uint16_t sat_range_max;
} hsl_range_set; } hsl_range_set;
struct { struct {
bool op_en; bool op_en;
u16_t lightness; uint16_t lightness;
u16_t x; uint16_t x;
u16_t y; uint16_t y;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} xyl_set; } xyl_set;
struct { struct {
u16_t lightness; uint16_t lightness;
u16_t x; uint16_t x;
u16_t y; uint16_t y;
} xyl_default_set; } xyl_default_set;
struct { struct {
u16_t x_range_min; uint16_t x_range_min;
u16_t x_range_max; uint16_t x_range_max;
u16_t y_range_min; uint16_t y_range_min;
u16_t y_range_max; uint16_t y_range_max;
} xyl_range_set; } xyl_range_set;
struct { struct {
u8_t mode; uint8_t mode;
} lc_mode_set; } lc_mode_set;
struct { struct {
u8_t mode; uint8_t mode;
} lc_om_set; } lc_om_set;
struct { struct {
bool op_en; bool op_en;
u8_t light_onoff; uint8_t light_onoff;
u8_t tid; uint8_t tid;
u8_t trans_time; uint8_t trans_time;
u8_t delay; uint8_t delay;
} lc_light_onoff_set; } lc_light_onoff_set;
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *value; struct net_buf_simple *value;
} lc_property_set; } lc_property_set;
} bt_mesh_light_server_recv_set_msg_t; } bt_mesh_light_server_recv_set_msg_t;
@ -495,13 +495,13 @@ typedef union {
void bt_mesh_light_server_lock(void); void bt_mesh_light_server_lock(void);
void bt_mesh_light_server_unlock(void); void bt_mesh_light_server_unlock(void);
u8_t *bt_mesh_get_lc_prop_value(struct bt_mesh_model *model, u16_t prop_id); uint8_t *bt_mesh_get_lc_prop_value(struct bt_mesh_model *model, uint16_t prop_id);
void light_lightness_publish(struct bt_mesh_model *model, u16_t opcode); void light_lightness_publish(struct bt_mesh_model *model, uint16_t opcode);
void light_ctl_publish(struct bt_mesh_model *model, u16_t opcode); void light_ctl_publish(struct bt_mesh_model *model, uint16_t opcode);
void light_hsl_publish(struct bt_mesh_model *model, u16_t opcode); void light_hsl_publish(struct bt_mesh_model *model, uint16_t opcode);
void light_xyl_publish(struct bt_mesh_model *model, u16_t opcode); void light_xyl_publish(struct bt_mesh_model *model, uint16_t opcode);
void light_lc_publish(struct bt_mesh_model *model, u16_t opcode); void light_lc_publish(struct bt_mesh_model *model, uint16_t opcode);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -79,26 +79,26 @@ enum bt_mesh_sensor_sample_func {
}; };
struct sensor_descriptor { struct sensor_descriptor {
u32_t positive_tolerance : 12, uint32_t positive_tolerance : 12,
negative_tolerance : 12, negative_tolerance : 12,
sample_function : 8; sample_function : 8;
u8_t measure_period; uint8_t measure_period;
u8_t update_interval; uint8_t update_interval;
}; };
struct sensor_setting { struct sensor_setting {
u16_t property_id; uint16_t property_id;
u8_t access; uint8_t access;
/* Or use union to include all possible types */ /* Or use union to include all possible types */
struct net_buf_simple *raw; struct net_buf_simple *raw;
}; };
struct sensor_cadence { struct sensor_cadence {
u8_t period_divisor : 7, uint8_t period_divisor : 7,
trigger_type : 1; trigger_type : 1;
struct net_buf_simple *trigger_delta_down; struct net_buf_simple *trigger_delta_down;
struct net_buf_simple *trigger_delta_up; struct net_buf_simple *trigger_delta_up;
u8_t min_interval; uint8_t min_interval;
struct net_buf_simple *fast_cadence_low; struct net_buf_simple *fast_cadence_low;
struct net_buf_simple *fast_cadence_high; struct net_buf_simple *fast_cadence_high;
}; };
@ -111,8 +111,8 @@ struct sensor_data {
* representing range of 1 127). The value 0x7F represents a * representing range of 1 127). The value 0x7F represents a
* length of zero. * length of zero.
*/ */
u8_t format : 1, uint8_t format : 1,
length : 7; length : 7;
struct net_buf_simple *raw_value; struct net_buf_simple *raw_value;
}; };
@ -123,7 +123,7 @@ struct sensor_series_column {
}; };
struct bt_mesh_sensor_state { struct bt_mesh_sensor_state {
u16_t sensor_property_id; uint16_t sensor_property_id;
/* Constant throughout the lifetime of an element */ /* Constant throughout the lifetime of an element */
struct sensor_descriptor descriptor; struct sensor_descriptor descriptor;
@ -132,7 +132,7 @@ struct bt_mesh_sensor_state {
* The Sensor Setting Property ID values shall be unique for each * The Sensor Setting Property ID values shall be unique for each
* Sensor Property ID that identifies a sensor within an element. * Sensor Property ID that identifies a sensor within an element.
*/ */
const u8_t setting_count; const uint8_t setting_count;
struct sensor_setting *settings; struct sensor_setting *settings;
/* The Sensor Cadence state may be not supported by sensors based /* The Sensor Cadence state may be not supported by sensors based
@ -176,73 +176,73 @@ struct bt_mesh_sensor_state {
struct bt_mesh_sensor_srv { struct bt_mesh_sensor_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
const u8_t state_count; const uint8_t state_count;
struct bt_mesh_sensor_state *states; struct bt_mesh_sensor_state *states;
}; };
struct bt_mesh_sensor_setup_srv { struct bt_mesh_sensor_setup_srv {
struct bt_mesh_model *model; struct bt_mesh_model *model;
struct bt_mesh_server_rsp_ctrl rsp_ctrl; struct bt_mesh_server_rsp_ctrl rsp_ctrl;
const u8_t state_count; const uint8_t state_count;
struct bt_mesh_sensor_state *states; struct bt_mesh_sensor_state *states;
}; };
typedef union { typedef union {
struct { struct {
u16_t id; uint16_t id;
u8_t period_divisor : 7, uint8_t period_divisor : 7,
trigger_type : 1; trigger_type : 1;
struct net_buf_simple *trigger_delta_down; struct net_buf_simple *trigger_delta_down;
struct net_buf_simple *trigger_delta_up; struct net_buf_simple *trigger_delta_up;
u8_t min_interval; uint8_t min_interval;
struct net_buf_simple *fast_cadence_low; struct net_buf_simple *fast_cadence_low;
struct net_buf_simple *fast_cadence_high; struct net_buf_simple *fast_cadence_high;
} sensor_cadence_set; } sensor_cadence_set;
struct { struct {
u16_t id; uint16_t id;
u16_t setting_id; uint16_t setting_id;
struct net_buf_simple *value; struct net_buf_simple *value;
} sensor_setting_set; } sensor_setting_set;
} bt_mesh_sensor_server_state_change_t; } bt_mesh_sensor_server_state_change_t;
typedef union { typedef union {
struct { struct {
bool op_en; bool op_en;
u16_t id; uint16_t id;
} sensor_descriptor_get; } sensor_descriptor_get;
struct { struct {
u16_t id; uint16_t id;
} sensor_cadence_get; } sensor_cadence_get;
struct { struct {
u16_t id; uint16_t id;
} sensor_settings_get; } sensor_settings_get;
struct { struct {
u16_t id; uint16_t id;
u16_t setting_id; uint16_t setting_id;
} sensor_setting_get; } sensor_setting_get;
struct { struct {
bool op_en; bool op_en;
u16_t id; uint16_t id;
} sensor_get; } sensor_get;
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *raw_x; struct net_buf_simple *raw_x;
} sensor_column_get; } sensor_column_get;
struct { struct {
bool op_en; bool op_en;
u16_t id; uint16_t id;
struct net_buf_simple *raw; struct net_buf_simple *raw;
} sensor_series_get; } sensor_series_get;
} bt_mesh_sensor_server_recv_get_msg_t; } bt_mesh_sensor_server_recv_get_msg_t;
typedef union { typedef union {
struct { struct {
u16_t id; uint16_t id;
struct net_buf_simple *cadence; struct net_buf_simple *cadence;
} sensor_cadence_set; } sensor_cadence_set;
struct { struct {
u16_t id; uint16_t id;
u16_t setting_id; uint16_t setting_id;
struct net_buf_simple *raw; struct net_buf_simple *raw;
} sensor_setting_set; } sensor_setting_set;
} bt_mesh_sensor_server_recv_set_msg_t; } bt_mesh_sensor_server_recv_set_msg_t;

View File

@ -61,23 +61,23 @@ enum {
struct bt_mesh_state_transition { struct bt_mesh_state_transition {
bool just_started; bool just_started;
u8_t trans_time; uint8_t trans_time;
u8_t remain_time; uint8_t remain_time;
u8_t delay; uint8_t delay;
u32_t quo_tt; uint32_t quo_tt;
u32_t counter; uint32_t counter;
u32_t total_duration; uint32_t total_duration;
s64_t start_timestamp; int64_t start_timestamp;
BLE_MESH_ATOMIC_DEFINE(flag, BLE_MESH_TRANS_FLAG_MAX); BLE_MESH_ATOMIC_DEFINE(flag, BLE_MESH_TRANS_FLAG_MAX);
struct k_delayed_work timer; struct k_delayed_work timer;
}; };
struct bt_mesh_last_msg_info { struct bt_mesh_last_msg_info {
u8_t tid; uint8_t tid;
u16_t src; uint16_t src;
u16_t dst; uint16_t dst;
s64_t timestamp; int64_t timestamp;
}; };
#define BLE_MESH_SERVER_RSP_BY_APP 0 #define BLE_MESH_SERVER_RSP_BY_APP 0
@ -99,31 +99,31 @@ struct bt_mesh_server_rsp_ctrl {
* 6. If status_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response * 6. If status_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
* of Server status messages will be replied by the server models; * of Server status messages will be replied by the server models;
*/ */
u8_t get_auto_rsp : 1, /* Response for Client Get messages */ uint8_t get_auto_rsp : 1, /* Response for Client Get messages */
set_auto_rsp : 1, /* Response for Client Set messages */ set_auto_rsp : 1, /* Response for Client Set messages */
status_auto_rsp : 1; /* Response for Server Status messages */ status_auto_rsp : 1; /* Response for Server Status messages */
}; };
u8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model); uint8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model);
int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, u8_t *trans_time); int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, uint8_t *trans_time);
int bt_mesh_server_get_optional(struct bt_mesh_model *model, int bt_mesh_server_get_optional(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx, struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, struct net_buf_simple *buf,
u8_t *trans_time, u8_t *delay, uint8_t *trans_time, uint8_t *delay,
bool *optional); bool *optional);
void bt_mesh_server_alloc_ctx(struct k_work *work); void bt_mesh_server_alloc_ctx(struct k_work *work);
void bt_mesh_server_free_ctx(struct k_work *work); void bt_mesh_server_free_ctx(struct k_work *work);
bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last, bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last,
u8_t tid, u16_t src, u16_t dst, s64_t *now); uint8_t tid, uint16_t src, uint16_t dst, int64_t *now);
void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last, void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last,
u8_t tid, u16_t src, u16_t dst, s64_t *now); uint8_t tid, uint16_t src, uint16_t dst, int64_t *now);
struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u16_t msg_len); struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, uint16_t msg_len);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -34,62 +34,62 @@ typedef enum {
typedef union { typedef union {
struct { struct {
u8_t onoff; uint8_t onoff;
} gen_onoff; } gen_onoff;
struct { struct {
s16_t level; int16_t level;
} gen_level; } gen_level;
struct { struct {
u8_t onpowerup; uint8_t onpowerup;
} gen_onpowerup; } gen_onpowerup;
struct { struct {
u16_t power; uint16_t power;
} gen_power_actual; } gen_power_actual;
struct { struct {
u16_t lightness; uint16_t lightness;
} light_lightness_actual; } light_lightness_actual;
struct { struct {
u16_t lightness; uint16_t lightness;
} light_lightness_linear; } light_lightness_linear;
struct { struct {
u16_t lightness; uint16_t lightness;
} light_ctl_lightness; } light_ctl_lightness;
struct { struct {
u16_t temperature; uint16_t temperature;
s16_t delta_uv; int16_t delta_uv;
} light_ctl_temp_delta_uv; } light_ctl_temp_delta_uv;
struct { struct {
u16_t lightness; uint16_t lightness;
} light_hsl_lightness; } light_hsl_lightness;
struct { struct {
u16_t hue; uint16_t hue;
} light_hsl_hue; } light_hsl_hue;
struct { struct {
u16_t saturation; uint16_t saturation;
} light_hsl_saturation; } light_hsl_saturation;
struct { struct {
u16_t lightness; uint16_t lightness;
} light_xyl_lightness; } light_xyl_lightness;
struct { struct {
u8_t onoff; uint8_t onoff;
} light_lc_light_onoff; } light_lc_light_onoff;
} bt_mesh_server_state_value_t; } bt_mesh_server_state_value_t;
u16_t bt_mesh_convert_lightness_actual_to_linear(u16_t actual); uint16_t bt_mesh_convert_lightness_actual_to_linear(uint16_t actual);
u16_t bt_mesh_convert_lightness_linear_to_actual(u16_t linear); uint16_t bt_mesh_convert_lightness_linear_to_actual(uint16_t linear);
s16_t bt_mesh_convert_temperature_to_gen_level(u16_t temp, u16_t min, u16_t max); int16_t bt_mesh_convert_temperature_to_gen_level(uint16_t temp, uint16_t min, uint16_t max);
u16_t bt_mesh_covert_gen_level_to_temperature(s16_t level, u16_t min, u16_t max); uint16_t bt_mesh_covert_gen_level_to_temperature(int16_t level, uint16_t min, uint16_t max);
s16_t bt_mesh_convert_hue_to_level(u16_t hue); int16_t bt_mesh_convert_hue_to_level(uint16_t hue);
u16_t bt_mesh_convert_level_to_hue(s16_t level); uint16_t bt_mesh_convert_level_to_hue(int16_t level);
s16_t bt_mesh_convert_saturation_to_level(u16_t saturation); int16_t bt_mesh_convert_saturation_to_level(uint16_t saturation);
u16_t bt_mesh_convert_level_to_saturation(s16_t level); uint16_t bt_mesh_convert_level_to_saturation(int16_t level);
int bt_mesh_update_binding_state(struct bt_mesh_model *model, int bt_mesh_update_binding_state(struct bt_mesh_model *model,
bt_mesh_server_state_type_t type, bt_mesh_server_state_type_t type,

Some files were not shown because too many files have changed in this diff Show More