diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 544e94303c..bcb5345e25 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 544e94303ce2a00805027a8f5427df8d6f3b3856 +Subproject commit bcb5345e258195515a62846e248ad76c9cadb742 diff --git a/examples/bluetooth/nimble/blecent/main/main.c b/examples/bluetooth/nimble/blecent/main/main.c index d2254d9239..d0b0c65e28 100644 --- a/examples/bluetooth/nimble/blecent/main/main.c +++ b/examples/bluetooth/nimble/blecent/main/main.c @@ -709,7 +709,9 @@ static void blecent_power_control(uint16_t conn_handle) static int blecent_gap_event(struct ble_gap_event *event, void *arg) { +#if NIMBLE_BLE_CONNECT struct ble_gap_conn_desc desc; +#endif struct ble_hs_adv_fields fields; #if MYNEWT_VAL(BLE_HCI_VS) #if MYNEWT_VAL(BLE_POWER_CONTROL) @@ -732,7 +734,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) /* Try to connect to the advertiser if it looks interesting. */ blecent_connect_if_interesting(&event->disc); return 0; - +#if NIMBLE_BLE_CONNECT case BLE_GAP_EVENT_CONNECT: /* A new connection was established or a connection attempt failed. */ if (event->connect.status == 0) { @@ -966,6 +968,8 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) #endif #endif return 0; + +#endif default: return 0; } @@ -1041,7 +1045,6 @@ static void stack_init_deinit(void) void app_main(void) { - int rc; /* Initialize NVS — it is used to store PHY calibration data */ esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { @@ -1061,6 +1064,8 @@ app_main(void) ble_hs_cfg.sync_cb = blecent_on_sync; ble_hs_cfg.store_status_cb = ble_store_util_status_rr; +#if NIMBLE_BLE_CONNECT + int rc; /* Initialize data structures to track connected peers. */ #if MYNEWT_VAL(BLE_INCL_SVC_DISCOVERY) || MYNEWT_VAL(BLE_GATT_CACHING_INCLUDE_SERVICES) rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64, 64); @@ -1069,11 +1074,13 @@ app_main(void) rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64); assert(rc == 0); #endif +#endif #if CONFIG_BT_NIMBLE_GAP_SERVICE + int m; /* Set the default device name. */ - rc = ble_svc_gap_device_name_set("nimble-blecent"); - assert(rc == 0); + m = ble_svc_gap_device_name_set("nimble-blecent"); + assert(m == 0); #endif /* XXX Need to have template for store */ diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.central b/examples/bluetooth/nimble/blecent/sdkconfig.ci.central new file mode 100644 index 0000000000..ed14605bc2 --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.central @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_broadcaster b/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_broadcaster new file mode 100644 index 0000000000..f78a87edcf --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_broadcaster @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_peripheral b/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_peripheral new file mode 100644 index 0000000000..6fb03c183c --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.no_peripheral @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.observer b/examples/bluetooth/nimble/blecent/sdkconfig.ci.observer new file mode 100644 index 0000000000..618e1ece53 --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.observer @@ -0,0 +1,11 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n +CONFIG_BT_NIMBLE_SECURITY_ENABLE=n diff --git a/examples/bluetooth/nimble/bleprph/main/main.c b/examples/bluetooth/nimble/bleprph/main/main.c index 5d01fe9604..522d7fdac2 100644 --- a/examples/bluetooth/nimble/bleprph/main/main.c +++ b/examples/bluetooth/nimble/bleprph/main/main.c @@ -52,6 +52,7 @@ static uint16_t bearers; void ble_store_config_init(void); +#if NIMBLE_BLE_CONNECT /** * Logs information about a connection to the console. */ @@ -78,6 +79,7 @@ bleprph_print_conn_desc(struct ble_gap_conn_desc *desc) desc->sec_state.authenticated, desc->sec_state.bonded); } +#endif #if CONFIG_EXAMPLE_EXTENDED_ADV /** @@ -148,7 +150,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; /** @@ -175,10 +179,12 @@ 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 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(GATT_SVR_SVC_ALERT_UUID) @@ -236,10 +242,14 @@ static void bleprph_power_control(uint16_t conn_handle) static int bleprph_gap_event(struct ble_gap_event *event, void *arg) { +#if NIMBLE_BLE_CONNECT struct ble_gap_conn_desc desc; int rc; +#endif switch (event->type) { + +#if NIMBLE_BLE_CONNECT case BLE_GAP_EVENT_CONNECT: /* A new connection was established or a connection attempt failed. */ MODLOG_DFLT(INFO, "connection %s; status=%d ", @@ -463,9 +473,9 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg) event->subrate_change.status, event->subrate_change.subrate_factor); return 0; +#endif #endif } - return 0; } @@ -594,9 +604,11 @@ app_main(void) 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); +#endif /* XXX Need to have template for store */ ble_store_config_init(); diff --git a/examples/bluetooth/nimble/bleprph/sdkconfig.ci.broadcaster b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.broadcaster new file mode 100644 index 0000000000..a354bd8cba --- /dev/null +++ b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.broadcaster @@ -0,0 +1,11 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=n +CONFIG_BT_NIMBLE_SECURITY_ENABLE=n diff --git a/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_central b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_central new file mode 100644 index 0000000000..fdbdfba3d5 --- /dev/null +++ b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_central @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y diff --git a/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_observer b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_observer new file mode 100644 index 0000000000..12c1962b96 --- /dev/null +++ b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.no_observer @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y diff --git a/examples/bluetooth/nimble/bleprph/sdkconfig.ci.peripheral b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.peripheral new file mode 100644 index 0000000000..69f6c440ba --- /dev/null +++ b/examples/bluetooth/nimble/bleprph/sdkconfig.ci.peripheral @@ -0,0 +1,10 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y diff --git a/examples/bluetooth/nimble/common/nimble_central_utils/peer.c b/examples/bluetooth/nimble/common/nimble_central_utils/peer.c index 5635b26b4f..117b36f5c1 100644 --- a/examples/bluetooth/nimble/common/nimble_central_utils/peer.c +++ b/examples/bluetooth/nimble/common/nimble_central_utils/peer.c @@ -9,6 +9,7 @@ #include "host/ble_hs.h" #include "esp_central.h" +#if NIMBLE_BLE_CONNECT static void *peer_svc_mem; static struct os_mempool peer_svc_pool; @@ -1089,3 +1090,4 @@ err: peer_free_mem(); return rc; } +#endif