Skip to content

Commit 020c617

Browse files
committed
[BREAKING]- Refactor client
* General code cleanup and rename variables to use a consistent style. * Removes the disconnect timer and will use the BLE_GAP_EVENT_TERM_FAILURE event to handle failed disconnects. * `NimBLEClient::getConnId` has been renamed to `getConnHandle` to be consistent with bluetooth terminology. * `NimBLEClient::disconnect` now returns a `bool = true on success` instead of an int to be consistent with the rest of the library. * `NimBLEClient::setPeerAddress` now returns a bool, true on success. * `NimBLEClientCallbacks::onConfirmPIN` renamed to `NimBLEClientCallbacks::onConfirmPasskey` to be consistent with bluetooth terminology. * `NimBLEClient::setDataLen` now returns bool, true if successful. * `NimBLEClient::updateConnParams` now returns bool, true if successful. * `NimBLEClient::getServices` now returns a const reference to std::vector<NimBLERemoteService*> instead of a pointer to the internal vector.
1 parent 68b82f5 commit 020c617

File tree

19 files changed

+539
-674
lines changed

19 files changed

+539
-674
lines changed

docs/Migration_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ The security callback methods are now incorporated in the `NimBLEServerCallbacks
383383

384384
The callback methods are:
385385

386-
> `bool onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pin)`
386+
> `bool onConfirmPasskey(NimBLEConnInfo& connInfo, uint32_t pin)`
387387
388388
Receives the pin when using numeric comparison authentication.
389389
Call `NimBLEDevice::injectConfirmPIN(connInfo, true);` to accept or `NimBLEDevice::injectConfirmPIN(connInfo, false);` to reject.

examples/Advanced/NimBLE_Client/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ClientCallbacks : public NimBLEClientCallbacks {
4747
NimBLEDevice::injectPassKey(connInfo, 123456);
4848
};
4949

50-
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
50+
void onConfirmPasskey(NimBLEConnInfo& connInfo, uint32_t pass_key){
5151
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
5252
/** Inject false if passkeys don't match. */
5353
NimBLEDevice::injectConfirmPasskey(connInfo, true);

examples/Advanced/NimBLE_Server/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ServerCallbacks: public NimBLEServerCallbacks {
5252
return 123456;
5353
};
5454

55-
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
55+
void onConfirmasskeyN(NimBLEConnInfo& connInfo, uint32_t pass_key){
5656
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
5757
/** Inject false if passkeys don't match. */
5858
NimBLEDevice::injectConfirmPasskey(connInfo, true);

examples/basic/BLE_client/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MyClientCallback : public BLEClientCallbacks {
5959
NimBLEDevice::injectPassKey(connInfo, 123456);
6060
};
6161

62-
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
62+
void onConfirmPasskey(NimBLEConnInfo& connInfo, uint32_t pass_key){
6363
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
6464
/** Inject false if passkeys don't match. */
6565
NimBLEDevice::injectConfirmPasskey(connInfo, true);

examples/basic/BLE_notify/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class MyServerCallbacks: public BLEServerCallbacks {
6565
return 123456;
6666
};
6767

68-
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
68+
void onConfirmPasskey(NimBLEConnInfo& connInfo, uint32_t pass_key){
6969
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
7070
/** Inject false if passkeys don't match. */
7171
NimBLEDevice::injectConfirmPasskey(connInfo, true);

examples/basic/BLE_uart/main/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MyServerCallbacks: public BLEServerCallbacks {
6767
return 123456;
6868
};
6969

70-
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
70+
void onConfirmPasskey(NimBLEConnInfo& connInfo, uint32_t pass_key){
7171
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
7272
/** Inject false if passkeys don't match. */
7373
NimBLEDevice::injectConfirmPasskey(connInfo, true);

0 commit comments

Comments
 (0)