summaryrefslogtreecommitdiff
path: root/src/ui/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/include')
-rw-r--r--src/ui/include/screen_settings.hpp22
-rw-r--r--src/ui/include/ui_fsm.hpp9
2 files changed, 30 insertions, 1 deletions
diff --git a/src/ui/include/screen_settings.hpp b/src/ui/include/screen_settings.hpp
index caa23fd4..4e1936a2 100644
--- a/src/ui/include/screen_settings.hpp
+++ b/src/ui/include/screen_settings.hpp
@@ -8,9 +8,12 @@
#include <stdint.h>
#include <cstdint>
+#include <list>
#include <memory>
#include <vector>
+#include "bluetooth.hpp"
+#include "bluetooth_types.hpp"
#include "display.hpp"
#include "index.hpp"
#include "lvgl.h"
@@ -28,7 +31,24 @@ class Settings : public MenuScreen {
class Bluetooth : public MenuScreen {
public:
- Bluetooth();
+ Bluetooth(drivers::Bluetooth& bt, drivers::NvsStorage& nvs);
+
+ auto ChangeEnabledState(bool enabled) -> void;
+ auto RefreshDevicesList() -> void;
+ auto OnDeviceSelected(size_t index) -> void;
+
+ private:
+ auto RemoveAllDevices() -> void;
+ auto AddPreferredDevice(const drivers::bluetooth::Device&) -> void;
+ auto AddDevice(const drivers::bluetooth::Device&) -> void;
+
+ drivers::Bluetooth& bt_;
+ drivers::NvsStorage& nvs_;
+
+ lv_obj_t* devices_list_;
+ lv_obj_t* preferred_device_;
+
+ std::list<drivers::bluetooth::mac_addr_t> macs_in_list_;
};
class Headphones : public MenuScreen {
diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp
index 5363e1a4..9980dac6 100644
--- a/src/ui/include/ui_fsm.hpp
+++ b/src/ui/include/ui_fsm.hpp
@@ -17,6 +17,7 @@
#include "nvs.hpp"
#include "relative_wheel.hpp"
#include "screen_playing.hpp"
+#include "screen_settings.hpp"
#include "service_locator.hpp"
#include "tinyfsm.hpp"
@@ -72,6 +73,7 @@ class UiState : public tinyfsm::Fsm<UiState> {
virtual void react(const system_fsm::DisplayReady&) {}
virtual void react(const system_fsm::BootComplete&) {}
virtual void react(const system_fsm::StorageMounted&) {}
+ virtual void react(const system_fsm::BluetoothDevicesChanged&) {}
protected:
void PushScreen(std::shared_ptr<Screen>);
@@ -112,6 +114,7 @@ class Onboarding : public UiState {
};
class Browse : public UiState {
+ public:
void entry() override;
void react(const internal::RecordSelected&) override;
@@ -122,10 +125,16 @@ class Browse : public UiState {
void react(const internal::ShowSettingsPage&) override;
void react(const system_fsm::StorageMounted&) override;
+ void react(const system_fsm::BluetoothDevicesChanged&) override;
+
using UiState::react;
+
+ private:
+ std::weak_ptr<screens::Bluetooth> bluetooth_screen_;
};
class Playing : public UiState {
+ public:
void entry() override;
void exit() override;