diff options
author | James A. Jerkins <evergreen@jamesjerkinscomputer.com> | 2021-10-30 13:02:39 -0500 |
---|---|---|
committer | JF <JF002@users.noreply.github.com> | 2021-12-09 21:14:16 +0100 |
commit | 62dbcbfc953a36202d96466563a8e71b8bd4ff65 (patch) | |
tree | c4819a9f3716bf6cf4fa839b5116b01671253a6f /src/components/ble/BleController.h | |
parent | 85a25302bfac215f9ec7b993f6a2c21a20ee223b (diff) |
Connect and bond with a passkey
This commit adds the following:
Passkey pairing - passkey is displayed on watch
Swipe down to clear passkey screen
Connection encryption
Connection bonding
Automatic reconnects to a bonded peripheral
Trusted device on Android
Note that persisting the bond between reboots is NOT included in
this commit. Therefore, rebooting the watch will cause reconnect failures.
You must delete the bond from the phone to reconnect/pair.
Diffstat (limited to 'src/components/ble/BleController.h')
-rw-r--r-- | src/components/ble/BleController.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h index 2cba26a9..72b87663 100644 --- a/src/components/ble/BleController.h +++ b/src/components/ble/BleController.h @@ -9,7 +9,7 @@ namespace Pinetime { public: using BleAddress = std::array<uint8_t, 6>; enum class FirmwareUpdateStates { Idle, Running, Validated, Error }; - enum class AddressTypes { Public, Random }; + enum class AddressTypes { Public, Random, RPA_Public, RPA_Random }; Ble() = default; bool IsConnected() const { @@ -48,6 +48,12 @@ namespace Pinetime { void AddressType(AddressTypes t) { addressType = t; } + void SetPairingKey(uint32_t k) { + pairingKey = k; + } + uint32_t GetPairingKey() const { + return pairingKey; + } private: bool isConnected = false; @@ -57,6 +63,7 @@ namespace Pinetime { FirmwareUpdateStates firmwareUpdateState = FirmwareUpdateStates::Idle; BleAddress address; AddressTypes addressType; + uint32_t pairingKey = 0; }; } -}
\ No newline at end of file +} |