32 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2021 by Andreas Theofilu <andreas@theosys.at>
|
|
|
3 |
*
|
|
|
4 |
* This program 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 |
* This program 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 program; if not, write to the Free Software Foundation,
|
|
|
16 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
17 |
*/
|
|
|
18 |
#ifndef TEXTERNAL_H
|
|
|
19 |
#define TEXTERNAL_H
|
|
|
20 |
|
|
|
21 |
#include <string>
|
|
|
22 |
#include <vector>
|
|
|
23 |
|
|
|
24 |
#include "tvalidatefile.h"
|
|
|
25 |
|
|
|
26 |
typedef enum extButtons_t
|
|
|
27 |
{
|
|
|
28 |
EXT_NOBUTTON,
|
|
|
29 |
EXT_CURSOR_LEFT,
|
|
|
30 |
EXT_CURSOR_RIGHT,
|
|
|
31 |
EXT_CURSOR_UP,
|
|
|
32 |
EXT_CURSOR_DOWN,
|
|
|
33 |
EXT_CURSOR_SELECT,
|
|
|
34 |
EXT_CURSOR_ROTATE_LEFT,
|
|
|
35 |
EXT_CURSOR_ROTATE_RIGHT,
|
|
|
36 |
EXT_GESTURE_LEFT,
|
|
|
37 |
EXT_GESTURE_RIGHT,
|
|
|
38 |
EXT_GESTURE_UP,
|
33 |
andreas |
39 |
EXT_GESTURE_DOWN,
|
|
|
40 |
EXT_GESTURE_ROTATE_LEFT,
|
|
|
41 |
EXT_GESTURE_ROTATE_RIGHT,
|
|
|
42 |
EXT_GESTURE_DOUBLE_PRESS,
|
|
|
43 |
EXT_GENERAL
|
32 |
andreas |
44 |
}extButtons_t;
|
|
|
45 |
|
|
|
46 |
typedef struct EXTBUTTON_t
|
|
|
47 |
{
|
|
|
48 |
int bi{0}; //!< Button index
|
|
|
49 |
extButtons_t type{EXT_NOBUTTON}; //!< The internal distinct button type
|
|
|
50 |
std::string bc; //!< Technical name of button
|
|
|
51 |
std::string na; //!< Name of button
|
|
|
52 |
int da{0};
|
|
|
53 |
std::string pp;
|
|
|
54 |
int ap{1}; //!< Address port (default: 1)
|
|
|
55 |
int ad{0}; //!< Address channel
|
|
|
56 |
int cp{1}; //!< Channel port
|
|
|
57 |
int ch{0}; //!< Channel number
|
|
|
58 |
std::string rt; //!< ? (default byte)
|
|
|
59 |
std::string vt;
|
|
|
60 |
int lp{1}; //!< Level port
|
|
|
61 |
int lv{0}; //!< Level code
|
|
|
62 |
int va{0};
|
|
|
63 |
int rv{0};
|
|
|
64 |
int rl{0}; //!< Level range low
|
|
|
65 |
int rh{255}; //!< Level range high
|
|
|
66 |
int lu{2}; //!< Level time up
|
|
|
67 |
int ld{2}; //!< Level time down
|
|
|
68 |
int so{1};
|
153 |
andreas |
69 |
int co{1}; //!< Port number for command list
|
33 |
andreas |
70 |
std::string ac;
|
153 |
andreas |
71 |
std::vector<std::string>cm; //!< Commands to self feed or to send to the NetLinx
|
33 |
andreas |
72 |
int ac_de{0};
|
|
|
73 |
int at{0};
|
32 |
andreas |
74 |
}EXBUTTON_t;
|
|
|
75 |
|
|
|
76 |
typedef struct EXTPAGE_t
|
|
|
77 |
{
|
|
|
78 |
int pageID; //!< The ID of the page
|
|
|
79 |
std::string name; //!< The name of the page (empty by default)
|
|
|
80 |
std::vector<EXTBUTTON_t> buttons;
|
|
|
81 |
}EXTPAGE_t;
|
|
|
82 |
|
|
|
83 |
class TExternal : public TValidateFile
|
|
|
84 |
{
|
|
|
85 |
public:
|
|
|
86 |
TExternal();
|
|
|
87 |
|
|
|
88 |
void setFileName(const std::string& fn);
|
|
|
89 |
EXTBUTTON_t getButton(extButtons_t bt);
|
|
|
90 |
EXTBUTTON_t getButton(int pageId, extButtons_t bt);
|
33 |
andreas |
91 |
void setStrict(bool s) { mStrict = s; }
|
|
|
92 |
bool getStrict() { return mStrict; }
|
32 |
andreas |
93 |
|
|
|
94 |
private:
|
|
|
95 |
void initialize();
|
33 |
andreas |
96 |
extButtons_t findCompatibel(extButtons_t bt);
|
32 |
andreas |
97 |
|
|
|
98 |
std::string mFileName; //!< The file name of the configuration file
|
|
|
99 |
std::vector<EXTPAGE_t> mPages; //!< External pages and buttons
|
33 |
andreas |
100 |
bool mStrict{true}; //!< TRUE = exact button comparison; FALSE = compatible button compare
|
32 |
andreas |
101 |
};
|
|
|
102 |
|
|
|
103 |
#endif // TEXTERNAL_H
|