Pi-XPlane-FMC-CDU
AbstractFMC.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_SRC_ABSTRACTFMC_H_
24 #define PIXPLANEFMCCDU_SRC_ABSTRACTFMC_H_
25 
26 #include <string>
27 
28 class AbstractFMC {
29 public:
30  AbstractFMC() {};
31  virtual ~AbstractFMC() {};
32 
41  virtual std::string getName() = 0;
42 
43  // called whenever ExtPlane connection established. Doesn't mean that
44  // the current aircraft is using this FMC. FMC Plugins should subscribe
45  // to whatever datarefs they need to determine that they are active.
46 
47  virtual void init () =0;
48 
56  virtual void deInit () = 0;
57 
58 
68  virtual void subscribeDataRefs () {};
69 
72  virtual void receiveDataRef(std::string type, std::string dataref, std::string value) {};
73 
74 
75  // these are called ONLY if FMCList thinks this FMC is currently active.
76  // FMC's should call FMCList::setCurrentFMC if they think they are the
77  // currently active one ... which essentially mean they are taking over
78  // all keypress event processing.
79 
80  virtual void keyPressEvent (int row, int col) = 0;
81  virtual void keyReleaseEvent (int row, int col) = 0;
82 };
83 
84 #endif /* PIXPLANEFMCCDU_SRC_ABSTRACTFMC_H_ */
virtual std::string getName()=0
returns name of FMC plugin.
Definition: AbstractFMC.h:28
virtual void receiveDataRef(std::string type, std::string dataref, std::string value)
called when we receive a float dataref from the server.
Definition: AbstractFMC.h:72
virtual void subscribeDataRefs()
subscribe to datarefs
Definition: AbstractFMC.h:68
virtual void deInit()=0
de-initialize the fmc.