EX-Display
EX-Display
Loading...
Searching...
No Matches
/home/runner/work/EX-Display/EX-Display/Screen.h
Go to the documentation of this file.
1/*
2 * © 2024 Peter Cole
3 *
4 * This is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * It is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this code. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef SCREEN_H
19#define SCREEN_H
20
21#include "ScreenRow.h"
22#include <Arduino.h>
23
27class Screen {
28public:
31 Screen(uint8_t screenId);
32
35 uint8_t getId();
36
39 void setNext(Screen *screen);
40
43 Screen *getNext();
44
50 void updateScreenRow(uint8_t screenRowId, const char *text);
51
55
59 ScreenRow *getScreenRowById(uint8_t screenRowId);
60
63 void setLogger(Logger *logger);
64
67 ~Screen();
68
69private:
70 uint8_t _screenId;
74
78 void _addScreenRow(uint8_t screenRowId, const char *text);
79
82 void _deleteScreenRow(ScreenRow *screenRow);
83};
84
85#endif // SCREEN_H
Class to enable simple logging to a Stream object with different log levels This enables embedding pe...
Definition Logger.h:35
Definition ScreenRow.h:24
Class for each screen as received from the EXRAIL SCREEN() command Each Screen instance contains a li...
Definition Screen.h:27
void updateScreenRow(uint8_t screenRowId, const char *text)
Update the specified ScreenRow, or create it if it doesn't exist This will automatically maintain the...
Definition Screen.cpp:28
ScreenRow * getFirstScreenRow()
Get the first ScreenRow instance in the list.
Definition Screen.cpp:49
ScreenRow * getScreenRowById(uint8_t screenRowId)
Get the ScreenRow instance at the specified ID.
Definition Screen.cpp:51
void _addScreenRow(uint8_t screenRowId, const char *text)
Add a new ScreenRow to the list.
Definition Screen.cpp:80
void setLogger(Logger *logger)
Set the Logger instance.
Definition Screen.cpp:63
~Screen()
Destructor for the Screen instance Will automatically clean up the associated ScreenRow list.
Definition Screen.cpp:65
void _deleteScreenRow(ScreenRow *screenRow)
Delete the specified ScreenRow and update the list accordingly.
Definition Screen.cpp:101
void setNext(Screen *screen)
Set the next Screen instance in the list.
Definition Screen.cpp:24
ScreenRow * _firstScreenRow
Definition Screen.h:72
Screen * _next
Definition Screen.h:71
Logger * _logger
Definition Screen.h:73
uint8_t getId()
Get the ID for this screen instance.
Definition Screen.cpp:22
uint8_t _screenId
Definition Screen.h:70
Screen * getNext()
Get the next Screen instance in the list.
Definition Screen.cpp:26