CCIMXDesktop
 
Loading...
Searching...
No Matches
lightcontrollerwindow.h
1#ifndef LIGHTCONTROLLERWINDOW_H
2#define LIGHTCONTROLLERWINDOW_H
3
4#include "LEDController.h"
5#include <QMainWindow>
6
7QT_BEGIN_NAMESPACE
8namespace Ui {
10}
11QT_END_NAMESPACE
12
15class LightControllerWindow : public QMainWindow {
16 Q_OBJECT
17
18public:
20 enum class Speed {
21 Slow,
22 Normal,
23 Fast
24 };
25
27 static constexpr const char* DEV_FILE = "red-led";
28
30 static constexpr const short BLINK_DEF = 500;
31
34 LightControllerWindow(QWidget* parent = nullptr);
35
38
40 void process_flip();
41
43 void process_blink();
44
47
50
51private:
52 bool init_state { false };
53 Ui::LightControllerWindow* ui;
54 LEDController ledController;
55 LEDParamsPackagePlain* plain_package { nullptr };
56 LEDParamsPackageBlink* blink { nullptr };
57 Speed speed { Speed::Normal };
58
60 void init_mode();
61};
62
63#endif // LIGHTCONTROLLERWINDOW_H
High-level controller interface for controlling LEDs, abstracting real or pseudo backends.
Definition LEDController.h:12
Parameter package for simple on/off LED control.
Definition LEDParamsPackage.h:46
Main window class for controlling LEDs with various modes and speeds.
Definition lightcontrollerwindow.h:15
void process_flip()
Handle flipping the LED state.
Definition lightcontrollerwindow.cpp:24
static constexpr const short BLINK_DEF
Default blink interval in milliseconds.
Definition lightcontrollerwindow.h:30
void process_blink()
Handle blinking the LED.
Definition lightcontrollerwindow.cpp:37
void process_mode_switching()
Switch the LED operation mode.
Definition lightcontrollerwindow.cpp:45
~LightControllerWindow()
Destructor.
Definition lightcontrollerwindow.cpp:18
Speed
Enumeration for LED blinking speed.
Definition lightcontrollerwindow.h:20
@ Normal
Normal blinking speed.
@ Fast
Fast blinking speed.
@ Slow
Slow blinking speed.
static constexpr const char * DEV_FILE
Device file identifier for the red LED.
Definition lightcontrollerwindow.h:27
void process_speed_switching()
Switch the blinking speed.
Definition lightcontrollerwindow.cpp:65