3 |
andreas |
1 |
/*
|
89 |
andreas |
2 |
* Copyright (C) 2020 to 2022 by Andreas Theofilu <andreas@theosys.at>
|
3 |
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 __TPAGEMANAGER_H__
|
|
|
20 |
#define __TPAGEMANAGER_H__
|
|
|
21 |
|
5 |
andreas |
22 |
#include <functional>
|
11 |
andreas |
23 |
#include <thread>
|
36 |
andreas |
24 |
#ifdef __ANDROID__
|
|
|
25 |
#include <jni.h>
|
|
|
26 |
#endif
|
3 |
andreas |
27 |
#include "tpagelist.h"
|
|
|
28 |
#include "tpage.h"
|
|
|
29 |
#include "tsubpage.h"
|
|
|
30 |
#include "tsettings.h"
|
4 |
andreas |
31 |
#include "tpalette.h"
|
7 |
andreas |
32 |
#include "tbutton.h"
|
|
|
33 |
#include "tfont.h"
|
32 |
andreas |
34 |
#include "texternal.h"
|
11 |
andreas |
35 |
#include "tamxnet.h"
|
|
|
36 |
#include "tamxcommands.h"
|
73 |
andreas |
37 |
#include "tsystemdraw.h"
|
3 |
andreas |
38 |
|
14 |
andreas |
39 |
#define REG_CMD(func, name) registerCommand(bind(&TPageManager::func, this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3),name)
|
3 |
andreas |
40 |
|
8 |
andreas |
41 |
class TIcons;
|
14 |
andreas |
42 |
class TPageManager;
|
21 |
andreas |
43 |
|
|
|
44 |
extern bool prg_stopped;
|
8 |
andreas |
45 |
extern TIcons *gIcons;
|
|
|
46 |
extern TPrjResources *gPrjResources;
|
14 |
andreas |
47 |
extern TPageManager *gPageManager;
|
8 |
andreas |
48 |
|
93 |
andreas |
49 |
#ifdef __ANDROID__
|
|
|
50 |
#define NETSTATE_WIFI 1
|
|
|
51 |
#define NETSTATE_CELL 2
|
|
|
52 |
#endif
|
|
|
53 |
|
11 |
andreas |
54 |
class TPageManager : public TAmxCommands
|
3 |
andreas |
55 |
{
|
|
|
56 |
public:
|
|
|
57 |
TPageManager();
|
|
|
58 |
~TPageManager();
|
|
|
59 |
|
62 |
andreas |
60 |
bool readPages(); //!< Read all pages and subpages
|
|
|
61 |
bool readPage(const std::string& name); //!< Read the page with name \p name
|
|
|
62 |
bool readPage(int ID); //!< Read the page with id \p ID
|
|
|
63 |
bool readSubPage(const std::string& name); //!< Read the subpage with name \p name
|
|
|
64 |
bool readSubPage(int ID); //!< Read the subpage with ID \p ID
|
3 |
andreas |
65 |
|
62 |
andreas |
66 |
TPageList *getPageList() { return mPageList; } //!< Get the list of all pages
|
|
|
67 |
TSettings *getSettings() { return mTSettings; } //!< Get the (system) settings of the panel
|
3 |
andreas |
68 |
|
62 |
andreas |
69 |
TPage *getActualPage(); //!< Get the actual page
|
|
|
70 |
int getActualPageNumber() { return mActualPage; } //!< Get the ID of the actual page
|
|
|
71 |
int getPreviousPageNumber() { return mPreviousPage; } //!< Get the ID of the previous page, if there was any.
|
4 |
andreas |
72 |
TSubPage *getFirstSubPage();
|
|
|
73 |
TSubPage *getNextSubPage();
|
11 |
andreas |
74 |
TSubPage *getFirstSubPageGroup(const std::string& group);
|
|
|
75 |
TSubPage *getNextSubPageGroup();
|
|
|
76 |
TSubPage *getNextSubPageGroup(const std::string& group, TSubPage *pg);
|
|
|
77 |
TSubPage *getTopPage();
|
4 |
andreas |
78 |
|
|
|
79 |
TPage *getPage(int pageID);
|
|
|
80 |
TPage *getPage(const std::string& name);
|
15 |
andreas |
81 |
bool setPage(int PageID);
|
|
|
82 |
bool setPage(const std::string& name);
|
4 |
andreas |
83 |
TSubPage *getSubPage(int pageID);
|
|
|
84 |
TSubPage *getSubPage(const std::string& name);
|
96 |
andreas |
85 |
TSubPage *deliverSubPage(const std::string& name, TPage **pg=nullptr);
|
14 |
andreas |
86 |
bool havePage(const std::string& name);
|
|
|
87 |
bool haveSubPage(const std::string& name);
|
|
|
88 |
bool haveSubPage(int id);
|
|
|
89 |
bool haveSubPage(const std::string& page, const std::string& name);
|
|
|
90 |
bool haveSubPage(const std::string& page, int id);
|
50 |
andreas |
91 |
TFont *getFonts() { return mFonts; }
|
51 |
andreas |
92 |
Button::TButton *findButton(ulong handle);
|
4 |
andreas |
93 |
|
6 |
andreas |
94 |
void registerCallbackDB(std::function<void(ulong handle, ulong parent, unsigned char *buffer, int width, int height, int pixline, int left, int top)> displayButton) { _displayButton = displayButton; }
|
98 |
andreas |
95 |
void registerCBsetVisible(std::function<void(ulong handle, bool state)> setVisible) { _setVisible = setVisible; }
|
5 |
andreas |
96 |
void registerCallbackSP(std::function<void (ulong handle, int width, int height)> setPage) { _setPage = setPage; }
|
41 |
andreas |
97 |
void registerCallbackSSP(std::function<void (ulong handle, int left, int top, int width, int height, ANIMATION_t animate)> setSubPage) { _setSubPage = setSubPage; }
|
38 |
andreas |
98 |
void registerCallbackSB(std::function<void (ulong handle, unsigned char *image, size_t size, size_t rowBytes, int width, int height, ulong color)> setBackground) {_setBackground = setBackground; }
|
26 |
andreas |
99 |
void deployCallbacks();
|
36 |
andreas |
100 |
#ifdef __ANDROID__
|
|
|
101 |
void initNetworkState();
|
|
|
102 |
void stopNetworkState();
|
38 |
andreas |
103 |
void initBatteryState();
|
|
|
104 |
void stopBatteryState();
|
61 |
andreas |
105 |
void initPhoneState();
|
36 |
andreas |
106 |
void informTPanelNetwork(jboolean conn, jint level, jint type);
|
38 |
andreas |
107 |
void informBatteryStatus(jint level, jboolean charging, jint chargeType);
|
61 |
andreas |
108 |
void informPhoneState(bool call, const std::string& pnumber);
|
36 |
andreas |
109 |
#endif
|
11 |
andreas |
110 |
void regCallDropPage(std::function<void (ulong handle)> callDropPage) { _callDropPage = callDropPage; }
|
|
|
111 |
void regCallDropSubPage(std::function<void (ulong handle)> callDropSubPage) { _callDropSubPage = callDropSubPage; }
|
21 |
andreas |
112 |
void regCallPlayVideo(std::function<void (ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw)> callPlayVideo) { _callPlayVideo = callPlayVideo; };
|
52 |
andreas |
113 |
void regCallInputText(std::function<void (Button::TButton *button, Button::BITMAP_t& bm)> callInputText) { _callInputText = callInputText; }
|
63 |
andreas |
114 |
void regCallbackKeyboard(std::function<void (const std::string& init, const std::string& prompt, bool priv)> callKeyboard) { _callKeyboard = callKeyboard; }
|
|
|
115 |
void regCallbackKeypad(std::function<void (const std::string& init, const std::string& prompt, bool priv)> callKeypad) { _callKeypad = callKeypad; }
|
|
|
116 |
void regCallResetKeyboard(std::function<void ()> callResetKeyboard) { _callResetKeyboard = callResetKeyboard; }
|
64 |
andreas |
117 |
void regCallShowSetup(std::function<void ()> callShowSetup) { _callShowSetup = callShowSetup; }
|
36 |
andreas |
118 |
void regCallbackNetState(std::function<void (int level)> callNetState, ulong handle);
|
|
|
119 |
void unregCallbackNetState(ulong handle);
|
38 |
andreas |
120 |
void regCallbackBatteryState(std::function<void (int level, bool charging, int chargeType)> callBatteryState, ulong handle);
|
|
|
121 |
void unregCallbackBatteryState(ulong handle);
|
44 |
andreas |
122 |
void regCallbackResetSurface(std::function<void ()> resetSurface) { _resetSurface = resetSurface; }
|
64 |
andreas |
123 |
void regCallbackShutdown(std::function<void ()> shutdown) { _shutdown = shutdown; }
|
71 |
andreas |
124 |
void regCallbackPlaySound(std::function<void (const std::string& file)> playSound) { _playSound = playSound; }
|
111 |
andreas |
125 |
void regSendVirtualKeys(std::function<void (const std::string& str)> sendVirtualKeys) { _sendVirtualKeys = sendVirtualKeys; }
|
11 |
andreas |
126 |
|
|
|
127 |
/**
|
|
|
128 |
* The following function must be called to start non graphics part
|
|
|
129 |
* of the panel simulator. If everything worked well, it returns TRUE.
|
|
|
130 |
* otherwise a FALSE is returned and the program should be terminated.
|
|
|
131 |
*/
|
5 |
andreas |
132 |
bool run();
|
11 |
andreas |
133 |
/**
|
|
|
134 |
* Set an X value to add to the coordinated reported by the mouse catch
|
|
|
135 |
* event. In case the X coordinate reported by the event is not the real
|
|
|
136 |
* X coordinate, it's possible to set an X coordinate to translate the
|
|
|
137 |
* internal used coordinates.
|
|
|
138 |
*
|
14 |
andreas |
139 |
* @param x
|
|
|
140 |
* The left most pixel which correspond to X = 0
|
11 |
andreas |
141 |
*/
|
10 |
andreas |
142 |
void setFirstLeftPixel(int x) { mFirstLeftPixel = x; }
|
11 |
andreas |
143 |
/**
|
|
|
144 |
* Set an Y value to add to the coordinated reported by the mouse catch
|
|
|
145 |
* event. In case the Y coordinate reported by the event is not the real
|
|
|
146 |
* Y coordinate, it's possible to set an Y coordinate to translate the
|
|
|
147 |
* internal used coordinates.
|
|
|
148 |
*
|
14 |
andreas |
149 |
* @param y
|
43 |
andreas |
150 |
* The top most pixel which correspond to Y = 0
|
11 |
andreas |
151 |
*/
|
10 |
andreas |
152 |
void setFirstTopPixel(int y) { mFirstTopPixel = y; }
|
11 |
andreas |
153 |
/**
|
|
|
154 |
* This function must be called from a GUI whenever the left mouse
|
|
|
155 |
* button was pressed or released. Also if there was a touch event
|
14 |
andreas |
156 |
* this function must be called in the same way. It's up to any GUI
|
11 |
andreas |
157 |
* to handle the mouse and or touch events.
|
|
|
158 |
*
|
14 |
andreas |
159 |
* @param x
|
|
|
160 |
* the X coordinate of the mouse/touch event
|
|
|
161 |
*
|
|
|
162 |
* @param y
|
|
|
163 |
* the y coordinate if the mouse/touch event
|
|
|
164 |
*
|
|
|
165 |
* @return
|
11 |
andreas |
166 |
* pressed TRUE = button was pressed; FALSE = button was released
|
|
|
167 |
*/
|
10 |
andreas |
168 |
void mouseEvent(int x, int y, bool pressed);
|
51 |
andreas |
169 |
/**
|
|
|
170 |
* Searches for a button with the handle \p handle and determines all
|
|
|
171 |
* buttons with the same port and channel. Then it sets \p txt to all
|
|
|
172 |
* found buttons.
|
|
|
173 |
*
|
|
|
174 |
* @param handle The handle of a button.
|
|
|
175 |
* @param txt The text usualy comming from an input line.
|
|
|
176 |
*/
|
|
|
177 |
void setTextToButton(ulong handle, const std::string& txt);
|
|
|
178 |
/**
|
|
|
179 |
* Iterates through all active subpages of the active page and drops
|
|
|
180 |
* them.
|
|
|
181 |
*/
|
14 |
andreas |
182 |
void dropAllSubPages();
|
51 |
andreas |
183 |
/**
|
|
|
184 |
* Closes all subpages in the group \p group.
|
|
|
185 |
*
|
|
|
186 |
* @param group The name of the group.
|
|
|
187 |
*/
|
14 |
andreas |
188 |
void closeGroup(const std::string& group);
|
51 |
andreas |
189 |
/**
|
|
|
190 |
* Displays a the subpage \p name. If the subpage is part of a group
|
|
|
191 |
* the open subpage in the group is closed, if there was one open. Then
|
|
|
192 |
* the subpage is displayed. If the subpage is not already in the
|
|
|
193 |
* internal buffer it's configuration file is read and the page is
|
|
|
194 |
* created.
|
|
|
195 |
*
|
|
|
196 |
* @param name The name of the subpage to display.
|
|
|
197 |
*/
|
14 |
andreas |
198 |
void showSubPage(const std::string& name);
|
51 |
andreas |
199 |
/**
|
|
|
200 |
* Hides the subpage \p name.
|
|
|
201 |
*
|
|
|
202 |
* @param name The name of the subpage to hide.
|
|
|
203 |
*/
|
14 |
andreas |
204 |
void hideSubPage(const std::string& name);
|
43 |
andreas |
205 |
#ifdef _SCALE_SKIA_
|
24 |
andreas |
206 |
void setScaleFactor(double scale) { mScaleFactor = scale; }
|
|
|
207 |
double getScaleFactor() { return mScaleFactor; }
|
31 |
andreas |
208 |
void setScaleFactorWidth(double scale) { mScaleFactorWidth = scale; }
|
|
|
209 |
double getScaleFactorWidth() { return mScaleFactorWidth; }
|
|
|
210 |
void setScaleFactorHeight(double scale) { mScaleFactorHeight = scale; }
|
|
|
211 |
double getScaleFactorHeight() { return mScaleFactorHeight; }
|
43 |
andreas |
212 |
#endif
|
62 |
andreas |
213 |
/**
|
|
|
214 |
* This method handles some external buttons. Some original panels from
|
|
|
215 |
* AMX have external hard buttons. TPanel simulates some of them like
|
|
|
216 |
* the arrow keys, enter button and volume. The graphical surface may
|
|
|
217 |
* display a toolbar on the right side (only if there is enough space
|
|
|
218 |
* left) which offers this buttons. When such a button was pressed, this
|
|
|
219 |
* method is called to send them to the controller.
|
|
|
220 |
*
|
|
|
221 |
* @param bt The button who was pressed
|
|
|
222 |
* @param checked On button press this is TRUE, and on release it is FALSE.
|
|
|
223 |
*/
|
33 |
andreas |
224 |
void externalButton(extButtons_t bt, bool checked);
|
62 |
andreas |
225 |
void sendKeyboard(const std::string& text);
|
|
|
226 |
void sendKeypad(const std::string& text);
|
|
|
227 |
void sendString(uint handle, const std::string& text);
|
111 |
andreas |
228 |
void sendKeyStroke(char key);
|
62 |
andreas |
229 |
/**
|
|
|
230 |
* This starts the communication with the AMX controller. The method
|
|
|
231 |
* registers the callbacks and starts a thread. This thread runs as
|
|
|
232 |
* long as a valid communication is possible or until the communication
|
|
|
233 |
* end by a command.
|
|
|
234 |
*/
|
38 |
andreas |
235 |
void startUp();
|
14 |
andreas |
236 |
|
62 |
andreas |
237 |
// Callbacks who will be registered by the graphical surface.
|
26 |
andreas |
238 |
std::function<void (ulong handle, ulong parent, unsigned char *buffer, int width, int height, int pixline, int left, int top)> getCallbackDB() { return _displayButton; }
|
98 |
andreas |
239 |
std::function<void (ulong handle, bool state)> getVisible() { return _setVisible; };
|
38 |
andreas |
240 |
std::function<void (ulong handle, unsigned char *image, size_t size, size_t rowBytes, int width, int height, ulong color)> getCallbackBG() { return _setBackground; }
|
26 |
andreas |
241 |
std::function<void (ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw)> getCallbackPV() { return _callPlayVideo; }
|
38 |
andreas |
242 |
std::function<void (ulong handle, int width, int height)> getCallbackSetPage() { return _setPage; }
|
52 |
andreas |
243 |
std::function<void (Button::TButton *button, Button::BITMAP_t& bm)> getCallbackInputText() { return _callInputText; }
|
41 |
andreas |
244 |
std::function<void (ulong handle, int left, int top, int width, int height, ANIMATION_t animate)> getCallbackSetSubPage() { return _setSubPage; }
|
38 |
andreas |
245 |
std::function<void (ulong handle)> getCallDropPage() { return _callDropPage; }
|
|
|
246 |
std::function<void (ulong handle)> getCallDropSubPage() { return _callDropSubPage; }
|
71 |
andreas |
247 |
std::function<void (const std::string& file)> getCallPlaySound() { return _playSound; }
|
111 |
andreas |
248 |
std::function<void (const std::string& str)> sendVirtualKeys() { return _sendVirtualKeys; }
|
26 |
andreas |
249 |
|
71 |
andreas |
250 |
bool havePlaySound() { return _playSound != nullptr; }
|
73 |
andreas |
251 |
TSystemDraw *getSystemDraw() { return mSystemDraw; }
|
89 |
andreas |
252 |
void reset();
|
111 |
andreas |
253 |
bool getPassThrough() { return mPassThrough; }
|
71 |
andreas |
254 |
|
3 |
andreas |
255 |
protected:
|
|
|
256 |
PAGELIST_T findPage(const std::string& name);
|
|
|
257 |
PAGELIST_T findPage(int ID);
|
|
|
258 |
SUBPAGELIST_T findSubPage(const std::string& name);
|
|
|
259 |
SUBPAGELIST_T findSubPage(int ID);
|
|
|
260 |
|
|
|
261 |
bool addPage(TPage *pg);
|
|
|
262 |
bool addSubPage(TSubPage *pg);
|
11 |
andreas |
263 |
TSubPage *getCoordMatch(int x, int y);
|
40 |
andreas |
264 |
Button::TButton *getCoordMatchPage(int x, int y);
|
11 |
andreas |
265 |
void initialize();
|
|
|
266 |
void dropAllPages();
|
92 |
andreas |
267 |
bool startComm();
|
3 |
andreas |
268 |
|
|
|
269 |
private:
|
6 |
andreas |
270 |
std::function<void (ulong handle, ulong parent, unsigned char *buffer, int width, int height, int pixline, int left, int top)> _displayButton{nullptr};
|
98 |
andreas |
271 |
std::function<void (ulong handle, bool state)> _setVisible{nullptr};
|
5 |
andreas |
272 |
std::function<void (ulong handle, int width, int height)> _setPage{nullptr};
|
41 |
andreas |
273 |
std::function<void (ulong handle, int left, int top, int width, int height, ANIMATION_t animate)> _setSubPage{nullptr};
|
38 |
andreas |
274 |
std::function<void (ulong handle, unsigned char *image, size_t size, size_t rowBytes, int width, int height, ulong color)> _setBackground{nullptr};
|
7 |
andreas |
275 |
std::function<void (ulong handle, const std::string& text, const std::string& font, const std::string& family, int size, int x, int y, ulong color, ulong effectColor, FONT_STYLE style, Button::TEXT_ORIENTATION ori, Button::TEXT_EFFECT effect, bool ww)> _setText{nullptr};
|
11 |
andreas |
276 |
std::function<void (ulong handle)> _callDropPage{nullptr};
|
|
|
277 |
std::function<void (ulong handle)> _callDropSubPage{nullptr};
|
21 |
andreas |
278 |
std::function<void (ulong handle, ulong parent, int left, int top, int width, int height, const std::string& url, const std::string& user, const std::string& pw)> _callPlayVideo{nullptr};
|
52 |
andreas |
279 |
std::function<void (Button::TButton *button, Button::BITMAP_t& bm)> _callInputText{nullptr};
|
63 |
andreas |
280 |
std::function<void (const std::string& init, const std::string& prompt, bool priv)> _callKeyboard{nullptr};
|
|
|
281 |
std::function<void (const std::string& init, const std::string& prompt, bool priv)> _callKeypad{nullptr};
|
|
|
282 |
std::function<void ()> _callResetKeyboard{nullptr};
|
64 |
andreas |
283 |
std::function<void ()> _callShowSetup{nullptr};
|
44 |
andreas |
284 |
std::function<void ()> _resetSurface{nullptr};
|
64 |
andreas |
285 |
std::function<void ()> _shutdown{nullptr};
|
71 |
andreas |
286 |
std::function<void (const std::string& file)> _playSound{nullptr};
|
111 |
andreas |
287 |
std::function<void (const std::string& str)> _sendVirtualKeys{nullptr};
|
5 |
andreas |
288 |
|
32 |
andreas |
289 |
/**
|
|
|
290 |
* @brief doOverlap checks for overlapping objects
|
|
|
291 |
*
|
|
|
292 |
* The function checks whether some objects on the surface overlap or
|
|
|
293 |
* not. If they do it returns TRUE.
|
|
|
294 |
* This is used for images where we should check for a transparent
|
|
|
295 |
* pixel.
|
|
|
296 |
*
|
|
|
297 |
* @param r1 The rectangular of the first object
|
|
|
298 |
* @param r2 The rectangular of the second object
|
|
|
299 |
* @return If the objects \p r1 and \p r2 overlap at least partialy,
|
|
|
300 |
* TRUE is returned. Otherwise FALSE.
|
|
|
301 |
*/
|
11 |
andreas |
302 |
bool doOverlap(RECT_T r1, RECT_T r2);
|
|
|
303 |
/**
|
|
|
304 |
* Callback function for the AMX controller part. This function must
|
|
|
305 |
* be registered to the class TAmxNet and is called from this module
|
|
|
306 |
* every time an event occured from the controller.
|
|
|
307 |
* This method handles the commands comming from the controller and
|
|
|
308 |
* draws the necessary elements before they are sent to the GUI.
|
|
|
309 |
*
|
14 |
andreas |
310 |
* @param cmd
|
|
|
311 |
* An ANET_COMMAND structure containing the received command.
|
11 |
andreas |
312 |
*/
|
|
|
313 |
void doCommand(const amx::ANET_COMMAND& cmd);
|
14 |
andreas |
314 |
/**
|
|
|
315 |
* The following function is used internaly. It searches in the map
|
|
|
316 |
* table for the button corresponding to the port and channel number
|
|
|
317 |
* and puts the result into a chain of buttons. This chain is returned.
|
|
|
318 |
*
|
|
|
319 |
* If there are some pages not yet in memory, they will be created just
|
|
|
320 |
* to be able to set the button(s).
|
|
|
321 |
*/
|
|
|
322 |
std::vector<Button::TButton *> collectButtons(std::vector<MAP_T>& map);
|
44 |
andreas |
323 |
/**
|
|
|
324 |
* This internal function frees and destroys all settings, loaded pages
|
|
|
325 |
* and sub pages as well as all buttons ens elements belonging to this
|
|
|
326 |
* pages. Wehen the function is finished, the state is the same as it
|
|
|
327 |
* was immediately at startup.
|
|
|
328 |
* This method is called when a filetransfer starts. It is necessary to
|
|
|
329 |
* start all over and read in the changed pages.
|
|
|
330 |
*
|
|
|
331 |
* @return Returns TRUE on success. Else it returns FALSE and the error
|
|
|
332 |
* flag is set.
|
|
|
333 |
*/
|
|
|
334 |
bool destroyAll();
|
15 |
andreas |
335 |
TPage *loadPage(PAGELIST_T& pl);
|
18 |
andreas |
336 |
void setButtonCallbacks(Button::TButton *bt);
|
110 |
andreas |
337 |
bool sendCustomEvent(int value1, int value2, int value3, const std::string& msg, int evType, int cp, int cn);
|
11 |
andreas |
338 |
|
|
|
339 |
// List of command functions
|
23 |
andreas |
340 |
void doFTR(int port, std::vector<int>&, std::vector<std::string>& pars);
|
|
|
341 |
|
14 |
andreas |
342 |
void doON(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
343 |
void doOFF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
344 |
void doLEVEL(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
345 |
void doBLINK(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
14 |
andreas |
346 |
|
11 |
andreas |
347 |
void doAPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
348 |
void doCPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
349 |
void doDPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
350 |
void doPHE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
351 |
void doPHP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
352 |
void doPHT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
11 |
andreas |
353 |
void doPPA(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
12 |
andreas |
354 |
void doPPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
355 |
void doPPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
356 |
void doPPK(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
357 |
void doPPM(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
358 |
void doPPN(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
359 |
void doPPT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
12 |
andreas |
360 |
void doPPX(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
361 |
void doPSE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
362 |
void doPSP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
363 |
void doPST(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
12 |
andreas |
364 |
void doPAGE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
11 |
andreas |
365 |
|
38 |
andreas |
366 |
void doANI(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
367 |
void doAPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
43 |
andreas |
368 |
void doBAT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
369 |
void doBAU(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
43 |
andreas |
370 |
void doBCB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
82 |
andreas |
371 |
void getBCB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
372 |
void doBCF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
82 |
andreas |
373 |
void getBCF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
374 |
void doBCT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
82 |
andreas |
375 |
void getBCT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
376 |
void doBDO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
377 |
void doBFB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
106 |
andreas |
378 |
void doBMC(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
110 |
andreas |
379 |
void doBML(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
15 |
andreas |
380 |
void doBMP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
82 |
andreas |
381 |
void getBMP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
16 |
andreas |
382 |
void doBOP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
106 |
andreas |
383 |
void getBOP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
384 |
void doBOR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
107 |
andreas |
385 |
void doBOS(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
386 |
void doBRD(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
107 |
andreas |
387 |
void getBRD(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
16 |
andreas |
388 |
void doBSP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
107 |
andreas |
389 |
void doBSM(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
390 |
void doBSO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
16 |
andreas |
391 |
void doBWW(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
392 |
void getBWW(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
16 |
andreas |
393 |
void doCPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
394 |
void doDPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
395 |
void doENA(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
396 |
void doFON(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
397 |
void getFON(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
60 |
andreas |
398 |
void doGLH(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
399 |
void doGLL(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
400 |
void doGSC(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
14 |
andreas |
401 |
void doICO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
402 |
void getICO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
403 |
void doJSB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
404 |
void getJSB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
405 |
void doJSI(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
406 |
void getJSI(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
407 |
void doJST(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
408 |
void getJST(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
16 |
andreas |
409 |
void doSHO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
410 |
void doTEC(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
411 |
void getTEC(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
110 |
andreas |
412 |
void doTEF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
413 |
void getTEF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
14 |
andreas |
414 |
void doTXT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
110 |
andreas |
415 |
void getTXT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
104 |
andreas |
416 |
void doUNI(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
417 |
void doUTF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
4 |
andreas |
418 |
|
111 |
andreas |
419 |
void doKPS(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
420 |
void doVKS(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
421 |
|
21 |
andreas |
422 |
void doBBR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
97 |
andreas |
423 |
void doRAF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
424 |
void doRFR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
21 |
andreas |
425 |
void doRMF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
111 |
andreas |
426 |
void doRSR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
21 |
andreas |
427 |
|
62 |
andreas |
428 |
void doAKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
429 |
void doAKEYB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
430 |
void doAKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
431 |
void doAKEYP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
63 |
andreas |
432 |
void doAKEYR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
433 |
void doAKR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
108 |
andreas |
434 |
void doABEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
435 |
void doADBEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
71 |
andreas |
436 |
void doBEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
437 |
void doDBEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
62 |
andreas |
438 |
void doEKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
63 |
andreas |
439 |
void doPKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
440 |
void doPKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
64 |
andreas |
441 |
void doSetup(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
442 |
void doShutdown(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
82 |
andreas |
443 |
void doSOU(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
63 |
andreas |
444 |
void doTKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
|
|
445 |
void doVKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
|
62 |
andreas |
446 |
|
14 |
andreas |
447 |
int mActualPage{0}; // The number of the actual visible page
|
15 |
andreas |
448 |
int mPreviousPage{0}; // The number of the previous page
|
14 |
andreas |
449 |
int mFirstLeftPixel{0}; // Pixels to add to left (x) mouse coordinate
|
|
|
450 |
int mFirstTopPixel{0}; // Pixels to add to top (y) mouse position
|
|
|
451 |
std::string mActualGroupName; // The name of the actual group
|
70 |
andreas |
452 |
TSubPage *mActualGroupPage{nullptr}; // Pointer to subpage of a group which is visible
|
14 |
andreas |
453 |
|
|
|
454 |
amx::TAmxNet *mAmxNet{nullptr}; // Pointer to class TAmxNet; Handles the communication with the controller
|
|
|
455 |
TPageList *mPageList{nullptr}; // List of available pages and subpages
|
|
|
456 |
PCHAIN_T *mPchain{nullptr}; // Pointer to chain of pages in memory
|
|
|
457 |
SPCHAIN_T *mSPchain{nullptr}; // Pointer to chain of subpages in memory for the actual page
|
|
|
458 |
TSettings *mTSettings{nullptr}; // Pointer to basic settings for the panel
|
|
|
459 |
TPalette *mPalette{nullptr}; // Pointer to the color handler
|
|
|
460 |
TFont *mFonts{nullptr}; // Pointer to the font handler
|
32 |
andreas |
461 |
TExternal *mExternal{nullptr}; // Pointer to the external buttons (if any)
|
73 |
andreas |
462 |
TSystemDraw *mSystemDraw{nullptr}; // A pointer to the (optional) system resources
|
14 |
andreas |
463 |
std::thread mThreadAmxNet; // The thread handle to the controler handler
|
|
|
464 |
std::vector<amx::ANET_COMMAND> mCommands; // Command queue of commands received from controller
|
|
|
465 |
bool mBusy{false}; // Internal used to block the command handler
|
|
|
466 |
std::string mCmdBuffer; // Internal used buffer for commands who need more than one network package
|
62 |
andreas |
467 |
std::string mAkbText; // This is the text for the virtual keyboard (@AKB)
|
73 |
andreas |
468 |
std::string mAkpText; // This is the text for the virtual keyad (@AKP)
|
111 |
andreas |
469 |
bool mPassThrough{false}; // Can ve set to true with the command ^KPS
|
70 |
andreas |
470 |
#ifdef _SCALE_SKIA_
|
24 |
andreas |
471 |
double mScaleFactor{1.0}; // The scale factor to zoom or shrink all components
|
31 |
andreas |
472 |
double mScaleFactorWidth{1.0}; // The individual scale factor for the width
|
|
|
473 |
double mScaleFactorHeight{1.0}; // The individual scale factor for the height
|
43 |
andreas |
474 |
#endif
|
93 |
andreas |
475 |
#ifdef __ANDROID__
|
|
|
476 |
int mNetState{0}; // On Android remembers the type of connection to the network (cell or wifi)
|
|
|
477 |
#endif
|
36 |
andreas |
478 |
std::map<int, std::function<void (int level)> > mNetCalls; // List of callbacks for the network state multistate bargraph
|
38 |
andreas |
479 |
std::map<int, std::function<void (int level, bool charging, int chargeType)> > mBatteryCalls;
|
3 |
andreas |
480 |
};
|
|
|
481 |
|
36 |
andreas |
482 |
#ifdef __ANDROID__
|
|
|
483 |
extern "C" {
|
|
|
484 |
JNIEXPORT void JNICALL Java_org_qtproject_theosys_NetworkStatus_informTPanelNetwork(JNIEnv */*env*/, jclass /*clazz*/, jboolean conn, jint level, jint type);
|
38 |
andreas |
485 |
JNIEXPORT void JNICALL Java_org_qtproject_theosys_BatteryState_informBatteryStatus(JNIEnv */*env*/, jclass /*clazz*/, jint level, jboolean charge, jint chargeType);
|
61 |
andreas |
486 |
JNIEXPORT void JNICALL Java_org_qtproject_theosys_PhoneCallState_informPhoneState(JNIEnv *env, jclass cl, jboolean call, jstring pnumber);
|
|
|
487 |
JNIEXPORT void JNICALL Java_org_qtproject_theosys_Logger_logger(JNIEnv *env, jclass cl, jint mode, jstring msg);
|
36 |
andreas |
488 |
}
|
|
|
489 |
#endif // __ANDROID__
|
|
|
490 |
|
3 |
andreas |
491 |
#endif
|