Files
pilotclient/samples/dbusserver/main.cpp
Roland Winklmeier efacac77eb refs #42
- Added DBus handler interface
- Added more complex flow to both samples
- Added custom class to be transfered
2013-08-07 01:32:13 +02:00

49 lines
1.4 KiB
C++

#include <QCoreApplication>
#include <QDebug>
#include "blackcore/dbus_server.h"
#include "aircraft_manager_handler.h"
#include "aircraft_manager.h"
#include "atc_manager_handler.h"
#include "atc_manager.h"
#include "fsd_client.h"
#include "fsd_client_handler.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
CRemoteAircraft::registerMetaType();
BlackCore::CDBusServer server("tcp:host=127.0.0.1,port=45000");
// Setting up our objects
CAircraftManager aircraftManager;
aircraftManager.addAircraft(CRemoteAircraft("DLH456"));
aircraftManager.addAircraft(CRemoteAircraft("DLH555"));
aircraftManager.addAircraft(CRemoteAircraft("DLH666"));
CAtcManager atcManager;
atcManager.addATC("EDDM_N_TWR");
atcManager.addATC("KJFK_GND");
atcManager.addATC("LOWW_CTR");
CFsdClient fsdclient;
// Setting up the handler to expose the objects via DBus
CAircraftManagerHandler aircraftManagerHandler(&aircraftManager);
CAtcManagerHandler atcManagerHandler(&atcManager);
CFsdClientHandler fsdClientHandler (&fsdclient);
// Pass the DBus server to the handlers. This registers also
// the handler in the DBus server and makes it available
// via the interface.
aircraftManagerHandler.setDBusServer(&server);
atcManagerHandler.setDBusServer(&server);
fsdClientHandler.setDBusServer(&server);
return a.exec();
}