Add BleController to manage the BLE connection status
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
|
||||
using namespace Pinetime::Applications;
|
||||
|
||||
DisplayApp::DisplayApp(Pinetime::Controllers::Battery &batteryController) : batteryController{batteryController} {
|
||||
DisplayApp::DisplayApp(Pinetime::Controllers::Battery &batteryController, Pinetime::Controllers::Ble &bleController) :
|
||||
batteryController{batteryController},
|
||||
bleController{bleController} {
|
||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
||||
}
|
||||
|
||||
@@ -66,8 +68,8 @@ void DisplayApp::InitHw() {
|
||||
x = 181;
|
||||
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
|
||||
|
||||
gfx->DrawString(10, 0, 0xffff, "BLE", &smallFont, false);
|
||||
gfx->DrawString(20, 160, 0xffff, "FRIDAY 27 DEC 2019", &smallFont, false);
|
||||
gfx->DrawString(10, 0, 0x0000, "BLE", &smallFont, false);
|
||||
gfx->DrawString(20, 180, 0xffff, "FRIDAY 27 DEC 2019", &smallFont, false);
|
||||
}
|
||||
|
||||
void DisplayApp::Refresh() {
|
||||
@@ -133,6 +135,13 @@ void DisplayApp::RunningState() {
|
||||
gfx->DrawString((240-108), 0, 0xffff, batteryChar, &smallFont, false);
|
||||
}
|
||||
|
||||
bool newIsBleConnected = bleController.IsConnected();
|
||||
if(newIsBleConnected != bleConnected) {
|
||||
bleConnected = newIsBleConnected;
|
||||
uint16_t color = (bleConnected) ? 0xffff : 0x0000;
|
||||
gfx->DrawString(10, 0, color, "BLE", &smallFont, false);
|
||||
}
|
||||
|
||||
auto raw = systick_counter / 1000;
|
||||
auto currentDeltaSeconds = raw - deltaSeconds;
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <bits/unique_ptr.h>
|
||||
#include <queue.h>
|
||||
#include <Components/Battery/BatteryController.h>
|
||||
#include <Components/Ble/BleController.h>
|
||||
#include "lcdfont14.h"
|
||||
|
||||
extern const FONT_INFO lCD_70ptFontInfo;
|
||||
@@ -17,7 +18,7 @@ namespace Pinetime {
|
||||
public:
|
||||
enum class States {Idle, Running};
|
||||
enum class Messages : uint8_t {GoToSleep, GoToRunning} ;
|
||||
DisplayApp(Pinetime::Controllers::Battery& batteryController);
|
||||
DisplayApp(Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Ble& bleController);
|
||||
void Start();
|
||||
|
||||
void Minutes(uint8_t m);
|
||||
@@ -53,7 +54,9 @@ namespace Pinetime {
|
||||
static constexpr uint8_t itemSize = 1;
|
||||
|
||||
Pinetime::Controllers::Battery &batteryController;
|
||||
Pinetime::Controllers::Ble &bleController;
|
||||
uint16_t battery = 0;
|
||||
bool bleConnected = false;
|
||||
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user