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