Add Version Information

This commit is contained in:
Justin Hammond 2019-12-03 18:34:12 +08:00
parent 04440c3929
commit 8c8da7fc03
7 changed files with 26 additions and 2 deletions

View file

@ -114,6 +114,7 @@ public:
*/
QTOZWManager *GetManager();
QString getVersion();
private:
QTOZWManager *m_manager;
QDir m_ozwdbpath;

View file

@ -30,7 +30,7 @@ DEFINES += QTOPENZWAVE_LIBRARY
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS QT_MESSAGELOGCONTEXT
DEFINES += QT_DEPRECATED_WARNINGS QT_MESSAGELOGCONTEXT LIB_VERSION=$$VERSION
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.

View file

@ -68,3 +68,10 @@ QTOZWManager *QTOpenZwave::GetManager
}
return this->m_manager;
}
#define VAL(str) #str
#define TOSTRING(str) VAL(str)
QString QTOpenZwave::getVersion() {
return TOSTRING(LIB_VERSION);
}

View file

@ -1,4 +1,5 @@
#include <QDateTime>
#include <QCoreApplication>
#include "mqttpublisher.h"
#include "qtrj.h"
@ -215,6 +216,8 @@ QString mqttpublisher::getCommandResponseTopic(QString cmd) {
return t;
}
void mqttpublisher::setOZWDaemon(qtozwdaemon *ozwdaemon) {
this->m_qtozwdeamon = ozwdaemon;
@ -252,6 +255,11 @@ void mqttpublisher::setOZWDaemon(qtozwdaemon *ozwdaemon) {
connect(manager, &QTOZWManager::started, this, &mqttpublisher::started);
connect(manager, &QTOZWManager::stopped, this, &mqttpublisher::stopped);
QT2JS::SetString(this->m_ozwstatus, "OpenZWave_Version", this->getQTOZWManager()->getVersionAsString());
QT2JS::SetString(this->m_ozwstatus, "OZWDeamon_Version", QCoreApplication::applicationVersion());
QT2JS::SetString(this->m_ozwstatus, "QTOpenZWave_Version", this->m_qtozwdeamon->getQTOpenZWave()->getVersion());
QT2JS::SetString(this->m_ozwstatus, "QT_Version", qVersion());
this->m_currentStartTime = QDateTime::currentDateTime();
if (settings->value("MQTTTLS").toBool() == true) {
this->m_client->connectToHostEncrypted();
@ -295,6 +303,7 @@ bool mqttpublisher::clearStatusUpdate() {
QT2JS::removeField(this->m_ozwstatus, "getControllerLibraryVersion");
QT2JS::removeField(this->m_ozwstatus, "getControllerLibraryType");
QT2JS::removeField(this->m_ozwstatus, "getControllerPath");
QT2JS::removeField(this->m_ozwstatus, "pollInterval");
return true;
}
@ -568,6 +577,7 @@ void mqttpublisher::driverReady(quint32 homeID) {
QT2JS::SetString(this->m_ozwstatus, "getControllerLibraryVersion", this->getQTOZWManager()->getLibraryVersion());
QT2JS::SetString(this->m_ozwstatus, "getControllerLibraryType", this->getQTOZWManager()->getLibraryTypeName());
QT2JS::SetString(this->m_ozwstatus, "getControllerPath", this->getQTOZWManager()->getControllerPath());
QT2JS::SetUint(this->m_ozwstatus, "pollInterval", this->getQTOZWManager()->getPollInterval());
QT2JS::SetUint(this->m_ozwstatus, "homeID", homeID);
this->sendStatusUpdate();
}

View file

@ -4,6 +4,8 @@ QT += remoteobjects
TARGET = ../ozwdaemon
VERSION = 0.1.0
CONFIG += c++11 console link_pkgconfig silent
CONFIG -= app_bundle
@ -11,7 +13,7 @@ CONFIG -= app_bundle
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS QT_MESSAGELOGCONTEXT
DEFINES += QT_DEPRECATED_WARNINGS QT_MESSAGELOGCONTEXT APP_VERSION=$$VERSION
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.

View file

@ -25,3 +25,6 @@ QTOZWManager *qtozwdaemon::getManager() {
return this->m_qtozwmanager;
}
QTOpenZwave *qtozwdaemon::getQTOpenZWave() {
return this->m_openzwave;
}

View file

@ -18,6 +18,7 @@ public:
void setSerialPort(QString serialPort) { this->m_serialPort = serialPort;}
void startOZW();
QTOZWManager *getManager();
QTOpenZwave *getQTOpenZWave();
signals:
public slots: