Subversion Repositories tpanel

Rev

Rev 446 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
446 andreas 1
/*
2
 * Copyright (C) 2020 to 2022 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
 
19
#ifndef AMXPANEL_SETTINGS_H
20
#define AMXPANEL_SETTINGS_H
21
 
22
#include <iostream>
23
#include <string>
24
#include <vector>
25
#include "tvalidatefile.h"
26
#include "tprjresources.h"
27
 
462 andreas 28
typedef struct VERSION_INFO
29
{
30
    int formatVersion{0};
31
    int graphicsVersion{0};
32
    int g5appsVersion{0};           // Only in TP5
33
    std::string fileVersion;
34
    std::string designVersion;
35
}VERSION_INFO;
36
 
37
typedef struct SUPPORT_FILES
38
{
39
    std::string mapFile;
40
    std::string colorFile;
41
    std::string fontFile;
42
    std::string themeFile;
43
    std::string iconFile;               // Only on TP4
44
    std::string externalButtonFile;
45
    std::string appFile;                // Only on TP5
46
}SUPPORT_FILES;
47
 
446 andreas 48
typedef struct PALETTE_SETUP
49
{
50
    std::string name;
51
    std::string file;
52
    int paletteID{0};
53
}PALETTE_SETUP;
54
 
55
typedef struct PROJECT_INFO
56
{
57
    std::string protection;             //!< Default: none;
58
    bool encrypted{0};                  //!< TRUE=Password is encrypted
59
    std::string password;               //!< The password to open the page
60
    std::string panelType;              //!< The type of the panel (NXT-CV7, ...)
61
    std::string fileRevision;           //!< Optional revision number of the file
62
    std::string dealerID;               //!< The ID of the dealer, if any
63
    std::string jobName;                //!< The job name
64
    std::string salesOrder;
65
    std::string purchaseOrder;
66
    std::string jobComment;
67
    std::string designerID;
68
    std::string creationDate;
69
    std::string revisionDate;
70
    std::string lastSaveDate;
71
    std::string fileName;
72
    std::string colorChoice;
73
    int specifyPortCount{0};
74
    int specifyChanCount{0};
75
}PROJECT_INFO;
76
 
77
typedef struct PANEL_SETUP
78
{
462 andreas 79
    VERSION_INFO versionInfo;           //!< The version information is used to tell between TP4 and TP5
446 andreas 80
    int portCount{0};                   //!< Number of total ports available
81
    int setupPort{0};                   //!< The number of the setup port used for setup pages. Usualy 0
82
    int addressCount{0};
83
    int channelCount{0};
84
    int levelCount{0};
85
    std::string powerUpPage;            //!< The name of the page to display on startup
86
    std::vector<std::string> powerUpPopup;  //!< The popup(s) to display on startup
87
    int feedbackBlinkRate{0};
88
    std::string startupString;
89
    std::string wakeupString;           //!< A string which wake up the panel if received
90
    std::string sleepString;            //!< A string which put panel to sleep when received
91
    std::string standbyString;          //!< A string which put panel in standby mode
92
    std::string shutdownString;         //!< A string which shut off the panel
93
    std::string idlePage;               //!< A page called when the panel is idle
94
    int idleTimeout{0};                 //!< Time until enter idle mode when no touch occured
95
    int extButtonsKey{0};
96
    int screenWidth{0};                 //!< Width of the screen in pixels
97
    int screenHeight{0};                //!< Height of screen in pixels
98
    int screenRefresh{0};
99
    int screenRotate{0};                //!< 0 = landscape; 1 = portrait
100
    std::string screenDescription;
101
    int pageTracking{0};
102
    int cursor{0};
103
    int brightness{0};
104
    int lightSensorLevelPort{0};
105
    int lightSensorLevelCode{0};
106
    int lightSensorChannelPort{0};
107
    int lightSensorChannelCode{0};
108
    int motionSensorChannelPort{0};
109
    int motionSensorChannelCode{0};
110
    int batteryLevelPort{0};
111
    int batteryLevelCode{0};
112
    int irPortAMX38Emit{0};
113
    int irPortAMX455Emit{0};
114
    int irPortAMX38Recv{0};
115
    int irPortAMX455Recv{0};
116
    int irPortUser1{0};
117
    int irPortUser2{0};
118
    int cradleChannelPort{0};
119
    int cradleChannelCode{0};
120
    std::string uniqueID;
121
    std::string appCreated;
122
    int buildNumber{0};
123
    std::string appModified;
124
    int buildNumberMod{0};
125
    std::string buildStatusMod;
126
    int activePalette{0};
127
    int marqueeSpeed{0};
128
    int setupPagesProject{0};
129
    int voipCommandPort{0};
462 andreas 130
    SUPPORT_FILES supportFiles;
446 andreas 131
    std::vector<PALETTE_SETUP> palettes;
132
}PANEL_SETUP_T;
133
 
134
class TSettings : public TValidateFile
135
{
136
    public:
137
        TSettings(const std::string& path);
138
 
139
        const std::string& getPath() { return mPath; }
140
        PANEL_SETUP_T& getSettings() { return mSetup; }
141
        PROJECT_INFO& getProjectInfo() { return mProject; }
462 andreas 142
        VERSION_INFO& getVersionInfo() { return mSetup.versionInfo; }
143
        SUPPORT_FILES& getSupportFiles() { return mSetup.supportFiles; }
144
        std::string& getMapFileName() { return mSetup.supportFiles.mapFile; }
145
        std::string& getColorFileName() { return mSetup.supportFiles.colorFile; }
146
        std::string& getFontFileName() { return mSetup.supportFiles.fontFile; }
147
        std::string& getThemeFileName() { return mSetup.supportFiles.themeFile; }
148
        std::string& getIconFileName() { return mSetup.supportFiles.iconFile; }
149
        std::string& getExtButtonFileName() { return mSetup.supportFiles.externalButtonFile; }
150
        std::string& getAppFileName() { return mSetup.supportFiles.appFile; }
151
 
446 andreas 152
        int getWidth() { return mSetup.screenWidth; }
153
        int getHeight() { return mSetup.screenHeight; }
154
        int getRotate() { return mSetup.screenRotate; }
155
        bool isPortrait();
156
        bool isLandscape();
157
        std::vector<RESOURCE_LIST_T>& getResourcesList() { return mResourceLists; }
158
        bool loadSettings(bool initial=false);
159
        std::string& getPowerUpPage() { return mSetup.powerUpPage; }
160
        int getVoipCmdPort() { return mSetup.voipCommandPort; }
161
        std::string& getPanelType() { return mProject.panelType; }
462 andreas 162
        bool isTP5() { return mSetup.versionInfo.g5appsVersion > 0; }
446 andreas 163
 
164
    private:
165
        RESOURCE_LIST_T findResourceType(const std::string& type);
166
 
167
        std::string mPath;                              // The path to the resources
168
        PANEL_SETUP_T mSetup;                           // Settings read from file prj.xma
169
        PROJECT_INFO mProject;                          // The project information.
170
        std::vector<RESOURCE_LIST_T> mResourceLists;    // Resources (cameras) read from prj.xma
171
};
172
 
173
 
174
 
175
#endif //AMXPANEL_SETTINGS_H