Debian Codegraph @

src/MultiPlayer/cpdlc.hxx

raw symbols SCIP
1 //////////////////////////////////////////////////////////////////////
2 //
3 // cpdlc.hxx
4 //
5 // started November 2020
6 // Authors: Henning Stahlke, Michael Filhol
7 //
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.
12 //
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.
17 //
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.
21 //
22 // $Id$
23 //
24 //////////////////////////////////////////////////////////////////////
25
26 #ifndef CPDLC_H
27 #define CPDLC_H
28
29 #include <deque>
30 #include <string>
31
32 #include <simgear/compiler.h>
33 #include <simgear/props/props.hxx>
34 #include <simgear/io/raw_socket.hxx>
35 #include <simgear/io/sg_socket.hxx>
36 #include "mpirc.hxx"
37
38 enum CPDLCStatus {
39 CPDLC_OFFLINE,
40 CPDLC_CONNECTING,
41 CPDLC_ONLINE,
42
43 // private (not exposed to property tree) below this line:
44 CPDLC_WAIT_IRC_READY,
45 };
46
47 //
48 // CPDLCManager implements a ControllerPilotDataLinkConnection via an IRC connection
49 //
50 class CPDLCManager
51 {
52 public:
53 CPDLCManager(IRCConnection* irc);
54 ~CPDLCManager();
55
56 bool connect(const std::string authority);
57 void disconnect();
58 bool send(const std::string message);
59 void getMessage();
60 void update();
61
62 private:
63 IRCConnection *_irc;
64 std::string _data_authority {""};
65 std::deque<struct IRCMessage> _incoming_messages;
66 CPDLCStatus _status {CPDLC_OFFLINE};
67
68 SGPropertyNode *_pStatus {nullptr};
69 SGPropertyNode *_pDataAuthority {nullptr};
70 SGPropertyNode *_pMessage {nullptr};
71 SGPropertyNode *_pNewMessage {nullptr};
72
73 void processMessage(struct IRCMessage entry);
74 };
75
76 #endif