FlightGear next
swift_connection.hxx
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: (C) 2019-2022 swift Project Community / Contributors (https://swift-project.org/)
3 * SPDX-FileCopyrightText: (C) 2019-2022 Lars Toenning <dev@ltoenning.de>
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#pragma once
7
8#include <memory>
9
10#include <simgear/props/props.hxx>
11#include <simgear/structure/subsystem_mgr.hxx>
12
13#include "dbusconnection.h"
14#include "dbusdispatcher.h"
15#include "dbusserver.h"
16#include "plugin.h"
17
18namespace flightgear::swift {
19
20class SwiftConnection : public SGSubsystem
21{
22public:
23 SwiftConnection() = default;
25
26 // Subsystem API.
27 void init() override;
28 void reinit() override;
29 void shutdown() override;
30 void update(double delta_time_sec) override;
31
32 // Subsystem identification.
33 static const char* staticSubsystemClassId() { return "swift"; }
34
35private:
36 bool startServer(const SGPropertyNode* arg, SGPropertyNode* root);
37 bool stopServer(const SGPropertyNode* arg, SGPropertyNode* root);
38
39 // non-virtual shutdown function to avoid calling a virtual function from dtor for proper cleanup
40 void shutdownSwift();
41
42 std::unique_ptr<CPlugin> m_plugin;
43 bool m_initialized = false;
44};
45} // namespace flightgear::swift
static const char * staticSubsystemClassId()
void update(double delta_time_sec) override