diff --git a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c index b37ccb0d7a..7f8959cf66 100644 --- a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c +++ b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c @@ -72,23 +72,23 @@ static uint8_t dev_uuid[16] = { }; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_ENABLED, + /* 3 transmissions with 20ms interval */ + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - /* 3 transmissions with 20ms interval */ - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; uint8_t test_ids[1] = {0x00}; @@ -96,15 +96,19 @@ uint8_t test_ids[1] = {0x00}; /** ESP BLE Mesh Health Server Model Context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(health_pub, 2 + 11, ROLE_NODE); static esp_ble_mesh_health_srv_t health_server = { - .health_test.id_count = 1, - .health_test.test_ids = test_ids, + .health_test = { + .id_count = 1, + .test_ids = test_ids, + }, }; #ifdef CONFIG_MESH_MODEL_GEN_ONOFF_SRV ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_0, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_0 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, }; #endif @@ -115,16 +119,20 @@ static esp_ble_mesh_light_lightness_state_t lightness_state; /* Light Lightness Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(lightness_pub, 2 + 5, ROLE_NODE); static esp_ble_mesh_light_lightness_srv_t lightness_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &lightness_state, }; /* Light Lightness Setup Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(lightness_setup_pub, 2 + 5, ROLE_NODE); static esp_ble_mesh_light_lightness_setup_srv_t lightness_setup_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &lightness_state, }; #endif @@ -136,16 +144,20 @@ static esp_ble_mesh_light_ctl_state_t ctl_state; /* Light CTL Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(ctl_pub, 2 + 9, ROLE_NODE); static esp_ble_mesh_light_ctl_srv_t ctl_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &ctl_state, }; /* Light CTL Setup Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(ctl_setup_pub, 2 + 6, ROLE_NODE); static esp_ble_mesh_light_ctl_setup_srv_t ctl_setup_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &ctl_state, }; #endif @@ -157,16 +169,20 @@ static esp_ble_mesh_light_hsl_state_t hsl_state; /* Light HSL Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(hsl_pub, 2 + 9, ROLE_NODE); static esp_ble_mesh_light_hsl_srv_t hsl_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &hsl_state, }; /* Light HSL Setup Server related context */ ESP_BLE_MESH_MODEL_PUB_DEFINE(hsl_setup_pub, 2 + 9, ROLE_NODE); static esp_ble_mesh_light_hsl_setup_srv_t hsl_setup_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, .state = &hsl_state, }; #endif @@ -213,14 +229,18 @@ static esp_ble_mesh_model_t ali_vnd_models[] = { ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_1, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_1 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, }; ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_2, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_2 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, }; static esp_ble_mesh_model_t extend_model_0[] = { @@ -239,8 +259,8 @@ esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ALIBABA, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; /* Disable OOB security for SILabs Android app */ @@ -474,7 +494,7 @@ void user_genie_event_handle(genie_event_t event, void *p_arg) case GENIE_EVT_SDK_COLOR_ACTION: { ESP_LOGI(TAG, "GENIE_EVT_SDK_COLOR_ACTION"); #ifdef CONFIG_MESH_MODEL_HSL_SRV - uint8_t *p_data = p_arg; + uint8_t *p_data = (uint8_t *)p_arg; uint16_t lightness = *p_data++; lightness += (*p_data++ << 8); @@ -1041,7 +1061,7 @@ static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_ev case ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT: ESP_LOGI(TAG, "ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT"); if (param->ctx.recv_op == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET) { - esp_ble_mesh_gen_onoff_srv_t *srv = param->model->user_data; + esp_ble_mesh_gen_onoff_srv_t *srv = (esp_ble_mesh_gen_onoff_srv_t *)param->model->user_data; ESP_LOGI(TAG, "onoff: 0x%02x", srv->state.onoff); esp_ble_mesh_server_model_send_msg(param->model, ¶m->ctx, ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS, sizeof(srv->state.onoff), &srv->state.onoff); @@ -1057,7 +1077,7 @@ static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_ev param->value.set.onoff.trans_time, param->value.set.onoff.delay); } - esp_ble_mesh_gen_onoff_srv_t *srv = param->model->user_data; + esp_ble_mesh_gen_onoff_srv_t *srv = (esp_ble_mesh_gen_onoff_srv_t *)param->model->user_data; if (param->value.set.onoff.op_en == false) { srv->state.onoff = param->value.set.onoff.onoff; } else { @@ -1264,7 +1284,7 @@ static esp_err_t ble_mesh_init(void) return err; } - ESP_ERROR_CHECK(esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); + ESP_ERROR_CHECK(esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT))); if (esp_ble_mesh_node_is_provisioned()) { ESP_LOGW(TAG, "node already provisioned"); diff --git a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/include/board.h b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/include/board.h index 2040e398b9..67ab60d352 100644 --- a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/include/board.h +++ b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/include/board.h @@ -9,14 +9,13 @@ #ifndef _BOARD_H_ #define _BOARD_H_ -#include "driver/gpio.h" - -#include "light_driver.h" - #ifdef __cplusplus extern "C" { #endif /**< __cplusplus */ +#include "driver/gpio.h" +#include "light_driver.h" + #define LED_ON 1 #define LED_OFF 0 @@ -81,4 +80,4 @@ uint8_t *mac_str2hex(const char *mac_str, uint8_t *mac_hex); } #endif /**< __cplusplus */ -#endif +#endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/main/main.c index 55951da892..6ee2164d5a 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/main/main.c @@ -41,22 +41,22 @@ static const esp_ble_mesh_client_op_pair_t fast_prov_cli_op_pair[] = { }; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with a 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with a 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; esp_ble_mesh_client_t config_client; esp_ble_mesh_client_t gen_onoff_client; @@ -89,8 +89,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t comp = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t prov = { @@ -211,10 +211,10 @@ static void example_recv_unprov_adv_pkt(uint8_t dev_uuid[16], uint8_t addr[BLE_M add: memcpy(add_dev.addr, addr, 6); - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; memcpy(add_dev.uuid, dev_uuid, 16); add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; flag = ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_START_PROV_NOW_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG; err = esp_ble_mesh_provisioner_add_unprov_dev(&add_dev, flag); if (err != ESP_OK) { @@ -551,7 +551,7 @@ static esp_err_t ble_mesh_init(void) return ESP_FAIL; } - err = esp_ble_mesh_provisioner_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_provisioner_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "%s: Failed to enable provisioning", __func__); return ESP_FAIL; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/board.h index fb09b5547b..820e2dcb1b 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/board.h @@ -8,6 +8,10 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "sdkconfig.h" #include "driver/gpio.h" #include "esp_ble_mesh_defs.h" @@ -53,4 +57,8 @@ void board_led_operation(uint8_t pin, uint8_t onoff); esp_err_t board_init(void); +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + #endif diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/main.c index ce2135e8cb..4ca03a2950 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/main.c @@ -48,22 +48,22 @@ esp_ble_mesh_client_t config_client; /* Configuration Server Model user_data */ esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_ENABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_DISABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; /* Fast Prov Client Model user_data */ @@ -77,6 +77,7 @@ example_fast_prov_server_t fast_prov_server = { .primary_role = false, .max_node_num = 6, .prov_node_cnt = 0x0, + .app_idx = ESP_BLE_MESH_KEY_UNUSED, .unicast_min = ESP_BLE_MESH_ADDR_UNASSIGNED, .unicast_max = ESP_BLE_MESH_ADDR_UNASSIGNED, .unicast_cur = ESP_BLE_MESH_ADDR_UNASSIGNED, @@ -84,7 +85,6 @@ example_fast_prov_server_t fast_prov_server = { .flags = 0x0, .iv_index = 0x0, .net_idx = ESP_BLE_MESH_KEY_UNUSED, - .app_idx = ESP_BLE_MESH_KEY_UNUSED, .group_addr = ESP_BLE_MESH_ADDR_UNASSIGNED, .prim_prov_addr = ESP_BLE_MESH_ADDR_UNASSIGNED, .match_len = 0x0, @@ -94,8 +94,10 @@ example_fast_prov_server_t fast_prov_server = { ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub, 2 + 3, ROLE_FAST_PROV); static esp_ble_mesh_gen_onoff_srv_t onoff_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + } }; static esp_ble_mesh_model_op_t fast_prov_srv_op[] = { @@ -134,8 +136,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t comp = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t prov = { @@ -309,9 +311,9 @@ static void example_recv_unprov_adv_pkt(uint8_t dev_uuid[16], uint8_t addr[BLE_M } } - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; memcpy(add_dev.uuid, dev_uuid, 16); memcpy(add_dev.addr, addr, BLE_MESH_ADDR_LEN); flag = ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_START_PROV_NOW_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG; @@ -452,8 +454,8 @@ static void example_ble_mesh_custom_model_cb(esp_ble_mesh_model_cb_event_t event case ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_NODE_GROUP_DELETE: { ESP_LOGI(TAG, "%s: Fast prov server receives msg, opcode 0x%04" PRIx32, __func__, opcode); struct net_buf_simple buf = { - .len = param->model_operation.length, .data = param->model_operation.msg, + .len = param->model_operation.length, }; err = example_fast_prov_server_recv_msg(param->model_operation.model, param->model_operation.ctx, &buf); @@ -727,7 +729,7 @@ static esp_err_t ble_mesh_init(void) k_delayed_work_init(&send_self_prov_node_addr_timer, example_send_self_prov_node_addr); - err = esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "%s: Failed to enable node provisioning", __func__); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/board.h index edb45915d1..71af077eec 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/board.h @@ -10,6 +10,10 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "driver/gpio.h" #include "esp_ble_mesh_defs.h" @@ -53,4 +57,8 @@ void board_led_operation(uint8_t pin, uint8_t onoff); void board_init(void); -#endif +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + +#endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/main.c index 9b4d2bafb7..c619ea9cf3 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/main/main.c @@ -48,22 +48,22 @@ static const char * NVS_KEY = "onoff_client"; static esp_ble_mesh_client_t onoff_client; static esp_ble_mesh_cfg_srv_t config_server = { - .relay = ESP_BLE_MESH_RELAY_ENABLED, + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), + .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_cli_pub, 2 + 1, ROLE_NODE); @@ -79,8 +79,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; /* Disable OOB security for SILabs Android app */ @@ -89,8 +89,8 @@ static esp_ble_mesh_prov_t provision = { #if 0 .output_size = 4, .output_actions = ESP_BLE_MESH_DISPLAY_NUMBER, - .input_actions = ESP_BLE_MESH_PUSH, .input_size = 4, + .input_actions = ESP_BLE_MESH_PUSH, #else .output_size = 0, .output_actions = 0, @@ -278,7 +278,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh node (err %d)", err); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/board.h index 7c4b03cc3a..5c5a511cd6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/board.h @@ -10,6 +10,10 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "driver/gpio.h" #if defined(CONFIG_BLE_MESH_ESP_WROOM_32) @@ -52,4 +56,8 @@ void board_led_operation(uint8_t pin, uint8_t onoff); void board_init(void); -#endif +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + +#endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/main.c index dc39598458..8e115b43e6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/main.c @@ -34,40 +34,46 @@ extern struct _led_state led_state[3]; static uint8_t dev_uuid[16] = { 0xdd, 0xdd }; static esp_ble_mesh_cfg_srv_t config_server = { - .relay = ESP_BLE_MESH_RELAY_ENABLED, + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), + .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_0, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_0 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + }, }; ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_1, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_1 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, }; ESP_BLE_MESH_MODEL_PUB_DEFINE(onoff_pub_2, 2 + 3, ROLE_NODE); static esp_ble_mesh_gen_onoff_srv_t onoff_server_2 = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_AUTO_RSP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, }; static esp_ble_mesh_model_t root_models[] = { @@ -91,8 +97,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; /* Disable OOB security for SILabs Android app */ @@ -101,8 +107,8 @@ static esp_ble_mesh_prov_t provision = { #if 0 .output_size = 4, .output_actions = ESP_BLE_MESH_DISPLAY_NUMBER, - .input_actions = ESP_BLE_MESH_PUSH, .input_size = 4, + .input_actions = ESP_BLE_MESH_PUSH, #else .output_size = 0, .output_actions = 0, @@ -146,7 +152,7 @@ static void example_handle_gen_onoff_msg(esp_ble_mesh_model_t *model, esp_ble_mesh_msg_ctx_t *ctx, esp_ble_mesh_server_recv_gen_onoff_set_t *set) { - esp_ble_mesh_gen_onoff_srv_t *srv = model->user_data; + esp_ble_mesh_gen_onoff_srv_t *srv = (esp_ble_mesh_gen_onoff_srv_t *)model->user_data; switch (ctx->recv_op) { case ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET: @@ -227,7 +233,7 @@ static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_ev case ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT: ESP_LOGI(TAG, "ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT"); if (param->ctx.recv_op == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET) { - srv = param->model->user_data; + srv = (esp_ble_mesh_gen_onoff_srv_t *)param->model->user_data; ESP_LOGI(TAG, "onoff 0x%02x", srv->state.onoff); example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } @@ -298,7 +304,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh node (err %d)", err); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/main/main.c index e7581a2a40..0aaa9b2171 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/main/main.c @@ -51,13 +51,7 @@ typedef struct { uint8_t onoff; } esp_ble_mesh_node_info_t; -static esp_ble_mesh_node_info_t nodes[CONFIG_BLE_MESH_MAX_PROV_NODES] = { - [0 ... (CONFIG_BLE_MESH_MAX_PROV_NODES - 1)] = { - .unicast = ESP_BLE_MESH_ADDR_UNASSIGNED, - .elem_num = 0, - .onoff = LED_OFF, - } -}; +static esp_ble_mesh_node_info_t nodes[CONFIG_BLE_MESH_MAX_PROV_NODES] = {0}; static struct esp_ble_mesh_key { uint16_t net_idx; @@ -69,22 +63,22 @@ static esp_ble_mesh_client_t config_client; static esp_ble_mesh_client_t onoff_client; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; static esp_ble_mesh_model_t root_models[] = { @@ -99,8 +93,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t provision = { @@ -259,14 +253,14 @@ static void recv_unprov_adv_pkt(uint8_t dev_uuid[16], uint8_t addr[BD_ADDR_LEN], ESP_LOGI(TAG, "oob info: %d, bearer: %s", oob_info, (bearer & ESP_BLE_MESH_PROV_ADV) ? "PB-ADV" : "PB-GATT"); memcpy(add_dev.addr, addr, BD_ADDR_LEN); - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; memcpy(add_dev.uuid, dev_uuid, 16); add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; /* Note: If unprovisioned device adv packets have not been received, we should not add device with ADD_DEV_START_PROV_NOW_FLAG set. */ err = esp_ble_mesh_provisioner_add_unprov_dev(&add_dev, - ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_START_PROV_NOW_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG); + (esp_ble_mesh_dev_add_flag_t)(ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_START_PROV_NOW_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG)); if (err) { ESP_LOGE(TAG, "%s: Add unprovisioned device into queue failed", __func__); } @@ -608,7 +602,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_provisioner_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_provisioner_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh provisioner (err %d)", err); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/board.h index 79cc232d83..73420a3760 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/board.h @@ -10,6 +10,14 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + void board_init(void); +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + #endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/main.c index b4c0e04b02..3e66ea72ea 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/main/main.c @@ -54,7 +54,10 @@ static struct esp_ble_mesh_key { } prov_key; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_DISABLED, #if defined(CONFIG_BLE_MESH_FRIEND) .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, @@ -62,9 +65,6 @@ static esp_ble_mesh_cfg_srv_t config_server = { .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; static esp_ble_mesh_client_t config_client; @@ -82,8 +82,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t provision = { @@ -164,10 +164,10 @@ static void recv_unprov_adv_pkt(uint8_t dev_uuid[ESP_BLE_MESH_OCTET16_LEN], uint ESP_LOGI(TAG, "oob info 0x%04x, bearer %s", oob_info, (bearer & ESP_BLE_MESH_PROV_ADV) ? "PB-ADV" : "PB-GATT"); memcpy(add_dev.addr, addr, BD_ADDR_LEN); - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; memcpy(add_dev.uuid, dev_uuid, ESP_BLE_MESH_OCTET16_LEN); add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; /* Note: If unprovisioned device adv packets have not been received, we should not add device with ADD_DEV_START_PROV_NOW_FLAG set. */ err = esp_ble_mesh_provisioner_add_unprov_dev(&add_dev, @@ -648,7 +648,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_provisioner_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_provisioner_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh provisioner"); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/board.h index 7c4b03cc3a..5c5a511cd6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/board.h @@ -10,6 +10,10 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "driver/gpio.h" #if defined(CONFIG_BLE_MESH_ESP_WROOM_32) @@ -52,4 +56,8 @@ void board_led_operation(uint8_t pin, uint8_t onoff); void board_init(void); -#endif +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + +#endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/main.c index efef461691..70b30136e2 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/main/main.c @@ -49,22 +49,22 @@ static int8_t outdoor_temp = 60; /* Outdoor temperature is 30 Degrees Celsius static uint8_t dev_uuid[ESP_BLE_MESH_OCTET16_LEN] = { 0x32, 0x10 }; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_ENABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; NET_BUF_SIMPLE_DEFINE_STATIC(sensor_data_0, 1); @@ -89,41 +89,53 @@ static esp_ble_mesh_sensor_state_t sensor_states[2] = { * Sensor Descriptor state represents the attributes describing the sensor * data. This state does not change throughout the lifetime of an element. */ - .descriptor.positive_tolerance = SENSOR_POSITIVE_TOLERANCE, - .descriptor.negative_tolerance = SENSOR_NEGATIVE_TOLERANCE, - .descriptor.sampling_function = SENSOR_SAMPLE_FUNCTION, - .descriptor.measure_period = SENSOR_MEASURE_PERIOD, - .descriptor.update_interval = SENSOR_UPDATE_INTERVAL, - .sensor_data.format = ESP_BLE_MESH_SENSOR_DATA_FORMAT_A, - .sensor_data.length = 0, /* 0 represents the length is 1 */ - .sensor_data.raw_value = &sensor_data_0, + .descriptor = { + .positive_tolerance = SENSOR_POSITIVE_TOLERANCE, + .negative_tolerance = SENSOR_NEGATIVE_TOLERANCE, + .sampling_function = SENSOR_SAMPLE_FUNCTION, + .measure_period = SENSOR_MEASURE_PERIOD, + .update_interval = SENSOR_UPDATE_INTERVAL, + }, + .sensor_data = { + .format = ESP_BLE_MESH_SENSOR_DATA_FORMAT_A, + .length = 0, /* 0 represents the length is 1 */ + .raw_value = &sensor_data_0, + }, }, [1] = { .sensor_property_id = SENSOR_PROPERTY_ID_1, - .descriptor.positive_tolerance = SENSOR_POSITIVE_TOLERANCE, - .descriptor.negative_tolerance = SENSOR_NEGATIVE_TOLERANCE, - .descriptor.sampling_function = SENSOR_SAMPLE_FUNCTION, - .descriptor.measure_period = SENSOR_MEASURE_PERIOD, - .descriptor.update_interval = SENSOR_UPDATE_INTERVAL, - .sensor_data.format = ESP_BLE_MESH_SENSOR_DATA_FORMAT_A, - .sensor_data.length = 0, /* 0 represents the length is 1 */ - .sensor_data.raw_value = &sensor_data_1, + .descriptor = { + .positive_tolerance = SENSOR_POSITIVE_TOLERANCE, + .negative_tolerance = SENSOR_NEGATIVE_TOLERANCE, + .sampling_function = SENSOR_SAMPLE_FUNCTION, + .measure_period = SENSOR_MEASURE_PERIOD, + .update_interval = SENSOR_UPDATE_INTERVAL, + }, + .sensor_data = { + .format = ESP_BLE_MESH_SENSOR_DATA_FORMAT_A, + .length = 0, /* 0 represents the length is 1 */ + .raw_value = &sensor_data_1, + }, }, }; /* 20 octets is large enough to hold two Sensor Descriptor state values. */ ESP_BLE_MESH_MODEL_PUB_DEFINE(sensor_pub, 20, ROLE_NODE); static esp_ble_mesh_sensor_srv_t sensor_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, .state_count = ARRAY_SIZE(sensor_states), .states = sensor_states, }; ESP_BLE_MESH_MODEL_PUB_DEFINE(sensor_setup_pub, 20, ROLE_NODE); static esp_ble_mesh_sensor_setup_srv_t sensor_setup_server = { - .rsp_ctrl.get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, - .rsp_ctrl.set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .rsp_ctrl = { + .get_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + .set_auto_rsp = ESP_BLE_MESH_SERVER_RSP_BY_APP, + }, .state_count = ARRAY_SIZE(sensor_states), .states = sensor_states, }; @@ -140,8 +152,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t provision = { @@ -244,7 +256,7 @@ static void example_ble_mesh_send_sensor_descriptor_status(esp_ble_mesh_sensor_s esp_err_t err; int i; - status = calloc(1, ARRAY_SIZE(sensor_states) * ESP_BLE_MESH_SENSOR_DESCRIPTOR_LEN); + status = (uint8_t *)calloc(1, ARRAY_SIZE(sensor_states) * ESP_BLE_MESH_SENSOR_DESCRIPTOR_LEN); if (!status) { ESP_LOGE(TAG, "No memory for sensor descriptor status!"); return; @@ -427,7 +439,7 @@ static void example_ble_mesh_send_sensor_status(esp_ble_mesh_sensor_server_cb_pa } } - status = calloc(1, buf_size); + status = (uint8_t *)calloc(1, buf_size); if (!status) { ESP_LOGE(TAG, "No memory for sensor status!"); return; @@ -485,7 +497,7 @@ static void example_ble_mesh_send_sensor_column_status(esp_ble_mesh_sensor_serve length = ESP_BLE_MESH_SENSOR_PROPERTY_ID_LEN +param->value.get.sensor_column.raw_value_x->len; - status = calloc(1, length); + status = (uint8_t *)calloc(1, length); if (!status) { ESP_LOGE(TAG, "No memory for sensor column status!"); return; @@ -599,7 +611,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh node"); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/board.h index 79cc232d83..73420a3760 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/board.h @@ -10,6 +10,14 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + void board_init(void); +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + #endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c index 0d6d0b4b30..6bedb601ca 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c @@ -71,7 +71,10 @@ static struct esp_ble_mesh_key { } prov_key; static esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_DISABLED, #if defined(CONFIG_BLE_MESH_FRIEND) .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, @@ -79,9 +82,6 @@ static esp_ble_mesh_cfg_srv_t config_server = { .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; static esp_ble_mesh_client_t config_client; @@ -116,8 +116,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t provision = { @@ -219,10 +219,10 @@ static void recv_unprov_adv_pkt(uint8_t dev_uuid[ESP_BLE_MESH_OCTET16_LEN], uint ESP_LOGI(TAG, "oob info 0x%04x, bearer %s", oob_info, (bearer & ESP_BLE_MESH_PROV_ADV) ? "PB-ADV" : "PB-GATT"); memcpy(add_dev.addr, addr, BD_ADDR_LEN); - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; memcpy(add_dev.uuid, dev_uuid, ESP_BLE_MESH_OCTET16_LEN); add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; /* Note: If unprovisioned device adv packets have not been received, we should not add device with ADD_DEV_START_PROV_NOW_FLAG set. */ err = esp_ble_mesh_provisioner_add_unprov_dev(&add_dev, @@ -542,7 +542,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_provisioner_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_provisioner_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh provisioner"); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/board.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/board.h index 7c4b03cc3a..5c5a511cd6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/board.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/board.h @@ -10,6 +10,10 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "driver/gpio.h" #if defined(CONFIG_BLE_MESH_ESP_WROOM_32) @@ -52,4 +56,8 @@ void board_led_operation(uint8_t pin, uint8_t onoff); void board_init(void); -#endif +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + +#endif /* _BOARD_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c index b84f173f1b..3dde20b0ed 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c @@ -38,22 +38,22 @@ static uint8_t dev_uuid[ESP_BLE_MESH_OCTET16_LEN] = { 0x32, 0x10 }; static esp_ble_mesh_cfg_srv_t config_server = { - .relay = ESP_BLE_MESH_RELAY_ENABLED, + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), + .relay = ESP_BLE_MESH_RELAY_DISABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_ENABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; static esp_ble_mesh_model_t root_models[] = { @@ -76,8 +76,8 @@ static esp_ble_mesh_elem_t elements[] = { static esp_ble_mesh_comp_t composition = { .cid = CID_ESP, - .elements = elements, .element_count = ARRAY_SIZE(elements), + .elements = elements, }; static esp_ble_mesh_prov_t provision = { @@ -193,7 +193,7 @@ static esp_err_t ble_mesh_init(void) return err; } - err = esp_ble_mesh_node_prov_enable(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT); + err = esp_ble_mesh_node_prov_enable((esp_ble_mesh_prov_bearer_t)(ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT)); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to enable mesh node"); return err; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/main.c index c2630ccde4..b80445f52c 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/main.c @@ -61,22 +61,22 @@ esp_ble_mesh_client_t config_client; /* Configuration Server Model user_data */ esp_ble_mesh_cfg_srv_t config_server = { + /* 3 transmissions with 20ms interval */ + .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), .relay = ESP_BLE_MESH_RELAY_ENABLED, + .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), .beacon = ESP_BLE_MESH_BEACON_DISABLED, -#if defined(CONFIG_BLE_MESH_FRIEND) - .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, -#else - .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, -#endif #if defined(CONFIG_BLE_MESH_GATT_PROXY_SERVER) .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_ENABLED, #else .gatt_proxy = ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED, +#endif +#if defined(CONFIG_BLE_MESH_FRIEND) + .friend_state = ESP_BLE_MESH_FRIEND_ENABLED, +#else + .friend_state = ESP_BLE_MESH_FRIEND_NOT_SUPPORTED, #endif .default_ttl = 7, - /* 3 transmissions with 20ms interval */ - .net_transmit = ESP_BLE_MESH_TRANSMIT(2, 20), - .relay_retransmit = ESP_BLE_MESH_TRANSMIT(2, 20), }; /* Fast Prov Client Model user_data */ @@ -90,6 +90,7 @@ example_fast_prov_server_t fast_prov_server = { .primary_role = false, .max_node_num = 6, .prov_node_cnt = 0x0, + .app_idx = ESP_BLE_MESH_KEY_UNUSED, .unicast_min = ESP_BLE_MESH_ADDR_UNASSIGNED, .unicast_max = ESP_BLE_MESH_ADDR_UNASSIGNED, .unicast_cur = ESP_BLE_MESH_ADDR_UNASSIGNED, @@ -97,7 +98,6 @@ example_fast_prov_server_t fast_prov_server = { .flags = 0x0, .iv_index = 0x0, .net_idx = ESP_BLE_MESH_KEY_UNUSED, - .app_idx = ESP_BLE_MESH_KEY_UNUSED, .group_addr = ESP_BLE_MESH_ADDR_UNASSIGNED, .prim_prov_addr = ESP_BLE_MESH_ADDR_UNASSIGNED, .match_len = 0x0, @@ -321,9 +321,9 @@ static void example_recv_unprov_adv_pkt(uint8_t dev_uuid[16], uint8_t addr[BLE_M } } - add_dev.addr_type = (uint8_t)addr_type; + add_dev.addr_type = (esp_ble_mesh_addr_type_t)addr_type; add_dev.oob_info = oob_info; - add_dev.bearer = (uint8_t)bearer; + add_dev.bearer = (esp_ble_mesh_prov_bearer_t)bearer; memcpy(add_dev.uuid, dev_uuid, 16); memcpy(add_dev.addr, addr, BLE_MESH_ADDR_LEN); flag = ADD_DEV_RM_AFTER_PROV_FLAG | ADD_DEV_START_PROV_NOW_FLAG | ADD_DEV_FLUSHABLE_DEV_FLAG; @@ -464,8 +464,8 @@ static void example_ble_mesh_custom_model_cb(esp_ble_mesh_model_cb_event_t event case ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_NODE_GROUP_DELETE: { ESP_LOGI(TAG, "%s: Fast prov server receives msg, opcode 0x%04" PRIx32, __func__, opcode); struct net_buf_simple buf = { - .len = param->model_operation.length, .data = param->model_operation.msg, + .len = param->model_operation.length, }; err = example_fast_prov_server_recv_msg(param->model_operation.model, param->model_operation.ctx, &buf); diff --git a/examples/bluetooth/esp_ble_mesh/common_components/example_init/ble_mesh_example_init.h b/examples/bluetooth/esp_ble_mesh/common_components/example_init/ble_mesh_example_init.h index 499e2d5e72..b587b8b6a6 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/example_init/ble_mesh_example_init.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/example_init/ble_mesh_example_init.h @@ -7,10 +7,18 @@ #ifndef _BLE_MESH_EXAMPLE_INIT_H_ #define _BLE_MESH_EXAMPLE_INIT_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include "esp_err.h" void ble_mesh_get_dev_uuid(uint8_t *dev_uuid); esp_err_t bluetooth_init(void); +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + #endif /* _BLE_MESH_EXAMPLE_INIT_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/common_components/example_nvs/ble_mesh_example_nvs.h b/examples/bluetooth/esp_ble_mesh/common_components/example_nvs/ble_mesh_example_nvs.h index 9cd7d8b092..0e02745c65 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/example_nvs/ble_mesh_example_nvs.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/example_nvs/ble_mesh_example_nvs.h @@ -7,6 +7,10 @@ #ifndef _BLE_MESH_EXAMPLE_NVS_H_ #define _BLE_MESH_EXAMPLE_NVS_H_ +#ifdef __cplusplus +extern "C" { +#endif /**< __cplusplus */ + #include #include "esp_err.h" #include "nvs_flash.h" @@ -21,4 +25,8 @@ esp_err_t ble_mesh_nvs_restore(nvs_handle_t handle, const char *key, void *data, esp_err_t ble_mesh_nvs_erase(nvs_handle_t handle, const char *key); +#ifdef __cplusplus +} +#endif /**< __cplusplus */ + #endif /* _BLE_MESH_EXAMPLE_NVS_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.h b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.h index 27d0eb79e1..2a0b30b0c3 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.h @@ -7,6 +7,10 @@ #ifndef _BLE_MESH_FAST_PROV_CLIENT_MODEL_H_ #define _BLE_MESH_FAST_PROV_CLIENT_MODEL_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "esp_ble_mesh_defs.h" enum { @@ -25,4 +29,8 @@ esp_err_t example_fast_prov_client_recv_status(esp_ble_mesh_model_t *model, esp_ble_mesh_msg_ctx_t *ctx, uint16_t len, const uint8_t *data); +#ifdef __cplusplus +} +#endif + #endif /* _BLE_MESH_FAST_PROV_CLIENT_MODEL_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_common.h b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_common.h index 29391cff40..ce0a349ab9 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_common.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_common.h @@ -7,6 +7,10 @@ #ifndef _BLE_MESH_FAST_PROV_COMMON_H_ #define _BLE_MESH_FAST_PROV_COMMON_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "esp_ble_mesh_defs.h" #include "esp_ble_mesh_config_model_api.h" @@ -109,4 +113,8 @@ typedef struct { uint8_t status_act; /* Indicate the result of action */ } example_fast_prov_net_key_status_t; +#ifdef __cplusplus +} +#endif + #endif /* _BLE_MESH_FAST_PROV_COMMON_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.h b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.h index dd5dc403c6..58236df466 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.h @@ -7,6 +7,10 @@ #ifndef _BLE_MESH_FAST_PROV_OPERATION_H_ #define _BLE_MESH_FAST_PROV_OPERATION_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "ble_mesh_fast_prov_common.h" esp_err_t example_store_node_info(const uint8_t uuid[16], uint16_t node_addr, @@ -58,4 +62,8 @@ esp_err_t example_send_fast_prov_status_msg(esp_ble_mesh_model_t *model, esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode, struct net_buf_simple *msg); +#ifdef __cplusplus +} +#endif + #endif /* _BLE_MESH_FAST_PROV_OPERATION_H_ */ diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_server_model.h b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_server_model.h index 55d9480049..b7f855fb6e 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_server_model.h +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_server_model.h @@ -7,6 +7,10 @@ #ifndef _BLE_MESH_FAST_PROV_SERVER_MODEL_H_ #define _BLE_MESH_FAST_PROV_SERVER_MODEL_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "ble_mesh_fast_prov_common.h" #define DISABLE_FAST_PROV_TIMEOUT K_SECONDS(10) @@ -91,4 +95,8 @@ esp_err_t example_handle_fast_prov_status_send_comp_evt(int err_code, uint32_t o esp_err_t example_fast_prov_server_init(esp_ble_mesh_model_t *model); +#ifdef __cplusplus +} +#endif + #endif /* _BLE_MESH_FAST_PROV_SERVER_MODEL_H_ */