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