mirror of
https://github.com/Fishwaldo/qt-openzwave.git
synced 2025-07-23 13:38:26 +00:00
add a few more Manager Methods
This commit is contained in:
parent
adb35f9bc0
commit
7b11b06a37
9 changed files with 153 additions and 1 deletions
66
qt-openzwave/include/qt-openzwave/qtozw_pods.h
Normal file
66
qt-openzwave/include/qt-openzwave/qtozw_pods.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
#ifndef QTOZW_PODS_H
|
||||
#define QTOZW_PODS_H
|
||||
#include <QObject>
|
||||
|
||||
struct NodeStatistics {
|
||||
quint32 sentCount;
|
||||
quint32 sentFailed;
|
||||
quint32 retries;
|
||||
quint32 recievedPackets;
|
||||
quint32 recievedDupPackets;
|
||||
quint32 recievedUnsolicited;
|
||||
QString lastSentTimeStamp;
|
||||
QString lastReceivedTimeStamp;
|
||||
quint32 lastRequestRTT;
|
||||
quint32 averageRequestRTT;
|
||||
quint32 lastResponseRTT;
|
||||
quint32 averageResponseRTT;
|
||||
quint8 quality;
|
||||
bool extendedTXSupported;
|
||||
quint16 txTime;
|
||||
quint8 hops;
|
||||
QString rssi_1;
|
||||
QString rssi_2;
|
||||
QString rssi_3;
|
||||
QString rssi_4;
|
||||
QString rssi_5;
|
||||
quint8 ackChannel;
|
||||
quint8 lastTXChannel;
|
||||
QString routeScheme;
|
||||
QString routeUsed;
|
||||
QString routeSpeed;
|
||||
quint8 routeTries;
|
||||
quint8 lastFailedLinkFrom;
|
||||
quint8 lastFailedLinkTo;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(NodeStatistics)
|
||||
|
||||
inline QDataStream &operator<<(QDataStream &ds, const NodeStatistics &obj) {
|
||||
ds << obj.hops << obj.rssi_1 << obj.rssi_2 << obj.rssi_3 << obj.rssi_4 << obj.rssi_5;
|
||||
ds << obj.txTime << obj.quality << obj.retries << obj.routeUsed << obj.sentCount;
|
||||
ds << obj.ackChannel << obj.routeSpeed << obj.routeTries << obj.sentFailed;
|
||||
ds << obj.routeScheme << obj.lastTXChannel << obj.lastRequestRTT << obj.lastResponseRTT;
|
||||
ds << obj.recievedPackets << obj.lastFailedLinkTo << obj.averageRequestRTT;
|
||||
ds << obj.lastSentTimeStamp << obj.averageResponseRTT << obj.lastFailedLinkFrom;
|
||||
ds << obj.recievedDupPackets << obj.extendedTXSupported << obj.recievedUnsolicited;
|
||||
ds << obj.lastReceivedTimeStamp;
|
||||
return ds;
|
||||
}
|
||||
|
||||
inline QDataStream &operator>>(QDataStream &ds, NodeStatistics &obj) {
|
||||
#if 0
|
||||
ds >> (quint8)obj.hops >> obj.rssi_1 >> obj.rssi_2 >> obj.rssi_3 >> obj.rssi_4 >> obj.rssi_5;
|
||||
ds >> obj.txTime << obj.quality << obj.retries << obj.routeUsed << obj.sentCount;
|
||||
ds >> obj.ackChannel << obj.routeSpeed << obj.routeTries << obj.sentFailed;
|
||||
ds >> obj.routeScheme << obj.lastTXChannel << obj.lastRequestRTT << obj.lastResponseRTT;
|
||||
ds >> obj.recievedPackets << obj.lastFailedLinkTo << obj.averageRequestRTT;
|
||||
ds >> obj.lastSentTimeStamp << obj.averageResponseRTT << obj.lastFailedLinkFrom;
|
||||
ds >> obj.recievedDupPackets << obj.extendedTXSupported << obj.recievedUnsolicited;
|
||||
ds >> obj.lastReceivedTimeStamp;
|
||||
#endif
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
#endif // QTOZW_PODS_H
|
|
@ -69,6 +69,11 @@ public:
|
|||
bool requestNetworkUpdate(quint8 _node);
|
||||
QString GetMetaData(quint8 _node, QTOZWManagerSource::QTOZWMetaDataField _field);
|
||||
QByteArray GetMetaDataProductPic(quint8 _node);
|
||||
|
||||
QString GetNodeQueryStage(quint8 const _node);
|
||||
NodeStatistics GetNodeStatistics(quint8 const node);
|
||||
|
||||
|
||||
bool checkLatestConfigFileRevision(quint8 const _node);
|
||||
bool checkLatestMFSRevision();
|
||||
bool downloadLatestConfigFileRevision(quint8 const _node);
|
||||
|
|
|
@ -63,6 +63,9 @@ public Q_SLOTS:
|
|||
QString GetMetaData(quint8 _node, QTOZWManagerSource::QTOZWMetaDataField _field);
|
||||
QByteArray GetMetaDataProductPic(quint8 _node);
|
||||
|
||||
QString GetNodeQueryStage(quint8 const node);
|
||||
NodeStatistics GetNodeStatistics(quint8 const node);
|
||||
|
||||
bool checkLatestConfigFileRevision(quint8 const _node);
|
||||
bool checkLatestMFSRevision();
|
||||
bool downloadLatestConfigFileRevision(quint8 const _node);
|
||||
|
|
|
@ -39,6 +39,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += source/qtopenzwave.cpp \
|
||||
source/qt_pods.cpp \
|
||||
source/qtozwassociationmodel.cpp \
|
||||
source/qtozwassociationmodel_p.cpp \
|
||||
source/qtozwmanager.cpp \
|
||||
|
@ -51,6 +52,7 @@ SOURCES += source/qtopenzwave.cpp \
|
|||
source/qtozwvalueidmodel_p.cpp
|
||||
|
||||
HEADERS += include/qt-openzwave/qtopenzwave.h \
|
||||
include/qt-openzwave/qtozw_pods.h \
|
||||
include/qt-openzwave_global.h \ \
|
||||
include/qtozw_logging.h \
|
||||
include/qt-openzwave/qtozwassociationmodel.h \
|
||||
|
@ -67,7 +69,7 @@ HEADERS += include/qt-openzwave/qtopenzwave.h \
|
|||
INCLUDEPATH += include/
|
||||
|
||||
REPC_SOURCE = source/qtozwmanager.rep
|
||||
REPC_REPLICA = source/qtozwmanager.rep
|
||||
REPC_REPLICA = source/qtozwmanager.rep
|
||||
|
||||
unix {
|
||||
target.path = /usr/local/lib
|
||||
|
|
3
qt-openzwave/source/qt_pods.cpp
Normal file
3
qt-openzwave/source/qt_pods.cpp
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "qt-openzwave/qtozw_pods.h"
|
||||
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include "qt-openzwave/qtopenzwave.h"
|
||||
#include "qt-openzwave/qtozw_pods.h"
|
||||
#include "qtozw_logging.h"
|
||||
|
||||
|
||||
|
@ -22,6 +23,8 @@ QTOpenZwave::QTOpenZwave
|
|||
qRegisterMetaType<QTOZW_ValueIDBitSet>("QTOZW_ValueIDBitSet");
|
||||
qRegisterMetaTypeStreamOperators<QTOZW_ValueIDBitSet>("QTOZW_ValueIDBitSet");
|
||||
|
||||
qRegisterMetaType<NodeStatistics>("NodeStatistics");
|
||||
qRegisterMetaTypeStreamOperators<NodeStatistics>("NodeStatistics");
|
||||
qSetMessagePattern("%{category} %{message}");
|
||||
}
|
||||
|
||||
|
|
|
@ -278,6 +278,13 @@ QByteArray QTOZWManager::GetMetaDataProductPic(quint8 _node) {
|
|||
CALL_DPTR_RTN(GetMetaDataProductPic(_node), QByteArray);
|
||||
}
|
||||
|
||||
QString QTOZWManager::GetNodeQueryStage(const quint8 _node) {
|
||||
CALL_DPTR_RTN(GetNodeQueryStage(_node), QString);
|
||||
}
|
||||
|
||||
NodeStatistics QTOZWManager::GetNodeStatistics(const quint8 _node) {
|
||||
CALL_DPTR_RTN(GetNodeStatistics(_node), NodeStatistics);
|
||||
}
|
||||
bool QTOZWManager::checkLatestConfigFileRevision(quint8 const _node) {
|
||||
CALL_DPTR_RTN(checkLatestConfigFileRevision(_node), bool);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <QtCore>
|
||||
#include <QByteArray>
|
||||
#include "qt-openzwave/qtozw_pods.h"
|
||||
|
||||
class QTOZWManager {
|
||||
ENUM QTOZWErrorCodes {
|
||||
|
@ -93,6 +94,9 @@ class QTOZWManager {
|
|||
SLOT(QString GetMetaData(quint8 _node, QTOZWMetaDataField _field))
|
||||
SLOT(QByteArray GetMetaDataProductPic(quint8 _node))
|
||||
|
||||
SLOT(QString GetNodeQueryStage(quint8 _node))
|
||||
SLOT(NodeStatistics GetNodeStatistics(quint8 _node))
|
||||
|
||||
SLOT(bool checkLatestConfigFileRevision(quint8 const _node))
|
||||
SLOT(bool checkLatestMFSRevision())
|
||||
SLOT(bool downloadLatestConfigFileRevision(quint8 const _node))
|
||||
|
|
|
@ -426,6 +426,65 @@ QByteArray QTOZWManager_Internal::GetMetaDataProductPic(quint8 _node) {
|
|||
|
||||
}
|
||||
|
||||
QString QTOZWManager_Internal::GetNodeQueryStage(quint8 const _node) {
|
||||
if (!this->checkHomeId() || !this->checkNodeId(_node))
|
||||
return QString();
|
||||
try {
|
||||
return this->m_manager->GetNodeQueryStage(this->homeId(), _node).c_str();
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
emit this->error(QTOZWErrorCodes::OZWException);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
NodeStatistics QTOZWManager_Internal::GetNodeStatistics(quint8 const _node) {
|
||||
if (!this->checkHomeId() || !this->checkNodeId(_node))
|
||||
return NodeStatistics();
|
||||
try {
|
||||
OpenZWave::Node::NodeData nd;
|
||||
NodeStatistics ns;
|
||||
this->m_manager->GetNodeStatistics(this->homeId(), _node, &nd);
|
||||
/* copy */
|
||||
ns.hops = nd.m_hops;
|
||||
ns.rssi_1 = nd.m_rssi_1;
|
||||
ns.rssi_2 = nd.m_rssi_2;
|
||||
ns.rssi_3 = nd.m_rssi_3;
|
||||
ns.rssi_4 = nd.m_rssi_4;
|
||||
ns.rssi_5 = nd.m_rssi_5;
|
||||
ns.txTime = nd.m_txTime;
|
||||
ns.quality = nd.m_quality;
|
||||
ns.retries = nd.m_retries;
|
||||
ns.routeUsed = nd.m_routeUsed;
|
||||
ns.sentCount = nd.m_sentCnt;
|
||||
ns.ackChannel = nd.m_ackChannel;
|
||||
ns.routeSpeed = this->m_manager->GetNodeRouteSpeed(&nd).c_str();
|
||||
ns.routeTries = nd.m_routeTries;
|
||||
ns.sentFailed = nd.m_sentFailed;
|
||||
ns.routeScheme = this->m_manager->GetNodeRouteScheme(&nd).c_str();
|
||||
ns.lastTXChannel = nd.m_lastTxChannel;
|
||||
ns.lastRequestRTT = nd.m_lastRequestRTT;
|
||||
ns.lastResponseRTT = nd.m_lastResponseRTT;
|
||||
ns.recievedPackets = nd.m_receivedCnt;
|
||||
ns.lastFailedLinkTo = nd.m_lastFailedLinkTo;
|
||||
ns.averageRequestRTT = nd.m_averageRequestRTT;
|
||||
ns.lastSentTimeStamp = nd.m_sentTS.c_str();
|
||||
ns.averageResponseRTT = nd.m_averageResponseRTT;
|
||||
ns.lastFailedLinkFrom = nd.m_lastFailedLinkFrom;
|
||||
ns.recievedDupPackets = nd.m_receivedDups;
|
||||
ns.extendedTXSupported = nd.m_txStatusReportSupported;
|
||||
ns.recievedUnsolicited = nd.m_receivedUnsolicited;
|
||||
ns.lastReceivedTimeStamp = nd.m_receivedTS.c_str();
|
||||
return ns;
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
emit this->error(QTOZWErrorCodes::OZWException);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
return NodeStatistics();
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool QTOZWManager_Internal::checkLatestConfigFileRevision(quint8 const _node) {
|
||||
if (!this->checkHomeId() || !this->checkNodeId(_node))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue