Skip to content

Commit 472c1d0

Browse files
committed
Add void pointer argument to setCustomGapHandler.
1 parent 0ec0832 commit 472c1d0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/NimBLEDevice.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,11 @@ bool NimBLEDevice::setDeviceName(const std::string& deviceName) {
13021302
/**
13031303
* @brief Set a custom callback for gap events.
13041304
* @param [in] handler The function to call when gap events occur.
1305+
* @param [in] arg Argument to pass to the handler.
13051306
* @returns
13061307
*/
1307-
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
1308-
int rc = ble_gap_event_listener_register(&m_listener, handler, NULL);
1308+
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler, void* arg) {
1309+
int rc = ble_gap_event_listener_register(&m_listener, handler, arg);
13091310
if (rc == BLE_HS_EALREADY) {
13101311
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
13111312
return true;

src/NimBLEDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class NimBLEDevice {
139139
static void setScanDuplicateCacheSize(uint16_t cacheSize);
140140
static void setScanFilterMode(uint8_t type);
141141
static void setScanDuplicateCacheResetTime(uint16_t time);
142-
static bool setCustomGapHandler(gap_event_handler handler);
142+
static bool setCustomGapHandler(gap_event_handler handler, void* arg = nullptr);
143143
static void setSecurityAuth(bool bonding, bool mitm, bool sc);
144144
static void setSecurityAuth(uint8_t auth);
145145
static void setSecurityIOCap(uint8_t iocap);

0 commit comments

Comments
 (0)