From f18519da4ef4965730bb2d09b2d54232d68a817f Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Mon, 13 Oct 2025 10:50:19 +0530 Subject: [PATCH] fix(nimble): Address compilation issues in nimble examples --- components/bt/host/nimble/Kconfig.in | 2 +- components/bt/host/nimble/nimble | 2 +- .../nimble/port/include/ble_svc_gap_stub.h | 54 +++++++++++++++++++ .../host/nimble/port/include/esp_nimble_cfg.h | 6 +++ .../src/transports/protocomm_nimble.c | 4 +- .../nimble/NimBLE_Beacon/main/main.c | 2 + .../nimble/NimBLE_Connection/main/main.c | 2 + .../nimble/NimBLE_Connection/main/src/gap.c | 1 + .../nimble/NimBLE_GATT_Server/main/main.c | 2 + .../nimble/NimBLE_Security/main/main.c | 2 + .../nimble/ble_cts/cts_cent/main/main.c | 6 +++ .../nimble/ble_cts/cts_prph/main/main.c | 6 +-- .../nimble/ble_dynamic_service/main/main.c | 2 + .../enc_adv_data_cent/main/main.c | 11 ++++ .../enc_adv_data_prph/main/main.c | 3 +- .../nimble/ble_htp/htp_cent/main/main.c | 8 ++- .../nimble/ble_htp/htp_prph/main/main.c | 12 ++++- .../ble_l2cap_coc/coc_bleprph/main/main.c | 2 +- .../nimble/ble_multi_adv/main/main.c | 5 +- .../ble_multi_conn_cent/main/main.c | 10 ++-- .../ble_multi_conn_prph/main/main.c | 2 + .../nimble/ble_phy/phy_cent/main/main.c | 4 ++ .../nimble/ble_phy/phy_prph/main/main.c | 2 + .../proximity_sensor_cent/main/main.c | 9 +++- .../proximity_sensor_prph/main/main.c | 6 +-- .../nimble/ble_spp/spp_client/main/main.c | 7 ++- .../nimble/ble_spp/spp_server/main/main.c | 7 +-- examples/bluetooth/nimble/blehr/main/main.c | 2 + .../nimble/bleprph_host_only/main/main.c | 4 +- .../nimble/bleprph_wifi_coex/main/main.c | 7 +-- .../bluetooth/nimble/power_save/main/main.c | 4 +- .../blecent_throughput/main/main.c | 1 + .../bleprph_throughput/main/main.c | 6 +-- 33 files changed, 171 insertions(+), 32 deletions(-) create mode 100644 components/bt/host/nimble/port/include/ble_svc_gap_stub.h diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index aa2db4ec01..106b92fdb8 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -568,7 +568,7 @@ menu "BLE 5.x Features" config BT_NIMBLE_EXT_SCAN bool "Enable extended scanning" - depends on BT_NIMBLE_50_FEATURE_SUPPORT && BT_NIMBLE_ROLE_OBSERVER + depends on BT_NIMBLE_50_FEATURE_SUPPORT default y help Enable this option to do extended scanning. diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 4bd977641f..7c2c9c359b 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 4bd977641f544e1270a33e7e869a12cc65bcb212 +Subproject commit 7c2c9c359bdc764229ad18bf38674f550556d957 diff --git a/components/bt/host/nimble/port/include/ble_svc_gap_stub.h b/components/bt/host/nimble/port/include/ble_svc_gap_stub.h new file mode 100644 index 0000000000..1fb456f219 --- /dev/null +++ b/components/bt/host/nimble/port/include/ble_svc_gap_stub.h @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "esp_log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define BLE_SVC_GAP_TAG "ble_svc_gap" + +/** + * Stub implementations for GAP service APIs. + * These are compiled when CONFIG_BT_NIMBLE_GAP_SERVICE is disabled. + */ + +static inline void ble_svc_gap_init(void) +{ + ESP_LOGE(BLE_SVC_GAP_TAG, "GAP service not enabled. Enable CONFIG_BT_NIMBLE_GAP_SERVICE to use this API."); +} + +static inline int ble_svc_gap_device_name_set(const char *name) +{ + (void)name; + ESP_LOGE(BLE_SVC_GAP_TAG, "GAP service not enabled. Enable CONFIG_BT_NIMBLE_GAP_SERVICE to use this API."); + return -1; +} + +static inline const char *ble_svc_gap_device_name(void) +{ + ESP_LOGE(BLE_SVC_GAP_TAG, "GAP service not enabled. Enable CONFIG_BT_NIMBLE_GAP_SERVICE to use this API."); + return NULL; +} + +static inline int ble_svc_gap_device_appearance_set(uint16_t appearance) +{ + ESP_LOGE(BLE_SVC_GAP_TAG, "GAP service not enabled. Enable CONFIG_BT_NIMBLE_GAP_SERVICE to use this API."); + return -1; +} + +static inline int ble_svc_gap_device_key_material_set(uint8_t *session_key, uint8_t *iv) +{ + ESP_LOGE(BLE_SVC_GAP_TAG, "GAP service not enabled. Enable CONFIG_BT_NIMBLE_GAP_SERVICE to use this API."); + return -1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index 849e9fbb3b..6a16a64176 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -1793,9 +1793,11 @@ #endif /*** @apache-mynewt-nimble/nimble/host/services/gap */ +#ifdef CONFIG_BT_NIMBLE_GAP_SERVICE #ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE #define MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE #endif +#endif #ifndef MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM #if CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM @@ -1808,10 +1810,12 @@ #endif //CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM #endif //MYNEWT_VAL_BLE_SVC_GAP_APPEARANCE_WRITE_PERM +#ifdef CONFIG_BT_NIMBLE_GAP_SERVICE #ifndef MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION #define MYNEWT_VAL_BLE_SVC_GAP_CENTRAL_ADDRESS_RESOLUTION \ CONFIG_BT_NIMBLE_SVC_GAP_CENT_ADDR_RESOLUTION #endif +#endif #ifndef CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME #define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME "nimble" @@ -1819,9 +1823,11 @@ #define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME #endif +#ifdef CONFIG_BT_NIMBLE_GAP_SERVICE #ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH #define MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN // According to the specification, the maximum length should be 248 #endif +#endif #ifndef MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_WRITE_PERM #if CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM diff --git a/components/protocomm/src/transports/protocomm_nimble.c b/components/protocomm/src/transports/protocomm_nimble.c index 2852c782c8..b0be003bbf 100644 --- a/components/protocomm/src/transports/protocomm_nimble.c +++ b/components/protocomm/src/transports/protocomm_nimble.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -534,6 +534,7 @@ static int simple_ble_start(const simple_ble_cfg_t *cfg) ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(cfg); if (rc != 0) { ESP_LOGE(TAG, "Error initializing GATT server"); @@ -552,6 +553,7 @@ static int simple_ble_start(const simple_ble_cfg_t *cfg) resp_data.name_len = strlen(ble_svc_gap_device_name()); resp_data.name_is_complete = 1; } +#endif /* Set manufacturer data if protocomm_ble_mfg_data points to valid data */ if (protocomm_ble_mfg_data != NULL) { diff --git a/examples/bluetooth/ble_get_started/nimble/NimBLE_Beacon/main/main.c b/examples/bluetooth/ble_get_started/nimble/NimBLE_Beacon/main/main.c index 2903a67c02..d4c871e964 100644 --- a/examples/bluetooth/ble_get_started/nimble/NimBLE_Beacon/main/main.c +++ b/examples/bluetooth/ble_get_started/nimble/NimBLE_Beacon/main/main.c @@ -78,12 +78,14 @@ void app_main(void) { return; } +#if CONFIG_BT_NIMBLE_GAP_SERVICE /* GAP service initialization */ rc = gap_init(); if (rc != 0) { ESP_LOGE(TAG, "failed to initialize GAP service, error code: %d", rc); return; } +#endif /* NimBLE host configuration initialization */ nimble_host_config_init(); diff --git a/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/main.c b/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/main.c index b3fa8a9012..6fc6c414a0 100644 --- a/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/main.c +++ b/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/main.c @@ -82,12 +82,14 @@ void app_main(void) { return; } +#if CONFIG_BT_NIMBLE_GAP_SERVICE /* GAP service initialization */ rc = gap_init(); if (rc != 0) { ESP_LOGE(TAG, "failed to initialize GAP service, error code: %d", rc); return; } +#endif /* NimBLE host configuration initialization */ nimble_host_config_init(); diff --git a/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/src/gap.c b/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/src/gap.c index 8788b66f26..d2689f9230 100644 --- a/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/src/gap.c +++ b/examples/bluetooth/ble_get_started/nimble/NimBLE_Connection/main/src/gap.c @@ -251,6 +251,7 @@ int gap_init(void) { /* Local variables */ int rc = 0; + /* Initialize GAP service */ ble_svc_gap_init(); diff --git a/examples/bluetooth/ble_get_started/nimble/NimBLE_GATT_Server/main/main.c b/examples/bluetooth/ble_get_started/nimble/NimBLE_GATT_Server/main/main.c index aa804b2099..5283e2e785 100644 --- a/examples/bluetooth/ble_get_started/nimble/NimBLE_GATT_Server/main/main.c +++ b/examples/bluetooth/ble_get_started/nimble/NimBLE_GATT_Server/main/main.c @@ -109,12 +109,14 @@ void app_main(void) { return; } +#if CONFIG_BT_NIMBLE_GAP_SERVICE /* GAP service initialization */ rc = gap_init(); if (rc != 0) { ESP_LOGE(TAG, "failed to initialize GAP service, error code: %d", rc); return; } +#endif /* GATT server initialization */ rc = gatt_svc_init(); diff --git a/examples/bluetooth/ble_get_started/nimble/NimBLE_Security/main/main.c b/examples/bluetooth/ble_get_started/nimble/NimBLE_Security/main/main.c index 26541056a6..dfe997eb08 100644 --- a/examples/bluetooth/ble_get_started/nimble/NimBLE_Security/main/main.c +++ b/examples/bluetooth/ble_get_started/nimble/NimBLE_Security/main/main.c @@ -118,12 +118,14 @@ void app_main(void) { return; } +#if CONFIG_BT_NIMBLE_GAP_SERVICE /* GAP service initialization */ rc = gap_init(); if (rc != 0) { ESP_LOGE(TAG, "failed to initialize GAP service, error code: %d", rc); return; } +#endif /* GATT server initialization */ rc = gatt_svc_init(); diff --git a/examples/bluetooth/nimble/ble_cts/cts_cent/main/main.c b/examples/bluetooth/nimble/ble_cts/cts_cent/main/main.c index 0a99776f2c..128b6afd3a 100644 --- a/examples/bluetooth/nimble/ble_cts/cts_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_cts/cts_cent/main/main.c @@ -44,6 +44,7 @@ void printtime(struct ble_svc_cts_curr_time ctime) { ESP_LOGI(tag, "fractions : %d\n", ctime.et_256.fractions_256); } +#if MYNEWT_VAL(BLE_GATTC) /** * Application callback. Called when the read of the cts current time * characteristic has completed. @@ -137,6 +138,7 @@ ble_cts_cent_on_disc_complete(const struct peer *peer, int status, void *arg) */ ble_cts_cent_read_time(peer); } +#endif /** * Initiates the GAP general discovery procedure. @@ -434,6 +436,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery */ rc = peer_disc_all(event->connect.conn_handle, ble_cts_cent_on_disc_complete, NULL); @@ -441,6 +444,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif } else { @@ -485,6 +489,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /*** Go for service discovery after encryption has been successfully enabled ***/ rc = peer_disc_all(event->connect.conn_handle, ble_cts_cent_on_disc_complete, NULL); @@ -492,6 +497,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif return 0; diff --git a/examples/bluetooth/nimble/ble_cts/cts_prph/main/main.c b/examples/bluetooth/nimble/ble_cts/cts_prph/main/main.c index 2da3a66ad6..04ee0c3ead 100644 --- a/examples/bluetooth/nimble/ble_cts/cts_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_cts/cts_prph/main/main.c @@ -28,7 +28,6 @@ static uint8_t ext_adv_pattern_1[] = { static const char *tag = "NimBLE_CTS_PRPH"; static const char *device_name = "ble_cts_prph"; - static int ble_cts_prph_gap_event(struct ble_gap_event *event, void *arg); static uint8_t ble_cts_prph_addr_type; @@ -274,8 +273,6 @@ void ble_cts_prph_host_task(void *param) 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) { @@ -302,12 +299,15 @@ void app_main(void) ble_hs_cfg.sm_sc = 1; ble_hs_cfg.sm_mitm = 1; +#if MYNEWT_VAL(BLE_GATTS) + int rc; rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name */ rc = ble_svc_gap_device_name_set(device_name); assert(rc == 0); +#endif /* Start the task */ nimble_port_freertos_init(ble_cts_prph_host_task); diff --git a/examples/bluetooth/nimble/ble_dynamic_service/main/main.c b/examples/bluetooth/nimble/ble_dynamic_service/main/main.c index d99326f81d..02a7ed0727 100644 --- a/examples/bluetooth/nimble/ble_dynamic_service/main/main.c +++ b/examples/bluetooth/nimble/ble_dynamic_service/main/main.c @@ -280,12 +280,14 @@ app_main(void) ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb; ble_hs_cfg.store_status_cb = ble_store_util_status_rr; +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name. */ rc = ble_svc_gap_device_name_set("ble-dynamic-service"); assert(rc == 0); +#endif nimble_port_freertos_init(dynamic_service_host_task); diff --git a/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_cent/main/main.c b/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_cent/main/main.c index 1b3e77574d..a141d0f2e0 100644 --- a/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_cent/main/main.c @@ -22,7 +22,10 @@ static struct km_peer kmp[CONFIG_BT_NIMBLE_MAX_CONNECTIONS + 1] = {0}; static const char *tag = "ENC_ADV_DATA_CENT"; static int enc_adv_data_cent_gap_event(struct ble_gap_event *event, void *arg); + +#if MYNEWT_VAL(BLE_GATTC) static int mtu_def = 512; +#endif void ble_store_config_init(void); @@ -37,6 +40,7 @@ enc_adv_data_find_peer(const uint8_t *peer_addr) return -1; } +#if MYNEWT_VAL(BLE_GATTC) static int enc_adv_data_set_km_exist(const uint8_t *peer_addr) { @@ -47,6 +51,7 @@ enc_adv_data_set_km_exist(const uint8_t *peer_addr) kmp[ind].key_material_exist = true; return 0; } +#endif static bool enc_adv_data_check_km_exist(const uint8_t *peer_addr) @@ -60,6 +65,7 @@ enc_adv_data_check_km_exist(const uint8_t *peer_addr) return kmp[ind].key_material_exist; } +#if MYNEWT_VAL(BLE_GATTC) /** * Application callback. Called when the read has completed. */ @@ -175,6 +181,7 @@ enc_adv_data_cent_on_disc_complete(const struct peer *peer, int status, void *ar enc_adv_data_cent_read(peer); } } +#endif /** * Initiates the GAP general discovery procedure. @@ -444,6 +451,7 @@ enc_adv_data_cent_gap_event(struct ble_gap_event *event, void *arg) print_conn_desc(&desc); MODLOG_DFLT(INFO, ""); +#if MYNEWT_VAL(BLE_GATTC) rc = ble_att_set_preferred_mtu(mtu_def); if (rc != 0) { ESP_LOGE(tag, "Failed to set preferred MTU; rc = %d", rc); @@ -453,6 +461,7 @@ enc_adv_data_cent_gap_event(struct ble_gap_event *event, void *arg) if (rc != 0) { ESP_LOGE(tag, "Failed to negotiate MTU; rc = %d", rc); } +#endif /* Remember peer. */ rc = peer_add(event->connect.conn_handle); @@ -511,12 +520,14 @@ enc_adv_data_cent_gap_event(struct ble_gap_event *event, void *arg) assert(rc == 0); print_conn_desc(&desc); +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery */ rc = peer_disc_all(event->enc_change.conn_handle, enc_adv_data_cent_on_disc_complete, NULL); if (rc != 0) { MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); } +#endif return 0; case BLE_GAP_EVENT_NOTIFY_RX: diff --git a/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_prph/main/main.c b/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_prph/main/main.c index e0c8790258..78a3159eb4 100644 --- a/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_enc_adv_data/enc_adv_data_prph/main/main.c @@ -413,15 +413,16 @@ app_main(void) ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ID; #endif +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name. */ rc = ble_svc_gap_device_name_set("enc_adv_data_prph"); assert(rc == 0); +#endif /* Set the session key and initialization vector */ - rc = ble_svc_gap_device_key_material_set(km.session_key, km.iv); assert(rc == 0); diff --git a/examples/bluetooth/nimble/ble_htp/htp_cent/main/main.c b/examples/bluetooth/nimble/ble_htp/htp_cent/main/main.c index 2e47880916..281dadc610 100644 --- a/examples/bluetooth/nimble/ble_htp/htp_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_htp/htp_cent/main/main.c @@ -20,6 +20,8 @@ static int ble_htp_cent_gap_event(struct ble_gap_event *event, void *arg); void ble_store_config_init(void); static void ble_htp_cent_scan(void); + +#if MYNEWT_VAL(BLE_GATTC) /** * Application callback. Called when the attempt to subscribe to notifications * for the HTP intermediate temperature characteristic has completed. @@ -255,7 +257,7 @@ ble_htp_cent_on_disc_complete(const struct peer *peer, int status, void *arg) */ ble_htp_cent_read_write_subscribe(peer); } - +#endif /** * Initiates the GAP general discovery procedure. */ @@ -548,6 +550,7 @@ ble_htp_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery */ rc = peer_disc_all(event->connect.conn_handle, ble_htp_cent_on_disc_complete, NULL); @@ -555,6 +558,7 @@ ble_htp_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif } else { @@ -599,6 +603,7 @@ ble_htp_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /*** Go for service discovery after encryption has been successfully enabled ***/ rc = peer_disc_all(event->connect.conn_handle, ble_htp_cent_on_disc_complete, NULL); @@ -606,6 +611,7 @@ ble_htp_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif return 0; diff --git a/examples/bluetooth/nimble/ble_htp/htp_prph/main/main.c b/examples/bluetooth/nimble/ble_htp/htp_prph/main/main.c index 01bece43a4..896c1d6fd4 100644 --- a/examples/bluetooth/nimble/ble_htp/htp_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_htp/htp_prph/main/main.c @@ -201,6 +201,8 @@ ble_htp_prph_tx_htp_reset(void) static void ble_htp_prph_tx(TimerHandle_t ev) { + +#if CONFIG_BT_NIMBLE_HTP_SERVICE int rc; float temp; @@ -222,6 +224,7 @@ ble_htp_prph_tx(TimerHandle_t ev) } else { MODLOG_DFLT(INFO, "Error in sending notification"); } +#endif ble_htp_prph_tx_htp_reset(); } @@ -259,7 +262,9 @@ ble_htp_prph_gap_event(struct ble_gap_event *event, void *arg) #endif ble_htp_prph_tx_htp_stop(); +#if CONFIG_BT_NIMBLE_HTP_SERVICE ble_svc_htp_on_disconnect(event->disconnect.conn.conn_handle); +#endif break; case BLE_GAP_EVENT_ADV_COMPLETE: @@ -276,7 +281,9 @@ ble_htp_prph_gap_event(struct ble_gap_event *event, void *arg) "val_handle=%d\n", event->subscribe.cur_notify, event->subscribe.attr_handle); +#if CONFIG_BT_NIMBLE_HTP_SERVICE ble_svc_htp_subscribe(event->subscribe.conn_handle, event->subscribe.attr_handle); +#endif if (event->subscribe.cur_notify) { ble_htp_prph_tx_htp_reset(); @@ -336,8 +343,6 @@ void ble_htp_prph_host_task(void *param) 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) { @@ -368,12 +373,15 @@ void app_main(void) ble_htp_prph_tx_timer = xTimerCreate("ble_htp_prph_tx_timer", pdMS_TO_TICKS(1000), pdTRUE, (void *)0, ble_htp_prph_tx); +#if MYNEWT_VAL(BLE_GATTS) + int rc; rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name */ rc = ble_svc_gap_device_name_set(device_name); assert(rc == 0); +#endif /* Start the task */ nimble_port_freertos_init(ble_htp_prph_host_task); diff --git a/examples/bluetooth/nimble/ble_l2cap_coc/coc_bleprph/main/main.c b/examples/bluetooth/nimble/ble_l2cap_coc/coc_bleprph/main/main.c index 010ea85a15..641a2f43bc 100644 --- a/examples/bluetooth/nimble/ble_l2cap_coc/coc_bleprph/main/main.c +++ b/examples/bluetooth/nimble/ble_l2cap_coc/coc_bleprph/main/main.c @@ -133,7 +133,6 @@ bleprph_advertise(void) { struct ble_gap_adv_params adv_params; struct ble_hs_adv_fields fields; - const char *name; int rc; /** @@ -160,6 +159,7 @@ bleprph_advertise(void) fields.tx_pwr_lvl_is_present = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + const char *name; name = ble_svc_gap_device_name(); fields.name = (uint8_t *)name; fields.name_len = strlen(name); diff --git a/examples/bluetooth/nimble/ble_multi_adv/main/main.c b/examples/bluetooth/nimble/ble_multi_adv/main/main.c index b8393aa806..03f93210fd 100644 --- a/examples/bluetooth/nimble/ble_multi_adv/main/main.c +++ b/examples/bluetooth/nimble/ble_multi_adv/main/main.c @@ -459,8 +459,6 @@ void ble_multi_adv_host_task(void *param) 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) { @@ -495,6 +493,8 @@ app_main(void) ble_instance_cb[i].cb = NULL; } +#if MYNEWT_VAL(BLE_GATTS) + int rc; rc = gatt_svr_init(); assert(rc == 0); @@ -502,6 +502,7 @@ app_main(void) /* Set the default device name. */ rc = ble_svc_gap_device_name_set("nimble-multi-adv"); assert(rc == 0); +#endif #endif /* XXX Need to have template for store */ diff --git a/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_cent/main/main.c b/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_cent/main/main.c index 6acd00750c..c324092aee 100644 --- a/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_cent/main/main.c @@ -461,12 +461,16 @@ app_main(void) rc = peer_init(BLE_PEER_MAX_NUM, BLE_PEER_MAX_NUM, BLE_PEER_MAX_NUM, BLE_PEER_MAX_NUM); assert(rc == 0); #endif + + +#if MYNEWT_VAL(BLE_GATTS) + rc = gatt_svr_init(); + assert(rc == 0); + /* Set the default device name. We will act as both central and peripheral. */ rc = ble_svc_gap_device_name_set("esp-ble-role-coex"); assert(rc == 0); - - rc = gatt_svr_init(); - assert(rc == 0); +#endif /* XXX Need to have template for store */ ble_store_config_init(); diff --git a/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_prph/main/main.c b/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_prph/main/main.c index 47f6461572..e4b0f4686a 100644 --- a/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_multi_conn/ble_multi_conn_prph/main/main.c @@ -287,12 +287,14 @@ app_main(void) ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb; ble_hs_cfg.store_status_cb = ble_store_util_status_rr; +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name. */ rc = ble_svc_gap_device_name_set("esp-multi-conn"); assert(rc == 0); +#endif /* XXX Need to have template for store */ ble_store_config_init(); diff --git a/examples/bluetooth/nimble/ble_phy/phy_cent/main/main.c b/examples/bluetooth/nimble/ble_phy/phy_cent/main/main.c index 09eb5f6cc6..cec4bcaa3a 100644 --- a/examples/bluetooth/nimble/ble_phy/phy_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_phy/phy_cent/main/main.c @@ -24,6 +24,7 @@ static void blecent_scan(void); static uint8_t s_current_phy; void ble_store_config_init(void); +#if MYNEWT_VAL(BLE_GATTC) /** * Performs GATT operation against the specified peer: * 1. Reads the Supported LE PHY characteristic. @@ -167,6 +168,7 @@ blecent_on_disc_complete(const struct peer *peer, int status, void *arg) blecent_read(peer); } +#endif /* Set default LE PHY before establishing connection */ void set_default_le_phy(uint8_t tx_phys_mask, uint8_t rx_phys_mask) @@ -388,6 +390,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) return 0; } +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery. */ rc = peer_disc_all(event->connect.conn_handle, blecent_on_disc_complete, NULL); @@ -395,6 +398,7 @@ blecent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif } else { /* Connection attempt failed; resume scanning. */ MODLOG_DFLT(ERROR, "Error: Connection failed; status=%d\n", diff --git a/examples/bluetooth/nimble/ble_phy/phy_prph/main/main.c b/examples/bluetooth/nimble/ble_phy/phy_prph/main/main.c index b43e8f649f..4fce3bedb3 100644 --- a/examples/bluetooth/nimble/ble_phy/phy_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_phy/phy_prph/main/main.c @@ -342,8 +342,10 @@ app_main(void) ble_hs_cfg.sm_their_key_dist = 1; #endif +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init_le_phy(); assert(rc == 0); +#endif /* Set the default device name. */ rc = ble_svc_gap_device_name_set("bleprph-phy"); diff --git a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c index 0f6f9b309d..1089883280 100644 --- a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c +++ b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_cent/main/main.c @@ -33,6 +33,7 @@ void ble_store_config_init(void); static void ble_prox_cent_scan(void); static int ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg); +#if MYNEWT_VAL(BLE_GATTC) static int ble_prox_cent_on_read(uint16_t conn_handle, const struct ble_gatt_error *error, @@ -172,6 +173,7 @@ ble_prox_cent_on_disc_complete(const struct peer *peer, int status, void *arg) */ ble_prox_cent_read_write_subscribe(peer); } +#endif /** * Initiates the GAP general discovery procedure. @@ -480,6 +482,7 @@ ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery */ rc = peer_disc_all(event->connect.conn_handle, ble_prox_cent_on_disc_complete, NULL); @@ -487,6 +490,7 @@ ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif } else { @@ -547,6 +551,7 @@ ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg) return 0; } #else +#if MYNEWT_VAL(BLE_GATTC) /*** Go for service discovery after encryption has been successfully enabled ***/ rc = peer_disc_all(event->connect.conn_handle, ble_prox_cent_on_disc_complete, NULL); @@ -554,6 +559,7 @@ ble_prox_cent_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif #endif // BLE_GATT_CACHING_ASSOC_ENABLE #endif return 0; @@ -656,6 +662,7 @@ ble_prox_cent_path_loss_task(void *pvParameters) path_loss = 0; } +#if MYNEWT_VAL(BLE_GATTC) rc = ble_gattc_write_no_rsp_flat(i, conn_peer[i].val_handle, &path_loss, sizeof(path_loss)); if (rc != 0) { @@ -664,6 +671,7 @@ ble_prox_cent_path_loss_task(void *pvParameters) } else { MODLOG_DFLT(INFO, "Write to alert level characteristis done"); } +#endif } } } @@ -743,7 +751,6 @@ app_main(void) /* Initialize a task to keep checking path loss of the link */ ble_prox_cent_init(); - for (int i = 0; i <= MYNEWT_VAL(BLE_MAX_CONNECTIONS); i++) { disconn_peer[i].addr = NULL; disconn_peer[i].link_lost = true; diff --git a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c index 7eb301cdb2..336f80c722 100644 --- a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c @@ -270,8 +270,6 @@ void ble_prox_prph_host_task(void *param) 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) { @@ -286,9 +284,10 @@ void app_main(void) return; } +#if CONFIG_BT_NIMBLE_PROX_SERVICE /* Initialize a task to keep checking path loss of the link */ ble_svc_prox_init(); - +#endif /* Initialize the NimBLE host configuration */ ble_hs_cfg.sync_cb = ble_prox_prph_on_sync; ble_hs_cfg.reset_cb = ble_prox_prph_on_reset; @@ -301,6 +300,7 @@ void app_main(void) ble_hs_cfg.sm_sc = 1; ble_hs_cfg.sm_mitm = 1; + int rc; /* Set the default device name */ rc = ble_svc_gap_device_name_set(device_name); assert(rc == 0); diff --git a/examples/bluetooth/nimble/ble_spp/spp_client/main/main.c b/examples/bluetooth/nimble/ble_spp/spp_client/main/main.c index e7d98f6ca1..b5d5fb3faf 100644 --- a/examples/bluetooth/nimble/ble_spp/spp_client/main/main.c +++ b/examples/bluetooth/nimble/ble_spp/spp_client/main/main.c @@ -26,6 +26,7 @@ uint16_t attribute_handle[CONFIG_BT_NIMBLE_MAX_CONNECTIONS + 1]; static void ble_spp_client_scan(void); static ble_addr_t connected_addr[CONFIG_BT_NIMBLE_MAX_CONNECTIONS + 1]; +#if MYNEWT_VAL(BLE_GATTC) static void ble_spp_client_write_subscribe(const struct peer *peer) { uint8_t value[2]; @@ -90,7 +91,6 @@ ble_spp_client_set_handle(const struct peer *peer) value, sizeof(value), NULL, NULL); } - /** * Called when service discovery of the specified peer has completed. */ @@ -119,6 +119,7 @@ ble_spp_client_on_disc_complete(const struct peer *peer, int status, void *arg) ble_spp_client_scan(); #endif } +#endif /** * Initiates the GAP general discovery procedure. @@ -306,6 +307,7 @@ ble_spp_client_gap_event(struct ble_gap_event *event, void *arg) return 0; } +#if MYNEWT_VAL(BLE_GATTC) /* Perform service discovery. */ rc = peer_disc_all(event->connect.conn_handle, ble_spp_client_on_disc_complete, NULL); @@ -313,6 +315,7 @@ ble_spp_client_gap_event(struct ble_gap_event *event, void *arg) MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc); return 0; } +#endif } else { /* Connection attempt failed; resume scanning. */ MODLOG_DFLT(ERROR, "Error: Connection failed; status=%d\n", @@ -421,12 +424,14 @@ void ble_client_uart_task(void *pvParameters) uart_read_bytes(UART_NUM_0, temp, event.size, portMAX_DELAY); for ( i = 0; i <= CONFIG_BT_NIMBLE_MAX_CONNECTIONS; i++) { if (attribute_handle[i] != 0) { +#if MYNEWT_VAL(BLE_GATTC) rc = ble_gattc_write_flat(i, attribute_handle[i], temp, event.size, NULL, NULL); if (rc == 0) { ESP_LOGI(tag, "Write in uart task success!"); } else { ESP_LOGI(tag, "Error in writing characteristic rc=%d", rc); } +#endif vTaskDelay(10); } } diff --git a/examples/bluetooth/nimble/ble_spp/spp_server/main/main.c b/examples/bluetooth/nimble/ble_spp/spp_server/main/main.c index 2a526a83b8..0c30e23603 100644 --- a/examples/bluetooth/nimble/ble_spp/spp_server/main/main.c +++ b/examples/bluetooth/nimble/ble_spp/spp_server/main/main.c @@ -63,7 +63,6 @@ ble_spp_server_advertise(void) { struct ble_gap_adv_params adv_params; struct ble_hs_adv_fields fields; - const char *name; int rc; /** @@ -90,6 +89,7 @@ ble_spp_server_advertise(void) fields.tx_pwr_lvl_is_present = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + const char *name; name = ble_svc_gap_device_name(); fields.name = (uint8_t *)name; fields.name_len = strlen(name); @@ -412,8 +412,6 @@ static void ble_spp_uart_init(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) { @@ -459,6 +457,8 @@ app_main(void) ble_hs_cfg.sm_their_key_dist = 1; #endif +#if MYNEWT_VAL(BLE_GATTS) + int rc; /* Register custom service */ rc = gatt_svr_init(); assert(rc == 0); @@ -466,6 +466,7 @@ app_main(void) /* Set the default device name. */ rc = ble_svc_gap_device_name_set("nimble-ble-spp-svr"); assert(rc == 0); +#endif /* XXX Need to have template for store */ ble_store_config_init(); diff --git a/examples/bluetooth/nimble/blehr/main/main.c b/examples/bluetooth/nimble/blehr/main/main.c index b9c7ea991f..94b7b495fd 100644 --- a/examples/bluetooth/nimble/blehr/main/main.c +++ b/examples/bluetooth/nimble/blehr/main/main.c @@ -293,12 +293,14 @@ void app_main(void) /* name, period/time, auto reload, timer ID, callback */ blehr_tx_timer = xTimerCreate("blehr_tx_timer", pdMS_TO_TICKS(1000), pdTRUE, (void *)0, blehr_tx_hrate); +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); /* Set the default device name */ rc = ble_svc_gap_device_name_set(device_name); assert(rc == 0); +#endif /* Start the task */ nimble_port_freertos_init(blehr_host_task); diff --git a/examples/bluetooth/nimble/bleprph_host_only/main/main.c b/examples/bluetooth/nimble/bleprph_host_only/main/main.c index 756863565a..a03b3157ea 100644 --- a/examples/bluetooth/nimble/bleprph_host_only/main/main.c +++ b/examples/bluetooth/nimble/bleprph_host_only/main/main.c @@ -131,7 +131,6 @@ bleprph_advertise(void) { struct ble_gap_adv_params adv_params; struct ble_hs_adv_fields fields; - const char *name; int rc; /** @@ -158,6 +157,7 @@ bleprph_advertise(void) fields.tx_pwr_lvl_is_present = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + const char *name; name = ble_svc_gap_device_name(); fields.name = (uint8_t *)name; fields.name_len = strlen(name); @@ -528,12 +528,14 @@ app_main(void) ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ID; #endif +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); /* 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_wifi_coex/main/main.c b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c index bd2af71daa..4d31b9d308 100644 --- a/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c +++ b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c @@ -311,7 +311,6 @@ bleprph_advertise(void) { struct ble_gap_adv_params adv_params; struct ble_hs_adv_fields fields; - const char *name; int rc; /** @@ -338,6 +337,7 @@ bleprph_advertise(void) fields.tx_pwr_lvl_is_present = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + const char *name; name = ble_svc_gap_device_name(); fields.name = (uint8_t *)name; fields.name_len = strlen(name); @@ -525,8 +525,6 @@ void bleprph_host_task(void *param) 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) { @@ -550,12 +548,15 @@ app_main(void) ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb; ble_hs_cfg.store_status_cb = ble_store_util_status_rr; +#if MYNEWT_VAL(BLE_GATTS) + int rc; rc = gatt_svr_init(); assert(rc == 0); /* 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/power_save/main/main.c b/examples/bluetooth/nimble/power_save/main/main.c index b526832286..ec9afce054 100644 --- a/examples/bluetooth/nimble/power_save/main/main.c +++ b/examples/bluetooth/nimble/power_save/main/main.c @@ -167,7 +167,6 @@ bleprph_advertise(void) { struct ble_gap_adv_params adv_params; struct ble_hs_adv_fields fields; - const char *name; int rc; /** @@ -194,6 +193,7 @@ bleprph_advertise(void) fields.tx_pwr_lvl_is_present = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + const char *name; name = ble_svc_gap_device_name(); fields.name = (uint8_t *)name; fields.name_len = strlen(name); @@ -620,6 +620,7 @@ app_main(void) ble_hs_cfg.sm_their_key_dist |= BLE_SM_PAIR_KEY_DIST_ID; #endif +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); @@ -627,6 +628,7 @@ app_main(void) /* 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 */ diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/main/main.c b/examples/bluetooth/nimble/throughput_app/blecent_throughput/main/main.c index d8180b5416..161045dc90 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/main/main.c +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/main/main.c @@ -945,6 +945,7 @@ app_main(void) rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64); assert(rc == 0); #endif + /* Set the default device name. */ rc = ble_svc_gap_device_name_set("gattc-throughput"); assert(rc == 0); diff --git a/examples/bluetooth/nimble/throughput_app/bleprph_throughput/main/main.c b/examples/bluetooth/nimble/throughput_app/bleprph_throughput/main/main.c index b20504aadf..6fb1bfa747 100644 --- a/examples/bluetooth/nimble/throughput_app/bleprph_throughput/main/main.c +++ b/examples/bluetooth/nimble/throughput_app/bleprph_throughput/main/main.c @@ -26,10 +26,10 @@ static uint8_t ext_adv_pattern[] = { }; static uint8_t s_current_phy; -#else -static const char *device_name = "nimble_prph"; #endif +static const char *device_name = "nimble_prph"; + #define NOTIFY_THROUGHPUT_PAYLOAD 495 #define MIN_REQUIRED_MBUF 2 /* Assuming payload of 500Bytes and each mbuf can take 292Bytes. */ #define PREFERRED_MTU_VALUE 512 @@ -509,10 +509,10 @@ void app_main(void) /* Initialize Notify Task */ xTaskCreate(notify_task, "notify_task", 4096, NULL, 10, NULL); +#if MYNEWT_VAL(BLE_GATTS) rc = gatt_svr_init(); assert(rc == 0); -#if !(CONFIG_EXAMPLE_EXTENDED_ADV) /* Set the default device name */ rc = ble_svc_gap_device_name_set(device_name); assert(rc == 0);