-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLE: supports legacy pairing. #2237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good.
I did the following integration testing with Boron as a Central device, and BLE devices that require pairing:
- nRF evaluation board with Nordic firmware that makes it a peripheral that requires pairing: passed
- Masterbuilt meat smoker that requires passkey authentication: passed
- Omron Blood Pressure monitor: failed. Upon further investigation, it uses LESC, not Legacy Pairing, so pairing to this device is not in scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Nice
hal/src/nRF52840/ble_hal_impl.h
Outdated
@@ -121,6 +121,8 @@ | |||
#define BLE_MAX_PERIPHERAL_COUNT NRF_SDH_BLE_PERIPHERAL_LINK_COUNT | |||
#define BLE_MAX_CENTRAL_COUNT NRF_SDH_BLE_CENTRAL_LINK_COUNT | |||
|
|||
#define BLE_PAIRING_PASSKEY_LEN 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: move to ble_hal_defines.h
perhaps? I believe this is a universal BLE constant.
} hal_ble_pairing_passkey_input_evt_t; | ||
|
||
typedef struct hal_ble_pairing_status_updated_evt_t { | ||
int status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int32_t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SoftDevice features uint8_t
for the authentication status and the status
here will also indicate system error, so I think int
is sufficient and is consistent with the function that returns system error.
hal/src/nRF52840/ble_hal.cpp
Outdated
secParams.min_key_size = 7; | ||
secParams.max_key_size = 16; | ||
secParams.kdist_own.enc = 1; | ||
secParams.kdist_own.id = 1; | ||
secParams.kdist_peer.enc = 1; | ||
secParams.kdist_peer.id = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: magic numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the one bit-filed member, I'll just use true
/false
instead.
hal/src/nRF52840/ble_hal.cpp
Outdated
secParams.min_key_size = 7; | ||
secParams.max_key_size = 16; | ||
secParams.kdist_own.enc = 1; | ||
secParams.kdist_own.id = 1; | ||
secParams.kdist_peer.enc = 1; | ||
secParams.kdist_peer.id = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: magic numbers
48523f5
to
fd950b8
Compare
As the title describes.
Example App
References
N/A
Completeness