Skip to content

Commit 037e7fe

Browse files
committed
Add void pointer argument to setCustomGapHandler.
1 parent 7a4402f commit 037e7fe

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
@@ -1303,10 +1303,11 @@ bool NimBLEDevice::setDeviceName(const std::string& deviceName) {
13031303
/**
13041304
* @brief Set a custom callback for gap events.
13051305
* @param [in] handler The function to call when gap events occur.
1306+
* @param [in] arg Argument to pass to the handler.
13061307
* @returns
13071308
*/
1308-
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
1309-
int rc = ble_gap_event_listener_register(&m_listener, handler, NULL);
1309+
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler, void* arg) {
1310+
int rc = ble_gap_event_listener_register(&m_listener, handler, arg);
13101311
if (rc == BLE_HS_EALREADY) {
13111312
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
13121313
return true;

src/NimBLEDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class NimBLEDevice {
133133
static void setScanDuplicateCacheSize(uint16_t cacheSize);
134134
static void setScanFilterMode(uint8_t type);
135135
static void setScanDuplicateCacheResetTime(uint16_t time);
136-
static bool setCustomGapHandler(gap_event_handler handler);
136+
static bool setCustomGapHandler(gap_event_handler handler, void* arg = nullptr);
137137
static void setSecurityAuth(bool bonding, bool mitm, bool sc);
138138
static void setSecurityAuth(uint8_t auth);
139139
static void setSecurityIOCap(uint8_t iocap);

0 commit comments

Comments
 (0)