summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
authorJames A. Jerkins <evergreen@jamesjerkinscomputer.com>2021-10-30 18:02:39 (GMT)
committerJF <JF002@users.noreply.github.com>2021-12-09 20:14:16 (GMT)
commit62dbcbfc953a36202d96466563a8e71b8bd4ff65 (patch)
treec4819a9f3716bf6cf4fa839b5116b01671253a6f /src/displayapp/screens
parent85a25302bfac215f9ec7b993f6a2c21a20ee223b (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/displayapp/screens')
-rw-r--r--src/displayapp/screens/PassKey.cpp17
-rw-r--r--src/displayapp/screens/PassKey.h20
2 files changed, 37 insertions, 0 deletions
diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp
new file mode 100644
index 0000000..66bf0c2
--- /dev/null
+++ b/src/displayapp/screens/PassKey.cpp
@@ -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());
+}
+
diff --git a/src/displayapp/screens/PassKey.h b/src/displayapp/screens/PassKey.h
new file mode 100644
index 0000000..34e0d59
--- /dev/null
+++ b/src/displayapp/screens/PassKey.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "Screen.h"
+#include <lvgl/lvgl.h>
+
+namespace Pinetime {
+ namespace Applications {
+ namespace Screens {
+
+ class PassKey : public Screen {
+ public:
+ PassKey(DisplayApp* app, uint32_t key);
+ ~PassKey() override;
+
+ private:
+ lv_obj_t* lpasskey;
+ };
+ }
+ }
+}