/* Copyright (C) 2013 * swift Project Community / Contributors * * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, * including this file, may be copied, modified, propagated, or distributed except according to the terms * contained in the LICENSE file. */ //! \file #ifndef BLACKMISC_TEST_TESTSERVICEINTERFACE_H #define BLACKMISC_TEST_TESTSERVICEINTERFACE_H #include "blackmisc/blackmiscexport.h" #include "blackmisc/aviation/aircrafticaocode.h" #include "blackmisc/aviation/aircraftsituation.h" #include "blackmisc/aviation/airportlist.h" #include "blackmisc/aviation/altitude.h" #include "blackmisc/aviation/atcstation.h" #include "blackmisc/aviation/atcstationlist.h" #include "blackmisc/aviation/callsign.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/aviation/track.h" #include "blackmisc/aviation/transponder.h" #include "blackmisc/geo/coordinategeodetic.h" #include "blackmisc/network/client.h" #include "blackmisc/network/clientlist.h" #include "blackmisc/network/user.h" #include "blackmisc/pq/length.h" #include "blackmisc/pq/speed.h" #include "blackmisc/propertyindex.h" #include "blackmisc/propertyindexvariantmap.h" #include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h" #include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/simulation/simulatedaircraftlist.h" #include "blackmisc/simulation/simulatorplugininfo.h" #include "blackmisc/variantlist.h" #include #include #include #include #include #include #include #include #include class QDBusConnection; class QDBusObjectPath; class QDBusVariant; namespace BlackMisc { class CVariant; namespace Simulation { namespace FsCommon { class CAircraftCfgEntriesList; } } } namespace BlackMisc { namespace Test { //! Proxy class for BlackMisc::Test::CTestService. This part is the caller. class BLACKMISC_EXPORT ITestServiceInterface: public QDBusAbstractInterface { Q_OBJECT public: //! Constructor ITestServiceInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); //! Destructor virtual ~ITestServiceInterface(); //! Ping via DBus, tests object marshalling/unmarshalling static int pingTests(ITestServiceInterface &testServiceInterface, bool verbose); //! DBus calls //! @{ QDBusPendingReply getAtcStation() { QList argumentList; return asyncCallWithArgumentList(QLatin1String("getAtcStation"), argumentList); } QDBusPendingReply getAircraftCfgEntriesList(int number) { QList argumentList; argumentList << QVariant::fromValue(number); return asyncCallWithArgumentList(QLatin1String("getAircraftCfgEntriesList"), argumentList); } QDBusPendingReply getAtcStationList(int number) { QList argumentList; argumentList << QVariant::fromValue(number); return asyncCallWithArgumentList(QLatin1String("getAtcStationList"), argumentList); } QDBusPendingReply> getObjectPaths(int number) { QList argumentList; argumentList << QVariant::fromValue(number); return asyncCallWithArgumentList(QLatin1String("getObjectPaths"), argumentList); } QDBusPendingReply getSpeed() { QList argumentList; return asyncCallWithArgumentList(QLatin1String("getSpeed"), argumentList); } QDBusPendingReply pingAltitude(const BlackMisc::Aviation::CAltitude &altitude) { QList argumentList; argumentList << QVariant::fromValue(altitude); return asyncCallWithArgumentList(QLatin1String("pingAltitude"), argumentList); } QDBusPendingReply pingSituation(const BlackMisc::Aviation::CAircraftSituation &situation) { QList argumentList; argumentList << QVariant::fromValue(situation); return asyncCallWithArgumentList(QLatin1String("pingSituation"), argumentList); } QDBusPendingReply pingUser(const BlackMisc::Network::CUser &user) { QList argumentList; argumentList << QVariant::fromValue(user); return asyncCallWithArgumentList(QLatin1String("pingUser"), argumentList); } QDBusPendingReply pingTransponder(const BlackMisc::Aviation::CTransponder &transponder) { QList argumentList; argumentList << QVariant::fromValue(transponder); return asyncCallWithArgumentList(QLatin1String("pingTransponder"), argumentList); } QDBusPendingReply pingAtcStation(const BlackMisc::Aviation::CAtcStation &station) { QList argumentList; argumentList << QVariant::fromValue(station); return asyncCallWithArgumentList(QLatin1String("pingAtcStation"), argumentList); } QDBusPendingReply pingAircraftIcaoData(const BlackMisc::Aviation::CAircraftIcaoCode &icaoData) { QList argumentList; argumentList << QVariant::fromValue(icaoData); return asyncCallWithArgumentList(QLatin1String("pingAircraftIcaoData"), argumentList); } QDBusPendingReply pingAircraftLights(const BlackMisc::Aviation::CAircraftLights &lights) { QList argumentList; argumentList << QVariant::fromValue(lights); return asyncCallWithArgumentList(QLatin1String("pingAircraftLights"), argumentList); } QDBusPendingReply pingAircraftParts(const BlackMisc::Aviation::CAircraftParts &parts) { QList argumentList; argumentList << QVariant::fromValue(parts); return asyncCallWithArgumentList(QLatin1String("pingAircraftParts"), argumentList); } QDBusPendingReply pingAircraftEngine(const BlackMisc::Aviation::CAircraftEngine &engine) { QList argumentList; argumentList << QVariant::fromValue(engine); return asyncCallWithArgumentList(QLatin1String("pingAircraftEngine"), argumentList); } QDBusPendingReply pingAircraftModel(const BlackMisc::Simulation::CAircraftModel &model) { QList argumentList; argumentList << QVariant::fromValue(model); return asyncCallWithArgumentList(QLatin1String("pingAircraftModel"), argumentList); } QDBusPendingReply pingAircraftModelList(const BlackMisc::Simulation::CAircraftModelList &model) { QList argumentList; argumentList << QVariant::fromValue(model); return asyncCallWithArgumentList(QLatin1String("pingAircraftModelList"), argumentList); } QDBusPendingReply pingSimulatedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) { QList argumentList; argumentList << QVariant::fromValue(aircraft); return asyncCallWithArgumentList(QLatin1String("pingSimulatedAircraft"), argumentList); } QDBusPendingReply pingPluginInfo(const BlackMisc::Simulation::CSimulatorPluginInfo &info) { QList argumentList; argumentList << QVariant::fromValue(info); return asyncCallWithArgumentList(QLatin1String("pingPluginInfo"), argumentList); } QDBusPendingReply pingAtcStationList(const BlackMisc::Aviation::CAtcStationList &atcStationList) { QList argumentList; argumentList << QVariant::fromValue(atcStationList); return asyncCallWithArgumentList(QLatin1String("pingAtcStationList"), argumentList); } QDBusPendingReply pingSpeed(const BlackMisc::PhysicalQuantities::CSpeed &speed) { QList argumentList; argumentList << QVariant::fromValue(speed); return asyncCallWithArgumentList(QLatin1String("pingSpeed"), argumentList); } QDBusPendingReply pingAircraftList(const BlackMisc::Simulation::CSimulatedAircraftList &aircraftList) { QList argumentList; argumentList << QVariant::fromValue(aircraftList); return asyncCallWithArgumentList(QLatin1String("pingAircraftList"), argumentList); } QDBusPendingReply pingAirportList(const BlackMisc::Aviation::CAirportList &airportList) { QList argumentList; argumentList << QVariant::fromValue(airportList); return asyncCallWithArgumentList(QLatin1String("pingAirportList"), argumentList); } QDBusPendingReply pingClientList(const BlackMisc::Network::CClientList &clientList) { QList argumentList; argumentList << QVariant::fromValue(clientList); return asyncCallWithArgumentList(QLatin1String("pingClientList"), argumentList); } QDBusPendingReply pingClient(const BlackMisc::Network::CClient &client) { QList argumentList; argumentList << QVariant::fromValue(client); return asyncCallWithArgumentList(QLatin1String("pingClient"), argumentList); } QDBusPendingReply pingCVariant(const BlackMisc::CVariant &variant) { QList argumentList; argumentList << QVariant::fromValue(variant); return asyncCallWithArgumentList(QLatin1String("pingCVariant"), argumentList); } QDBusPendingReply pingPropertyIndex(const BlackMisc::CPropertyIndex &index) { QList argumentList; argumentList << QVariant::fromValue(index); return asyncCallWithArgumentList(QLatin1String("pingPropertyIndex"), argumentList); } QDBusPendingReply pingIndexVariantMap(const BlackMisc::CPropertyIndexVariantMap &indexVariantMap) { QList argumentList; argumentList << QVariant::fromValue(indexVariantMap); return asyncCallWithArgumentList(QLatin1String("pingIndexVariantMap"), argumentList); } QDBusPendingReply receiveAltitude(const BlackMisc::Aviation::CAltitude &altitude) { QList argumentList; argumentList << QVariant::fromValue(altitude); return asyncCallWithArgumentList(QLatin1String("receiveAltitude"), argumentList); } QDBusPendingReply<> receiveAtcStation(const BlackMisc::Aviation::CAtcStation &station) { QList argumentList; argumentList << QVariant::fromValue(station); return asyncCallWithArgumentList(QLatin1String("receiveAtcStation"), argumentList); } QDBusPendingReply<> receiveAtcStationList(const BlackMisc::Aviation::CAtcStationList &atcStationList) { QList argumentList; argumentList << QVariant::fromValue(atcStationList); return asyncCallWithArgumentList(QLatin1String("receiveAtcStationList"), argumentList); } QDBusPendingReply<> receiveCallsign(const BlackMisc::Aviation::CCallsign &callsign) { QList argumentList; argumentList << QVariant::fromValue(callsign); return asyncCallWithArgumentList(QLatin1String("receiveCallsign"), argumentList); } QDBusPendingReply<> receiveComUnit(const BlackMisc::Aviation::CComSystem &comUnit) { QList argumentList; argumentList << QVariant::fromValue(comUnit); return asyncCallWithArgumentList(QLatin1String("receiveComUnit"), argumentList); } QDBusPendingReply<> receiveGeoPosition(const BlackMisc::Geo::CCoordinateGeodetic &geo) { QList argumentList; argumentList << QVariant::fromValue(geo); return asyncCallWithArgumentList(QLatin1String("receiveGeoPosition"), argumentList); } QDBusPendingReply<> receiveLength(const BlackMisc::PhysicalQuantities::CLength &length) { QList argumentList; argumentList << QVariant::fromValue(length); return asyncCallWithArgumentList(QLatin1String("receiveLength"), argumentList); } QDBusPendingReply<> receiveVariantList(const BlackMisc::CVariantList &list) { QList argumentList; argumentList << QVariant::fromValue(list); return asyncCallWithArgumentList(QLatin1String("receiveVariantList"), argumentList); } QDBusPendingReply<> receiveList(const QList &list) { QList argumentList; argumentList << QVariant::fromValue(list); return asyncCallWithArgumentList(QLatin1String("receiveList"), argumentList); } QDBusPendingReply<> receiveSpeed(const BlackMisc::PhysicalQuantities::CSpeed &speed) { QList argumentList; argumentList << QVariant::fromValue(speed); return asyncCallWithArgumentList(QLatin1String("receiveSpeed"), argumentList); } QDBusPendingReply<> receiveStringMessage(const QString &message) { QList argumentList; argumentList << QVariant::fromValue(message); return asyncCallWithArgumentList(QLatin1String("receiveStringMessage"), argumentList); } QDBusPendingReply<> receiveTrack(const BlackMisc::Aviation::CTrack &track) { QList argumentList; argumentList << QVariant::fromValue(track); return asyncCallWithArgumentList(QLatin1String("receiveTrack"), argumentList); } QDBusPendingReply<> receiveTransponder(const BlackMisc::Aviation::CTransponder &transponder) { QList argumentList; argumentList << QVariant::fromValue(transponder); return asyncCallWithArgumentList(QLatin1String("receiveTransponder"), argumentList); } QDBusPendingReply<> receiveValueMap(const BlackMisc::CPropertyIndexVariantMap &valueMap) { QList argumentList; argumentList << QVariant::fromValue(valueMap); return asyncCallWithArgumentList(QLatin1String("receiveValueMap"), argumentList); } QDBusPendingReply<> receiveVariant(const QDBusVariant &variant, int localMetyType) { QList argumentList; argumentList << QVariant::fromValue(variant) << QVariant::fromValue(localMetyType); return asyncCallWithArgumentList(QLatin1String("receiveVariant"), argumentList); } //! @} signals: //! send message void sendStringMessage(const QString &message); private: //! Interface name static const char *InterfaceName(); //! Compare objects and output info template static bool pingCompare(const ValueObject &in, const ValueObject &out, QTextStream &ts, bool verbose, int &errors) { const bool equal = (in == out); if (!equal) { errors++; } if (equal && !verbose) { return true; } ts << "I: " << in.toQString() << endl << "O: " << out.toQString() << endl; return equal; } //! Error info string static const QString &errorInfo(bool ok); }; } // ns } // ns #endif