Skip to content

Commit

Permalink
BLE: fix NRF.getSecurityStatus() only returning privacy info while co…
Browse files Browse the repository at this point in the history
…nnected
  • Loading branch information
ssievert42 committed Dec 9, 2024
1 parent ebaa426 commit 70701e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
Graphics: g.dump/asBMP can now output 16 bit images
Crypto: Add support for AES CCM (enabled on Bangle.js 2)
Add Serial over SWD vis RTT (enabled on Bangle.js 2)
BLE: fix NRF.getSecurityStatus() only returning privacy info while connected

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
6 changes: 3 additions & 3 deletions targets/nrf5x/bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -3411,6 +3411,9 @@ JsVar *jsble_get_security_status(uint16_t conn_handle) {
if (conn_handle == m_peripheral_conn_handle) {
jsvObjectSetChildAndUnLock(result, "connectionInterval", jsvNewFromInteger(blePeriphConnectionInterval));
}
#ifdef ESPR_BLE_PRIVATE_ADDRESS_SUPPORT
jsvObjectSetChildAndUnLock(result, "privacy", jsble_getPrivacy());
#endif // ESPR_BLE_PRIVATE_ADDRESS_SUPPORT
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
jsvObjectSetChildAndUnLock(result, "connected", jsvNewFromBool(false));
return result;
Expand All @@ -3422,9 +3425,6 @@ JsVar *jsble_get_security_status(uint16_t conn_handle) {
jsvObjectSetChildAndUnLock(result, "encrypted", jsvNewFromBool(status.encrypted));
jsvObjectSetChildAndUnLock(result, "mitm_protected", jsvNewFromBool(status.mitm_protected));
jsvObjectSetChildAndUnLock(result, "bonded", jsvNewFromBool(status.bonded));
#ifdef ESPR_BLE_PRIVATE_ADDRESS_SUPPORT
jsvObjectSetChildAndUnLock(result, "privacy", jsble_getPrivacy());
#endif // ESPR_BLE_PRIVATE_ADDRESS_SUPPORT
#ifndef SAVE_ON_FLASH
if (status.connected && conn_handle==m_peripheral_conn_handle)
jsvObjectSetChildAndUnLock(result, "connected_addr", bleAddrToStr(m_peripheral_addr));
Expand Down

0 comments on commit 70701e0

Please sign in to comment.