Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/NimBLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,10 +1303,11 @@ bool NimBLEDevice::setDeviceName(const std::string& deviceName) {
/**
* @brief Set a custom callback for gap events.
* @param [in] handler The function to call when gap events occur.
* @param [in] arg Argument to pass to the handler.
* @returns
*/
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
int rc = ble_gap_event_listener_register(&m_listener, handler, NULL);
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler, void* arg) {
int rc = ble_gap_event_listener_register(&m_listener, handler, arg);
if (rc == BLE_HS_EALREADY) {
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class NimBLEDevice {
static void setScanDuplicateCacheSize(uint16_t cacheSize);
static void setScanFilterMode(uint8_t type);
static void setScanDuplicateCacheResetTime(uint16_t time);
static bool setCustomGapHandler(gap_event_handler handler);
static bool setCustomGapHandler(gap_event_handler handler, void* arg = nullptr);
static void setSecurityAuth(bool bonding, bool mitm, bool sc);
static void setSecurityAuth(uint8_t auth);
static void setSecurityIOCap(uint8_t iocap);
Expand Down