Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/NimBLEAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if CONFIG_BT_NIMBLE_ENABLED

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "nimble/ble.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/include/nimble/ble.h"
# else
# include "nimble/ble.h"
# endif

/**** FIX COMPILATION ****/
Expand Down Expand Up @@ -63,8 +63,8 @@ class NimBLEAddress : private ble_addr_t {
const NimBLEAddress& reverseByteOrder();
bool operator==(const NimBLEAddress& rhs) const;
bool operator!=(const NimBLEAddress& rhs) const;
operator std::string() const;
operator uint64_t() const;
operator std::string() const;
operator uint64_t() const;
};

#endif // CONFIG_BT_NIMBLE_ENABLED
Expand Down
22 changes: 11 additions & 11 deletions src/NimBLEAdvertisedDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
# include "NimBLEScan.h"
# include "NimBLEUUID.h"

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_hs_adv.h"
# include "host/ble_gap.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_hs_adv.h"
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include "host/ble_hs_adv.h"
# include "host/ble_gap.h"
# endif

# include <vector>
Expand Down Expand Up @@ -158,13 +158,13 @@ class NimBLEAdvertisedDevice {
uint8_t findAdvField(uint8_t type, uint8_t index = 0, size_t* data_loc = nullptr) const;
size_t findServiceData(uint8_t index, uint8_t* bytes) const;

NimBLEAddress m_address{};
uint8_t m_advType{};
int8_t m_rssi{};
uint8_t m_callbackSent{};
uint16_t m_advLength{};
ble_npl_time_t m_time{};
NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor
NimBLEAddress m_address{};
uint8_t m_advType{};
int8_t m_rssi{};
uint8_t m_callbackSent{};
uint16_t m_advLength{};
ble_npl_time_t m_time{};
NimBLEAdvertisedDevice* m_pNextWaiting{}; // intrusive list node; self-pointer means "not in list", set in ctor

# if MYNEWT_VAL(BLE_EXT_ADV)
bool m_isLegacyAdv{};
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEAdvertisementData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
# include "NimBLEUUID.h"
# include "NimBLELog.h"

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_hs_adv.h"
# else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_hs_adv.h"
# else
# include "host/ble_hs_adv.h"
# endif

static const char* LOG_TAG = "NimBLEAdvertisementData";
Expand Down
7 changes: 4 additions & 3 deletions src/NimBLEAdvertising.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include "NimBLEAdvertising.h"
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "services/gap/ble_svc_gap.h"
# else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
# else
# include "services/gap/ble_svc_gap.h"
# endif

# include "NimBLEDevice.h"
# include "NimBLEServer.h"
# include "NimBLEUtils.h"
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEAdvertising.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if (CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && !MYNEWT_VAL(BLE_EXT_ADV)) || defined(_DOXYGEN_)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_gap.h"
# else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include "host/ble_gap.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEAttValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#include "NimBLEAttValue.h"
#if CONFIG_BT_NIMBLE_ENABLED

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "nimble/nimble_npl.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/include/nimble/nimble_npl.h"
# else
# include "nimble/nimble_npl.h"
# endif

# include "NimBLEUtils.h"
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLECharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "NimBLECharacteristic.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# ifndef USING_NIMBLE_ARDUINO_HEADERS
# if !defined(ESP_IDF_VERSION_MAJOR) || ESP_IDF_VERSION_MAJOR < 5
# define ble_gatts_notify_custom ble_gattc_notify_custom
# define ble_gatts_indicate_custom ble_gattc_indicate_custom
Expand Down
8 changes: 4 additions & 4 deletions src/NimBLEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
# include "NimBLEDevice.h"
# include "NimBLELog.h"

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "nimble/nimble_port.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/porting/nimble/include/nimble/nimble_port.h"
# else
# include "nimble/nimble_port.h"
# endif

# include <climits>
Expand Down Expand Up @@ -550,7 +550,7 @@ bool NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval,
* @param [in] txOctets The preferred number of payload octets to use (Range 0x001B-0x00FB).
*/
bool NimBLEClient::setDataLen(uint16_t txOctets) {
# if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \
# if !defined(USING_NIMBLE_ARDUINO_HEADERS) && !defined(ESP_IDF_VERSION) || \
(ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432
return false;
# else
Expand Down
8 changes: 4 additions & 4 deletions src/NimBLEClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_CENTRAL)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_gap.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include "host/ble_gap.h"
# endif

# include "NimBLEAddress.h"
Expand Down Expand Up @@ -118,7 +118,7 @@ class NimBLEClient {
* - deleteOnConnectFail: false
* - asyncConnect: false
* - exchangeMTU: true
* - connectFailRetries: 2
* - connectFailRetries: 2
*/
Config()
: deleteCallbacks(0),
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEConnInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#ifndef NIMBLE_CPP_CONNINFO_H_
#define NIMBLE_CPP_CONNINFO_H_

#if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_gap.h"
#else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
#else
# include "host/ble_gap.h"
Comment on lines +21 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Macro definition =="
rg -n '^\s*#\s*define\s+USING_NIMBLE_ARDUINO_HEADERS\b' src/nimconfig.h

echo
echo "== Include gate location in src/NimBLEConnInfo.h =="
nl -ba src/NimBLEConnInfo.h | sed -n '1,40p'

echo
echo "== Candidate ble_gap.h paths in repo =="
fd -a 'ble_gap\.h$' | rg '/host/ble_gap\.h$|/nimble/nimble/host/include/host/ble_gap\.h$' || true

echo
echo "== Files including NimBLEConnInfo.h =="
rg -n '#\s*include\s*"NimBLEConnInfo\.h"'

Repository: h2zero/NimBLE-Arduino

Length of output: 245


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== First 40 lines of src/NimBLEConnInfo.h =="
head -40 src/NimBLEConnInfo.h

echo
echo "== Check if nimconfig.h is included in src/NimBLEConnInfo.h =="
rg -n 'nimconfig\.h' src/NimBLEConnInfo.h || echo "(not found)"

echo
echo "== Check ble_gap.h paths =="
fd -a 'ble_gap\.h$'

echo
echo "== Files directly including NimBLEConnInfo.h =="
rg -l 'include.*NimBLEConnInfo\.h' src/ || echo "(none found)"

echo
echo "== Sample: first includer of NimBLEConnInfo.h =="
rg -B5 -A2 'include.*NimBLEConnInfo\.h' src/ | head -30 || true

Repository: h2zero/NimBLE-Arduino

Length of output: 2033


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== src/NimBLEDevice.h: lines around NimBLEConnInfo.h include =="
rg -B20 -A5 'include.*NimBLEConnInfo\.h' src/NimBLEDevice.h

echo
echo "== Check if nimconfig.h is included in src/NimBLEDevice.h =="
rg -n 'nimconfig\.h' src/NimBLEDevice.h | head -5

echo
echo "== Verify USING_NIMBLE_ARDUINO_HEADERS in nimconfig.h =="
grep -n 'USING_NIMBLE_ARDUINO_HEADERS' src/nimconfig.h

Repository: h2zero/NimBLE-Arduino

Length of output: 834


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Files that include nimconfig.h =="
rg -l 'nimconfig\.h' src/ | head -10

echo
echo "== Check for Arduino/build system includes =="
rg -r -n '#\s*include.*nimconfig\.h' src/ | head -10 || echo "(pattern not found)"

echo
echo "== First 50 lines of src/NimBLEDevice.h =="
head -50 src/NimBLEDevice.h

echo
echo "== Check if Arduino.h or config brings in nimconfig =="
rg -l 'Arduino\.h|nimble_host_config\.h' src/ | head -5

Repository: h2zero/NimBLE-Arduino

Length of output: 1727


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Contents of src/syscfg/syscfg.h =="
head -60 src/syscfg/syscfg.h

echo
echo "== Check if nimconfig.h defines USING_NIMBLE_ARDUINO_HEADERS =="
grep -A2 -B2 'USING_NIMBLE_ARDUINO_HEADERS' src/nimconfig.h

echo
echo "== Direct include pattern: does user code directly include NimBLEConnInfo.h? =="
rg 'include.*NimBLEConnInfo' --type cpp --type h . 2>/dev/null | grep -v src/NimBLEDevice.h || echo "(only from NimBLEDevice.h)"

echo
echo "== Verify fallback path really doesn't exist =="
find . -path "*/host/ble_gap.h" 2>/dev/null || echo "(confirmed: fallback path not in repo)"

Repository: h2zero/NimBLE-Arduino

Length of output: 2286


Ensure header includes its config dependency before conditional path branching.

Arrr, src/NimBLEConnInfo.h be lacking a direct include o' nimconfig.h, so the USING_NIMBLE_ARDUINO_HEADERS macro may not be in scope at Lines 21–24. The fallback path host/ble_gap.h does not exist in the repo either, makin' the fallback liable to fail. While currently 'tis only included from src/NimBLEDevice.h (where the macro is visible through syscfg.h), proper header design requires each header to be self-contained.

⚙️ Proposed fix
+#include "nimconfig.h"
 `#ifdef` USING_NIMBLE_ARDUINO_HEADERS
 # include "nimble/nimble/host/include/host/ble_gap.h"
 `#else`
 # include "host/ble_gap.h"
 `#endif`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
#else
# include "host/ble_gap.h"
`#include` "nimconfig.h"
`#ifdef` USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
`#else`
# include "host/ble_gap.h"
`#endif`
🧰 Tools
🪛 Clang (14.0.6)

[error] 24-24: 'host/ble_gap.h' file not found

(clang-diagnostic-error)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/NimBLEConnInfo.h` around lines 21 - 24, Add a direct include of
nimconfig.h at the top of NimBLEConnInfo.h so the USING_NIMBLE_ARDUINO_HEADERS
macro is always defined before the `#ifdef` branch; then fix the conditional
include block that references host/ble_gap.h by either removing the non-existent
fallback or replacing it with the correct repository include path so the include
in NimBLEConnInfo.h is self-contained (update the `#ifdef`
USING_NIMBLE_ARDUINO_HEADERS ... `#else` ... `#endif` block accordingly).

#endif

#include "NimBLEAddress.h"
Expand Down
10 changes: 5 additions & 5 deletions src/NimBLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# include "esp_bt.h"
# endif
# include "nvs_flash.h"
# if defined(CONFIG_NIMBLE_CPP_IDF)
# ifndef USING_NIMBLE_ARDUINO_HEADERS
# if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE)
# include "esp_nimble_hci.h"
# endif
Expand All @@ -35,14 +35,14 @@
# include "host/util/util.h"
# include "services/gap/ble_svc_gap.h"
# include "services/gatt/ble_svc_gatt.h"
# else
# else // USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/esp_port/esp-hci/include/esp_nimble_hci.h"
# endif
# else
# include "nimble/nimble/controller/include/controller/ble_phy.h"
# endif

# ifndef CONFIG_NIMBLE_CPP_IDF
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/porting/nimble/include/nimble/nimble_port.h"
# include "nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h"
# include "nimble/nimble/host/include/host/ble_hs.h"
Expand Down Expand Up @@ -914,7 +914,7 @@ bool NimBLEDevice::init(const std::string& deviceName) {
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
# endif

# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || !defined(CONFIG_NIMBLE_CPP_IDF)
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || defined(USING_NIMBLE_ARDUINO_HEADERS)
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
# if defined(CONFIG_IDF_TARGET_ESP32)
bt_cfg.mode = ESP_BT_MODE_BLE;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ bool NimBLEDevice::deinit(bool clearAll) {
rc = nimble_port_stop();
if (rc == 0) {
nimble_port_deinit();
# ifdef CONFIG_NIMBLE_CPP_IDF
# ifndef USING_NIMBLE_ARDUINO_HEADERS
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
rc = esp_nimble_hci_and_controller_deinit();
if (rc != ESP_OK) {
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
(CONFIG_BTDM_BLE_SCAN_DUPL || CONFIG_BT_LE_SCAN_DUPL || CONFIG_BT_CTRL_BLE_SCAN_DUPL)
# endif

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include <host/ble_gap.h>
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include <nimble/nimble/host/include/host/ble_gap.h>
# include "host/ble_gap.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEExtAdvertising.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#include "NimBLEExtAdvertising.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && MYNEWT_VAL(BLE_EXT_ADV)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "services/gap/ble_svc_gap.h"
# else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
#else
# include "services/gap/ble_svc_gap.h"
# endif

# include "NimBLEDevice.h"
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEExtAdvertising.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_BROADCASTER) && MYNEWT_VAL(BLE_EXT_ADV)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_gap.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include "host/ble_gap.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEL2CAPChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# include "NimBLELog.h"
# include "NimBLEUtils.h"

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_gap.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gap.h"
# else
# include "host/ble_gap.h"
# endif

// L2CAP buffer block size
Expand Down
8 changes: 4 additions & 4 deletions src/NimBLEL2CAPChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM)

# include "inttypes.h"
# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_l2cap.h"
# include "os/os_mbuf.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_l2cap.h"
# include "nimble/porting/nimble/include/os/os_mbuf.h"
# else
# include "host/ble_l2cap.h"
# include "os/os_mbuf.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLELocalValueAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "host/ble_hs.h"
# else
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_hs.h"
# else
# include "host/ble_hs.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
4 changes: 2 additions & 2 deletions src/NimBLELog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# endif
# endif

# if defined(CONFIG_NIMBLE_CPP_IDF)
# ifndef USING_NIMBLE_ARDUINO_HEADERS
# include "esp_log.h"
# include "console/console.h"

Expand Down Expand Up @@ -172,7 +172,7 @@
# define NIMBLE_LOGE(tag, format, ...) (void)tag
# endif

# endif /* CONFIG_NIMBLE_CPP_IDF */
# endif /* !USING_NIMBLE_ARDUINO_HEADERS */

# define NIMBLE_LOGD_IF(cond, tag, format, ...) { if (cond) { NIMBLE_LOGD(tag, format, ##__VA_ARGS__); }}
# define NIMBLE_LOGI_IF(cond, tag, format, ...) { if (cond) { NIMBLE_LOGI(tag, format, ##__VA_ARGS__); }}
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLERemoteValueAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "syscfg/syscfg.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_CENTRAL)

# if defined(CONFIG_NIMBLE_CPP_IDF)
# include <host/ble_gatt.h>
#ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/nimble/host/include/host/ble_gatt.h"
# else
# include <nimble/nimble/host/include/host/ble_gatt.h>
# include "host/ble_gatt.h"
# endif

/**** FIX COMPILATION ****/
Expand Down
24 changes: 12 additions & 12 deletions src/NimBLEScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

# include "NimBLEDevice.h"
# include "NimBLELog.h"
# if defined(CONFIG_NIMBLE_CPP_IDF)
# include "nimble/nimble_port.h"
# else
# ifdef USING_NIMBLE_ARDUINO_HEADERS
# include "nimble/porting/nimble/include/nimble/nimble_port.h"
# else
# include "nimble/nimble_port.h"
# endif

# include <string>
Expand Down Expand Up @@ -553,15 +553,15 @@ bool NimBLEScan::start(uint32_t duration, bool isContinue, bool restart) {
scan_params.itvl = m_scanParams.itvl;
scan_params.window = m_scanParams.window;
int rc = ble_gap_ext_disc(NimBLEDevice::m_ownAddrType,
duration / 10, // 10ms units
m_period,
m_scanParams.filter_duplicates,
m_scanParams.filter_policy,
m_scanParams.limited,
m_phy & SCAN_1M ? &scan_params : NULL,
m_phy & SCAN_CODED ? &scan_params : NULL,
NimBLEScan::handleGapEvent,
NULL);
duration / 10, // 10ms units
m_period,
m_scanParams.filter_duplicates,
m_scanParams.filter_policy,
m_scanParams.limited,
m_phy & SCAN_1M ? &scan_params : NULL,
m_phy & SCAN_CODED ? &scan_params : NULL,
NimBLEScan::handleGapEvent,
NULL);
# else
int rc = ble_gap_disc(NimBLEDevice::m_ownAddrType,
duration ? duration : BLE_HS_FOREVER,
Expand Down
Loading
Loading