Pi-XPlane-FMC-CDU
MainFMC.h
1 /*
2  This file is part of Pi-XPlane-FMC-CDU
3  A Raspberry Pi-based External FMC for XPlane
4 
5  Copyright (C) 2017-2018 shahada abubakar
6  <shahada@abubakar.net>
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <https://www.gnu.org/licenses/>.
20 
21  */
22 
23 #ifndef PIXPLANEFMCCDU_MAINFMC_H_
24 #define PIXPLANEFMCCDU_MAINFMC_H_
25 
26 #include <vector>
27 #include <XPlaneBeaconListener.h>
28 #include "AbstractFMC.h"
29 
30 class MainFMC: public AbstractFMC {
31 protected:
32  int numCols;
33  int page;
34 
35  // @brief list discovered servers
36  std::vector<XPlaneBeaconListener::XPlaneServer> servers;
37 
38  // @brief current server
39  int nowServer;
40 
41  // @brief current FMC
42  int nowFMC;
43 
44  std::vector<std::string> detectedFMCs;
45 
46 public:
47 
48  virtual std::string getName() {
49  return "MainFMC";
50  }
51 
52  MainFMC();
53  virtual ~MainFMC();
54 
55  virtual void init();
56  virtual void deInit();
57  virtual void receiveData(time_t time, std::string type, std::string dataref,
58  std::string value);
59  virtual void keyPressEvent(int row, int col);
60  virtual void keyReleaseEvent(int row, int col);
61 
62  virtual void drawCenteredText(int line, std::string text);
63 
64 
65  /* @brief refresh the display of the SelectFMC */
66  void refreshDisplay ();
67 
68  /* @brief Update server availability
69  * Called from FMCManager whenever a XPlane server appears or disappears.
70  */
71 
72  void XPlaneBeaconListenerHandler (XPlaneBeaconListener::XPlaneServer server, bool exists);
73 
74  /* @brief x-plane disconnected
75  *
76  */
77 
78  void onExtPlaneDisconnect ();
79 
85  void onDetectFMC (std::string fmc, bool present);
86 };
87 
88 #endif /* PIXPLANEFMCCDU_MAINFMC_H_ */
virtual void deInit()
de-initialize the fmc.
Definition: MainFMC.cpp:54
Definition: AbstractFMC.h:28
void onDetectFMC(std::string fmc, bool present)
add to the list of discovered FMCs.
Definition: MainFMC.cpp:271
virtual std::string getName()
returns name of FMC plugin.
Definition: MainFMC.h:48
Definition: MainFMC.h:30