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.
This commit is contained in:
17
src/displayapp/screens/PassKey.cpp
Normal file
17
src/displayapp/screens/PassKey.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "PassKey.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
|
||||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) {
|
||||
lpasskey = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00));
|
||||
lv_obj_set_style_local_text_font(lpasskey, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
|
||||
lv_label_set_text_fmt(lpasskey, "%06u", key);
|
||||
lv_obj_align(lpasskey, nullptr, LV_ALIGN_CENTER, 0, -20);
|
||||
}
|
||||
|
||||
PassKey::~PassKey() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user