1.客户端
1.1TestQtDBus.pro
QT += dbus
1.2TestQtDBus.h
#ifndef TESTQTDBUS_H
#define TESTQTDBUS_H
#include <QObject>
#include <QtDBus>
enum MessageType
{
Message_Conncet = 0, //设备连接
Message_DisConnect = 1, //设备断开连接
Message_Command = 2, //下发指令
Meassge_Note = 99
};
class TestQtDBus : public QObject
{
Q_OBJECT
public:
TestQtDBus();
void NewIP_Connect(QString oldIp,int DeviceNum); //服务端发送
public slots:
void Client_get(QDBusMessage st); //获取通信服务端信息
signals:
void Updatexxx();
private:
};
#endif // TESTQTDBUS_H
1.3TestQtDBus.cpp
#include <QDebug>
#include "TestQtDBus.h"
TestQtDBus::TestQtDBus()
{
QDBusConnection::sessionBus().connect(QString(), QS
标签:TESTQTDBUS,void,通信,QDBus,Message,include,public,小记,TestQtDBus
From: https://blog.csdn.net/chubu3218/article/details/140993784