mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Shifted DBus operators to CBaseStreamStringifier, much easier to provide streaming - especially for derived classes.
Still required but unwanted overloaded DBus operator in aviomodulator.h - no compilation without them. Need to be removed. Enabled more classes for DBus.
This commit is contained in:
@@ -15,8 +15,12 @@
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::PhysicalQuantities::CSpeed"/>
|
||||
</method>
|
||||
<method name="receiveComUnit">
|
||||
<arg name="comUnit" type="((didb(s)(s))(didb(s)(s))i)" direction="in"/>
|
||||
<arg name="comUnit" type="(s(didb(s)(s))(didb(s)(s))i)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CComSystem"/>
|
||||
</method>
|
||||
<method name="receiveAltitude">
|
||||
<arg name="altitude" type="(didb(s)(s)b)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CAltitude"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
|
||||
@@ -60,8 +60,7 @@ int main(int argc, char *argv[])
|
||||
QString service; // service not needed
|
||||
if (QDBusConnection::sessionBus().connect(
|
||||
service, Testservice::ServicePath, Testservice::ServiceName,
|
||||
"sendStringMessage", pTestservice,
|
||||
SLOT(receiveStringMessage(const QString &)))) {
|
||||
"sendStringMessage", pTestservice, SLOT(receiveStringMessage(const QString &)))) {
|
||||
qDebug() << "Connected object with bus sendStringMessage";
|
||||
} else {
|
||||
qFatal("Cannot connect service with DBus");
|
||||
@@ -100,12 +99,23 @@ int main(int argc, char *argv[])
|
||||
CSpeed speed(speedValue++, BlackMisc::PhysicalQuantities::CSpeedUnit::km_h());
|
||||
testserviceInterface.receiveSpeed(speed);
|
||||
qDebug() << "Send speed via interface" << speed;
|
||||
|
||||
speed.switchUnit(CSpeedUnit::kts());
|
||||
testserviceInterface.receiveSpeed(speed);
|
||||
qDebug() << "Send speed via interface" << speed;
|
||||
TestserviceTool::sleep(2500);
|
||||
|
||||
// Aviation
|
||||
CComSystem comSystem = CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress(), CPhysicalQuantitiesConstants::FrequencyUnicom());
|
||||
testserviceInterface.receiveComUnit(comSystem);
|
||||
qDebug() << "Send COM via interface" << comSystem;
|
||||
|
||||
CAltitude al(1000, true, CLengthUnit::ft());
|
||||
QDBusVariant qv(QVariant::fromValue(al));
|
||||
testserviceInterface.receiveVariant(qv);
|
||||
testserviceInterface.receiveAltitude(al);
|
||||
qDebug() << "Send altitude via interface" << al;
|
||||
|
||||
TestserviceTool::sleep(2500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ Starting: dbus-daemon.exe --session
|
||||
- blocks CMD (sometimes daemon continues to run when pressing CTRL/C)
|
||||
- does not start without directory session.d, i.e. ..\Qt\Qt5.1.0DBus\qtbase\etc\dbus-1\session.d
|
||||
|
||||
qdbuscpp2xml testservice.h -x H:\Projects\QtBuilds\build-client-Qt_5_1_0_VATSIM_qmake_Microsoft_Visual_C_Compiler_10_0_x86_2-Release\bin\blackmisc_cpp2xml.dll -o BlackMiscTest.Testservice.xml
|
||||
qdbuscpp2xml testservice.h -x blackmisc_cpp2xml.dll -o BlackMiscTest.Testservice.xml
|
||||
Set search path for plugins: env.var. QT_PLUGIN_PATH
|
||||
|
||||
Done automatically, but if required manually
|
||||
Interface: qdbusxml2cpp blackbus.testservice.xml -p itestservice
|
||||
|
||||
@@ -33,7 +33,8 @@ void Testservice::receiveStringMessage(const QString &message)
|
||||
void Testservice::receiveVariant(const QDBusVariant &variant)
|
||||
{
|
||||
QVariant qv = variant.variant();
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received variant:" << qv;
|
||||
BlackMisc::Aviation::CAltitude altitude = qv.value<BlackMisc::Aviation::CAltitude>();
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received variant:" << altitude;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -52,5 +53,13 @@ void Testservice::receiveComUnit(const BlackMisc::Aviation::CComSystem &comUnit)
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received COM:" << comUnit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receivealtitude
|
||||
*/
|
||||
void Testservice::receiveAltitude(const BlackMisc::Aviation::CAltitude &altitude)
|
||||
{
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received altitude:" << altitude;
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -65,11 +65,18 @@ public slots:
|
||||
void receiveSpeed(const BlackMisc::PhysicalQuantities::CSpeed &speed);
|
||||
|
||||
/*!
|
||||
* \brief receiveComUnit
|
||||
* \brief Receive com unit
|
||||
* \param comUnit
|
||||
*/
|
||||
void receiveComUnit(const BlackMisc::Aviation::CComSystem &comUnit);
|
||||
|
||||
/*!
|
||||
* \brief Receive altitude
|
||||
* \param comUnit
|
||||
*/
|
||||
void receiveAltitude(const BlackMisc::Aviation::CAltitude &altitude);
|
||||
|
||||
|
||||
public:
|
||||
static const QString ServiceName;
|
||||
static const QString ServicePath;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
QT += core dbus
|
||||
|
||||
TARGET = sample_quantities_avionics_xmlplugin
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += plugin
|
||||
|
||||
DEPENDPATH += . ../../src/blackmisc
|
||||
INCLUDEPATH += . ../../src
|
||||
|
||||
LIBS += -L../../lib -lblackmisc \
|
||||
../blackmiscquantities_dbus/release/dummy.obj \
|
||||
../blackmiscquantities_dbus/release/moc_dummy.obj \
|
||||
../blackmiscquantities_dbus/release/dummynoq.obj
|
||||
|
||||
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \
|
||||
../../samples/blackmiscquantities_dbus/release/dummy.obj
|
||||
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
||||
../../samples/blackmiscquantities_dbus/release/dummy.obj
|
||||
|
||||
DESTDIR = ../../bin
|
||||
|
||||
HEADERS += *.h
|
||||
SOURCES += *.cpp
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "sampleplugin.h"
|
||||
|
||||
|
||||
void CXmlSamplePlugin::registerMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<BlackMiscTest::Dummy>("BlackMiscTest::Dummy");
|
||||
qDBusRegisterMetaType<BlackMiscTest::Dummy>();
|
||||
|
||||
qRegisterMetaType<BlackMiscTest::DummyNoQ>("BlackMiscTest::DummyNoQ");
|
||||
qDBusRegisterMetaType<BlackMiscTest::DummyNoQ>();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef SAMPLEPLUGIN_H
|
||||
#define SAMPLEPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QDBusMetaType>
|
||||
#include <QMetaType>
|
||||
#include "../blackmiscquantities_dbus/dummy.h"
|
||||
#include "../blackmiscquantities_dbus/dummynoq.h"
|
||||
|
||||
class CXmlSamplePlugin : public QObject, public QDBusCpp2XmlPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDBusCpp2XmlPlugin)
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.DBus.Cpp2XmlPlugin")
|
||||
|
||||
public:
|
||||
virtual void registerMetaTypes();
|
||||
};
|
||||
|
||||
#endif // SAMPLEPLUGIN_H
|
||||
Reference in New Issue
Block a user