mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(nimble): Migrate to NimBLE 1.9.0
This commit is contained in:
@@ -779,9 +779,11 @@ app_main(void)
|
||||
ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ENC;
|
||||
ble_hs_cfg.sm_sc = 0;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble-ancs");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
ble_store_config_init();
|
||||
|
||||
@@ -750,9 +750,11 @@ app_main(void)
|
||||
rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64);
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble_ble_channel_sounding");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
ble_store_config_init();
|
||||
|
||||
@@ -150,13 +150,15 @@ static int blecs_gap_event(struct ble_cs_event *event, void *arg)
|
||||
*/
|
||||
ind ++;
|
||||
if (ind==1) {
|
||||
struct ble_cs_event continue_event;
|
||||
continue_event.type = BLE_CS_EVENT_SUBEVET_RESULT_CONTINUE;
|
||||
continue_event.subev_result_continue = event->subev_result_continue;
|
||||
ble_gatts_store_ranging_data(continue_event);
|
||||
ble_gatts_indicate_ranging_data_ready(most_recent_local_ranging_counter);
|
||||
idx = 0;
|
||||
ind = 0;
|
||||
#if MYNEWT_VAL(BLE_GATTS) && CONFIG_BT_NIMBLE_RAS_SERVICE
|
||||
struct ble_cs_event continue_event;
|
||||
continue_event.type = BLE_CS_EVENT_SUBEVET_RESULT_CONTINUE;
|
||||
continue_event.subev_result_continue = event->subev_result_continue;
|
||||
ble_gatts_store_ranging_data(continue_event);
|
||||
ble_gatts_indicate_ranging_data_ready(most_recent_local_ranging_counter);
|
||||
idx = 0;
|
||||
ind = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +255,9 @@ bleprph_advertise(void)
|
||||
{
|
||||
struct ble_gap_adv_params adv_params;
|
||||
struct ble_hs_adv_fields fields;
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
#endif
|
||||
int rc;
|
||||
/**
|
||||
* Set the advertisement data included in our advertisements:
|
||||
@@ -400,7 +404,10 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg)
|
||||
event->notify_tx.indication);
|
||||
|
||||
if (event->notify_tx.status == BLE_HS_EDONE) {
|
||||
#if MYNEWT_VAL(BLE_GATTS) && CONFIG_BT_NIMBLE_RAS_SERVICE
|
||||
vTaskDelay(4000 / portTICK_PERIOD_MS);
|
||||
ble_gatts_indicate_control_point_response(event->notify_tx.attr_handle,most_recent_local_ranging_counter);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
case BLE_GAP_EVENT_SUBSCRIBE:
|
||||
@@ -489,7 +496,9 @@ app_main(void)
|
||||
/* Initialize the NimBLE host configuration. */
|
||||
ble_hs_cfg.reset_cb = bleprph_on_reset;
|
||||
ble_hs_cfg.sync_cb = bleprph_on_sync;
|
||||
#if MYNEWT_VAL(BLE_GATTS) && CONFIG_BT_NIMBLE_RAS_SERVICE
|
||||
ble_hs_cfg.gatts_register_cb = custom_gatt_svr_register_cb;
|
||||
#endif
|
||||
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
|
||||
ble_hs_cfg.sm_io_cap = 0x03;
|
||||
#ifdef CONFIG_EXAMPLE_BONDING
|
||||
|
||||
@@ -305,9 +305,11 @@ void app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name */
|
||||
rc = ble_svc_gap_device_name_set(device_name);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Start the task */
|
||||
|
||||
@@ -58,7 +58,9 @@ dynamic_service_advertise(void)
|
||||
{
|
||||
struct ble_gap_adv_params adv_params;
|
||||
struct ble_hs_adv_fields fields;
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
#endif
|
||||
int rc;
|
||||
|
||||
/**
|
||||
@@ -85,10 +87,12 @@ dynamic_service_advertise(void)
|
||||
fields.tx_pwr_lvl_is_present = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
name = ble_svc_gap_device_name();
|
||||
fields.name = (uint8_t *)name;
|
||||
fields.name_len = strlen(name);
|
||||
fields.name_is_complete = 1;
|
||||
#endif
|
||||
|
||||
/* Must be static: ble_gap_adv_set_fields stores the pointer, not the data.
|
||||
* A stack compound literal becomes dangling after this function returns,
|
||||
@@ -293,6 +297,7 @@ app_main(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("ble-dynamic-service");
|
||||
if (rc != 0) {
|
||||
@@ -300,6 +305,7 @@ app_main(void)
|
||||
nimble_port_deinit();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
nimble_port_freertos_init(dynamic_service_host_task);
|
||||
|
||||
@@ -523,9 +523,11 @@ app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("enc_adv_data_prph");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Set the session key and initialization vector */
|
||||
|
||||
@@ -489,7 +489,9 @@ ble_coex_advertise(void)
|
||||
{
|
||||
struct ble_gap_adv_params adv_params;
|
||||
struct ble_hs_adv_fields fields;
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
#endif
|
||||
int rc;
|
||||
|
||||
/**
|
||||
@@ -516,12 +518,14 @@ ble_coex_advertise(void)
|
||||
fields.tx_pwr_lvl_is_present = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
name = ble_svc_gap_device_name();
|
||||
if (name) {
|
||||
fields.name = (uint8_t *)name;
|
||||
fields.name_len = strlen(name);
|
||||
fields.name_is_complete = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const ble_uuid16_t adv_uuids16[] = {
|
||||
BLE_UUID16_INIT(BLECOEX_SVC_ALERT_UUID)
|
||||
|
||||
@@ -377,9 +377,11 @@ void app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name */
|
||||
rc = ble_svc_gap_device_name_set(device_name);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Start the task */
|
||||
|
||||
@@ -158,11 +158,13 @@ bleprph_advertise(void)
|
||||
fields.tx_pwr_lvl_is_present = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
name = ble_svc_gap_device_name();
|
||||
fields.name = (uint8_t *)name;
|
||||
fields.name_len = strlen(name);
|
||||
fields.name_is_complete = 1;
|
||||
#endif
|
||||
|
||||
static const ble_uuid16_t adv_uuids16[] = {
|
||||
BLE_UUID16_INIT(L2CAP_COC_UUID)
|
||||
@@ -475,9 +477,11 @@ app_main(void)
|
||||
bleprph_l2cap_coc_mem_init();
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("bleprph-l2coc");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
ble_store_config_init();
|
||||
|
||||
@@ -94,7 +94,9 @@ ble_prph_advertise(void)
|
||||
#else
|
||||
struct ble_gap_adv_params adv_params;
|
||||
struct ble_hs_adv_fields fields;
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
#endif
|
||||
|
||||
if (ble_gap_adv_active()) {
|
||||
return;
|
||||
|
||||
@@ -89,11 +89,13 @@ ble_spp_server_advertise(void)
|
||||
fields.tx_pwr_lvl_is_present = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
name = ble_svc_gap_device_name();
|
||||
fields.name = (uint8_t *)name;
|
||||
fields.name_len = strlen(name);
|
||||
fields.name_is_complete = 1;
|
||||
#endif
|
||||
|
||||
fields.uuids16 = (ble_uuid16_t[]) {
|
||||
BLE_UUID16_INIT(BLE_SVC_SPP_UUID16)
|
||||
@@ -478,9 +480,11 @@ app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble-ble-spp-svr");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
|
||||
@@ -289,9 +289,11 @@ void app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name */
|
||||
rc = ble_svc_gap_device_name_set(device_name);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Start the task */
|
||||
|
||||
@@ -546,7 +546,9 @@ app_main(void)
|
||||
#if MYNEWT_VAL(BLE_GATTS)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble-bleprph");
|
||||
assert(rc == 0);
|
||||
|
||||
@@ -345,11 +345,13 @@ bleprph_advertise(void)
|
||||
fields.tx_pwr_lvl_is_present = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
const char *name;
|
||||
name = ble_svc_gap_device_name();
|
||||
fields.name = (uint8_t *)name;
|
||||
fields.name_len = strlen(name);
|
||||
fields.name_is_complete = 1;
|
||||
#endif
|
||||
|
||||
static const ble_uuid16_t adv_uuids16[] = {
|
||||
BLE_UUID16_INIT(GATT_SVR_SVC_ALERT_UUID)
|
||||
@@ -562,9 +564,11 @@ app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name. */
|
||||
rc = ble_svc_gap_device_name_set("nimble-bleprph");
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* XXX Need to have template for store */
|
||||
|
||||
@@ -561,9 +561,11 @@ void app_main(void)
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
#if CONFIG_BT_NIMBLE_GAP_SERVICE
|
||||
/* Set the default device name */
|
||||
rc = ble_svc_gap_device_name_set(device_name);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Start the task */
|
||||
|
||||
Reference in New Issue
Block a user