1
0
Fork 0

Maintenance: plugin

Minor whitespace adjustments.
This commit is contained in:
Scott Giese 2021-02-26 21:03:11 -06:00
parent 82c34590f6
commit a3c4dcf522

View file

@ -1,5 +1,5 @@
// plugin.cpp
//
// plugin.cpp
//
// Copyright (C) 2019 - swift Project Community / Contributors (http://swift-project.org/)
// Adapted to Flightgear by Lars Toenning <dev@ltoenning.de>
//
@ -20,13 +20,14 @@
#include "plugin.h"
#include "service.h"
#include "traffic.h"
#include <simgear/structure/event_mgr.hxx>
#include <simgear/structure/commands.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
#include <cmath>
#include <functional>
#include <iostream>
#include <simgear/structure/commands.hxx>
#include <simgear/structure/event_mgr.hxx>
#include <thread>
namespace {
@ -44,8 +45,7 @@ CPlugin::CPlugin()
CPlugin::~CPlugin()
{
if(m_dbusConnection)
{
if (m_dbusConnection) {
m_dbusConnection->close();
}
m_shouldStop = true;
@ -54,19 +54,18 @@ CPlugin::~CPlugin()
void CPlugin::startServer()
{
m_service.reset(new CService());
m_traffic.reset(new CTraffic());
m_dbusP2PServer.reset(new CDBusServer());
std::string ip = fgGetString("/sim/swift/adress", "127.0.0.1");
std::string port = fgGetString("/sim/swift/port", "45003");
std::string ip = fgGetString("/sim/swift/adress", "127.0.0.1");
std::string port = fgGetString("/sim/swift/port", "45003");
std::string listenAddress = "tcp:host=" + ip + ",port=" + port;
if (! m_dbusP2PServer->listen(listenAddress))
{
if (!m_dbusP2PServer->listen(listenAddress)) {
m_service->addTextMessage("FGSwiftBus startup failed!");
return;
}
m_dbusP2PServer->setDispatcher(&m_dbusDispatcher);
m_dbusP2PServer->setNewConnectionFunc([this](const std::shared_ptr<CDBusConnection>& conn) {
m_dbusConnection = conn;
@ -77,7 +76,7 @@ void CPlugin::startServer()
m_traffic->registerDBusObjectPath(m_traffic->InterfaceName(), m_traffic->ObjectPath());
});
SG_LOG(SG_NETWORK,SG_INFO,"FGSwiftBus started");
SG_LOG(SG_NETWORK, SG_INFO, "FGSwiftBus started");
}
float CPlugin::startServerDeferred(float, float, int, void* refcon)
@ -87,6 +86,7 @@ float CPlugin::startServerDeferred(float, float, int, void* refcon)
plugin->startServer();
plugin->m_isRunning = true;
}
return 0;
}