summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/ble/BleController.h1
-rw-r--r--src/components/ble/NimbleController.cpp10
2 files changed, 6 insertions, 5 deletions
diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h
index 594cf40..b15d688 100644
--- a/src/components/ble/BleController.h
+++ b/src/components/ble/BleController.h
@@ -22,6 +22,7 @@ namespace Pinetime {
void EnablePasskey() { isPasskeyEnabled = true; }
void DisablePasskey() { isPasskeyEnabled = false; }
+ bool IsPasskeyEnabled() { return isPasskeyEnabled; }
void StartFirmwareUpdate();
void StopFirmwareUpdate();
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index a66551e..4dee63e 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -116,7 +116,7 @@ void NimbleController::Init() {
ASSERT(rc == 0);
bleController.Address(std::move(address));
- if (bleController.isPasskeyEnabled) {
+ if (bleController.IsPasskeyEnabled()) {
switch (addrType) {
case BLE_OWN_ADDR_PUBLIC:
bleController.AddressType(Ble::AddressTypes::Public);
@@ -145,7 +145,7 @@ void NimbleController::Init() {
rc = ble_gatts_start();
ASSERT(rc == 0);
- if (bleController.isPasskeyEnabled) {
+ if (bleController.IsPasskeyEnabled()) {
RestoreBond();
}
@@ -230,7 +230,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
NRF_LOG_INFO("Disconnect event : BLE_GAP_EVENT_DISCONNECT");
NRF_LOG_INFO("disconnect reason=%d", event->disconnect.reason);
- if (bleController.isPasskeyEnabled && event->disconnect.conn.sec_state.bonded) {
+ if (bleController.IsPasskeyEnabled() && event->disconnect.conn.sec_state.bonded) {
PersistBond(event->disconnect.conn);
}
@@ -265,7 +265,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
NRF_LOG_INFO("Security event : BLE_GAP_EVENT_ENC_CHANGE");
NRF_LOG_INFO("encryption change event; status=%0X ", event->enc_change.status);
- if (bleController.isPasskeyEnabled && event->enc_change.status == 0) {
+ if (bleController.IsPasskeyEnabled() && event->enc_change.status == 0) {
struct ble_gap_conn_desc desc;
ble_gap_conn_find(event->enc_change.conn_handle, &desc);
if (desc.sec_state.bonded) {
@@ -294,7 +294,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
* Use the tinycrypt prng here since rand() is predictable.
*/
NRF_LOG_INFO("Security event : BLE_GAP_EVENT_PASSKEY_ACTION");
- if (bleController.isPasskeyEnabled && event->passkey.params.action == BLE_SM_IOACT_DISP) {
+ if (bleController.IsPasskeyEnabled() && event->passkey.params.action == BLE_SM_IOACT_DISP) {
struct ble_sm_io pkey = {0};
pkey.action = event->passkey.params.action;