summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/Apps.h1
-rw-r--r--src/displayapp/DisplayApp.cpp9
-rw-r--r--src/displayapp/Messages.h1
-rw-r--r--src/displayapp/screens/PassKey.cpp17
-rw-r--r--src/displayapp/screens/PassKey.h20
5 files changed, 48 insertions, 0 deletions
diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h
index d340efee..935a61a1 100644
--- a/src/displayapp/Apps.h
+++ b/src/displayapp/Apps.h
@@ -25,6 +25,7 @@ namespace Pinetime {
Metronome,
Motion,
Steps,
+ PassKey,
QuickSettings,
Settings,
SettingWatchFace,
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 80155187..08a76467 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -29,6 +29,7 @@
#include "displayapp/screens/FlashLight.h"
#include "displayapp/screens/BatteryInfo.h"
#include "displayapp/screens/Steps.h"
+#include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h"
#include "drivers/Cst816s.h"
@@ -288,6 +289,9 @@ void DisplayApp::Refresh() {
// Added to remove warning
// What should happen here?
break;
+ case Messages::ShowPairingKey:
+ LoadApp(Apps::PassKey, DisplayApp::FullRefreshDirections::Up);
+ break;
}
}
@@ -351,6 +355,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::None);
break;
+ case Apps::PassKey:
+ currentScreen = std::make_unique<Screens::PassKey>(this, bleController.GetPairingKey());
+ ReturnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ break;
+
case Apps::Notifications:
currentScreen = std::make_unique<Screens::Notifications>(
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal);
diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index 29e09eb3..b22d6c3c 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -19,6 +19,7 @@ namespace Pinetime {
UpdateTimeOut,
DimScreen,
RestoreBrightness,
+ ShowPairingKey,
AlarmTriggered
};
}
diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp
new file mode 100644
index 00000000..66bf0c24
--- /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 00000000..34e0d593
--- /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;
+ };
+ }
+ }
+}