Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 andreas 1
/*
21 andreas 2
 * Copyright (C) 2020, 2021 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"
2 andreas 26
#include "terror.h"
8 andreas 27
#include "tprjresources.h"
2 andreas 28
 
4 andreas 29
typedef struct PALETTE_SETUP
30
{
31
    std::string name;
32
    std::string file;
118 andreas 33
    int paletteID{0};
4 andreas 34
}PALETTE_SETUP;
35
 
2 andreas 36
typedef struct PANEL_SETUP
37
{
24 andreas 38
    int portCount{0};                   //!< Number of total ports available
39
    int setupPort{0};                   //!< The number of the setup port used for setup pages. Usualy 0
2 andreas 40
    int addressCount{0};
41
    int channelCount{0};
42
    int levelCount{0};
24 andreas 43
    std::string powerUpPage;            //!< The name of the page to display on startup
44
    std::vector<std::string> powerUpPopup;  //!< The popup(s) to display on startup
2 andreas 45
    int feedbackBlinkRate{0};
46
    std::string startupString;
24 andreas 47
    std::string wakeupString;           //!< A string which wake up the panel if received
48
    std::string sleepString;            //!< A string which put panel to sleep when received
49
    std::string standbyString;          //!< A string which put panel in standby mode
50
    std::string shutdownString;         //!< A string which shut off the panel
51
    std::string idlePage;               //!< A page called when the panel is idle
52
    int idleTimeout{0};                 //!< Time until enter idle mode when no touch occured
2 andreas 53
    int extButtonsKey{0};
24 andreas 54
    int screenWidth{0};                 //!< Width of the screen in pixels
55
    int screenHeight{0};                //!< Height of screen in pixels
2 andreas 56
    int screenRefresh{0};
24 andreas 57
    int screenRotate{0};                //!< 0 = landscape; 1 = portrait
2 andreas 58
    std::string screenDescription;
59
    int pageTracking{0};
60
    int cursor{0};
61
    int brightness{0};
62
    int lightSensorLevelPort{0};
63
    int lightSensorLevelCode{0};
64
    int lightSensorChannelPort{0};
65
    int lightSensorChannelCode{0};
66
    int motionSensorChannelPort{0};
67
    int motionSensorChannelCode{0};
68
    int batteryLevelPort{0};
69
    int batteryLevelCode{0};
70
    int irPortAMX38Emit{0};
71
    int irPortAMX455Emit{0};
72
    int irPortAMX38Recv{0};
73
    int irPortAMX455Recv{0};
74
    int irPortUser1{0};
75
    int irPortUser2{0};
76
    int cradleChannelPort{0};
77
    int cradleChannelCode{0};
78
    std::string uniqueID;
79
    std::string appCreated;
80
    int buildNumber{0};
81
    std::string appModified;
82
    int buildNumberMod{0};
83
    std::string buildStatusMod;
84
    int activePalette{0};
85
    int marqueeSpeed{0};
86
    int setupPagesProject{0};
87
    int voipCommandPort{0};
4 andreas 88
    std::vector<PALETTE_SETUP> palettes;
2 andreas 89
}PANEL_SETUP_T;
90
 
3 andreas 91
class TSettings : public TValidateFile
2 andreas 92
{
93
    public:
94
        TSettings(const std::string& path);
95
 
96
        const std::string& getPath() { return mPath; }
3 andreas 97
        PANEL_SETUP_T& getSettings() { return mSetup; }
98
        int getWith() { return mSetup.screenWidth; }
99
        int getHeight() { return mSetup.screenHeight; }
100
        int getRotate() { return mSetup.screenRotate; }
151 andreas 101
        bool isPortrait();
102
        bool isLandscape();
8 andreas 103
        std::vector<RESOURCE_LIST_T>& getResourcesList() { return mResourceLists; }
11 andreas 104
        bool loadSettings(bool initial=false);
15 andreas 105
        std::string& getPowerUpPage() { return mSetup.powerUpPage; }
151 andreas 106
        int getVoipCmdPort() { return mSetup.voipCommandPort; }
2 andreas 107
 
108
    private:
8 andreas 109
        RESOURCE_LIST_T findResourceType(const std::string& type);
2 andreas 110
 
8 andreas 111
        std::string mPath;                              // The path to the resources
112
        PANEL_SETUP_T mSetup;                           // Settings read from file prj.xma
113
        std::vector<RESOURCE_LIST_T> mResourceLists;    // Resources (cameras) read from prj.xma
2 andreas 114
};
115
 
116
 
117
 
118
#endif //AMXPANEL_SETTINGS_H