C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
rtos_ui_core.h
Go to the documentation of this file.
1
11
12#pragma once
14#include "sw/ui_core/ui_core.h"
17
18#include "FreeRTOS.h"
19#include "task.h"
20#include "queue.h"
21#include "semphr.h"
22#include "event_groups.h"
23
24#include <set>
25
29{
30private:
32 std::set<rtos_Widget *> attached_rtos_widget;
33 // std::set<Widget *> attached_widgets;
34
35public:
37 TaskHandle_t task_handle;
40 void update_attached_rtos_widget(rtos_Widget *linked_widget);
43 // virtual void draw_refresh_all_attached_widgets();
45 rtos_Model();
48};
49
52class rtos_UIControlledModel : public rtos_Model
53{
54protected:
57
58public:
61
62 rtos_UIControlledModel();
63 ~rtos_UIControlledModel();
67
71
74 virtual void process_control_event(struct_ControlEventData control_event) = 0;
75};
76
78class rtos_UIModelManager : public rtos_UIControlledModel
79{
80private:
87
88protected:
90 virtual void increment_focus();
92 virtual void decrement_focus();
93
94public:
99
101 std::vector<rtos_UIControlledModel *> managed_rtos_models;
102
104 rtos_UIControlledModel *current_active_rtos_model;
105
109
112
117 void add_managed_rtos_model(rtos_UIControlledModel *new_model);
121};
122
124{
125protected:
127 int value;
137
138public:
148 core_IncrementControlledModel(int min_value = 0, int max_value = 10, bool is_wrappable = false, int increment = 1);
150
153 virtual bool increment_value();
154
157 virtual bool decrement_value();
158
162 bool set_clipped_value(int _new_value);
163
166 int get_value();
167
170 int get_min_value();
171
174 int get_max_value();
175};
int get_max_value()
Get the max value object.
Definition rtos_ui_core.cpp:182
virtual bool increment_value()
Increment the current value by the increment amount.
Definition rtos_ui_core.cpp:134
int increment
The number that is added or substracted to the current value. Default to 1.
Definition rtos_ui_core.h:133
core_IncrementControlledModel(int min_value=0, int max_value=10, bool is_wrappable=false, int increment=1)
Construct a new UIControlledIncrementalValue object.
Definition rtos_ui_core.cpp:121
int get_value()
Get the current value.
Definition rtos_ui_core.cpp:172
int max_value
The maximum value that can be reached. Can be either negative or positive.
Definition rtos_ui_core.h:129
int get_min_value()
Get the min value object.
Definition rtos_ui_core.cpp:177
bool set_clipped_value(int _new_value)
Set value to _new_value, and clip the result to min or max value if needed.
Definition rtos_ui_core.cpp:160
virtual bool decrement_value()
Decrement the current value by the increment amount.
Definition rtos_ui_core.cpp:147
int value
The internal value incremented or decremented by action on the controller.
Definition rtos_ui_core.h:127
int min_value
The minimum value that can be reached. Can be either negative or positive.
Definition rtos_ui_core.h:131
bool is_wrappable
If true, once the max (resp. min) value is reached, the next one wraps to min (resp*; max) value....
Definition rtos_ui_core.h:136
void notify_all_linked_widget_task()
notify all linked widget tasks that the model has changed
Definition rtos_ui_core.cpp:9
~rtos_Model()
destructor for RTOS model
Definition rtos_ui_core.cpp:30
TaskHandle_t task_handle
the task handle of the model task
Definition rtos_ui_core.h:37
std::set< rtos_Widget * > attached_rtos_widget
the set of linked widget tasks
Definition rtos_ui_core.h:32
void update_attached_rtos_widget(rtos_Widget *linked_widget)
link a new widget task to the model
Definition rtos_ui_core.cpp:4
rtos_Model()
constructor for RTOS model
Definition rtos_ui_core.cpp:26
ControlledObjectStatus get_rtos_status()
Get the current status of the controlled model.
Definition rtos_ui_core.cpp:54
QueueHandle_t control_event_input_queue
FreeRTOS queue handle used to receive control events for this model.
Definition rtos_ui_core.h:60
ControlledObjectStatus rtos_status
The status of the model, indicating if it is waiting, active or just ahs focus (pointed by the object...
Definition rtos_ui_core.h:56
void update_rtos_status(ControlledObjectStatus _new_status)
update the status of the controlled model
Definition rtos_ui_core.cpp:45
virtual void process_control_event(struct_ControlEventData control_event)=0
process a control event received from the control event queue
void make_rtos_manager_active()
Make the rtos_UIModelManager the active one.
Definition rtos_ui_core.cpp:103
int current_focus_index
The current focus index among the managed models.
Definition rtos_ui_core.h:82
void add_managed_rtos_model(rtos_UIControlledModel *new_model)
Add a new managed rtos_UIControlledModel.
Definition rtos_ui_core.cpp:110
void make_managed_rtos_model_active()
Make the current active managed rtos_UIControlledModel the active one.
Definition rtos_ui_core.cpp:96
rtos_UIModelManager(bool is_wrapable=true)
Construct a new rtos UIModel Manager object.
Definition rtos_ui_core.cpp:79
bool is_wrapable
If true, the focus index wraps around when incremented/decremented beyond the limits.
Definition rtos_ui_core.h:84
std::vector< rtos_UIControlledModel * > managed_rtos_models
A static vector containing all the managed rtos_UIControlledModel objects.
Definition rtos_ui_core.h:101
virtual void increment_focus()
Increment the focus index.
Definition rtos_ui_core.cpp:59
rtos_UIControlledModel * current_active_rtos_model
A static pointer to the current active rtos_UIControlledModel object.
Definition rtos_ui_core.h:104
void forward_control_event_to_active_managed_model(struct_ControlEventData *control_event)
Forward a control event to the current active managed rtos_UIControlledModel.
Definition rtos_ui_core.cpp:116
int max_focus_index
The maximum focus index based on the number of managed models.
Definition rtos_ui_core.h:86
virtual void decrement_focus()
Decrement the focus index.
Definition rtos_ui_core.cpp:69
size_t get_current_focus_index()
Get the current focus index.
Definition rtos_ui_core.cpp:91
RTOS wrapper for Widget class.
Definition rtos_widget.h:31
this is the structure used to transmit control event through a RTOS queue
Definition ui_control_event.h:46
ControlledObjectStatus
The list of status that a Model can have. (0) IS_WAITING (1) HAS_FOCUS (2) IS_ACTIVE.
Definition ui_control_event.h:58
@ IS_WAITING
the object has done its job and is waiting for the next activation
Definition ui_control_event.h:62