4 // fgcom.hxx -- FGCom: Voice communication
6 // Written by Clement de l'Hamaide, started May 2013.
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <simgear/structure/subsystem_mgr.hxx>
23 #include <simgear/props/props.hxx>
24 #include <simgear/math/sg_geodesy.hxx>
26 class FGCom : public SGSubsystem, public SGPropertyChangeListener
33 virtual void unbind();
35 virtual void postinit();
36 virtual void update(double dt);
37 virtual void valueChanged(SGPropertyNode *prop);
38 virtual void shutdown();
39 void iaxTextEvent(struct iaxc_ev_text text);
44 SGPropertyNode_ptr _ptt0_node; // instrumentation/nav[0]/ptt
45 SGPropertyNode_ptr _comm0_node; // instrumentation/comm[0]/frequencies/selected-mhz
46 SGPropertyNode_ptr _comm1_node; // instrumentation/comm[1]/frequencies/selected-mhz
47 SGPropertyNode_ptr _test_node; // sim/fgcom/test
48 SGPropertyNode_ptr _text_node; // sim/fgcom/text
49 SGPropertyNode_ptr _server_node; // sim/fgcom/server
50 SGPropertyNode_ptr _enabled_node; // sim/fgcom/enabled
51 SGPropertyNode_ptr _version_node; // sim/version/flightgear
52 SGPropertyNode_ptr _micBoost_node; // sim/fgcom/mic-boost
53 SGPropertyNode_ptr _callsign_node; // sim/multiplay/callsign
54 SGPropertyNode_ptr _register_node; // sim/fgcom/register/enabled
55 SGPropertyNode_ptr _username_node; // sim/fgcom/register/username
56 SGPropertyNode_ptr _password_node; // sim/fgcom/register/password
57 SGPropertyNode_ptr _micLevel_node; // sim/fgcom/mic-level
58 SGPropertyNode_ptr _silenceThd_node; // sim/fgcom/silence-threshold
59 SGPropertyNode_ptr _speakerLevel_node; // sim/fgcom/speaker-level
60 SGPropertyNode_ptr _deviceID_node[4]; // sim/fgcom/device[n]/id
61 SGPropertyNode_ptr _deviceName_node[4]; // sim/fgcom/device[n]/name
62 SGPropertyNode_ptr _deviceInput_node[4]; // sim/fgcom/device[n]/available-input
63 SGPropertyNode_ptr _deviceOutput_node[4]; // sim/fgcom/device[n]/available-output
64 SGPropertyNode_ptr _selectedInput_node; // sim/fgcom/device-input
65 SGPropertyNode_ptr _selectedOutput_node; // sim/fgcom/device-output
66 SGPropertyNode_ptr _showMessages_node; // sim/fgcom/show-messages
86 std::string _callsign;
87 std::string _username;
88 std::string _password;
92 std::string computePhoneNumber(const double& freq, const std::string& icao) const;
93 std::string getAirportCode(const double& freq);
94 SGGeod getAirportPos(const double& freq) const;
95 bool isInRange(const double& freq) const;
97 void updateCall(bool& changed, int& callNo, double freqMHz);
98 void testMode(bool testMode);
102 #endif // of FG_FGCOM_HXX