Debian Codegraph @

src/Network/Swift/traffic.h

raw symbols SCIP
1 /*
2 * Traffic module for swift<->FG connection
3 * SPDX-FileCopyrightText: (C) 2019-2022 swift Project Community / Contributors (https://swift-project.org/)
4 * SPDX-FileCopyrightText: (C) 2019-2022 Lars Toenning <[email protected]>
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #pragma once
9
10 #include "SwiftAircraftManager.h"
11 #include "dbusobject.h"
12
13 #include <functional>
14 #include <utility>
15
16 namespace flightgear::swift {
17 /*!
18 * FGSwiftBus service object for traffic aircraft which is accessible through DBus
19 */
20 class CTraffic : public CDBusObject
21 {
22 public:
23 //! Constructor
24 CTraffic();
25
26 //! Destructor
27 ~CTraffic() override;
28
29 //! DBus interface name
30 static const std::string& InterfaceName();
31
32 //! DBus object path
33 static const std::string& ObjectPath();
34
35 //! Initialize the multiplayer planes rendering and return true if successful
36 bool initialize();
37
38 //! Perform generic processing
39 int process();
40
41 void emitSimFrame();
42
43 protected:
44 virtual void dbusDisconnectedHandler() override;
45
46 DBusHandlerResult dbusMessageHandler(const CDBusMessage& message) override;
47
48 private:
49 void emitPlaneAdded(const std::string& callsign);
50 void cleanup();
51
52 struct Plane {
53 void* id = nullptr;
54 std::string callsign;
55 char label[32]{};
56 };
57
58 bool m_emitSimFrame = true;
59 std::unique_ptr<FGSwiftAircraftManager> acm;
60 };
61 } // namespace flightgear::swift