]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/commradio.hxx
add to project files
[flightgear.git] / src / Instrumentation / commradio.hxx
1 // commradio.hxx -- class to manage a comm radio instance
2 //
3 // Written by Adrian Musceac, started August 2011.
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19
20 #ifndef __cplusplus
21 # error This library requires C++
22 #endif
23
24 #include <simgear/compiler.h>
25 #include <simgear/structure/subsystem_mgr.hxx>
26
27 #include <Main/fg_props.hxx>
28
29 #include <simgear/math/sg_geodesy.hxx>
30 #include <simgear/debug/logstream.hxx>
31 #include <string>
32
33
34 using std::string;
35
36
37 class FGCommRadio : public SGSubsystem, public SGPropertyChangeListener
38 {
39 private:
40         bool isOperable() const
41                 { return _operable; }
42         bool _operable; ///< is the unit serviceable, on, powered, etc
43         
44         double _receiver_sensitivity;
45         double _transmitter_power;
46         double _antenna_gain;
47         
48         int _propagation_model; /// 0 none, 1 round Earth, 2 ITM
49         double ITM_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air)
50         
51 public:
52
53     FGCommRadio(SGPropertyNode *node);
54     ~FGCommRadio();
55
56     void init ();
57     void bind ();
58     void unbind ();
59     void update (double dt);
60     
61     void setFrequency(double freq, int radio);
62     double getFrequency(int radio);
63     void setTxPower(double txpower) { _transmitter_power = txpower; };
64     // transmission_type: 1 for ground to air, 2 for air to air, 3 for pilot to ground, 4 for pilot to air
65     void receiveText(SGGeod tx_pos, double freq, string text, int transmission_type);
66     void setPropagationModel(int model) { _propagation_model = model; };
67     
68 };
69
70