mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #42:
- Added CDBusServer into Blackcore library - Added DBus server and client sample
This commit is contained in:
33
samples/dbusserver/planemanagerhandler.cpp
Normal file
33
samples/dbusserver/planemanagerhandler.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <QDebug>
|
||||
#include "planemanagerhandler.h"
|
||||
|
||||
// It is really IMPORTANT to include this header.
|
||||
// Otherwise it won't be generated by qmake and the
|
||||
// project can't be build
|
||||
#include "planemanager_adaptor.h"
|
||||
|
||||
CPlaneManagerHandler::CPlaneManagerHandler(QObject *parent) :
|
||||
QObject(parent), m_dbusserver(0), m_parent(0)
|
||||
{
|
||||
m_dbusPath = "/PlaneManager";
|
||||
m_parent = qobject_cast<CPlaneManager *>(parent);
|
||||
|
||||
new PlaneManagerAdaptor(this);
|
||||
|
||||
}
|
||||
|
||||
void CPlaneManagerHandler::setDBusServer(BlackCore::CDBusServer *dbusServer)
|
||||
{
|
||||
m_dbusserver = dbusServer;
|
||||
|
||||
// We add ourselves to the DBus server. This is needed, because
|
||||
// DBus has to register all exposed objects for each new connection
|
||||
if (m_dbusserver)
|
||||
m_dbusserver->addObject(m_dbusPath, this);
|
||||
}
|
||||
|
||||
QStringList CPlaneManagerHandler::pilotList() const
|
||||
{
|
||||
qDebug() << "Somebody requested the list of pilots. Here you go...";
|
||||
return m_parent->pilotList();
|
||||
}
|
||||
Reference in New Issue
Block a user