]> git.mxchange.org Git - flightgear.git/blob - utils/fgcom/fgcom.hxx
Fix stray back-button in Qt launcher
[flightgear.git] / utils / fgcom / fgcom.hxx
1 /*
2  * fgcom - VoIP-Client for the FlightGear-Radio-Infrastructure
3  *
4  * This program realizes the usage of the VoIP infractructure based
5  * on flight data which is send from FlightGear with an external
6  * protocol to this application.
7  *
8  * Clement de l'Hamaide - Jan 2014
9  * Re-writting of FGCom standalone
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of the
14  * License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24  * MA  02110-1301, USA.
25  *
26  */
27
28 #ifndef __FGCOM_H__
29 #define __FGCOM_H__
30
31 // avoid name clash with winerror.h
32 #define FGC_SUCCESS(__x__)              (__x__ == 0)
33 #define FGC_FAILED(__x__)               (__x__ < 0)
34
35 #ifdef _MSC_VER
36 #define snprintf _snprintf
37 #ifdef WIN64
38 typedef __int64 ssize_t;
39 #else
40 typedef int ssize_t;
41 #endif
42 #endif
43
44
45 #include <map>
46 #include <fstream>
47 #include <iostream>
48 #include <algorithm>
49 #include <stdlib.h>
50 #include <signal.h>
51 #include <stdio.h>
52 #include <string.h>
53 #include "version.h"
54
55 #ifndef FGCOM_VERSION
56 #ifdef FLIGHTGEAR_VERSION
57 #define FGCOM_VERSION FLIGHTGEAR_VERSION
58 #else
59 #define FGCOM_VERSION "unknown"
60 #endif
61 #endif
62
63 #define MAXBUFLEN 1024
64
65 enum Modes {
66     ATC,
67     PILOT,
68     OBS,
69     TEST
70 };
71
72 enum ActiveComm {
73     COM1,
74     COM2
75 };
76
77 struct Data
78 {
79     int     ptt;
80     float   com1;
81     float   com2;
82     double  lon;
83     double  lat;
84     double  alt;
85     float   outputVol;
86     float   silenceThd;
87     std::string callsign;
88 };
89
90 struct Airport
91 {
92     double      frequency;
93     double      latitude;
94     double      longitude;
95     double      distanceNm;
96     std::string icao;
97     std::string type;
98     std::string name;
99 };
100
101 // Internal functions
102 int         usage();
103 int         version();
104 void        quit(int state);
105 bool        isInRange(std::string icao, double acftLat, double acftLon, double acftAlt);
106 std::string computePhoneNumber(double freq, std::string icao, bool atis = false);
107 std::string getClosestAirportForFreq(double freq, double acftLat, double acftLon, double acftAlt);
108 std::multimap<int, Airport> getAirportsData();
109
110 // Library functions
111 bool lib_init();
112 bool lib_hangup();
113 bool lib_shutdown();
114 bool lib_call(std::string icao, double freq);
115 bool lib_directCall(std::string icao, double freq, std::string num);
116
117 int  lib_registration();
118 int  iaxc_callback(iaxc_event e);
119
120 void lib_setSilenceThreshold(double thd);
121 void lib_setCallerId(std::string callsign);
122 void lib_setVolume(double input, double output);
123
124 #endif