summaryrefslogtreecommitdiff
path: root/src/ui/include/screen_settings.hpp
blob: 4e1936a28382920ec5999f834b394b8dde2f3de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#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"

#include "nvs.hpp"
#include "screen.hpp"

namespace ui {
namespace screens {

class Settings : public MenuScreen {
 public:
  Settings();
};

class Bluetooth : public MenuScreen {
 public:
  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 {
 public:
  Headphones(drivers::NvsStorage& nvs);

  auto ChangeMaxVolume(uint8_t index) -> void;
  auto ChangeCustomVolume(int8_t diff) -> void;

 private:
  auto UpdateCustomVol(uint16_t) -> void;

  drivers::NvsStorage& nvs_;
  lv_obj_t* custom_vol_container_;
  lv_obj_t* custom_vol_label_;

  std::vector<uint16_t> index_to_level_;
  uint16_t custom_limit_;
};

class Appearance : public MenuScreen {
 public:
  Appearance(drivers::NvsStorage& nvs, drivers::Display& display);

  auto ChangeBrightness(uint_fast8_t) -> void;
  auto CommitBrightness() -> void;

 private:
  drivers::NvsStorage& nvs_;
  drivers::Display& display_;

  lv_obj_t* current_brightness_label_;
  uint_fast8_t current_brightness_;
};

class InputMethod : public MenuScreen {
 public:
  InputMethod();
};

class Storage : public MenuScreen {
 public:
  Storage();
};

class FirmwareUpdate : public MenuScreen {
 public:
  FirmwareUpdate();
};

class About : public MenuScreen {
 public:
  About();
};

}  // namespace screens
}  // namespace ui