Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 andreas 1
/*
193 andreas 2
 * Copyright (C) 2020 to 2022 by Andreas Theofilu <andreas@theosys.at>
2 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>
3 andreas 25
#include "tvalidatefile.h"
8 andreas 26
#include "tprjresources.h"
2 andreas 27
 
4 andreas 28
typedef struct PALETTE_SETUP
29
{
30
    std::string name;
31
    std::string file;
118 andreas 32
    int paletteID{0};
4 andreas 33
}PALETTE_SETUP;
34
 
178 andreas 35
typedef struct PROJECT_INFO
36
{
37
    std::string protection;             //!< Default: none;
38
    bool encrypted{0};                  //!< TRUE=Password is encrypted
39
    std::string password;               //!< The password to open the page
40
    std::string panelType;              //!< The type of the panel (NXT-CV7, ...)
41
    std::string fileRevision;           //!< Optional revision number of the file
42
    std::string dealerID;               //!< The ID of the dealer, if any
43
    std::string jobName;                //!< The job name
44
    std::string salesOrder;
45
    std::string purchaseOrder;
46
    std::string jobComment;
47
    std::string designerID;
48
    std::string creationDate;
49
    std::string revisionDate;
50
    std::string lastSaveDate;
51
    std::string fileName;
52
    std::string colorChoice;
53
    int specifyPortCount{0};
54
    int specifyChanCount{0};
55
}PROJECT_INFO;
56
 
2 andreas 57
typedef struct PANEL_SETUP
58
{
24 andreas 59
    int portCount{0};                   //!< Number of total ports available
60
    int setupPort{0};                   //!< The number of the setup port used for setup pages. Usualy 0
2 andreas 61
    int addressCount{0};
62
    int channelCount{0};
63
    int levelCount{0};
24 andreas 64
    std::string powerUpPage;            //!< The name of the page to display on startup
65
    std::vector<std::string> powerUpPopup;  //!< The popup(s) to display on startup
2 andreas 66
    int feedbackBlinkRate{0};
67
    std::string startupString;
24 andreas 68
    std::string wakeupString;           //!< A string which wake up the panel if received
69
    std::string sleepString;            //!< A string which put panel to sleep when received
70
    std::string standbyString;          //!< A string which put panel in standby mode
71
    std::string shutdownString;         //!< A string which shut off the panel
72
    std::string idlePage;               //!< A page called when the panel is idle
73
    int idleTimeout{0};                 //!< Time until enter idle mode when no touch occured
2 andreas 74
    int extButtonsKey{0};
24 andreas 75
    int screenWidth{0};                 //!< Width of the screen in pixels
76
    int screenHeight{0};                //!< Height of screen in pixels
2 andreas 77
    int screenRefresh{0};
24 andreas 78
    int screenRotate{0};                //!< 0 = landscape; 1 = portrait
2 andreas 79
    std::string screenDescription;
80
    int pageTracking{0};
81
    int cursor{0};
82
    int brightness{0};
83
    int lightSensorLevelPort{0};
84
    int lightSensorLevelCode{0};
85
    int lightSensorChannelPort{0};
86
    int lightSensorChannelCode{0};
87
    int motionSensorChannelPort{0};
88
    int motionSensorChannelCode{0};
89
    int batteryLevelPort{0};
90
    int batteryLevelCode{0};
91
    int irPortAMX38Emit{0};
92
    int irPortAMX455Emit{0};
93
    int irPortAMX38Recv{0};
94
    int irPortAMX455Recv{0};
95
    int irPortUser1{0};
96
    int irPortUser2{0};
97
    int cradleChannelPort{0};
98
    int cradleChannelCode{0};
99
    std::string uniqueID;
100
    std::string appCreated;
101
    int buildNumber{0};
102
    std::string appModified;
103
    int buildNumberMod{0};
104
    std::string buildStatusMod;
105
    int activePalette{0};
106
    int marqueeSpeed{0};
107
    int setupPagesProject{0};
108
    int voipCommandPort{0};
4 andreas 109
    std::vector<PALETTE_SETUP> palettes;
2 andreas 110
}PANEL_SETUP_T;
111
 
3 andreas 112
class TSettings : public TValidateFile
2 andreas 113
{
114
    public:
115
        TSettings(const std::string& path);
116
 
117
        const std::string& getPath() { return mPath; }
3 andreas 118
        PANEL_SETUP_T& getSettings() { return mSetup; }
178 andreas 119
        PROJECT_INFO& getProjectInfo() { return mProject; }
217 andreas 120
        int getWidth() { return mSetup.screenWidth; }
3 andreas 121
        int getHeight() { return mSetup.screenHeight; }
122
        int getRotate() { return mSetup.screenRotate; }
151 andreas 123
        bool isPortrait();
124
        bool isLandscape();
8 andreas 125
        std::vector<RESOURCE_LIST_T>& getResourcesList() { return mResourceLists; }
11 andreas 126
        bool loadSettings(bool initial=false);
15 andreas 127
        std::string& getPowerUpPage() { return mSetup.powerUpPage; }
151 andreas 128
        int getVoipCmdPort() { return mSetup.voipCommandPort; }
178 andreas 129
        std::string& getPanelType() { return mProject.panelType; }
2 andreas 130
 
131
    private:
8 andreas 132
        RESOURCE_LIST_T findResourceType(const std::string& type);
2 andreas 133
 
8 andreas 134
        std::string mPath;                              // The path to the resources
135
        PANEL_SETUP_T mSetup;                           // Settings read from file prj.xma
178 andreas 136
        PROJECT_INFO mProject;                          // The project information.
8 andreas 137
        std::vector<RESOURCE_LIST_T> mResourceLists;    // Resources (cameras) read from prj.xma
2 andreas 138
};
139
 
140
 
141
 
142
#endif //AMXPANEL_SETTINGS_H