Pi-XPlane-FMC-CDU
X737FMC.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_X737FMC_H_
24 #define PIXPLANEFMCCDU_SRC_X737FMC_H_
25 
26 #include <map>
27 #include <vector>
28 #include <string>
29 #include "AbstractFMC.h"
30 
31 // @brief driver for Javier Cortés x737FMC, for use with the EADT x737.
32 // Note for later: For SSG 748, replace FJCC with SSG in datarefs, i.e.
33 // SSG/UFMC/PRESENT.
34 
35 class X737FMC: public AbstractFMC {
36 protected:
37  std::map<int, std::map<int, std::string>> keyInfo;
38 
39  bool inLegsPage;
40 
41 public:
42 
43  // @brief constructor. Defines the mapping between keypad row/col combinations
44  // and the datarefs that can be used to indicate a keypress/release in x737FMC.
45  X737FMC();
46 
47  virtual ~X737FMC();
48 
49  // @brief returns the name of FMC i.e. "x737FMC"
50  virtual std::string getName();
51 
52  // @brief called when connected to ExtPlane server, it subscribes to required datarefs.
53  // includes datarefs for keypresses, screen lines, and LED indicators.
54  virtual void init ();
55 
56  virtual void subscribeDataRefs();
57 
65  virtual void deInit ();
66 
69  virtual void receiveDataRef(std::string type, std::string dataref, std::string value);
70 
71  // @brief called when keypress detected. Translates to which key was pressed and sends command to ExtPlane to trigger the keypress.
72  virtual void keyPressEvent (int row, int col);
73 
74  // @brief called when key release detected. Does nothing in x737FMC.
75  virtual void keyReleaseEvent (int row, int col);
76 
77 
78 
79 };
80 
81 #endif /* PIXPLANEFMCCDU_SRC_X737FMC_H_ */
Definition: X737FMC.h:35
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: X737FMC.cpp:198
virtual void subscribeDataRefs()
subscribe to datarefs
Definition: X737FMC.cpp:136
virtual void deInit()
de-initialize the fmc.
Definition: X737FMC.cpp:158
virtual std::string getName()
returns name of FMC plugin.
Definition: X737FMC.cpp:120