mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Rename Testservice DBus variables
This commit is contained in:
@@ -62,14 +62,14 @@ namespace BlackMiscTest
|
||||
void ServiceTool::dataTransferTestServer(BlackMisc::CDBusServer *dBusServer)
|
||||
{
|
||||
QDBusConnection sessionBusConnection = QDBusConnection::sessionBus();
|
||||
if (sessionBusConnection.interface()->isServiceRegistered(Testservice::ServiceName))
|
||||
if (sessionBusConnection.interface()->isServiceRegistered(Testservice::InterfaceName))
|
||||
{
|
||||
qFatal("Testservice already registed on session bus");
|
||||
}
|
||||
|
||||
// as this is the receiver side, the slots can be debugged too
|
||||
Testservice *testservice = ServiceTool::registerTestservice(sessionBusConnection, QCoreApplication::instance());
|
||||
dBusServer->addObject(Testservice::ServicePath, testservice);
|
||||
dBusServer->addObject(Testservice::ObjectPath, testservice);
|
||||
}
|
||||
|
||||
void ServiceTool::dataTransferTestClient(const QString &address)
|
||||
@@ -185,7 +185,7 @@ namespace BlackMiscTest
|
||||
Testservice *ServiceTool::registerTestservice(QDBusConnection &connection, QObject *parent)
|
||||
{
|
||||
Testservice *pTestservice = new Testservice(parent); // just a QObject with signals / slots and Q_CLASSINFO("D-Bus Interface", some service name)
|
||||
if (!connection.registerService(Testservice::ServiceName))
|
||||
if (!connection.registerService(Testservice::InterfaceName))
|
||||
{
|
||||
QDBusError err = connection.lastError();
|
||||
qWarning() << err.message();
|
||||
@@ -195,7 +195,7 @@ namespace BlackMiscTest
|
||||
qFatal("Could not register service!");
|
||||
}
|
||||
|
||||
if (!connection.registerObject(Testservice::ServicePath, pTestservice, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAdaptors))
|
||||
if (!connection.registerObject(Testservice::ObjectPath, pTestservice, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAdaptors))
|
||||
{
|
||||
qFatal("Could not register service object!");
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace BlackMiscTest
|
||||
|
||||
QString service; // service not needed
|
||||
if (connection.connect(
|
||||
service, Testservice::ServicePath, Testservice::ServiceName,
|
||||
service, Testservice::ObjectPath, Testservice::InterfaceName,
|
||||
"sendStringMessage", pTestservice, SLOT(receiveStringMessage(const QString &))))
|
||||
{
|
||||
qDebug() << "Connected object with bus sendStringMessage";
|
||||
@@ -220,7 +220,7 @@ namespace BlackMiscTest
|
||||
void ServiceTool::sendDataToTestservice(const QDBusConnection &connection)
|
||||
{
|
||||
// on the client's side
|
||||
TestServiceInterface testserviceInterface(Testservice::ServiceName, Testservice::ServicePath, connection);
|
||||
TestServiceInterface testserviceInterface(Testservice::InterfaceName, Testservice::ObjectPath, connection);
|
||||
|
||||
CSpeed speed(200, CSpeedUnit::km_h());
|
||||
CSpeed speedNull(0, CSpeedUnit::nullUnit());
|
||||
@@ -231,7 +231,7 @@ namespace BlackMiscTest
|
||||
while (true)
|
||||
{
|
||||
QDBusMessage m = QDBusMessage::createSignal(
|
||||
Testservice::ServicePath, Testservice::ServiceName,
|
||||
Testservice::ObjectPath, Testservice::InterfaceName,
|
||||
"sendStringMessage");
|
||||
|
||||
// The << operator is used to add the parameters for the slot
|
||||
|
||||
@@ -21,8 +21,8 @@ using namespace BlackMisc::Network;
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
const QString Testservice::ServiceName = QString(BLACKMISCKTEST_TESTSERVICE_INTERFACENAME);
|
||||
const QString Testservice::ServicePath = QString(BLACKMISCKTEST_TESTSERVICE_SERVICEPATH);
|
||||
const QString Testservice::InterfaceName = QString(BLACKSAMPLE_TESTSERVICE_INTERFACENAME);
|
||||
const QString Testservice::ObjectPath = QString(BLACKSAMPLE_TESTSERVICE_OBJECTPATH);
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
@@ -208,7 +208,7 @@ namespace BlackMiscTest
|
||||
QList<QDBusObjectPath> paths;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
paths.append(QDBusObjectPath(BLACKMISCKTEST_TESTSERVICE_SERVICEPATH));
|
||||
paths.append(QDBusObjectPath(BLACKSAMPLE_TESTSERVICE_OBJECTPATH));
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusObjectPath>
|
||||
|
||||
#define BLACKMISCKTEST_TESTSERVICE_INTERFACENAME "blackmisctest.testservice"
|
||||
#define BLACKMISCKTEST_TESTSERVICE_SERVICEPATH "/ts"
|
||||
#define BLACKSAMPLE_TESTSERVICE_INTERFACENAME "blackmisctest.testservice"
|
||||
#define BLACKSAMPLE_TESTSERVICE_OBJECTPATH "/ts"
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace BlackMiscTest
|
||||
class Testservice : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKMISCKTEST_TESTSERVICE_INTERFACENAME)
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKSAMPLE_TESTSERVICE_INTERFACENAME)
|
||||
|
||||
// For some reasons the interface name in the XML is not set correctly
|
||||
// to the above name
|
||||
@@ -169,8 +169,10 @@ namespace BlackMiscTest
|
||||
QList<QDBusObjectPath> getObjectPaths(int number) const;
|
||||
|
||||
public:
|
||||
static const QString ServiceName;
|
||||
static const QString ServicePath;
|
||||
//! DBus interface name
|
||||
static const QString InterfaceName;
|
||||
//! DBus object path
|
||||
static const QString ObjectPath;
|
||||
|
||||
//! Constructor
|
||||
explicit Testservice(QObject *parent = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user