mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
@@ -18,158 +18,25 @@ namespace BlackMisc
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
//! Constructor
|
||||||
* \brief Generic DBus interface
|
|
||||||
* \param serverName
|
|
||||||
* \param path
|
|
||||||
* \param interfaceName
|
|
||||||
* \param connection
|
|
||||||
* \param parent
|
|
||||||
*/
|
|
||||||
CGenericDBusInterface(const QString &serverName, const QString &path, const QString &interfaceName, const QDBusConnection &connection, QObject *parent = 0) :
|
CGenericDBusInterface(const QString &serverName, const QString &path, const QString &interfaceName, const QDBusConnection &connection, QObject *parent = 0) :
|
||||||
QDBusAbstractInterface(serverName, path, interfaceName.toUtf8().constData(), connection, parent)
|
QDBusAbstractInterface(serverName, path, interfaceName.toUtf8().constData(), connection, parent)
|
||||||
{
|
{
|
||||||
// void
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//! Call DBus, no return value
|
||||||
* \brief Call DBus
|
template <typename... Args>
|
||||||
* \param method
|
void callDBus(const QLatin1String &method, Args&&... args)
|
||||||
*/
|
|
||||||
void callDBus(const QLatin1String &method)
|
|
||||||
{
|
{
|
||||||
QList<QVariant> argumentList;
|
QList<QVariant> argumentList { QVariant::fromValue(std::forward<Args>(args))... };
|
||||||
this->asyncCallWithArgumentList(method, argumentList);
|
this->asyncCallWithArgumentList(method, argumentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//! Call DBus with synchronous return value
|
||||||
* \brief Call DBus, no return value
|
template <typename Ret, typename... Args>
|
||||||
* \param method
|
Ret callDBusRet(const QLatin1String &method, Args&&... args)
|
||||||
* \param p1
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename P1> void callDBus(const QLatin1String &method, P1 p1)
|
|
||||||
{
|
{
|
||||||
QList<QVariant> argumentList;
|
QList<QVariant> argumentList { QVariant::fromValue(std::forward<Args>(args))... };
|
||||||
argumentList << QVariant::fromValue(p1);
|
|
||||||
this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus, no return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename P1, typename P2> void callDBus(const QLatin1String &method, P1 p1, P2 p2)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2);
|
|
||||||
this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus, no return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \param p3
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename P1, typename P2, typename P3> void callDBus(const QLatin1String &method, P1 p1, P2 p2, P3 p3)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2) << QVariant::fromValue(p3);
|
|
||||||
this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus, no return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \param p3
|
|
||||||
* \param p4
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename P1, typename P2, typename P3, typename P4> void callDBus(const QLatin1String &method, P1 p1, P2 p2, P3 p3, P4 p4)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2) << QVariant::fromValue(p3) << QVariant::fromValue(p4);
|
|
||||||
this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus with return value
|
|
||||||
* \param method
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename Ret> Ret callDBusRet(const QLatin1String &method)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
return pr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus with return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename Ret, typename P1> Ret callDBusRet(const QLatin1String &method, P1 p1)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1);
|
|
||||||
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
return pr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus with return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename Ret, typename P1, typename P2> Ret callDBusRet(const QLatin1String &method, P1 p1, P2 p2)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2);
|
|
||||||
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
return pr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus with return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \param p3
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename Ret, typename P1, typename P2, typename P3> Ret callDBusRet(const QLatin1String &method, P1 p1, P2 p2, P3 p3)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2) << QVariant::fromValue(p3);
|
|
||||||
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
|
||||||
return pr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Call DBus with return value
|
|
||||||
* \param method
|
|
||||||
* \param p1
|
|
||||||
* \param p2
|
|
||||||
* \param p3
|
|
||||||
* \param p4
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
template<typename Ret, typename P1, typename P2, typename P3, typename P4> Ret callDBusRet(const QLatin1String &method, P1 p1, P2 p2, P3 p3, P4 p4)
|
|
||||||
{
|
|
||||||
QList<QVariant> argumentList;
|
|
||||||
argumentList << QVariant::fromValue(p1) << QVariant::fromValue(p2) << QVariant::fromValue(p3) << QVariant::fromValue(p4);
|
|
||||||
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
QDBusPendingReply<Ret> pr = this->asyncCallWithArgumentList(method, argumentList);
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user