mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-29 22:50:28 +01:00
functionality of sending null QByteArray and QString over the
bus. Add new headertest test and restore the old
qdbusxmlparser test.
38 lines
843 B
C++
38 lines
843 B
C++
#include <QtCore/QtCore>
|
|
#include <dbus/qdbus.h>
|
|
|
|
class Pong: public QObject
|
|
{
|
|
Q_OBJECT
|
|
public slots:
|
|
|
|
void ping(const QDBusMessage &msg)
|
|
{
|
|
QDBusMessage reply = QDBusMessage::methodReply(msg);
|
|
reply << static_cast<QList<QVariant> >(msg);
|
|
reply.setSignature(msg.signature());
|
|
if (!msg.connection().send(reply))
|
|
exit(1);
|
|
}
|
|
};
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication app(argc, argv);
|
|
|
|
QDBusConnection &con = QDBus::sessionBus();
|
|
if (!con.isConnected())
|
|
exit(1);
|
|
|
|
if (con.busService()->requestName("org.kde.selftest", QDBusBusService::DoNotQueueName).isError())
|
|
exit(2);
|
|
|
|
Pong pong;
|
|
con.registerObject("/org/kde/selftest", &pong, QDBusConnection::ExportSlots);
|
|
|
|
printf("ready.\n");
|
|
|
|
return app.exec();
|
|
}
|
|
|
|
#include "qpong.moc"
|