80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
#ifndef CMESSAGEMANAGE_H
|
|
#define CMESSAGEMANAGE_H
|
|
|
|
#include "net/net_msg_bus_api/MsgBusApi.h"
|
|
#include "net/net_msg_bus_api/CMbCommunicator.h"
|
|
#include "public/pub_sysinfo_api/SysInfoApi.h"
|
|
#include "perm_mng_api/PermMngApi.h"
|
|
#include "service/operate_server_api/JsonMessageStruct.h"
|
|
#include "service/operate_server_api/JsonOptCommand.h"
|
|
#include "common/MessageChannel.h"
|
|
#include <QTimer>
|
|
#include <QObject>
|
|
|
|
struct SReadQueue
|
|
{
|
|
QString tag_name;
|
|
QString rtu_tag;
|
|
int dev_id;
|
|
QString dev_name;
|
|
};
|
|
|
|
struct SReplyQueue
|
|
{
|
|
QString rtu_tag;
|
|
int isSuccess;
|
|
QString resultStr;
|
|
int dev_id;
|
|
int cur_group;
|
|
QList<int> dotList;
|
|
QList<double> valueList;
|
|
};
|
|
|
|
using namespace iot_public;
|
|
using namespace iot_service;
|
|
class CMessageManage : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CMessageManage(QObject *parent = 0);
|
|
~CMessageManage();
|
|
|
|
bool sendMessage(const SReadQueue &queueList, int nDstDomainId);
|
|
|
|
signals:
|
|
void dataChanged(const SReplyQueue& reply);
|
|
|
|
private slots:
|
|
void recvMessage();
|
|
|
|
private:
|
|
void init();
|
|
void initMsg();
|
|
void closeMsg();
|
|
bool addSub(int appID, int channel);
|
|
bool delSub(int appID, int channel);
|
|
SOptReqHead createReqHead(int nDstDomainId);
|
|
std::vector<SOptCustCtrlQueue> createCtrlQueue(int devID);
|
|
void parseMsg(const SOptCustCtrlReply &sOptCustCtrlReply);
|
|
bool checkMsg(std::string strHostName, std::string strInstName, int nOptTime);
|
|
|
|
void test();
|
|
|
|
private:
|
|
iot_net::CMbCommunicator *m_communicator;
|
|
CSysInfoInterfacePtr m_sysInfo;
|
|
CPermMngApiPtr m_permMng;
|
|
QTimer *m_timer;
|
|
std::string m_curRtu;
|
|
std::string m_strHostName;
|
|
std::string m_strInstName;
|
|
int m_nOptTime;
|
|
|
|
// bool m_test;
|
|
// int m_testDevId;
|
|
// QString m_testRtuTag;
|
|
// int m_testNum;
|
|
};
|
|
|
|
#endif // CMESSAGEMANAGE_H
|