Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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};
69
    int co{1};
33 andreas 70
    std::string ac;
71
    int ac_de{0};
72
    int at{0};
32 andreas 73
}EXBUTTON_t;
74
 
75
typedef struct EXTPAGE_t
76
{
77
    int pageID;         //!< The ID of the page
78
    std::string name;   //!< The name of the page (empty by default)
79
    std::vector<EXTBUTTON_t> buttons;
80
}EXTPAGE_t;
81
 
82
class TExternal : public TValidateFile
83
{
84
    public:
85
        TExternal();
86
 
87
        void setFileName(const std::string& fn);
88
        EXTBUTTON_t getButton(extButtons_t bt);
89
        EXTBUTTON_t getButton(int pageId, extButtons_t bt);
33 andreas 90
        void setStrict(bool s) { mStrict = s; }
91
        bool getStrict() { return mStrict; }
32 andreas 92
 
93
    private:
94
        void initialize();
33 andreas 95
        extButtons_t findCompatibel(extButtons_t bt);
32 andreas 96
 
97
        std::string mFileName;          //!< The file name of the configuration file
98
        std::vector<EXTPAGE_t> mPages;  //!< External pages and buttons
33 andreas 99
        bool mStrict{true};             //!< TRUE = exact button comparison; FALSE = compatible button compare
32 andreas 100
};
101
 
102
#endif // TEXTERNAL_H