Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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; }
11 andreas 125
 
126
        /**
127
         * The following function must be called to start non graphics part
128
         * of the panel simulator. If everything worked well, it returns TRUE.
129
         * otherwise a FALSE is returned and the program should be terminated.
130
         */
5 andreas 131
        bool run();
11 andreas 132
        /**
133
         * Set an X value to add to the coordinated reported by the mouse catch
134
         * event. In case the X coordinate reported by the event is not the real
135
         * X coordinate, it's possible to set an X coordinate to translate the
136
         * internal used coordinates.
137
         *
14 andreas 138
         * @param x
139
         * The left most pixel which correspond to X = 0
11 andreas 140
         */
10 andreas 141
        void setFirstLeftPixel(int x) { mFirstLeftPixel = x; }
11 andreas 142
        /**
143
         * Set an Y value to add to the coordinated reported by the mouse catch
144
         * event. In case the Y coordinate reported by the event is not the real
145
         * Y coordinate, it's possible to set an Y coordinate to translate the
146
         * internal used coordinates.
147
         *
14 andreas 148
         * @param y
43 andreas 149
         * The top most pixel which correspond to Y = 0
11 andreas 150
         */
10 andreas 151
        void setFirstTopPixel(int y) { mFirstTopPixel = y; }
11 andreas 152
        /**
153
         * This function must be called from a GUI whenever the left mouse
154
         * button was pressed or released. Also if there was a touch event
14 andreas 155
         * this function must be called in the same way. It's up to any GUI
11 andreas 156
         * to handle the mouse and or touch events.
157
         *
14 andreas 158
         * @param x
159
         * the X coordinate of the mouse/touch event
160
         *
161
         * @param y
162
         * the y coordinate if the mouse/touch event
163
         *
164
         * @return
11 andreas 165
         * pressed TRUE = button was pressed; FALSE = button was released
166
         */
10 andreas 167
        void mouseEvent(int x, int y, bool pressed);
51 andreas 168
        /**
169
         * Searches for a button with the handle \p handle and determines all
170
         * buttons with the same port and channel. Then it sets \p txt to all
171
         * found buttons.
172
         *
173
         * @param handle    The handle of a button.
174
         * @param txt       The text usualy comming from an input line.
175
         */
176
        void setTextToButton(ulong handle, const std::string& txt);
177
        /**
178
         * Iterates through all active subpages of the active page and drops
179
         * them.
180
         */
14 andreas 181
        void dropAllSubPages();
51 andreas 182
        /**
183
         * Closes all subpages in the group \p group.
184
         *
185
         * @param group The name of the group.
186
         */
14 andreas 187
        void closeGroup(const std::string& group);
51 andreas 188
        /**
189
         * Displays a the subpage \p name. If the subpage is part of a group
190
         * the open subpage in the group is closed, if there was one open. Then
191
         * the subpage is displayed. If the subpage is not already in the
192
         * internal buffer it's configuration file is read and the page is
193
         * created.
194
         *
195
         * @param name  The name of the subpage to display.
196
         */
14 andreas 197
        void showSubPage(const std::string& name);
51 andreas 198
        /**
199
         * Hides the subpage \p name.
200
         *
201
         * @param name  The name of the subpage to hide.
202
         */
14 andreas 203
        void hideSubPage(const std::string& name);
43 andreas 204
#ifdef _SCALE_SKIA_
24 andreas 205
        void setScaleFactor(double scale) { mScaleFactor = scale; }
206
        double getScaleFactor() { return mScaleFactor; }
31 andreas 207
        void setScaleFactorWidth(double scale) { mScaleFactorWidth = scale; }
208
        double getScaleFactorWidth() { return mScaleFactorWidth; }
209
        void setScaleFactorHeight(double scale) { mScaleFactorHeight = scale; }
210
        double getScaleFactorHeight() { return mScaleFactorHeight; }
43 andreas 211
#endif
62 andreas 212
        /**
213
         * This method handles some external buttons. Some original panels from
214
         * AMX have external hard buttons. TPanel simulates some of them like
215
         * the arrow keys, enter button and volume. The graphical surface may
216
         * display a toolbar on the right side (only if there is enough space
217
         * left) which offers this buttons. When such a button was pressed, this
218
         * method is called to send them to the controller.
219
         *
220
         * @param bt        The button who was pressed
221
         * @param checked   On button press this is TRUE, and on release it is FALSE.
222
         */
33 andreas 223
        void externalButton(extButtons_t bt, bool checked);
62 andreas 224
        void sendKeyboard(const std::string& text);
225
        void sendKeypad(const std::string& text);
226
        void sendString(uint handle, const std::string& text);
227
        /**
228
         * This starts the communication with the AMX controller. The method
229
         * registers the callbacks and starts a thread. This thread runs as
230
         * long as a valid communication is possible or until the communication
231
         * end by a command.
232
         */
38 andreas 233
        void startUp();
14 andreas 234
 
62 andreas 235
        // Callbacks who will be registered by the graphical surface.
26 andreas 236
        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 237
        std::function<void (ulong handle, bool state)> getVisible() { return _setVisible; };
38 andreas 238
        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 239
        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 240
        std::function<void (ulong handle, int width, int height)> getCallbackSetPage() { return _setPage; }
52 andreas 241
        std::function<void (Button::TButton *button, Button::BITMAP_t& bm)> getCallbackInputText() { return _callInputText; }
41 andreas 242
        std::function<void (ulong handle, int left, int top, int width, int height, ANIMATION_t animate)> getCallbackSetSubPage() { return _setSubPage; }
38 andreas 243
        std::function<void (ulong handle)> getCallDropPage() { return _callDropPage; }
244
        std::function<void (ulong handle)> getCallDropSubPage() { return _callDropSubPage; }
71 andreas 245
        std::function<void (const std::string& file)> getCallPlaySound() { return _playSound; }
26 andreas 246
 
71 andreas 247
        bool havePlaySound() { return _playSound != nullptr; }
73 andreas 248
        TSystemDraw *getSystemDraw() { return mSystemDraw; }
89 andreas 249
        void reset();
71 andreas 250
 
3 andreas 251
    protected:
252
        PAGELIST_T findPage(const std::string& name);
253
        PAGELIST_T findPage(int ID);
254
        SUBPAGELIST_T findSubPage(const std::string& name);
255
        SUBPAGELIST_T findSubPage(int ID);
256
 
257
        bool addPage(TPage *pg);
258
        bool addSubPage(TSubPage *pg);
11 andreas 259
        TSubPage *getCoordMatch(int x, int y);
40 andreas 260
        Button::TButton *getCoordMatchPage(int x, int y);
11 andreas 261
        void initialize();
262
        void dropAllPages();
92 andreas 263
        bool startComm();
3 andreas 264
 
265
    private:
6 andreas 266
        std::function<void (ulong handle, ulong parent, unsigned char *buffer, int width, int height, int pixline, int left, int top)> _displayButton{nullptr};
98 andreas 267
        std::function<void (ulong handle, bool state)> _setVisible{nullptr};
5 andreas 268
        std::function<void (ulong handle, int width, int height)> _setPage{nullptr};
41 andreas 269
        std::function<void (ulong handle, int left, int top, int width, int height, ANIMATION_t animate)> _setSubPage{nullptr};
38 andreas 270
        std::function<void (ulong handle, unsigned char *image, size_t size, size_t rowBytes, int width, int height, ulong color)> _setBackground{nullptr};
7 andreas 271
        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 272
        std::function<void (ulong handle)> _callDropPage{nullptr};
273
        std::function<void (ulong handle)> _callDropSubPage{nullptr};
21 andreas 274
        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 275
        std::function<void (Button::TButton *button, Button::BITMAP_t& bm)> _callInputText{nullptr};
63 andreas 276
        std::function<void (const std::string& init, const std::string& prompt, bool priv)> _callKeyboard{nullptr};
277
        std::function<void (const std::string& init, const std::string& prompt, bool priv)> _callKeypad{nullptr};
278
        std::function<void ()> _callResetKeyboard{nullptr};
64 andreas 279
        std::function<void ()> _callShowSetup{nullptr};
44 andreas 280
        std::function<void ()> _resetSurface{nullptr};
64 andreas 281
        std::function<void ()> _shutdown{nullptr};
71 andreas 282
        std::function<void (const std::string& file)> _playSound{nullptr};
5 andreas 283
 
32 andreas 284
        /**
285
         * @brief doOverlap checks for overlapping objects
286
         *
287
         * The function checks whether some objects on the surface overlap or
288
         * not. If they do it returns TRUE.
289
         * This is used for images where we should check for a transparent
290
         * pixel.
291
         *
292
         * @param r1    The rectangular of the first object
293
         * @param r2    The rectangular of the second object
294
         * @return If the objects \p r1 and \p r2 overlap at least partialy,
295
         * TRUE is returned. Otherwise FALSE.
296
         */
11 andreas 297
        bool doOverlap(RECT_T r1, RECT_T r2);
298
        /**
299
         * Callback function for the AMX controller part. This function must
300
         * be registered to the class TAmxNet and is called from this module
301
         * every time an event occured from the controller.
302
         * This method handles the commands comming from the controller and
303
         * draws the necessary elements before they are sent to the GUI.
304
         *
14 andreas 305
         * @param cmd
306
         * An ANET_COMMAND structure containing the received command.
11 andreas 307
         */
308
        void doCommand(const amx::ANET_COMMAND& cmd);
14 andreas 309
        /**
310
         * The following function is used internaly. It searches in the map
311
         * table for the button corresponding to the port and channel number
312
         * and puts the result into a chain of buttons. This chain is returned.
313
         *
314
         * If there are some pages not yet in memory, they will be created just
315
         * to be able to set the button(s).
316
         */
317
        std::vector<Button::TButton *> collectButtons(std::vector<MAP_T>& map);
44 andreas 318
        /**
319
         * This internal function frees and destroys all settings, loaded pages
320
         * and sub pages as well as all buttons ens elements belonging to this
321
         * pages. Wehen the function is finished, the state is the same as it
322
         * was immediately at startup.
323
         * This method is called when a filetransfer starts. It is necessary to
324
         * start all over and read in the changed pages.
325
         *
326
         * @return Returns TRUE on success. Else it returns FALSE and the error
327
         * flag is set.
328
         */
329
        bool destroyAll();
15 andreas 330
        TPage *loadPage(PAGELIST_T& pl);
18 andreas 331
        void setButtonCallbacks(Button::TButton *bt);
11 andreas 332
 
333
        // List of command functions
23 andreas 334
        void doFTR(int port, std::vector<int>&, std::vector<std::string>& pars);
335
 
14 andreas 336
        void doON(int port, std::vector<int>& channels, std::vector<std::string>& pars);
337
        void doOFF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 338
        void doLEVEL(int port, std::vector<int>& channels, std::vector<std::string>& pars);
339
        void doBLINK(int port, std::vector<int>& channels, std::vector<std::string>& pars);
14 andreas 340
 
11 andreas 341
        void doAPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
342
        void doCPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
343
        void doDPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 344
        void doPHE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
345
        void doPHP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
346
        void doPHT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
11 andreas 347
        void doPPA(int port, std::vector<int>& channels, std::vector<std::string>& pars);
12 andreas 348
        void doPPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
349
        void doPPG(int port, std::vector<int>& channels, std::vector<std::string>& pars);
350
        void doPPK(int port, std::vector<int>& channels, std::vector<std::string>& pars);
351
        void doPPM(int port, std::vector<int>& channels, std::vector<std::string>& pars);
352
        void doPPN(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 353
        void doPPT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
12 andreas 354
        void doPPX(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 355
        void doPSE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
356
        void doPSP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
357
        void doPST(int port, std::vector<int>& channels, std::vector<std::string>& pars);
12 andreas 358
        void doPAGE(int port, std::vector<int>& channels, std::vector<std::string>& pars);
11 andreas 359
 
38 andreas 360
        void doANI(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 361
        void doAPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
43 andreas 362
        void doBAT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 363
        void doBAU(int port, std::vector<int>& channels, std::vector<std::string>& pars);
43 andreas 364
        void doBCB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
82 andreas 365
        void getBCB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 366
        void doBCF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
82 andreas 367
        void getBCF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 368
        void doBCT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
82 andreas 369
        void getBCT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 370
        void doBDO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
371
        void doBFB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
15 andreas 372
        void doBMP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
82 andreas 373
        void getBMP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
16 andreas 374
        void doBOP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 375
        void doBOR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
376
        void doBRD(int port, std::vector<int>& channels, std::vector<std::string>& pars);
16 andreas 377
        void doBSP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
378
        void doBWW(int port, std::vector<int>& channels, std::vector<std::string>& pars);
379
        void doCPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
380
        void doDPF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
381
        void doENA(int port, std::vector<int>& channels, std::vector<std::string>& pars);
382
        void doFON(int port, std::vector<int>& channels, std::vector<std::string>& pars);
60 andreas 383
        void doGLH(int port, std::vector<int>& channels, std::vector<std::string>& pars);
384
        void doGLL(int port, std::vector<int>& channels, std::vector<std::string>& pars);
14 andreas 385
        void doICO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
16 andreas 386
        void doSHO(int port, std::vector<int>& channels, std::vector<std::string>& pars);
14 andreas 387
        void doTXT(int port, std::vector<int>& channels, std::vector<std::string>& pars);
4 andreas 388
 
21 andreas 389
        void doBBR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
97 andreas 390
        void doRAF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
391
        void doRFR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
21 andreas 392
        void doRMF(int port, std::vector<int>& channels, std::vector<std::string>& pars);
393
 
62 andreas 394
        void doAKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
395
        void doAKEYB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
396
        void doAKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
397
        void doAKEYP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
63 andreas 398
        void doAKEYR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
399
        void doAKR(int port, std::vector<int>& channels, std::vector<std::string>& pars);
71 andreas 400
        void doBEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
401
        void doDBEEP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
62 andreas 402
        void doEKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
63 andreas 403
        void doPKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
404
        void doPKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
64 andreas 405
        void doSetup(int port, std::vector<int>& channels, std::vector<std::string>& pars);
406
        void doShutdown(int port, std::vector<int>& channels, std::vector<std::string>& pars);
82 andreas 407
        void doSOU(int port, std::vector<int>& channels, std::vector<std::string>& pars);
63 andreas 408
        void doTKP(int port, std::vector<int>& channels, std::vector<std::string>& pars);
409
        void doVKB(int port, std::vector<int>& channels, std::vector<std::string>& pars);
62 andreas 410
 
14 andreas 411
        int mActualPage{0};                             // The number of the actual visible page
15 andreas 412
        int mPreviousPage{0};                           // The number of the previous page
14 andreas 413
        int mFirstLeftPixel{0};                         // Pixels to add to left (x) mouse coordinate
414
        int mFirstTopPixel{0};                          // Pixels to add to top (y) mouse position
415
        std::string mActualGroupName;                   // The name of the actual group
70 andreas 416
        TSubPage *mActualGroupPage{nullptr};            // Pointer to subpage of a group which is visible
14 andreas 417
 
418
        amx::TAmxNet *mAmxNet{nullptr};                 // Pointer to class TAmxNet; Handles the communication with the controller
419
        TPageList *mPageList{nullptr};                  // List of available pages and subpages
420
        PCHAIN_T *mPchain{nullptr};                     // Pointer to chain of pages in memory
421
        SPCHAIN_T *mSPchain{nullptr};                   // Pointer to chain of subpages in memory for the actual page
422
        TSettings *mTSettings{nullptr};                 // Pointer to basic settings for the panel
423
        TPalette *mPalette{nullptr};                    // Pointer to the color handler
424
        TFont *mFonts{nullptr};                         // Pointer to the font handler
32 andreas 425
        TExternal *mExternal{nullptr};                  // Pointer to the external buttons (if any)
73 andreas 426
        TSystemDraw *mSystemDraw{nullptr};              // A pointer to the (optional) system resources
14 andreas 427
        std::thread mThreadAmxNet;                      // The thread handle to the controler handler
428
        std::vector<amx::ANET_COMMAND> mCommands;       // Command queue of commands received from controller
429
        bool mBusy{false};                              // Internal used to block the command handler
430
        std::string mCmdBuffer;                         // Internal used buffer for commands who need more than one network package
62 andreas 431
        std::string mAkbText;                           // This is the text for the virtual keyboard (@AKB)
73 andreas 432
        std::string mAkpText;                           // This is the text for the virtual keyad (@AKP)
70 andreas 433
#ifdef _SCALE_SKIA_
24 andreas 434
        double mScaleFactor{1.0};                       // The scale factor to zoom or shrink all components
31 andreas 435
        double mScaleFactorWidth{1.0};                  // The individual scale factor for the width
436
        double mScaleFactorHeight{1.0};                 // The individual scale factor for the height
43 andreas 437
#endif
93 andreas 438
#ifdef __ANDROID__
439
        int mNetState{0};                               // On Android remembers the type of connection to the network (cell or wifi)
440
#endif
36 andreas 441
        std::map<int, std::function<void (int level)> > mNetCalls;  // List of callbacks for the network state multistate bargraph
38 andreas 442
        std::map<int, std::function<void (int level, bool charging, int chargeType)> > mBatteryCalls;
3 andreas 443
};
444
 
36 andreas 445
#ifdef __ANDROID__
446
extern "C" {
447
    JNIEXPORT void JNICALL Java_org_qtproject_theosys_NetworkStatus_informTPanelNetwork(JNIEnv */*env*/, jclass /*clazz*/, jboolean conn, jint level, jint type);
38 andreas 448
    JNIEXPORT void JNICALL Java_org_qtproject_theosys_BatteryState_informBatteryStatus(JNIEnv */*env*/, jclass /*clazz*/, jint level, jboolean charge, jint chargeType);
61 andreas 449
    JNIEXPORT void JNICALL Java_org_qtproject_theosys_PhoneCallState_informPhoneState(JNIEnv *env, jclass cl, jboolean call, jstring pnumber);
450
    JNIEXPORT void JNICALL Java_org_qtproject_theosys_Logger_logger(JNIEnv *env, jclass cl, jint mode, jstring msg);
36 andreas 451
}
452
#endif  // __ANDROID__
453
 
3 andreas 454
#endif