mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(nimble): Address compilation issues in nimble examples
This commit is contained in:
@@ -581,7 +581,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.
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: 9464ecd6e3...8fd41d86c4
@@ -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
|
||||
@@ -1804,9 +1804,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
|
||||
@@ -1819,10 +1821,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"
|
||||
@@ -1830,9 +1834,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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -547,6 +547,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");
|
||||
@@ -565,6 +566,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) {
|
||||
|
||||
Reference in New Issue
Block a user