More DBus tests

This commit is contained in:
Klaus Basan
2013-08-06 13:56:15 +02:00
parent 62591a750f
commit e6e6dea4cd
6 changed files with 56 additions and 2 deletions

View File

@@ -23,7 +23,7 @@
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CAltitude"/>
</method>
<method name="receiveMatrix">
<arg name="matrix" type="(ddddddddd)" direction="in"/>
<arg name="matrix" type="(adddddddddd)" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Math::CMatrix3x3"/>
</method>
<method name="receiveList">
@@ -42,5 +42,12 @@
<arg name="track" type="(didb(s)(s)b)" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CTrack"/>
</method>
<method name="receiveLength">
<arg name="length" type="(didb(s)(s))" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::PhysicalQuantities::CLength"/>
</method>
<method name="receiveLengths">
<arg name="lengths" type="av" direction="in"/>
</method>
</interface>
</node>

View File

@@ -135,6 +135,20 @@ int main(int argc, char *argv[])
testserviceInterface.receiveTrack(track);
qDebug() << "Send track via interface" << track;
CLength len(33, CLengthUnit::m());
testserviceInterface.receiveLength(len);
qDebug() << "Send length via interface" << len;
CAltitude alt(33, true, CLengthUnit::m());
testserviceInterface.receiveLength(alt);
qDebug() << "Send altitude via interface" << alt;
QVariantList lengths;
lengths << QVariant::fromValue(len);
lengths << QVariant::fromValue(alt);
testserviceInterface.receiveLengths(lengths);
qDebug() << "Send lengths via interface";
TestserviceTool::sleep(2500);
// Math

View File

@@ -101,4 +101,24 @@ void Testservice::receiveTrack(const BlackMisc::Aviation::CTrack &track)
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received track:" << track;
}
/*
* Receive a length
*/
void Testservice::receiveLength(const BlackMisc::PhysicalQuantities::CLength &length)
{
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received length:" << length;
}
/*
* Receive lengths
*/
void Testservice::receiveLengths(const QVariantList &lengths)
{
BlackMisc::PhysicalQuantities::CLength l;
foreach(QVariant lv, lengths) {
l = lv.value<BlackMisc::PhysicalQuantities::CLength>();
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received in list:" << l;
}
}
} // namespace

View File

@@ -106,6 +106,18 @@ public slots:
*/
void receiveTrack(const BlackMisc::Aviation::CTrack &track);
/*!
* \brief Receive a length
* \param length
*/
void receiveLength(const BlackMisc::PhysicalQuantities::CLength &length);
/*!
* \brief Receive lengths
* \param length
*/
void receiveLengths(const QVariantList &lengths);
public:
static const QString ServiceName;
static const QString ServicePath;

View File

@@ -24,7 +24,6 @@ namespace PhysicalQuantities
* \brief Typical prefixes (multipliers) such as kilo, mega, hecto.
* See <a href="http://www.poynton.com/notes/units/index.html">here</a> for an overview.
* Use the static values such CMeasurementMultiplier::k() as to specify values.
* \author KWB
*/
class CMeasurementPrefix : public CBaseStreamStringifier
{

View File

@@ -458,8 +458,10 @@ public:
{
qRegisterMetaType<MU>(typeid(MU).name());
qDBusRegisterMetaType<MU>();
qDBusRegisterMetaType<QList<MU>>();
qRegisterMetaType<PQ>(typeid(PQ).name());
qDBusRegisterMetaType<PQ>();
qDBusRegisterMetaType<QList<PQ>>();
}
};