Fix compilation when CONFIG_BTDM_BLE_SCAN_DUPL is not enabled.

*  fix warning: variable 'pkey' set but not used [-Wunused-but-set-variable]
---------

Co-authored-by: Franz Höpfinger <f.hoepfinger@hr-agrartechnik.de>
This commit is contained in:
h2zero 2023-05-29 09:08:14 -06:00 committed by GitHub
parent 4ff9baf68a
commit 1786d0ede3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 6 deletions

View file

@ -1138,6 +1138,7 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event *event, void *arg) {
case BLE_GAP_EVENT_PASSKEY_ACTION: { case BLE_GAP_EVENT_PASSKEY_ACTION: {
struct ble_sm_io pkey = {0,0}; struct ble_sm_io pkey = {0,0};
(void)pkey; //warning: variable 'pkey' set but not used [-Wunused-but-set-variable]
if(pClient->m_conn_id != event->passkey.conn_handle) if(pClient->m_conn_id != event->passkey.conn_handle)
return 0; return 0;

View file

@ -85,9 +85,11 @@ std::list <NimBLEAddress> NimBLEDevice::m_ignoreList;
std::vector<NimBLEAddress> NimBLEDevice::m_whiteList; std::vector<NimBLEAddress> NimBLEDevice::m_whiteList;
uint8_t NimBLEDevice::m_own_addr_type = BLE_OWN_ADDR_PUBLIC; uint8_t NimBLEDevice::m_own_addr_type = BLE_OWN_ADDR_PUBLIC;
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
# ifdef CONFIG_BTDM_BLE_SCAN_DUPL
uint16_t NimBLEDevice::m_scanDuplicateSize = CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE; uint16_t NimBLEDevice::m_scanDuplicateSize = CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE;
uint8_t NimBLEDevice::m_scanFilterMode = CONFIG_BTDM_SCAN_DUPL_TYPE; uint8_t NimBLEDevice::m_scanFilterMode = CONFIG_BTDM_SCAN_DUPL_TYPE;
# endif # endif
#endif
/** /**
* @brief Create a new instance of a server. * @brief Create a new instance of a server.
@ -493,6 +495,7 @@ uint16_t NimBLEDevice::getMTU() {
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
# ifdef CONFIG_BTDM_BLE_SCAN_DUPL
/** /**
* @brief Set the duplicate filter cache size for filtering scanned devices. * @brief Set the duplicate filter cache size for filtering scanned devices.
* @param [in] cacheSize The number of advertisements filtered before the cache is reset.\n * @param [in] cacheSize The number of advertisements filtered before the cache is reset.\n
@ -513,6 +516,7 @@ void NimBLEDevice::setScanDuplicateCacheSize(uint16_t cacheSize) {
} }
/** /**
* @brief Set the duplicate filter mode for filtering scanned devices. * @brief Set the duplicate filter mode for filtering scanned devices.
* @param [in] mode One of three possible options: * @param [in] mode One of three possible options:
@ -538,7 +542,8 @@ void NimBLEDevice::setScanFilterMode(uint8_t mode) {
m_scanFilterMode = mode; m_scanFilterMode = mode;
} }
#endif # endif // CONFIG_BTDM_BLE_SCAN_DUPL
#endif // ESP_PLATFORM
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
/** /**
@ -874,9 +879,11 @@ void NimBLEDevice::init(const std::string &deviceName) {
bt_cfg.mode = ESP_BT_MODE_BLE; bt_cfg.mode = ESP_BT_MODE_BLE;
bt_cfg.ble_max_conn = CONFIG_BT_NIMBLE_MAX_CONNECTIONS; bt_cfg.ble_max_conn = CONFIG_BT_NIMBLE_MAX_CONNECTIONS;
# endif # endif
# ifdef CONFIG_BTDM_BLE_SCAN_DUPL
bt_cfg.normal_adv_size = m_scanDuplicateSize; bt_cfg.normal_adv_size = m_scanDuplicateSize;
bt_cfg.scan_duplicate_type = m_scanFilterMode; bt_cfg.scan_duplicate_type = m_scanFilterMode;
# endif
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg)); ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE)); ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
ESP_ERROR_CHECK(esp_nimble_hci_init()); ESP_ERROR_CHECK(esp_nimble_hci_init());

View file

@ -228,8 +228,10 @@ private:
static gap_event_handler m_customGapHandler; static gap_event_handler m_customGapHandler;
static uint8_t m_own_addr_type; static uint8_t m_own_addr_type;
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
# ifdef CONFIG_BTDM_BLE_SCAN_DUPL
static uint16_t m_scanDuplicateSize; static uint16_t m_scanDuplicateSize;
static uint8_t m_scanFilterMode; static uint8_t m_scanFilterMode;
# endif
#endif #endif
static std::vector<NimBLEAddress> m_whiteList; static std::vector<NimBLEAddress> m_whiteList;
}; };