| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 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 |
|
| 19 |
|
| 20 |
class CTraffic : public CDBusObject |
| 21 |
{ |
| 22 |
public: |
| 23 |
|
| 24 |
CTraffic(); |
| 25 |
|
| 26 |
|
| 27 |
~CTraffic() override; |
| 28 |
|
| 29 |
|
| 30 |
static const std::string& InterfaceName(); |
| 31 |
|
| 32 |
|
| 33 |
static const std::string& ObjectPath(); |
| 34 |
|
| 35 |
|
| 36 |
bool initialize(); |
| 37 |
|
| 38 |
|
| 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 |
} |