FlightGear next
cpdlc.hxx
Go to the documentation of this file.
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//
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
42
43// private (not exposed to property tree) below this line:
45};
46
47//
48// CPDLCManager implements a ControllerPilotDataLinkConnection via an IRC connection
49//
51{
52public:
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
62private:
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
bool connect(const std::string authority)
Definition cpdlc.cxx:69
~CPDLCManager()
Definition cpdlc.cxx:53
void getMessage()
Definition cpdlc.cxx:124
void update()
Definition cpdlc.cxx:141
bool send(const std::string message)
Definition cpdlc.cxx:115
CPDLCManager(IRCConnection *irc)
Definition cpdlc.cxx:38
void disconnect()
Definition cpdlc.cxx:104
CPDLCStatus
Definition cpdlc.hxx:38
@ CPDLC_OFFLINE
Definition cpdlc.hxx:39
@ CPDLC_CONNECTING
Definition cpdlc.hxx:40
@ CPDLC_ONLINE
Definition cpdlc.hxx:41
@ CPDLC_WAIT_IRC_READY
Definition cpdlc.hxx:44