mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::PhysicalQuantities::CSpeed"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="receiveComUnit">
|
<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"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CComSystem"/>
|
||||||
</method>
|
</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>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ int main(int argc, char *argv[])
|
|||||||
QString service; // service not needed
|
QString service; // service not needed
|
||||||
if (QDBusConnection::sessionBus().connect(
|
if (QDBusConnection::sessionBus().connect(
|
||||||
service, Testservice::ServicePath, Testservice::ServiceName,
|
service, Testservice::ServicePath, Testservice::ServiceName,
|
||||||
"sendStringMessage", pTestservice,
|
"sendStringMessage", pTestservice, SLOT(receiveStringMessage(const QString &)))) {
|
||||||
SLOT(receiveStringMessage(const QString &)))) {
|
|
||||||
qDebug() << "Connected object with bus sendStringMessage";
|
qDebug() << "Connected object with bus sendStringMessage";
|
||||||
} else {
|
} else {
|
||||||
qFatal("Cannot connect service with DBus");
|
qFatal("Cannot connect service with DBus");
|
||||||
@@ -100,12 +99,23 @@ int main(int argc, char *argv[])
|
|||||||
CSpeed speed(speedValue++, BlackMisc::PhysicalQuantities::CSpeedUnit::km_h());
|
CSpeed speed(speedValue++, BlackMisc::PhysicalQuantities::CSpeedUnit::km_h());
|
||||||
testserviceInterface.receiveSpeed(speed);
|
testserviceInterface.receiveSpeed(speed);
|
||||||
qDebug() << "Send speed via interface" << speed;
|
qDebug() << "Send speed via interface" << speed;
|
||||||
|
|
||||||
|
speed.switchUnit(CSpeedUnit::kts());
|
||||||
|
testserviceInterface.receiveSpeed(speed);
|
||||||
|
qDebug() << "Send speed via interface" << speed;
|
||||||
TestserviceTool::sleep(2500);
|
TestserviceTool::sleep(2500);
|
||||||
|
|
||||||
// Aviation
|
// Aviation
|
||||||
CComSystem comSystem = CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress(), CPhysicalQuantitiesConstants::FrequencyUnicom());
|
CComSystem comSystem = CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress(), CPhysicalQuantitiesConstants::FrequencyUnicom());
|
||||||
testserviceInterface.receiveComUnit(comSystem);
|
testserviceInterface.receiveComUnit(comSystem);
|
||||||
qDebug() << "Send COM via interface" << 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);
|
TestserviceTool::sleep(2500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ Starting: dbus-daemon.exe --session
|
|||||||
- blocks CMD (sometimes daemon continues to run when pressing CTRL/C)
|
- 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
|
- 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
|
Done automatically, but if required manually
|
||||||
Interface: qdbusxml2cpp blackbus.testservice.xml -p itestservice
|
Interface: qdbusxml2cpp blackbus.testservice.xml -p itestservice
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ void Testservice::receiveStringMessage(const QString &message)
|
|||||||
void Testservice::receiveVariant(const QDBusVariant &variant)
|
void Testservice::receiveVariant(const QDBusVariant &variant)
|
||||||
{
|
{
|
||||||
QVariant qv = variant.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;
|
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received COM:" << comUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Receivealtitude
|
||||||
|
*/
|
||||||
|
void Testservice::receiveAltitude(const BlackMisc::Aviation::CAltitude &altitude)
|
||||||
|
{
|
||||||
|
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received altitude:" << altitude;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -65,11 +65,18 @@ public slots:
|
|||||||
void receiveSpeed(const BlackMisc::PhysicalQuantities::CSpeed &speed);
|
void receiveSpeed(const BlackMisc::PhysicalQuantities::CSpeed &speed);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief receiveComUnit
|
* \brief Receive com unit
|
||||||
* \param comUnit
|
* \param comUnit
|
||||||
*/
|
*/
|
||||||
void receiveComUnit(const BlackMisc::Aviation::CComSystem &comUnit);
|
void receiveComUnit(const BlackMisc::Aviation::CComSystem &comUnit);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Receive altitude
|
||||||
|
* \param comUnit
|
||||||
|
*/
|
||||||
|
void receiveAltitude(const BlackMisc::Aviation::CAltitude &altitude);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const QString ServiceName;
|
static const QString ServiceName;
|
||||||
static const QString ServicePath;
|
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
|
|
||||||
@@ -50,5 +50,14 @@ bool CAltitude::operator !=(const CAltitude &otherAltitude)
|
|||||||
return !((*this) == otherAltitude);
|
return !((*this) == otherAltitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register metadata
|
||||||
|
*/
|
||||||
|
void CAltitude::registerMetadata()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<CAltitude>(typeid(CAltitude).name());
|
||||||
|
qDBusRegisterMetaType<CAltitude>();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -28,6 +28,24 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual QString stringForConverter() const;
|
virtual QString stringForConverter() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream to DBus <<
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
|
CLength::marshallToDbus(argument);
|
||||||
|
argument << this->m_msl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream from DBus >>
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
|
CLength::unmarshallFromDbus(argument);
|
||||||
|
argument >> this->m_msl;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -105,9 +123,16 @@ public:
|
|||||||
{
|
{
|
||||||
return this->m_msl;
|
return this->m_msl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Register metadata
|
||||||
|
*/
|
||||||
|
static void registerMetadata();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Aviation::CAltitude)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -19,17 +19,16 @@ namespace Aviation
|
|||||||
/*!
|
/*!
|
||||||
* \brief Base class for avionics
|
* \brief Base class for avionics
|
||||||
*/
|
*/
|
||||||
class CAvionicsBase : public CBaseStreamStringifier
|
class CAvionicsBase : public BlackMisc::CBaseStreamStringifier
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
QString m_name; //!< name of the unit
|
QString m_name; //!< name of the unit
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Default constructor
|
* \brief Constructor
|
||||||
*/
|
*/
|
||||||
CAvionicsBase(const QString &name) : m_name(name) {}
|
CAvionicsBase(const QString &name) : CBaseStreamStringifier(), m_name(name) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Are the set values valid / in range
|
* \brief Are the set values valid / in range
|
||||||
@@ -60,6 +59,22 @@ protected:
|
|||||||
return this->m_name == otherSystem.m_name;
|
return this->m_name == otherSystem.m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream to DBus <<
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
|
argument << this->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream from DBus >>
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
|
argument >> this->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual destructor
|
* \brief Virtual destructor
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef BLACKMISC_AVIOCOMUNIT_H
|
#ifndef BLACKMISC_AVIOCOMSYSTEM_H
|
||||||
#define BLACKMISC_AVIOCOMUNIT_H
|
#define BLACKMISC_AVIOCOMSYSTEM_H
|
||||||
#include "blackmisc/aviomodulator.h"
|
#include "blackmisc/aviomodulator.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -315,8 +315,10 @@ public:
|
|||||||
static bool tryGetCom3System(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
static bool tryGetCom3System(CComSystem &comSystem, BlackMisc::PhysicalQuantities::CFrequency activeFrequency, BlackMisc::PhysicalQuantities::CFrequency standbyFrequency = CModulator::FrequencyNotSet()) {
|
||||||
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom3(), activeFrequency, standbyFrequency);
|
return CComSystem::tryGetComSystem(comSystem, CModulator::NameCom3(), activeFrequency, standbyFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "blackmisc/aviomodulator.h"
|
#include "blackmisc/aviomodulator.h"
|
||||||
#include "blackmisc/aviocomsystem.h"
|
#include "blackmisc/aviocomsystem.h"
|
||||||
#include "blackmisc/avionavsystem.h"
|
#include "blackmisc/avionavsystem.h"
|
||||||
|
#include "blackmisc/avioadfsystem.h"
|
||||||
|
|
||||||
using BlackMisc::PhysicalQuantities::CFrequency;
|
using BlackMisc::PhysicalQuantities::CFrequency;
|
||||||
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
|
using BlackMisc::PhysicalQuantities::CFrequencyUnit;
|
||||||
@@ -25,12 +26,20 @@ template <class AVIO> void CModulator<AVIO>::toggleActiveStandby()
|
|||||||
this->m_frequencyStandby = a;
|
this->m_frequencyStandby = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register metadata
|
||||||
|
*/
|
||||||
|
template <class AVIO> void CModulator<AVIO>::registerMetadata()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<AVIO>(typeid(AVIO).name());
|
||||||
|
qDBusRegisterMetaType<AVIO>();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assigment operator =
|
* Assigment operator =
|
||||||
*/
|
*/
|
||||||
template <class AVIO> CModulator<AVIO>& CModulator<AVIO>::operator=(const CModulator<AVIO> &otherModulator)
|
template <class AVIO> CModulator<AVIO>& CModulator<AVIO>::operator=(const CModulator<AVIO> &otherModulator)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this == &otherModulator) return *this; // Same object?
|
if (this == &otherModulator) return *this; // Same object?
|
||||||
this->m_frequencyActive = otherModulator.m_frequencyActive;
|
this->m_frequencyActive = otherModulator.m_frequencyActive;
|
||||||
this->m_frequencyStandby = otherModulator.m_frequencyStandby;
|
this->m_frequencyStandby = otherModulator.m_frequencyStandby;
|
||||||
@@ -63,6 +72,8 @@ template <class AVIO> bool CModulator<AVIO>::operator !=(const CModulator<AVIO>
|
|||||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||||
template class CModulator<CComSystem>;
|
template class CModulator<CComSystem>;
|
||||||
template class CModulator<CNavSystem>;
|
template class CModulator<CNavSystem>;
|
||||||
|
template class CModulator<CAdfSystem>;
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#ifndef BLACKMISC_AVIOMODULATORUNIT_H
|
#ifndef BLACKMISC_AVIOMODULATORUNIT_H
|
||||||
#define BLACKMISC_AVIOMODULATORUNIT_H
|
#define BLACKMISC_AVIOMODULATORUNIT_H
|
||||||
|
|
||||||
#include <QDBusArgument>
|
#include <QDBusMetaType>
|
||||||
#include "blackmisc/aviobase.h"
|
#include "blackmisc/aviobase.h"
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
@@ -19,6 +19,33 @@ namespace Aviation
|
|||||||
*/
|
*/
|
||||||
template <class AVIO> class CModulator : public CAvionicsBase
|
template <class AVIO> class CModulator : public CAvionicsBase
|
||||||
{
|
{
|
||||||
|
/*!
|
||||||
|
* \brief Unmarshalling operator >>, DBus to object
|
||||||
|
* \param argument
|
||||||
|
* \param uc
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend const QDBusArgument &operator>>(const QDBusArgument &argument, AVIO &uc) {
|
||||||
|
// If I do not have the method here, DBus metasystem tries to stream against
|
||||||
|
// a container: inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &list)
|
||||||
|
// Once someone solves this, this methods should go and the CBaseStreamStringifier signature
|
||||||
|
// should be used
|
||||||
|
CBaseStreamStringifier &sf = uc;
|
||||||
|
return argument >> sf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Marshalling operator <<, object to DBus
|
||||||
|
* \param argument
|
||||||
|
* \param pq
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO &uc)
|
||||||
|
{
|
||||||
|
const CBaseStreamStringifier &sf = uc;
|
||||||
|
return argument << sf;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
|
BlackMisc::PhysicalQuantities::CFrequency m_frequencyActive; //!< active frequency
|
||||||
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
BlackMisc::PhysicalQuantities::CFrequency m_frequencyStandby; //!< standby frequency
|
||||||
@@ -207,6 +234,28 @@ protected:
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream to DBus <<
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
|
CAvionicsBase::marshallToDbus(argument);
|
||||||
|
argument << this->m_frequencyActive;
|
||||||
|
argument << this->m_frequencyStandby;
|
||||||
|
argument << this->m_digits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream from DBus >>
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
|
CAvionicsBase::unmarshallFromDbus(argument);
|
||||||
|
argument >> this->m_frequencyActive;
|
||||||
|
argument >> this->m_frequencyStandby;
|
||||||
|
argument >> this->m_digits;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual destructor
|
* \brief Virtual destructor
|
||||||
@@ -262,47 +311,10 @@ public:
|
|||||||
this->m_frequencyStandby = frequency;
|
this->m_frequencyStandby = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Unmarshalling operator >>, DBus to object
|
|
||||||
* \param argument
|
|
||||||
* \param aviationUnit
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, AVIO &aviationUnit) {
|
|
||||||
argument.beginStructure();
|
|
||||||
argument >> aviationUnit.m_frequencyActive;
|
|
||||||
argument >> aviationUnit.m_frequencyStandby;
|
|
||||||
argument >> aviationUnit.m_digits;
|
|
||||||
argument >> aviationUnit.m_name;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Marshalling operator <<, object to DBus
|
|
||||||
* \param argument
|
|
||||||
* \param aviationUnit
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const AVIO& aviationUnit)
|
|
||||||
{
|
|
||||||
argument.beginStructure();
|
|
||||||
argument << aviationUnit.m_frequencyActive;
|
|
||||||
argument << aviationUnit.m_frequencyStandby;
|
|
||||||
argument << aviationUnit.m_digits;
|
|
||||||
argument << aviationUnit.m_name;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register metadata
|
* \brief Register metadata
|
||||||
*/
|
*/
|
||||||
static void registerMetadata()
|
static void registerMetadata();
|
||||||
{
|
|
||||||
qRegisterMetaType<AVIO>(typeid(AVIO).name());
|
|
||||||
qDBusRegisterMetaType<AVIO>();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define BLACKMISC_BASESTREAMSTRINGIFIER_H
|
#define BLACKMISC_BASESTREAMSTRINGIFIER_H
|
||||||
|
|
||||||
#include "blackmisc/debug.h"
|
#include "blackmisc/debug.h"
|
||||||
|
#include <QDBusMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
@@ -23,10 +24,10 @@ class CBaseStreamStringifier
|
|||||||
*/
|
*/
|
||||||
friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc)
|
friend QDebug operator<<(QDebug debug, const CBaseStreamStringifier &uc)
|
||||||
{
|
{
|
||||||
const CBaseStreamStringifier &sf = uc; // allows to access protected method
|
debug << uc.stringForStreaming();
|
||||||
debug << sf.stringForStreaming();
|
|
||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
// msvc2010: friend QDebug &operator<<(QDebug &debug, const CBaseStreamStringifier &uc)
|
// msvc2010: friend QDebug &operator<<(QDebug &debug, const CBaseStreamStringifier &uc)
|
||||||
// MinGW: No reference
|
// MinGW: No reference
|
||||||
|
|
||||||
@@ -38,8 +39,7 @@ class CBaseStreamStringifier
|
|||||||
*/
|
*/
|
||||||
friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc)
|
friend QTextStream &operator<<(QTextStream &textStream, const CBaseStreamStringifier &uc)
|
||||||
{
|
{
|
||||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
textStream << uc.stringForStreaming();
|
||||||
textStream << sf.stringForStreaming();
|
|
||||||
return textStream;
|
return textStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +62,7 @@ class CBaseStreamStringifier
|
|||||||
*/
|
*/
|
||||||
friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc)
|
friend QDataStream &operator<<(QDataStream &stream, const CBaseStreamStringifier &uc)
|
||||||
{
|
{
|
||||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
stream << uc.stringForStreaming();
|
||||||
stream << sf.stringForStreaming();
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,8 +74,7 @@ class CBaseStreamStringifier
|
|||||||
*/
|
*/
|
||||||
friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc)
|
friend CLogMessage operator<<(CLogMessage log, const CBaseStreamStringifier &uc)
|
||||||
{
|
{
|
||||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
log << uc.stringForStreaming();
|
||||||
log << sf.stringForStreaming();
|
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,12 +86,39 @@ class CBaseStreamStringifier
|
|||||||
*/
|
*/
|
||||||
friend std::ostream &operator<<(std::ostream &ostr, const CBaseStreamStringifier &uc)
|
friend std::ostream &operator<<(std::ostream &ostr, const CBaseStreamStringifier &uc)
|
||||||
{
|
{
|
||||||
const CBaseStreamStringifier &sf = uc; // allows to acces protected method
|
ostr << uc.stringForStreaming().toStdString();
|
||||||
ostr << sf.stringForStreaming().toStdString();
|
|
||||||
return ostr;
|
return ostr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Unmarshalling operator >>, DBus to object
|
||||||
|
* \param argument
|
||||||
|
* \param uc
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CBaseStreamStringifier &uc) {
|
||||||
|
argument.beginStructure();
|
||||||
|
uc.unmarshallFromDbus(argument);
|
||||||
|
argument.endStructure();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Marshalling operator <<, object to DBus
|
||||||
|
* \param argument
|
||||||
|
* \param pq
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
friend QDBusArgument &operator<<(QDBusArgument &argument, const CBaseStreamStringifier &uc)
|
||||||
|
{
|
||||||
|
argument.beginStructure();
|
||||||
|
uc.marshallToDbus(argument);
|
||||||
|
argument.endStructure();
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual destructor
|
* \brief Virtual destructor
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +134,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/*!
|
||||||
|
* \brief Default constructor
|
||||||
|
*/
|
||||||
|
CBaseStreamStringifier() {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief String for streaming operators
|
* \brief String for streaming operators
|
||||||
@@ -126,6 +155,18 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual QString stringForConverter() const = 0;
|
virtual QString stringForConverter() const = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream to DBus
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void marshallToDbus(QDBusArgument &) const { }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream from DBus
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void unmarshallFromDbus(const QDBusArgument &) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Copy assignment operator.
|
* \brief Copy assignment operator.
|
||||||
* This is protected in order to forbid slicing an instance of one derived
|
* This is protected in order to forbid slicing an instance of one derived
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ void BlackMisc::PhysicalQuantities::registerMetadata()
|
|||||||
void BlackMisc::Aviation::registerMetadata()
|
void BlackMisc::Aviation::registerMetadata()
|
||||||
{
|
{
|
||||||
CComSystem::registerMetadata();
|
CComSystem::registerMetadata();
|
||||||
CAdfSystem::registerMetadata();
|
|
||||||
CNavSystem::registerMetadata();
|
CNavSystem::registerMetadata();
|
||||||
|
CAdfSystem::registerMetadata();
|
||||||
|
CAltitude::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -50,6 +50,24 @@ protected:
|
|||||||
return this->m_name;
|
return this->m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream to DBus
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
|
argument << this->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stream from DBus
|
||||||
|
* \param argument
|
||||||
|
*/
|
||||||
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
|
QString name;
|
||||||
|
argument >> name;
|
||||||
|
(*this) = CMeasurementPrefix::fromPrefixName(name);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief Copy constructor
|
* \brief Copy constructor
|
||||||
@@ -224,6 +242,40 @@ public:
|
|||||||
return milli;
|
return milli;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief All prefixes
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const QList<CMeasurementPrefix> &prefixes()
|
||||||
|
{
|
||||||
|
static QList<CMeasurementPrefix> prefixes;
|
||||||
|
prefixes.append(CMeasurementPrefix::c());
|
||||||
|
prefixes.append(CMeasurementPrefix::G());
|
||||||
|
prefixes.append(CMeasurementPrefix::h());
|
||||||
|
prefixes.append(CMeasurementPrefix::k());
|
||||||
|
prefixes.append(CMeasurementPrefix::M());
|
||||||
|
prefixes.append(CMeasurementPrefix::m());
|
||||||
|
prefixes.append(CMeasurementPrefix::None());
|
||||||
|
prefixes.append(CMeasurementPrefix::One());
|
||||||
|
return prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Prefix from name
|
||||||
|
* \param prefixName must be valid!
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const CMeasurementPrefix &fromPrefixName(const QString &prefixName) {
|
||||||
|
QList<CMeasurementPrefix> prefixes = CMeasurementPrefix::prefixes();
|
||||||
|
// read only, avoid deep copy
|
||||||
|
for (int i = 0; i < prefixes.size(); ++i) {
|
||||||
|
if (prefixes.at(i).getName() == prefixName) return (prefixes.at(i));
|
||||||
|
}
|
||||||
|
qFatal("Illegal unit name");
|
||||||
|
return CMeasurementPrefix::None(); // just suppress "not all control paths return a value"
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
@@ -243,16 +295,11 @@ protected:
|
|||||||
typedef double(*UnitConverter)(const CMeasurementUnit &, double);
|
typedef double(*UnitConverter)(const CMeasurementUnit &, double);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get unit from DBus argument
|
* \brief Stream to DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
static QString unitNameUnmarshalling(const QDBusArgument &argument) {
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
QString type;
|
argument << this->m_unitName;
|
||||||
argument.beginStructure();
|
|
||||||
argument >> type;
|
|
||||||
argument.endStructure();
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -520,21 +567,6 @@ public:
|
|||||||
return abs(checkValue) <= this->m_epsilon;
|
return abs(checkValue) <= this->m_epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* Marshalling (to DBus) operator, unmarshalling to be found in specialized classes and
|
|
||||||
* mapping back to static object
|
|
||||||
* \brief Marshalling (to DBus) operator <<
|
|
||||||
* \param argument
|
|
||||||
* \param unit
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const CMeasurementUnit& unit) {
|
|
||||||
argument.beginStructure();
|
|
||||||
argument << unit.m_unitName;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// -- static
|
// -- static
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|||||||
@@ -422,40 +422,29 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, DBus to object
|
* \brief Stream to DBus <<
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param pq
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, PQ &pq) {
|
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||||
argument.beginStructure();
|
argument << this->m_unitValueD;
|
||||||
argument >> pq.m_unitValueD;
|
argument << this->m_unitValueI;
|
||||||
argument >> pq.m_unitValueI;
|
argument << this->m_convertedSiUnitValueD;
|
||||||
argument >> pq.m_convertedSiUnitValueD;
|
argument << this->m_isIntegerBaseValue;
|
||||||
argument >> pq.m_isIntegerBaseValue;
|
argument << this->m_unit;
|
||||||
argument >> pq.m_unit;
|
argument << this->m_conversionSiUnit;
|
||||||
argument >> pq.m_conversionSiUnit;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Marshalling operator <<, object to DBus
|
* \brief Stream from DBus >>
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param pq
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const PQ& pq)
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
{
|
argument >> this->m_unitValueD;
|
||||||
argument.beginStructure();
|
argument >> this->m_unitValueI;
|
||||||
argument << pq.m_unitValueD;
|
argument >> this->m_convertedSiUnitValueD;
|
||||||
argument << pq.m_unitValueI;
|
argument >> this->m_isIntegerBaseValue;
|
||||||
argument << pq.m_convertedSiUnitValueD;
|
argument >> this->m_unit;
|
||||||
argument << pq.m_isIntegerBaseValue;
|
argument >> this->m_conversionSiUnit;
|
||||||
argument << pq.m_unit;
|
|
||||||
argument << pq.m_conversionSiUnit;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -160,16 +160,15 @@ public:
|
|||||||
return CLengthUnit::m(); // just suppress "not all control paths return a value"
|
return CLengthUnit::m(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CLengthUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CLengthUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CLengthUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CLengthUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CLengthUnit)
|
||||||
@@ -289,16 +288,15 @@ public:
|
|||||||
return CAngleUnit::rad(); // just suppress "not all control paths return a value"
|
return CAngleUnit::rad(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CAngleUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CAngleUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CAngleUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAngleUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAngleUnit)
|
||||||
@@ -406,16 +404,15 @@ public:
|
|||||||
return CFrequencyUnit::Hz(); // just suppress "not all control paths return a value"
|
return CFrequencyUnit::Hz(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CFrequencyUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CFrequencyUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CFrequencyUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CFrequencyUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CFrequencyUnit)
|
||||||
@@ -523,16 +520,15 @@ public:
|
|||||||
return CMassUnit::kg(); // just suppress "not all control paths return a value"
|
return CMassUnit::kg(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CMassUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CMassUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CMassUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -673,16 +669,15 @@ public:
|
|||||||
return CPressureUnit::Pa(); // just suppress "not all control paths return a value"
|
return CPressureUnit::Pa(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CPressureUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CPressureUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CPressureUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CPressureUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CPressureUnit)
|
||||||
@@ -805,16 +800,15 @@ public:
|
|||||||
return CTemperatureUnit::K(); // just suppress "not all control paths return a value"
|
return CTemperatureUnit::K(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CTemperatureUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CTemperatureUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CTemperatureUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTemperatureUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTemperatureUnit)
|
||||||
@@ -942,16 +936,15 @@ public:
|
|||||||
return CSpeedUnit::m_s(); // just suppress "not all control paths return a value"
|
return CSpeedUnit::m_s(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CSpeedUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CSpeedUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CSpeedUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CSpeedUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CSpeedUnit)
|
||||||
@@ -1068,16 +1061,15 @@ public:
|
|||||||
return CTimeUnit::s(); // just suppress "not all control paths return a value"
|
return CTimeUnit::s(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CTimeUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CTimeUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CTimeUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTimeUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CTimeUnit)
|
||||||
@@ -1161,16 +1153,15 @@ public:
|
|||||||
return CAccelerationUnit::m_s2(); // just suppress "not all control paths return a value"
|
return CAccelerationUnit::m_s2(); // just suppress "not all control paths return a value"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
/*!
|
/*!
|
||||||
* \brief Unmarshalling operator >>, map back to concrete static object
|
* \brief Stream from DBus
|
||||||
* \param argument
|
* \param argument
|
||||||
* \param dummy
|
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, CAccelerationUnit &unit) {
|
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||||
QString unitName = CMeasurementUnit::unitNameUnmarshalling(argument);
|
QString unitName;
|
||||||
unit = CAccelerationUnit::fromUnitName(unitName);
|
argument >> unitName;
|
||||||
return argument;
|
(*this) = CAccelerationUnit::fromUnitName(unitName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAccelerationUnit)
|
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAccelerationUnit)
|
||||||
|
|||||||
Reference in New Issue
Block a user