Options Class

This commit is contained in:
Justin Hammond 2019-06-14 21:11:27 +08:00
parent 17bfdbb59e
commit 0f773a306e
16 changed files with 1083 additions and 85 deletions

View file

@ -10,7 +10,7 @@ class QTOPENZWAVESHARED_EXPORT QTOpenZwave : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
QTOpenZwave(QObject *parent = nullptr); QTOpenZwave(QObject *parent = nullptr, QDir DBPath = QDir("./config/"), QDir UserPath = QDir("./config/"));
QTOZWManager *GetManager(); QTOZWManager *GetManager();
private Q_SLOT: private Q_SLOT:
@ -18,6 +18,8 @@ private Q_SLOT:
private: private:
QTOZWManager *m_manager; QTOZWManager *m_manager;
QDir m_ozwdbpath;
QDir m_ozwuserpath;
}; };
#endif // QTOPENZWAVE_H #endif // QTOPENZWAVE_H

View file

@ -16,6 +16,7 @@ enum QTOZW_UserRoles {
class QTOZWManager_Internal; class QTOZWManager_Internal;
class QTOZWManagerReplica; class QTOZWManagerReplica;
class QTOZWOptionsReplica;
class QTOZWManager : public QObject { class QTOZWManager : public QObject {
Q_OBJECT Q_OBJECT
@ -26,6 +27,9 @@ public:
Invalid Invalid
}; };
Q_ENUM(connectionType) Q_ENUM(connectionType)
Q_PROPERTY(QDir OZWDatabasePath READ OZWDatabasePath WRITE setOZWDatabasePath)
Q_PROPERTY(QDir OZWUserPath READ OZWUserPath WRITE setOZWUserPath)
QTOZWManager(QObject *parent = nullptr); QTOZWManager(QObject *parent = nullptr);
bool initilizeBase(); bool initilizeBase();
@ -79,6 +83,12 @@ public:
bool downloadLatestConfigFileRevision(quint8 const _node); bool downloadLatestConfigFileRevision(quint8 const _node);
bool downloadLatestMFSRevision(); bool downloadLatestMFSRevision();
/* Property Methods */
QDir OZWDatabasePath() { return this->m_ozwdatabasepath; }
QDir OZWUserPath() { return this->m_ozwuserpath; }
void setOZWDatabasePath(QDir path);
void setOZWUserPath(QDir path);
Q_SIGNALS: Q_SIGNALS:
void ready(); void ready();
@ -117,6 +127,8 @@ private Q_SLOTS:
void onReplicaError(QRemoteObjectNode::ErrorCode); void onReplicaError(QRemoteObjectNode::ErrorCode);
void onSourceError(QRemoteObjectHost::ErrorCode); void onSourceError(QRemoteObjectHost::ErrorCode);
void onManagerStateChange(QRemoteObjectReplica::State); void onManagerStateChange(QRemoteObjectReplica::State);
void onOptionsStateChange(QRemoteObjectReplica::State);
void onNodeInitialized(); void onNodeInitialized();
void onValueInitialized(); void onValueInitialized();
void onAssociationInitialized(); void onAssociationInitialized();
@ -131,7 +143,9 @@ private:
QRemoteObjectHost *m_sourceNode; QRemoteObjectHost *m_sourceNode;
QTOZWManager_Internal *d_ptr_internal; QTOZWManager_Internal *d_ptr_internal;
QTOZWManagerReplica *d_ptr_replica; QTOZWManagerReplica *d_ptr_replica;
QTOZWOptionsReplica *d_options_replica;
QRemoteObjectReplica::State m_managerState; QRemoteObjectReplica::State m_managerState;
QRemoteObjectReplica::State m_optionsState;
bool m_nodeState; bool m_nodeState;
bool m_valuesState; bool m_valuesState;
bool m_associationsState; bool m_associationsState;
@ -141,6 +155,8 @@ private:
QAbstractItemModel *m_associationModel; QAbstractItemModel *m_associationModel;
bool m_running; bool m_running;
QDir m_ozwdatabasepath;
QDir m_ozwuserpath;
}; };

View file

@ -3,7 +3,7 @@
#include "qt-openzwave/qtozw_pods.h" #include "qt-openzwave/qtozw_pods.h"
class QTOZWManager { class QTOZWManager {
ENUM QTOZWErrorCodes { ENUM QTOZWManagerErrorCodes {
homeId_Invalid, homeId_Invalid,
nodeId_Invalid, nodeId_Invalid,
valueIDKey_Invalid, valueIDKey_Invalid,
@ -62,7 +62,7 @@ class QTOZWManager {
SIGNAL(starting()); SIGNAL(starting());
SIGNAL(started(quint32 homeID)) SIGNAL(started(quint32 homeID))
SIGNAL(stopped(quint32 homeID)) SIGNAL(stopped(quint32 homeID))
SIGNAL(error(QTOZWErrorCodes errorcode)) SIGNAL(error(QTOZWManagerErrorCodes errorcode))
SLOT(bool open(QString serialPort)) SLOT(bool open(QString serialPort))
SLOT(bool refreshNodeInfo(quint8 _node)) SLOT(bool refreshNodeInfo(quint8 _node))

View file

@ -0,0 +1,191 @@
#ifndef QTOZWOPTIONS_H
#define QTOZWOPTIONS_H
#include <QObject>
#include <QtRemoteObjects>
class QTOZWOptions_Internal;
class QTOZWOptionsReplica;
class QTOZWOptions : public QObject {
Q_OBJECT
public:
enum connectionType {
Local,
Remote,
Invalid
};
Q_ENUM(connectionType)
QTOZWOptions(QObject *parent = nullptr);
Q_PROPERTY(QString ConfigPath READ ConfigPath WRITE setConfigPath NOTIFY ConfigPathChanged)
Q_PROPERTY(QString UserPath READ UserPath WRITE setUserPath NOTIFY UserPathChanged)
Q_PROPERTY(bool Logging READ Logging WRITE setLogging NOTIFY LoggingChanged)
Q_PROPERTY(QString LogFileName READ LogFileName WRITE setLogFileName NOTIFY LogFileNameChanged)
Q_PROPERTY(bool AppendLogFile READ AppendLogFile WRITE setAppendLogFile NOTIFY AppendLogFileChanged)
Q_PROPERTY(bool ConsoleOutput READ ConsoleOutput WRITE setConsoleOutput NOTIFY ConsoleOutputChanged)
Q_PROPERTY(qint32 SaveLogLevel READ SaveLogLevel WRITE setSaveLogLevel NOTIFY SaveLogLevelChanged)
Q_PROPERTY(qint32 QueueLogLevel READ QueueLogLevel WRITE setQueueLogLevel NOTIFY QueueLogLevelChanged)
Q_PROPERTY(qint32 DumpTriggerLevel READ DumpTriggerLevel WRITE setDumpTriggerLevel NOTIFY DumpTriggerLevelChanged)
Q_PROPERTY(bool Associate READ Associate WRITE setAssociate NOTIFY AssociateChanged)
Q_PROPERTY(QString Exclude READ Exclude WRITE setExclude NOTIFY ExcludeChanged)
Q_PROPERTY(QString Include READ Include WRITE setInclude NOTIFY IncludeChanged)
Q_PROPERTY(bool NotifyTransactions READ NotifyTransactions WRITE setNotifyTransactions NOTIFY NotifyTransactionsChanged)
Q_PROPERTY(QString Interface READ Interface WRITE setInterface NOTIFY InterfaceChanged)
Q_PROPERTY(bool SaveConfiguration READ SaveConfiguration WRITE setSaveConfiguration NOTIFY SaveConfigurationChanged)
Q_PROPERTY(qint32 DriverMaxAttempts READ DriverMaxAttempts WRITE setDriverMaxAttempts NOTIFY DriverMaxAttemptsChanged)
Q_PROPERTY(qint32 PollInterval READ PollInterval WRITE setPollInterval NOTIFY PollIntervalChanged)
Q_PROPERTY(bool IntervalBetweenPolls READ IntervalBetweenPolls WRITE setIntervalBetweenPolls NOTIFY IntervalBetweenPollsChanged)
Q_PROPERTY(bool SuppressValueRefresh READ SuppressValueRefresh WRITE setSuppressValueRefresh NOTIFY SuppressValueRefreshChanged)
Q_PROPERTY(bool PerformReturnRoutes READ PerformReturnRoutes WRITE setPerformReturnRoutes NOTIFY PerformReturnRoutesChanged)
Q_PROPERTY(QString NetworkKey READ NetworkKey WRITE setNetworkKey NOTIFY NetworkKeyChanged)
Q_PROPERTY(bool RefreshAllUserCodes READ RefreshAllUserCodes WRITE setRefreshAllUserCodes NOTIFY RefreshAllUserCodesChanged)
Q_PROPERTY(qint32 RetryTimeout READ RetryTimeout WRITE setRetryTimeout NOTIFY RetryTimeoutChanged)
Q_PROPERTY(bool EnableSIS READ EnableSIS WRITE setEnableSIS NOTIFY EnableSISChanged)
Q_PROPERTY(bool AssumeAwake READ AssumeAwake WRITE setAssumeAwake NOTIFY AssumeAwakeChanged)
Q_PROPERTY(bool NotifyOnDriverUnload READ NotifyOnDriverUnload WRITE setNotifyOnDriverUnload NOTIFY NotifyOnDriverUnloadChanged)
Q_PROPERTY(QString SecurityStrategy READ SecurityStrategy WRITE setSecurityStrategy NOTIFY SecurityStrategyChanged)
Q_PROPERTY(QString CustomSecuredCC READ CustomSecuredCC WRITE setCustomSecuredCC NOTIFY CustomSecuredCCChanged)
Q_PROPERTY(bool EnforceSecureReception READ EnforceSecureReception WRITE setEnforceSecureReception NOTIFY EnforceSecureReceptionChanged)
Q_PROPERTY(bool AutoUpdateConfigFile READ AutoUpdateConfigFile WRITE setAutoUpdateConfigFile NOTIFY AutoUpdateConfigFileChanged)
Q_PROPERTY(QString ReloadAfterUpdate READ ReloadAfterUpdate WRITE setReloadAfterUpdate NOTIFY ReloadAfterUpdateChanged)
Q_PROPERTY(QString Language READ Language WRITE setLanguage NOTIFY LanguageChanged)
Q_PROPERTY(bool IncludeInstanceLabels READ IncludeInstanceLabels WRITE setIncludeInstanceLabels NOTIFY IncludeInstanceLabelsChanged)
QString ConfigPath() const;
QString UserPath() const;
bool Logging() const;
QString LogFileName() const;
bool AppendLogFile() const;
bool ConsoleOutput() const;
qint32 SaveLogLevel() const;
qint32 QueueLogLevel() const;
qint32 DumpTriggerLevel() const;
bool Associate() const;
QString Exclude() const;
QString Include() const;
bool NotifyTransactions() const;
QString Interface() const;
bool SaveConfiguration() const;
qint32 DriverMaxAttempts() const;
qint32 PollInterval() const;
bool SuppressValueRefresh() const;
bool IntervalBetweenPolls() const;
bool PerformReturnRoutes() const ;
QString NetworkKey() const;
bool RefreshAllUserCodes() const;
qint32 RetryTimeout() const;
bool EnableSIS() const;
bool AssumeAwake() const;
bool NotifyOnDriverUnload() const;
QString SecurityStrategy() const;
QString CustomSecuredCC() const;
bool EnforceSecureReception() const;
bool AutoUpdateConfigFile() const;
QString ReloadAfterUpdate() const;
QString Language() const;
bool IncludeInstanceLabels() const;
void setConfigPath(QString ConfigPath);
void setUserPath(QString UserPath);
void setLogging(bool Logging);
void setLogFileName(QString LogFileName);
void setAppendLogFile(bool AppendLogFile);
void setConsoleOutput(bool ConsoleOutput);
void setSaveLogLevel(qint32 SaveLogLevel);
void setQueueLogLevel(qint32 QueueLogLevel);
void setDumpTriggerLevel(qint32 DumpTriggerLevel);
void setAssociate(bool Associate);
void setExclude(QString Exclude);
void setInclude(QString Include);
void setNotifyTransactions(bool NotifyTransactions);
void setInterface(QString Interface);
void setSaveConfiguration(bool SaveConfiguration);
void setDriverMaxAttempts(qint32 DriverMaxAttempts);
void setPollInterval(qint32 PollInterval);
void setIntervalBetweenPolls(bool IntervalBetweenPolls);
void setSuppressValueRefresh(bool SuppressValueRefresh);
void setPerformReturnRoutes(bool PerformReturnRoutes);
void setNetworkKey(QString NetworkKey);
void setRefreshAllUserCodes(bool RefreshAllUserCodes);
void setRetryTimeout(qint32 RetryTimeout);
void setEnableSIS(bool EnableSIS);
void setAssumeAwake(bool AssumeAwake);
void setNotifyOnDriverUnload(bool NotifyOnDriverUnload);
void setSecurityStrategy(QString SecurityStrategy);
void setCustomSecuredCC(QString CustomSecuredCC);
void setEnforceSecureReception(bool EnforceSecureReception);
void setAutoUpdateConfigFile(bool AutoUpdateConfigFile);
void setReloadAfterUpdate(QString ReloadAfterUpdate);
void setLanguage(QString Language);
void setIncludeInstanceLabels(bool IncludeInstanceLabels);
bool initilizeBase();
bool initilizeSource(QRemoteObjectHost *m_sourceNode);
bool initilizeReplica(QRemoteObjectNode *m_replicaNode);
bool AddOptionBool(QString option, bool value);
bool AddOptionInt(QString option, qint32 value);
bool AddOptionString(QString option, QString value);
bool GetOptionAsBool(QString option);
qint32 GetOptionAsInt(QString option);
QString GetOptionAsString(QString option);
Q_SIGNALS:
void ConfigPathChanged(QString ConfigPath);
void UserPathChanged(QString UserPath);
void LoggingChanged(bool Logging);
void LogFileNameChanged(QString LogFileName);
void AppendLogFileChanged(bool AppendLogFile);
void ConsoleOutputChanged(bool ConsoleOutput);
void SaveLogLevelChanged(qint32 SaveLogLevel);
void QueueLogLevelChanged(qint32 QueueLogLevel);
void DumpTriggerLevelChanged(qint32 DumpTriggerLevel);
void AssociateChanged(bool Associate);
void ExcludeChanged(QString Exclude);
void IncludeChanged(QString Include);
void NotifyTransactionsChanged(bool NotifyTransactions);
void InterfaceChanged(QString Interface);
void SaveConfigurationChanged(bool SaveConfiguration);
void DriverMaxAttemptsChanged(qint32 DriverMaxAttempts);
void PollIntervalChanged(qint32 PollInterval);
void IntervalBetweenPollsChanged(bool IntervalBetweenPolls);
void SuppressValueRefreshChanged(bool SuppressValueRefresh);
void PerformReturnRoutesChanged(bool PerformReturnRoutes);
void NetworkKeyChanged(QString NetworkKey);
void RefreshAllUserCodesChanged(bool RefreshAllUserCodes);
void RetryTimeoutChanged(qint32 RetryTimeout);
void EnableSISChanged(bool EnableSIS);
void AssumeAwakeChanged(bool AssumeAwake);
void NotifyOnDriverUnloadChanged(bool NotifyOnDriverUnload);
void SecurityStrategyChanged(QString SecurityStrategy);
void CustomSecuredCCChanged(QString CustomSecuredCC);
void EnforceSecureReceptionChanged(bool EnforceSecureReception);
void AutoUpdateConfigFileChanged(bool AutoUpdateConfigFile);
void ReloadAfterUpdateChanged(QString ReloadAfterUpdate);
void LanguageChanged(QString Language);
void IncludeInstanceLabelsChanged(bool IncludeInstanceLabels);
//void error(QTOZWOptionsReplica::QTOZWOptionsErrorCodes errorcode);
private Q_SLOTS:
void onOptionStateChange(QRemoteObjectReplica::State);
private:
void connectSignals();
QTOZWOptions_Internal *d_ptr_internal;
QTOZWOptionsReplica *d_ptr_replica;
connectionType m_connectionType;
QRemoteObjectReplica::State m_optionState;
};
#endif // QTOZWOPTIONS_H

View file

@ -0,0 +1,54 @@
#include <QtCore>
#include <QByteArray>
#include "qt-openzwave/qtozw_pods.h"
class QTOZWOptions {
ENUM QTOZWOptionsErrorCodes {
InvalidOption,
NoOptionClass,
NoError
};
PROP(QString ConfigPath READWRITE)
PROP(QString UserPath READWRITE)
PROP(bool Logging READWRITE)
PROP(QString LogFileName READWRITE)
PROP(bool AppendLogFile READWRITE)
PROP(bool ConsoleOutput READWRITE)
PROP(qint32 SaveLogLevel READWRITE)
PROP(qint32 QueueLogLevel READWRITE)
PROP(qint32 DumpTriggerLevel READWRITE)
PROP(bool Associate READWRITE)
PROP(QString Exclude READWRITE)
PROP(QString Include READWRITE)
PROP(bool NotifyTransactions READWRITE)
PROP(QString Interface READWRITE)
PROP(bool SaveConfiguration READWRITE)
PROP(qint32 DriverMaxAttempts READWRITE)
PROP(qint32 PollInterval READWRITE)
PROP(bool IntervalBetweenPolls READWRITE)
PROP(bool SuppressValueRefresh READWRITE)
PROP(bool PerformReturnRoutes READWRITE)
PROP(QString NetworkKey READWRITE)
PROP(bool RefreshAllUserCodes READWRITE)
PROP(qint32 RetryTimeout READWRITE)
PROP(bool EnableSIS READWRITE)
PROP(bool AssumeAwake READWRITE)
PROP(bool NotifyOnDriverUnload READWRITE)
PROP(QString SecurityStrategy READWRITE)
PROP(QString CustomSecuredCC READWRITE)
PROP(bool EnforceSecureReception READWRITE)
PROP(bool AutoUpdateConfigFile READWRITE)
PROP(QString ReloadAfterUpdate READWRITE)
PROP(QString Language READWRITE)
PROP(bool IncludeInstanceLabels READWRITE)
SIGNAL(error(QTOZWOptionsErrorCodes errorcode))
SLOT(bool AddOptionBool(QString option, bool value))
SLOT(bool AddOptionInt(QString option, qint32 value))
SLOT(bool AddOptionString(QString option, QString value))
SLOT(bool GetOptionAsBool(QString option))
SLOT(qint32 GetOptionAsInt(QString option))
SLOT(QString GetOptionAsString(QString option))
}

View file

@ -8,13 +8,13 @@
#include "rep_qtozwmanager_replica.h" #include "rep_qtozwmanager_replica.h"
#include "qtozwnotification.h" #include "qtozwnotification.h"
#include "qt-openzwave/qtozwmanager.h" #include "qt-openzwave/qtozwmanager.h"
#include "qtozwoptions_p.h"
#include "qtozwnodemodel_p.h" #include "qtozwnodemodel_p.h"
#include "qtozwvalueidmodel_p.h" #include "qtozwvalueidmodel_p.h"
#include "qtozwassociationmodel_p.h" #include "qtozwassociationmodel_p.h"
/* OZW Includes */ /* OZW Includes */
#include "Manager.h" #include "Manager.h"
#include "Options.h"
#include "Notification.h" #include "Notification.h"
#include "platform/Log.h" #include "platform/Log.h"
#include "OZWException.h" #include "OZWException.h"
@ -30,6 +30,7 @@ public:
QTOZW_Nodes *getNodeModel(); QTOZW_Nodes *getNodeModel();
QTOZW_ValueIds *getValueModel(); QTOZW_ValueIds *getValueModel();
QTOZW_Associations *getAssociationModel(); QTOZW_Associations *getAssociationModel();
QTOZWOptions_Internal *getOptions();
public Q_SLOTS: public Q_SLOTS:
bool open(QString serialPort); bool open(QString serialPort);
@ -114,7 +115,7 @@ private:
bool convertValueID(quint64 vidKey); bool convertValueID(quint64 vidKey);
OpenZWave::Options *m_options; QTOZWOptions_Internal *m_options;
OpenZWave::Manager *m_manager; OpenZWave::Manager *m_manager;
QTOZW_Nodes_internal *m_nodeModel; QTOZW_Nodes_internal *m_nodeModel;
QTOZW_ValueIds_internal *m_valueModel; QTOZW_ValueIds_internal *m_valueModel;

View file

@ -0,0 +1,67 @@
#ifndef QTOZWOPTIONS_P_H
#define QTOZWOPTIONS_P_H
#include <QObject>
#include <QUrl>
#include <Options.h>
#include "qtozw_logging.h"
#include "rep_qtozwoptions_source.h"
#include "rep_qtozwoptions_replica.h"
class QTOZWOptions_Internal : public QTOZWOptionsSimpleSource
{
Q_OBJECT
public:
QTOZWOptions_Internal(QObject *parent = nullptr);
public Q_SLOTS:
bool AddOptionBool(QString option, bool value);
bool AddOptionInt(QString option, qint32 value);
bool AddOptionString(QString option, QString value);
bool GetOptionAsBool(QString option);
qint32 GetOptionAsInt(QString option);
QString GetOptionAsString(QString option);
private Q_SLOTS:
void pvt_ConfigPathChanged(QString value);
void pvt_UserPathChanged(QString value);
void pvt_LoggingChanged(bool value);
void pvt_LogFileNameChanged(QString value);
void pvt_AppendLogFileChanged(bool value);
void pvt_ConsoleOutputChanged(bool value);
void pvt_SaveLogLevelChanged(qint32 value);
void pvt_QueueLogLevelChanged(qint32 value);
void pvt_DumpTriggerLevelChanged(qint32 value);
void pvt_AssociateChanged(bool value);
void pvt_ExcludeChanged(QString value);
void pvt_IncludeChanged(QString value);
void pvt_NotifyTransactionChanged(bool value);
void pvt_InterfaceChanged(QString value);
void pvt_SaveConfigurationChanged(bool value);
void pvt_DriverMaxAttemptsChanged(qint32 value);
void pvt_PollIntervalChanged(qint32 value);
void pvt_IntervalBetweenPollsChanged(bool value);
void pvt_SuppressValueRefreshChanged(bool value);
void pvt_PerformReturnRoutesChanged(bool value);
void pvt_NetworkKeyChanged(QString value);
void pvt_RefreshAllUserCodesChanged(bool value);
void pvt_RetryTimeoutChanged(qint32 value);
void pvt_EnableSISChanged(bool value);
void pvt_AssumeAwakeChanged(bool value);
void pvt_NotifyOnDriverUnloadChanged(bool value);
void pvt_SecurityStrategyChanged(QString value);
void pvt_CustomSecuredCCChanged(QString value);
void pvt_EnforceSecureReceptionChanged(bool value);
void pvt_AutoUpdateConfigFileChanged(bool value);
void pvt_ReloadAfterUpdateChanged(QString value);
void pvt_LanguageChanged(QString value);
void pvt_IncludeInstanceLabelsChanged(bool value);
private:
bool populateProperties();
bool m_updating;
OpenZWave::Options *m_options;
};
#endif // QTOZWOPTIONS_P_H

View file

@ -6,7 +6,7 @@
QT -= gui QT -= gui
QT += remoteobjects QT += remoteobjects testlib
#QT += websockets #QT += websockets
TEMPLATE = lib TEMPLATE = lib
@ -39,6 +39,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += source/qtopenzwave.cpp \ SOURCES += source/qtopenzwave.cpp \
source/qtozwoptions.cpp \
source/qtozwoptions_p.cpp \
source/qt_pods.cpp \ source/qt_pods.cpp \
source/qtozwassociationmodel.cpp \ source/qtozwassociationmodel.cpp \
source/qtozwassociationmodel_p.cpp \ source/qtozwassociationmodel_p.cpp \
@ -53,6 +55,8 @@ SOURCES += source/qtopenzwave.cpp \
HEADERS += include/qt-openzwave/qtopenzwave.h \ HEADERS += include/qt-openzwave/qtopenzwave.h \
include/qt-openzwave/qtozw_pods.h \ include/qt-openzwave/qtozw_pods.h \
include/qt-openzwave/qtozwoptions.h \
include/qtozwoptions_p.h \
include/qt-openzwave_global.h \ \ include/qt-openzwave_global.h \ \
include/qtozw_logging.h \ include/qtozw_logging.h \
include/qt-openzwave/qtozwassociationmodel.h \ include/qt-openzwave/qtozwassociationmodel.h \
@ -68,12 +72,13 @@ HEADERS += include/qt-openzwave/qtopenzwave.h \
INCLUDEPATH += include/ INCLUDEPATH += include/
REPC_SOURCE = include/qt-openzwave/qtozwmanager.rep REPC_SOURCE = include/qt-openzwave/qtozwmanager.rep include/qt-openzwave/qtozwoptions.rep
REPC_REPLICA = include/qt-openzwave/qtozwmanager.rep
REPC_REPLICA = include/qt-openzwave/qtozwmanager.rep include/qt-openzwave/qtozwoptions.rep
copyrepheaders.path = include/qt-openzwave/ copyrepheaders.path = include/qt-openzwave/
copyrepheaders.files = rep_qtozwmanager_replica.h rep_qtozwmanager_source.h copyrepheaders.files = rep_qtozwmanager_replica.h rep_qtozwmanager_source.h rep_qtozwoptions_replica.h rep_qtozwoptions_source.h
copyrepheaders.depends = rep_qtozwmanager_replica.h rep_qtozwmanager_source.h copyrepheaders.depends = rep_qtozwmanager_replica.h rep_qtozwmanager_source.h rep_qtozwoptions_replica.h rep_qtozwoptions_source.h
COPIES += copyrepheaders COPIES += copyrepheaders
unix { unix {
@ -92,7 +97,6 @@ macx {
FRAMEWORK_HEADERS.path = Headers FRAMEWORK_HEADERS.path = Headers
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
CONFIG +=lib_bundle CONFIG +=lib_bundle
} }

View file

@ -12,10 +12,14 @@ Q_LOGGING_CATEGORY(notifications, "ozw.notifications");
QTOpenZwave::QTOpenZwave QTOpenZwave::QTOpenZwave
( (
QObject *parent QObject *parent,
QDir DBPath,
QDir UserPath
) : ) :
QObject (parent), QObject (parent),
m_manager(nullptr) m_manager(nullptr),
m_ozwdbpath(DBPath),
m_ozwuserpath(UserPath)
{ {
//qRegisterMetaType<uint32_t>("uint32_t"); //qRegisterMetaType<uint32_t>("uint32_t");
qRegisterMetaType<QTOZW_ValueIDList>("QTOZW_ValueIDList"); qRegisterMetaType<QTOZW_ValueIDList>("QTOZW_ValueIDList");
@ -34,6 +38,8 @@ QTOZWManager *QTOpenZwave::GetManager
{ {
if (m_manager == nullptr) { if (m_manager == nullptr) {
this->m_manager = new QTOZWManager(this); this->m_manager = new QTOZWManager(this);
this->m_manager->setOZWDatabasePath(m_ozwdbpath);
this->m_manager->setOZWUserPath(m_ozwuserpath);
} }
return this->m_manager; return this->m_manager;
} }

View file

@ -9,8 +9,9 @@
QTOZWManager::QTOZWManager(QObject *parent) QTOZWManager::QTOZWManager(QObject *parent)
: QObject(parent), : QObject(parent),
m_running(false) m_running(false),
m_ozwdatabasepath(""),
m_ozwuserpath("")
{ {
} }
@ -21,12 +22,22 @@ bool QTOZWManager::initilizeBase() {
bool QTOZWManager::initilizeSource(bool enableServer) { bool QTOZWManager::initilizeSource(bool enableServer) {
initilizeBase(); initilizeBase();
this->m_connectionType = connectionType::Local; this->m_connectionType = connectionType::Local;
if (!this->m_ozwdatabasepath.exists()) {
qCWarning(manager) << "Database Path Does Not Exist: " << this->m_ozwdatabasepath;
return false;
}
if (!this->m_ozwuserpath.exists()) {
qCWarning(manager) << "User Path Does Not Exist: " << this->m_ozwuserpath;
return false;
}
OpenZWave::Options::Create(this->m_ozwdatabasepath.path().toStdString(), this->m_ozwuserpath.path().toStdString(), "");
this->d_ptr_internal = new QTOZWManager_Internal(this); this->d_ptr_internal = new QTOZWManager_Internal(this);
if (enableServer) { if (enableServer) {
this->m_sourceNode = new QRemoteObjectHost(QUrl(QStringLiteral("tcp://0.0.0.0:1983")), this); this->m_sourceNode = new QRemoteObjectHost(QUrl(QStringLiteral("tcp://0.0.0.0:1983")), this);
QObject::connect(this->m_sourceNode, &QRemoteObjectHost::error, this, &QTOZWManager::onSourceError); QObject::connect(this->m_sourceNode, &QRemoteObjectHost::error, this, &QTOZWManager::onSourceError);
//this->m_sourceNode->setHeartbeatInterval(1000); //this->m_sourceNode->setHeartbeatInterval(1000);
this->m_sourceNode->enableRemoting<QTOZWManagerSourceAPI>(this->d_ptr_internal); this->m_sourceNode->enableRemoting<QTOZWManagerSourceAPI>(this->d_ptr_internal);
this->m_sourceNode->enableRemoting<QTOZWOptionsSourceAPI>(this->d_ptr_internal->getOptions());
QVector<int> roles; QVector<int> roles;
roles << Qt::DisplayRole << Qt::EditRole << Qt::ToolTipRole; roles << Qt::DisplayRole << Qt::EditRole << Qt::ToolTipRole;
this->m_sourceNode->enableRemoting(this->d_ptr_internal->getNodeModel(), "QTOZW_nodeModel", roles); this->m_sourceNode->enableRemoting(this->d_ptr_internal->getNodeModel(), "QTOZW_nodeModel", roles);
@ -46,6 +57,8 @@ bool QTOZWManager::initilizeReplica(QUrl remote) {
if (this->m_replicaNode->connectToNode(remote)) { if (this->m_replicaNode->connectToNode(remote)) {
this->d_ptr_replica = this->m_replicaNode->acquire<QTOZWManagerReplica>("QTOZWManager"); this->d_ptr_replica = this->m_replicaNode->acquire<QTOZWManagerReplica>("QTOZWManager");
QObject::connect(this->d_ptr_replica, &QTOZWManagerReplica::stateChanged, this, &QTOZWManager::onManagerStateChange); QObject::connect(this->d_ptr_replica, &QTOZWManagerReplica::stateChanged, this, &QTOZWManager::onManagerStateChange);
this->d_options_replica = this->m_replicaNode->acquire<QTOZWOptionsReplica>("QTOZWOptions");
QObject::connect(this->d_options_replica, &QTOZWOptionsReplica::stateChanged, this, &QTOZWManager::onOptionsStateChange);
this->m_nodeModel = this->m_replicaNode->acquireModel("QTOZW_nodeModel", QtRemoteObjects::InitialAction::PrefetchData); this->m_nodeModel = this->m_replicaNode->acquireModel("QTOZW_nodeModel", QtRemoteObjects::InitialAction::PrefetchData);
QObject::connect(qobject_cast<QAbstractItemModelReplica*>(this->m_nodeModel), &QAbstractItemModelReplica::initialized, this, &QTOZWManager::onNodeInitialized); QObject::connect(qobject_cast<QAbstractItemModelReplica*>(this->m_nodeModel), &QAbstractItemModelReplica::initialized, this, &QTOZWManager::onNodeInitialized);
this->m_valueModel= this->m_replicaNode->acquireModel("QTOZW_valueModel", QtRemoteObjects::InitialAction::PrefetchData); this->m_valueModel= this->m_replicaNode->acquireModel("QTOZW_valueModel", QtRemoteObjects::InitialAction::PrefetchData);
@ -70,6 +83,12 @@ void QTOZWManager::onManagerStateChange(QRemoteObjectReplica::State state) {
this->m_managerState = state; this->m_managerState = state;
this->checkReplicaReady(); this->checkReplicaReady();
} }
void QTOZWManager::onOptionsStateChange(QRemoteObjectReplica::State state) {
this->m_optionsState = state;
this->checkReplicaReady();
}
void QTOZWManager::onNodeInitialized() { void QTOZWManager::onNodeInitialized() {
this->m_nodeState = true; this->m_nodeState = true;
this->checkReplicaReady(); this->checkReplicaReady();
@ -85,9 +104,10 @@ void QTOZWManager::onAssociationInitialized() {
void QTOZWManager::checkReplicaReady() { void QTOZWManager::checkReplicaReady() {
if ((this->m_managerState == QRemoteObjectReplica::State::Valid) && if ((this->m_managerState == QRemoteObjectReplica::State::Valid) &&
(this->m_nodeState == true) && (this->m_optionsState == QRemoteObjectReplica::State::Valid) &&
(this->m_valuesState == true) && (this->m_nodeState == true) &&
(this->m_associationsState == true)) { (this->m_valuesState == true) &&
(this->m_associationsState == true)) {
/* have to connect all the d_ptr SIGNALS to our SIGNALS now */ /* have to connect all the d_ptr SIGNALS to our SIGNALS now */
connectSignals(); connectSignals();
emit this->ready(); emit this->ready();
@ -299,3 +319,18 @@ bool QTOZWManager::downloadLatestConfigFileRevision(quint8 const _node) {
bool QTOZWManager::downloadLatestMFSRevision() { bool QTOZWManager::downloadLatestMFSRevision() {
CALL_DPTR_RTN(downloadLatestMFSRevision(), bool); CALL_DPTR_RTN(downloadLatestMFSRevision(), bool);
} }
void QTOZWManager::setOZWDatabasePath(QDir path) {
if (path.exists())
this->m_ozwdatabasepath = path;
else
qCWarning(manager) << "Database Path " << path << " doesn't exist";
}
void QTOZWManager::setOZWUserPath(QDir path) {
if (path.exists())
this->m_ozwuserpath = path;
else
qCWarning(manager) << "User Path " << path << " doesn't exist";
}

View file

@ -23,22 +23,13 @@ QTOZWManager_Internal::QTOZWManager_Internal(QObject *parent)
{ {
this->setObjectName("QTOZW_Manager"); this->setObjectName("QTOZW_Manager");
try { try {
this->m_options = OpenZWave::Options::Create( "", "", "" ); qCDebug(manager) << "OpenZWave Options Class Creating";
this->m_options = new QTOZWOptions_Internal(this);
qCDebug(manager) << "OpenZWave Options Class Set";
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(manager) << "Failed to Load Options Class" << QString(e.GetMsg().c_str()); qCWarning(manager) << "Failed to Load Options Class" << QString(e.GetMsg().c_str());
return; return;
} }
qCDebug(manager) << "OpenZWave Options Class Created";
this->m_options->AddOptionInt( "SaveLogLevel", OpenZWave::LogLevel_Detail );
this->m_options->AddOptionInt( "QueueLogLevel", OpenZWave::LogLevel_Debug );
this->m_options->AddOptionInt( "DumpTrigger", OpenZWave::LogLevel_Error );
this->m_options->AddOptionBool("ConsoleOutput", false);
this->m_options->AddOptionInt( "PollInterval", 500 );
this->m_options->AddOptionBool( "IntervalBetweenPolls", true );
this->m_options->AddOptionBool( "ValidateValueChanges", true);
qCDebug(manager) << "OpenZWave Options Set";
this->m_nodeModel = new QTOZW_Nodes_internal(this); this->m_nodeModel = new QTOZW_Nodes_internal(this);
QObject::connect(this->m_nodeModel, &QTOZW_Nodes_internal::dataChanged, this, &QTOZWManager_Internal::pvt_nodeModelDataChanged); QObject::connect(this->m_nodeModel, &QTOZW_Nodes_internal::dataChanged, this, &QTOZWManager_Internal::pvt_nodeModelDataChanged);
this->m_valueModel = new QTOZW_ValueIds_internal(this); this->m_valueModel = new QTOZW_ValueIds_internal(this);
@ -56,7 +47,7 @@ bool QTOZWManager_Internal::open(QString SerialPort)
try { try {
this->m_manager = OpenZWave::Manager::Create(); this->m_manager = OpenZWave::Manager::Create();
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
qCWarning(manager) << "Failed to Load Manager Class" << QString(e.GetMsg().c_str()); qCWarning(manager) << "Failed to Load Manager Class" << QString(e.GetMsg().c_str());
return false; return false;
@ -64,13 +55,13 @@ bool QTOZWManager_Internal::open(QString SerialPort)
qCDebug(manager) << "OpenZWave Manager Instance Created"; qCDebug(manager) << "OpenZWave Manager Instance Created";
try { try {
if (this->m_manager->AddWatcher( OZWNotification::processNotification, this ) != true) { if (this->m_manager->AddWatcher( OZWNotification::processNotification, this ) != true) {
emit this->error(QTOZWErrorCodes::setupFailed); emit this->error(QTOZWManagerErrorCodes::setupFailed);
this->setErrorString("Failed to Add Notification Callback"); this->setErrorString("Failed to Add Notification Callback");
qCWarning(manager) << "Failed to Add Notification Callback"; qCWarning(manager) << "Failed to Add Notification Callback";
return false; return false;
} }
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
qCWarning(manager) << "Failed to Add Notification Callback " << QString(e.GetMsg().c_str()); qCWarning(manager) << "Failed to Add Notification Callback " << QString(e.GetMsg().c_str());
return false; return false;
@ -113,13 +104,13 @@ bool QTOZWManager_Internal::open(QString SerialPort)
try { try {
if (this->m_manager->AddDriver( SerialPort.toStdString()) != true) { if (this->m_manager->AddDriver( SerialPort.toStdString()) != true) {
emit this->error(QTOZWErrorCodes::setupFailed); emit this->error(QTOZWManagerErrorCodes::setupFailed);
this->setErrorString("Failed to Add Serial Port"); this->setErrorString("Failed to Add Serial Port");
qCWarning(manager) << "Failed to Add Serial Port"; qCWarning(manager) << "Failed to Add Serial Port";
return false; return false;
} }
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
qCWarning(manager) << "Failed to Add Serial Port: " << QString(e.GetMsg().c_str()); qCWarning(manager) << "Failed to Add Serial Port: " << QString(e.GetMsg().c_str());
return false; return false;
@ -135,7 +126,7 @@ bool QTOZWManager_Internal::refreshNodeInfo(quint8 _node) {
try { try {
return this->m_manager->RefreshNodeInfo(this->homeId(), _node); return this->m_manager->RefreshNodeInfo(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -147,7 +138,7 @@ bool QTOZWManager_Internal::requestNodeState(quint8 _node) {
try { try {
return this->m_manager->RequestNodeState(this->homeId(), _node); return this->m_manager->RequestNodeState(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -159,7 +150,7 @@ bool QTOZWManager_Internal::requestNodeDynamic(quint8 _node) {
try { try {
return this->m_manager->RequestNodeDynamic(this->homeId(), _node); return this->m_manager->RequestNodeDynamic(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -171,7 +162,7 @@ bool QTOZWManager_Internal::setConfigParam(quint8 _node, quint8 _param, qint32 _
try { try {
return this->m_manager->SetConfigParam(this->homeId(), _node, _param, _value, _size); return this->m_manager->SetConfigParam(this->homeId(), _node, _param, _value, _size);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -183,7 +174,7 @@ void QTOZWManager_Internal::requestConfigParam(quint8 _node, quint8 _param) {
try { try {
this->m_manager->RequestConfigParam(this->homeId(), _node, _param); this->m_manager->RequestConfigParam(this->homeId(), _node, _param);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -195,7 +186,7 @@ void QTOZWManager_Internal::requestAllConfigParam(quint8 _node) {
try { try {
this->m_manager->RequestAllConfigParams(this->homeId(), _node); this->m_manager->RequestAllConfigParams(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -207,7 +198,7 @@ void QTOZWManager_Internal::softResetController() {
try { try {
this->m_manager->SoftReset(this->homeId()); this->m_manager->SoftReset(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -220,7 +211,7 @@ void QTOZWManager_Internal::hardResetController() {
try { try {
this->m_manager->ResetController(this->homeId()); this->m_manager->ResetController(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -233,7 +224,7 @@ bool QTOZWManager_Internal::cancelControllerCommand() {
try { try {
return this->m_manager->CancelControllerCommand(this->homeId()); return this->m_manager->CancelControllerCommand(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -245,7 +236,7 @@ void QTOZWManager_Internal::testNetworkNode(quint8 _node, quint32 const _count)
try { try {
this->m_manager->TestNetworkNode(this->homeId(), _node, _count); this->m_manager->TestNetworkNode(this->homeId(), _node, _count);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -256,7 +247,7 @@ void QTOZWManager_Internal::testNetwork(quint32 const _count) {
try { try {
this->m_manager->TestNetwork(this->homeId(), _count); this->m_manager->TestNetwork(this->homeId(), _count);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -267,7 +258,7 @@ void QTOZWManager_Internal::healNetworkNode(quint8 _node, bool _doRR) {
try { try {
this->m_manager->HealNetworkNode(this->homeId(), _node, _doRR); this->m_manager->HealNetworkNode(this->homeId(), _node, _doRR);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -278,7 +269,7 @@ void QTOZWManager_Internal::healNetwork(bool _doRR) {
try { try {
this->m_manager->HealNetwork(this->homeId(), _doRR); this->m_manager->HealNetwork(this->homeId(), _doRR);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return; return;
@ -289,7 +280,7 @@ bool QTOZWManager_Internal::addNode(bool _doSecure) {
try { try {
return this->m_manager->AddNode(this->homeId(), _doSecure); return this->m_manager->AddNode(this->homeId(), _doSecure);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -300,7 +291,7 @@ bool QTOZWManager_Internal::removeNode() {
try { try {
return this->m_manager->RemoveNode(this->homeId()); return this->m_manager->RemoveNode(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -311,7 +302,7 @@ bool QTOZWManager_Internal::removeFailedNode(quint8 _node) {
try { try {
return this->m_manager->RemoveFailedNode(this->homeId(), _node); return this->m_manager->RemoveFailedNode(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -322,7 +313,7 @@ bool QTOZWManager_Internal::hasNodeFailed(quint8 _node) {
try { try {
return this->m_manager->HasNodeFailed(this->homeId(), _node); return this->m_manager->HasNodeFailed(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -333,7 +324,7 @@ bool QTOZWManager_Internal::requestNodeNeighborUpdate(quint8 _node) {
try { try {
return this->m_manager->RequestNodeNeighborUpdate(this->homeId(), _node); return this->m_manager->RequestNodeNeighborUpdate(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -344,7 +335,7 @@ bool QTOZWManager_Internal::assignReturnRoute(quint8 _node) {
try { try {
return this->m_manager->AssignReturnRoute(this->homeId(), _node); return this->m_manager->AssignReturnRoute(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -355,7 +346,7 @@ bool QTOZWManager_Internal::deleteAllReturnRoute(quint8 _node) {
try { try {
return this->m_manager->DeleteAllReturnRoutes(this->homeId(), _node); return this->m_manager->DeleteAllReturnRoutes(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -366,7 +357,7 @@ bool QTOZWManager_Internal::sendNodeInfomation(quint8 _node) {
try { try {
return this->m_manager->SendNodeInformation(this->homeId(), _node); return this->m_manager->SendNodeInformation(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -377,7 +368,7 @@ bool QTOZWManager_Internal::replaceFailedNode(quint8 _node) {
try { try {
return this->m_manager->ReplaceFailedNode(this->homeId(), _node); return this->m_manager->ReplaceFailedNode(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -388,7 +379,7 @@ bool QTOZWManager_Internal::requestNetworkUpdate(quint8 _node) {
try { try {
return this->m_manager->RequestNetworkUpdate(this->homeId(), _node); return this->m_manager->RequestNetworkUpdate(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -400,7 +391,7 @@ QString QTOZWManager_Internal::GetMetaData(quint8 _node, QTOZWMetaDataField _fie
try { try {
return QString::fromStdString(this->m_manager->GetMetaData(this->homeId(), _node, static_cast<OpenZWave::Node::MetaDataFields>(_field))); return QString::fromStdString(this->m_manager->GetMetaData(this->homeId(), _node, static_cast<OpenZWave::Node::MetaDataFields>(_field)));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return QString(); return QString();
@ -418,7 +409,7 @@ QByteArray QTOZWManager_Internal::GetMetaDataProductPic(quint8 _node) {
if (!file.open(QIODevice::ReadOnly)) return QByteArray(); if (!file.open(QIODevice::ReadOnly)) return QByteArray();
return file.readAll(); return file.readAll();
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return QByteArray(); return QByteArray();
@ -432,7 +423,7 @@ QString QTOZWManager_Internal::GetNodeQueryStage(quint8 const _node) {
try { try {
return this->m_manager->GetNodeQueryStage(this->homeId(), _node).c_str(); return this->m_manager->GetNodeQueryStage(this->homeId(), _node).c_str();
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return QString(); return QString();
@ -482,7 +473,7 @@ NodeStatistics QTOZWManager_Internal::GetNodeStatistics(quint8 const _node) {
ns.lastReceivedTimeStamp = nd.m_receivedTS.c_str(); ns.lastReceivedTimeStamp = nd.m_receivedTS.c_str();
return ns; return ns;
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return NodeStatistics(); return NodeStatistics();
@ -495,7 +486,7 @@ bool QTOZWManager_Internal::IsNodeFailed(quint8 const _node) {
try { try {
return this->m_manager->IsNodeFailed(this->homeId(), _node); return this->m_manager->IsNodeFailed(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -508,7 +499,7 @@ bool QTOZWManager_Internal::checkLatestConfigFileRevision(quint8 const _node) {
try { try {
return this->m_manager->checkLatestConfigFileRevision(this->homeId(), _node); return this->m_manager->checkLatestConfigFileRevision(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -520,7 +511,7 @@ bool QTOZWManager_Internal::checkLatestMFSRevision() {
try { try {
return this->m_manager->checkLatestMFSRevision(this->homeId()); return this->m_manager->checkLatestMFSRevision(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -532,7 +523,7 @@ bool QTOZWManager_Internal::downloadLatestConfigFileRevision(quint8 const _node)
try { try {
return this->m_manager->downloadLatestConfigFileRevision(this->homeId(), _node); return this->m_manager->downloadLatestConfigFileRevision(this->homeId(), _node);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -544,7 +535,7 @@ bool QTOZWManager_Internal::downloadLatestMFSRevision() {
try { try {
return this->m_manager->downloadLatestMFSRevision(this->homeId()); return this->m_manager->downloadLatestMFSRevision(this->homeId());
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
return false; return false;
@ -562,14 +553,20 @@ QTOZW_Associations *QTOZWManager_Internal::getAssociationModel() {
return static_cast<QTOZW_Associations *>(this->m_associationsModel); return static_cast<QTOZW_Associations *>(this->m_associationsModel);
} }
QTOZWOptions_Internal *QTOZWManager_Internal::getOptions() {
return this->m_options;
}
bool QTOZWManager_Internal::checkHomeId() { bool QTOZWManager_Internal::checkHomeId() {
if (this->m_manager == nullptr) { if (this->m_manager == nullptr) {
emit this->error(QTOZWErrorCodes::Manager_Not_Started); emit this->error(QTOZWManagerErrorCodes::Manager_Not_Started);
this->setErrorString("Manager Not Started"); this->setErrorString("Manager Not Started");
return false; return false;
} }
if (this->homeId() == 0) { if (this->homeId() == 0) {
emit this->error(QTOZWErrorCodes::homeId_Invalid); emit this->error(QTOZWManagerErrorCodes::homeId_Invalid);
this->setErrorString("Invalid homeID"); this->setErrorString("Invalid homeID");
return false; return false;
} }
@ -577,7 +574,7 @@ bool QTOZWManager_Internal::checkHomeId() {
} }
bool QTOZWManager_Internal::checkNodeId(quint8 _node) { bool QTOZWManager_Internal::checkNodeId(quint8 _node) {
if (!this->m_validNodes.contains(_node)) { if (!this->m_validNodes.contains(_node)) {
emit this->error(QTOZWErrorCodes::nodeId_Invalid); emit this->error(QTOZWManagerErrorCodes::nodeId_Invalid);
this->setErrorString("Invalid nodeID"); this->setErrorString("Invalid nodeID");
return false; return false;
} }
@ -586,7 +583,7 @@ bool QTOZWManager_Internal::checkNodeId(quint8 _node) {
bool QTOZWManager_Internal::checkValueKey(quint64 _vidKey) { bool QTOZWManager_Internal::checkValueKey(quint64 _vidKey) {
if (!this->m_validValues.contains(_vidKey)) { if (!this->m_validValues.contains(_vidKey)) {
emit this->error(QTOZWErrorCodes::valueIDKey_Invalid); emit this->error(QTOZWManagerErrorCodes::valueIDKey_Invalid);
this->setErrorString("Invalid ValueID Key"); this->setErrorString("Invalid ValueID Key");
return false; return false;
} }
@ -746,7 +743,7 @@ void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey)
this->convertValueID(vidKey); this->convertValueID(vidKey);
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->valueAdded(vidKey); emit this->valueAdded(vidKey);
@ -839,7 +836,7 @@ void QTOZWManager_Internal::pvt_nodeNew(quint8 node)
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node)); this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
@ -863,7 +860,7 @@ void QTOZWManager_Internal::pvt_nodeAdded(quint8 node)
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node)); this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeAdded(node); emit this->nodeAdded(node);
@ -913,7 +910,7 @@ void QTOZWManager_Internal::pvt_nodeNaming(quint8 node)
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node)); this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeNaming(node); emit this->nodeNaming(node);
@ -930,7 +927,7 @@ void QTOZWManager_Internal::pvt_nodeEvent(quint8 node, quint8 event)
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node)); this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeEvent(node, event); emit this->nodeEvent(node, event);
@ -1004,7 +1001,7 @@ void QTOZWManager_Internal::pvt_nodeProtocolInfo(quint8 node)
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node)); this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeProtocolInfo(node); emit this->nodeProtocolInfo(node);
@ -1081,7 +1078,7 @@ void QTOZWManager_Internal::pvt_nodeEssentialNodeQueriesComplete(quint8 node)
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeEssentialNodeQueriesComplete(node); emit this->nodeEssentialNodeQueriesComplete(node);
@ -1170,7 +1167,7 @@ void QTOZWManager_Internal::pvt_nodeQueriesComplete(quint8 node)
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(notifications) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
emit this->nodeQueriesComplete(node); emit this->nodeQueriesComplete(node);
@ -1272,7 +1269,7 @@ void QTOZWManager_Internal::pvt_nodeModelDataChanged(const QModelIndex &topLeft,
} }
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(nodeModel) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(nodeModel) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
@ -1363,7 +1360,7 @@ void QTOZWManager_Internal::pvt_valueModelDataChanged(const QModelIndex &topLeft
} }
} catch (OpenZWave::OZWException &e) { } catch (OpenZWave::OZWException &e) {
qCWarning(valueModel) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine(); qCWarning(valueModel) << "OZW Exception: " << e.GetMsg().c_str() << " at " << e.GetFile().c_str() <<":" << e.GetLine();
emit this->error(QTOZWErrorCodes::OZWException); emit this->error(QTOZWManagerErrorCodes::OZWException);
this->setErrorString(e.GetMsg().c_str()); this->setErrorString(e.GetMsg().c_str());
} }
} }

View file

@ -0,0 +1,329 @@
#include <QAbstractItemModelReplica>
#include <QSignalSpy>
#include "qt-openzwave/qtozwoptions.h"
#include "qtozwoptions_p.h"
#include "qtozw_logging.h"
#define CONNECT_DPTR(x) if (this->m_connectionType == connectionType::Local) { \
QObject::connect(this->d_ptr_internal, &QTOZWOptions_Internal::x, this, &QTOZWOptions::x);\
} else { \
QObject::connect(this->d_ptr_replica, &QTOZWOptionsReplica::x, this, &QTOZWOptions::x); \
};
#define CONNECT_DPTR1(x, y) if (this->m_connectionType == connectionType::Local) { \
QObject::connect(this->d_ptr_internal, &QTOZWOptions_Internal::x, this, &QTOZWOptions::y);\
} else { \
QObject::connect(this->d_ptr_replica, &QTOZWOptionsReplica::x, this, &QTOZWOptions::y); \
};
#define CALL_DPTR(x) if (this->m_connectionType == QTOZWOptions::connectionType::Local) this->d_ptr_internal->x; else this->d_ptr_replica->x;
#define CALL_DPTR_PROP(x) if (this->m_connectionType == QTOZWOptions::connectionType::Local) return this->d_ptr_internal->x; else return this->d_ptr_replica->x;
#define CALL_DPTR_PROP_SET(x) if (this->m_connectionType == QTOZWOptions::connectionType::Local) { \
this->d_ptr_internal->setProperty("x", x); \
} else { \
QSignalSpy spy(this, SIGNAL(xChanged)); \
this->d_ptr_replica->setProperty("x", x); \
spy.wait(); \
}
#define CALL_DPTR_METHOD_RTN(x, y) if (this->m_connectionType == QTOZWOptions::connectionType::Local) \
return this->d_ptr_internal->x; \
else { \
QRemoteObjectPendingReply<y> res = this->d_ptr_replica->x; \
res.waitForFinished(); \
return res.returnValue(); \
}
QTOZWOptions::QTOZWOptions(QObject *parent)
: QObject(parent)
{
}
bool QTOZWOptions::initilizeBase() {
return true;
}
bool QTOZWOptions::initilizeSource(QRemoteObjectHost *m_sourceNode) {
initilizeBase();
this->m_connectionType = connectionType::Local;
this->d_ptr_internal = new QTOZWOptions_Internal(this);
if (m_sourceNode) {
m_sourceNode->enableRemoting<QTOZWOptionsSourceAPI>(this->d_ptr_internal);
}
return true;
}
bool QTOZWOptions::initilizeReplica(QRemoteObjectNode *m_replicaNode) {
initilizeBase();
this->m_connectionType = connectionType::Remote;
this->d_ptr_replica = m_replicaNode->acquire<QTOZWOptionsReplica>("QTOZW_Options");
QObject::connect(this->d_ptr_replica, &QTOZWOptionsReplica::stateChanged, this, &QTOZWOptions::onOptionStateChange);
return true;
}
void QTOZWOptions::onOptionStateChange(QRemoteObjectReplica::State state) {
if (state == QRemoteObjectReplica::State::Valid) {
connectSignals();
}
}
void QTOZWOptions::connectSignals() {
CONNECT_DPTR(ConfigPathChanged);
CONNECT_DPTR(UserPathChanged);
CONNECT_DPTR(LoggingChanged);
CONNECT_DPTR(LogFileNameChanged);
CONNECT_DPTR(AppendLogFileChanged);
CONNECT_DPTR(ConsoleOutputChanged);
CONNECT_DPTR(SaveLogLevelChanged);
CONNECT_DPTR(QueueLogLevelChanged);
CONNECT_DPTR(DumpTriggerLevelChanged);
CONNECT_DPTR(AssociateChanged);
CONNECT_DPTR(ExcludeChanged);
CONNECT_DPTR(IncludeChanged);
CONNECT_DPTR(NotifyTransactionsChanged);
CONNECT_DPTR(InterfaceChanged);
CONNECT_DPTR(SaveConfigurationChanged);
CONNECT_DPTR(DriverMaxAttemptsChanged);
CONNECT_DPTR(PollIntervalChanged);
CONNECT_DPTR(IntervalBetweenPollsChanged);
CONNECT_DPTR(SuppressValueRefreshChanged);
CONNECT_DPTR(PerformReturnRoutesChanged);
CONNECT_DPTR(NetworkKeyChanged);
CONNECT_DPTR(RefreshAllUserCodesChanged);
CONNECT_DPTR(RetryTimeoutChanged);
CONNECT_DPTR(EnableSISChanged);
CONNECT_DPTR(AssumeAwakeChanged);
CONNECT_DPTR(NotifyOnDriverUnloadChanged);
CONNECT_DPTR(SecurityStrategyChanged);
CONNECT_DPTR(CustomSecuredCCChanged);
CONNECT_DPTR(EnforceSecureReceptionChanged);
CONNECT_DPTR(AutoUpdateConfigFileChanged);
CONNECT_DPTR(ReloadAfterUpdateChanged);
CONNECT_DPTR(LanguageChanged);
CONNECT_DPTR(IncludeInstanceLabelsChanged);
// CONNECT_DPTR(error);
}
QString QTOZWOptions::ConfigPath() const {
CALL_DPTR_PROP(ConfigPath());
}
QString QTOZWOptions::UserPath() const {
CALL_DPTR_PROP(UserPath());
}
bool QTOZWOptions::Logging() const {
CALL_DPTR_PROP(Logging());
}
QString QTOZWOptions::LogFileName() const {
CALL_DPTR_PROP(LogFileName());
}
bool QTOZWOptions::AppendLogFile() const {
CALL_DPTR_PROP(AppendLogFile());
}
bool QTOZWOptions::ConsoleOutput() const {
CALL_DPTR_PROP(ConsoleOutput());
}
qint32 QTOZWOptions::SaveLogLevel() const {
CALL_DPTR_PROP(SaveLogLevel());
}
qint32 QTOZWOptions::QueueLogLevel() const {
CALL_DPTR_PROP(QueueLogLevel());
}
qint32 QTOZWOptions::DumpTriggerLevel() const {
CALL_DPTR_PROP(DumpTriggerLevel());
}
bool QTOZWOptions::Associate() const {
CALL_DPTR_PROP(Associate());
}
QString QTOZWOptions::Exclude() const {
CALL_DPTR_PROP(Exclude());
}
QString QTOZWOptions::Include() const {
CALL_DPTR_PROP(Include());
}
bool QTOZWOptions::NotifyTransactions() const {
CALL_DPTR_PROP(NotifyTransactions());
}
QString QTOZWOptions::Interface() const {
CALL_DPTR_PROP(Interface());
}
bool QTOZWOptions::SaveConfiguration() const {
CALL_DPTR_PROP(SaveConfiguration());
}
qint32 QTOZWOptions::DriverMaxAttempts() const {
CALL_DPTR_PROP(DriverMaxAttempts());
}
qint32 QTOZWOptions::PollInterval() const {
CALL_DPTR_PROP(PollInterval());
}
bool QTOZWOptions::SuppressValueRefresh() const {
CALL_DPTR_PROP(SuppressValueRefresh());
}
bool QTOZWOptions::IntervalBetweenPolls() const {
CALL_DPTR_PROP(IntervalBetweenPolls());
}
bool QTOZWOptions::PerformReturnRoutes() const {
CALL_DPTR_PROP(PerformReturnRoutes());
}
QString QTOZWOptions::NetworkKey() const {
CALL_DPTR_PROP(NetworkKey());
}
bool QTOZWOptions::RefreshAllUserCodes() const {
CALL_DPTR_PROP(RefreshAllUserCodes());
}
qint32 QTOZWOptions::RetryTimeout() const {
CALL_DPTR_PROP(RetryTimeout());
}
bool QTOZWOptions::EnableSIS() const {
CALL_DPTR_PROP(EnableSIS());
}
bool QTOZWOptions::AssumeAwake() const {
CALL_DPTR_PROP(AssumeAwake());
}
bool QTOZWOptions::NotifyOnDriverUnload() const {
CALL_DPTR_PROP(NotifyTransactions());
}
QString QTOZWOptions::SecurityStrategy() const {
CALL_DPTR_PROP(SecurityStrategy());
}
QString QTOZWOptions::CustomSecuredCC() const {
CALL_DPTR_PROP(CustomSecuredCC());
}
bool QTOZWOptions::EnforceSecureReception() const {
CALL_DPTR_PROP(EnforceSecureReception());
}
bool QTOZWOptions::AutoUpdateConfigFile() const {
CALL_DPTR_PROP(AutoUpdateConfigFile());
}
QString QTOZWOptions::ReloadAfterUpdate() const {
CALL_DPTR_PROP(ReloadAfterUpdate());
}
QString QTOZWOptions::Language() const {
CALL_DPTR_PROP(Language());
}
bool QTOZWOptions::IncludeInstanceLabels() const {
CALL_DPTR_PROP(IncludeInstanceLabels());
}
void QTOZWOptions::setConfigPath(QString ConfigPath) {
CALL_DPTR_PROP_SET(ConfigPath);
}
void QTOZWOptions::setUserPath(QString UserPath) {
CALL_DPTR_PROP_SET(UserPath);
}
void QTOZWOptions::setLogging(bool Logging) {
CALL_DPTR_PROP_SET(Logging);
}
void QTOZWOptions::setLogFileName(QString LogFileName) {
CALL_DPTR_PROP_SET(LogFileName);
}
void QTOZWOptions::setAppendLogFile(bool AppendLogFile) {
CALL_DPTR_PROP_SET(AppendLogFile);
}
void QTOZWOptions::setConsoleOutput(bool ConsoleOutput) {
CALL_DPTR_PROP_SET(ConsoleOutput);
}
void QTOZWOptions::setSaveLogLevel(qint32 SaveLogLevel) {
CALL_DPTR_PROP_SET(SaveLogLevel);
}
void QTOZWOptions::setQueueLogLevel(qint32 QueueLogLevel) {
CALL_DPTR_PROP_SET(QueueLogLevel);
}
void QTOZWOptions::setDumpTriggerLevel(qint32 DumpTriggerLevel) {
CALL_DPTR_PROP_SET(DumpTriggerLevel);
}
void QTOZWOptions::setAssociate(bool Associate) {
CALL_DPTR_PROP_SET(Associate);
}
void QTOZWOptions::setExclude(QString Exclude) {
CALL_DPTR_PROP_SET(Exclude);
}
void QTOZWOptions::setInclude(QString Include) {
CALL_DPTR_PROP_SET(Include);
}
void QTOZWOptions::setNotifyTransactions(bool NotifyTransactions) {
CALL_DPTR_PROP_SET(NotifyTransactions);
}
void QTOZWOptions::setInterface(QString Interface) {
CALL_DPTR_PROP_SET(Interface);
}
void QTOZWOptions::setSaveConfiguration(bool SaveConfiguration) {
CALL_DPTR_PROP_SET(SaveConfiguration);
}
void QTOZWOptions::setDriverMaxAttempts(qint32 DriverMaxAttempts) {
CALL_DPTR_PROP_SET(DriverMaxAttempts);
}
void QTOZWOptions::setPollInterval(qint32 PollInterval) {
CALL_DPTR_PROP_SET(PollInterval);
}
void QTOZWOptions::setIntervalBetweenPolls(bool IntervalBetweenPolls) {
CALL_DPTR_PROP_SET(IntervalBetweenPolls);
}
void QTOZWOptions::setSuppressValueRefresh(bool SuppressValueRefresh) {
CALL_DPTR_PROP_SET(SuppressValueRefresh);
}
void QTOZWOptions::setPerformReturnRoutes(bool PerformReturnRoutes) {
CALL_DPTR_PROP_SET(PerformReturnRoutes);
}
void QTOZWOptions::setNetworkKey(QString NetworkKey) {
CALL_DPTR_PROP_SET(NetworkKey);
}
void QTOZWOptions::setRefreshAllUserCodes(bool RefreshAllUserCodes) {
CALL_DPTR_PROP_SET(RefreshAllUserCodes);
}
void QTOZWOptions::setRetryTimeout(qint32 RetryTimeout) {
CALL_DPTR_PROP_SET(RetryTimeout);
}
void QTOZWOptions::setEnableSIS(bool EnableSIS) {
CALL_DPTR_PROP_SET(EnableSIS);
}
void QTOZWOptions::setAssumeAwake(bool AssumeAwake) {
CALL_DPTR_PROP_SET(AssumeAwake);
}
void QTOZWOptions::setNotifyOnDriverUnload(bool NotifyOnDriverUnload) {
CALL_DPTR_PROP_SET(NotifyOnDriverUnload);
}
void QTOZWOptions::setSecurityStrategy(QString SecurityStrategy) {
CALL_DPTR_PROP_SET(SecurityStrategy);
}
void QTOZWOptions::setCustomSecuredCC(QString CustomSecuredCC) {
CALL_DPTR_PROP_SET(CustomSecuredCC);
}
void QTOZWOptions::setEnforceSecureReception(bool EnforceSecureReception) {
CALL_DPTR_PROP_SET(EnforceSecureReception);
}
void QTOZWOptions::setAutoUpdateConfigFile(bool AutoUpdateConfigFile) {
CALL_DPTR_PROP_SET(AutoUpdateConfigFile);
}
void QTOZWOptions::setReloadAfterUpdate(QString ReloadAfterUpdate) {
CALL_DPTR_PROP_SET(ReloadAfterUpdate);
}
void QTOZWOptions::setLanguage(QString Language) {
CALL_DPTR_PROP_SET(Language);
}
void QTOZWOptions::setIncludeInstanceLabels(bool IncludeInstanceLabels) {
CALL_DPTR_PROP_SET(IncludeInstanceLabels);
}
bool QTOZWOptions::AddOptionBool(QString option, bool value) {
CALL_DPTR_METHOD_RTN(AddOptionBool(option, value), bool);
}
bool QTOZWOptions::AddOptionInt(QString option, qint32 value) {
CALL_DPTR_METHOD_RTN(AddOptionInt(option, value), bool)
}
bool QTOZWOptions::AddOptionString(QString option, QString value) {
CALL_DPTR_METHOD_RTN(AddOptionString(option, value), bool)
}
bool QTOZWOptions::GetOptionAsBool(QString option) {
CALL_DPTR_METHOD_RTN(GetOptionAsBool(option), bool);
}
qint32 QTOZWOptions::GetOptionAsInt(QString option) {
CALL_DPTR_METHOD_RTN(GetOptionAsInt(option), qint32);
}
QString QTOZWOptions::GetOptionAsString(QString option) {
CALL_DPTR_METHOD_RTN(GetOptionAsString(option), QString);
}

View file

@ -0,0 +1,292 @@
#include "qtozwoptions_p.h"
QTOZWOptions_Internal::QTOZWOptions_Internal(QObject *parent)
: QTOZWOptionsSimpleSource (parent),
m_updating(false)
{
this->setObjectName("QTOZW_Options");
this->m_options = OpenZWave::Options::Get();
if (!this->m_options) {
/* Not Created...Bail Out*/
emit this->error(QTOZWOptionsErrorCodes::NoOptionClass);
return;
}
this->populateProperties();
connect(this, &QTOZWOptionsSimpleSource::ConfigPathChanged, this, &QTOZWOptions_Internal::pvt_ConfigPathChanged);
connect(this, &QTOZWOptionsSimpleSource::UserPathChanged, this, &QTOZWOptions_Internal::pvt_UserPathChanged);
connect(this, &QTOZWOptionsSimpleSource::LoggingChanged, this, &QTOZWOptions_Internal::pvt_LoggingChanged);
connect(this, &QTOZWOptionsSimpleSource::LogFileNameChanged, this, &QTOZWOptions_Internal::pvt_LogFileNameChanged);
connect(this, &QTOZWOptionsSimpleSource::AppendLogFileChanged, this, &QTOZWOptions_Internal::pvt_AppendLogFileChanged);
connect(this, &QTOZWOptionsSimpleSource::ConsoleOutputChanged, this, &QTOZWOptions_Internal::pvt_ConsoleOutputChanged);
connect(this, &QTOZWOptionsSimpleSource::SaveLogLevelChanged, this, &QTOZWOptions_Internal::pvt_SaveLogLevelChanged);
connect(this, &QTOZWOptionsSimpleSource::QueueLogLevelChanged, this, &QTOZWOptions_Internal::pvt_QueueLogLevelChanged);
connect(this, &QTOZWOptionsSimpleSource::DumpTriggerLevelChanged, this, &QTOZWOptions_Internal::pvt_DumpTriggerLevelChanged);
connect(this, &QTOZWOptionsSimpleSource::AssociateChanged, this, &QTOZWOptions_Internal::pvt_AssociateChanged);
connect(this, &QTOZWOptionsSimpleSource::ExcludeChanged, this, &QTOZWOptions_Internal::pvt_ExcludeChanged);
connect(this, &QTOZWOptionsSimpleSource::IncludeChanged, this, &QTOZWOptions_Internal::pvt_IncludeChanged);
connect(this, &QTOZWOptionsSimpleSource::NotifyTransactionsChanged, this, &QTOZWOptions_Internal::pvt_NotifyTransactionChanged);
connect(this, &QTOZWOptionsSimpleSource::InterfaceChanged, this, &QTOZWOptions_Internal::pvt_InterfaceChanged);
connect(this, &QTOZWOptionsSimpleSource::SaveConfigurationChanged, this, &QTOZWOptions_Internal::pvt_SaveConfigurationChanged);
connect(this, &QTOZWOptionsSimpleSource::DriverMaxAttemptsChanged, this, &QTOZWOptions_Internal::pvt_DriverMaxAttemptsChanged);
connect(this, &QTOZWOptionsSimpleSource::PollIntervalChanged, this, &QTOZWOptions_Internal::pvt_PollIntervalChanged);
connect(this, &QTOZWOptionsSimpleSource::IntervalBetweenPollsChanged, this, &QTOZWOptions_Internal::pvt_IntervalBetweenPollsChanged);
connect(this, &QTOZWOptionsSimpleSource::SuppressValueRefreshChanged, this, &QTOZWOptions_Internal::pvt_SuppressValueRefreshChanged);
connect(this, &QTOZWOptionsSimpleSource::PerformReturnRoutesChanged, this, &QTOZWOptions_Internal::pvt_PerformReturnRoutesChanged);
connect(this, &QTOZWOptionsSimpleSource::NetworkKeyChanged, this, &QTOZWOptions_Internal::pvt_NetworkKeyChanged);
connect(this, &QTOZWOptionsSimpleSource::RefreshAllUserCodesChanged, this, &QTOZWOptions_Internal::pvt_RefreshAllUserCodesChanged);
connect(this, &QTOZWOptionsSimpleSource::RetryTimeoutChanged, this, &QTOZWOptions_Internal::pvt_RetryTimeoutChanged);
connect(this, &QTOZWOptionsSimpleSource::EnableSISChanged, this, &QTOZWOptions_Internal::pvt_EnableSISChanged);
connect(this, &QTOZWOptionsSimpleSource::AssumeAwakeChanged, this, &QTOZWOptions_Internal::pvt_AssumeAwakeChanged);
connect(this, &QTOZWOptionsSimpleSource::NotifyOnDriverUnloadChanged, this, &QTOZWOptions_Internal::pvt_NotifyOnDriverUnloadChanged);
connect(this, &QTOZWOptionsSimpleSource::SecurityStrategyChanged, this, &QTOZWOptions_Internal::pvt_SecurityStrategyChanged);
connect(this, &QTOZWOptionsSimpleSource::CustomSecuredCCChanged, this, &QTOZWOptions_Internal::pvt_CustomSecuredCCChanged);
connect(this, &QTOZWOptionsSimpleSource::EnforceSecureReceptionChanged, this, &QTOZWOptions_Internal::pvt_EnforceSecureReceptionChanged);
connect(this, &QTOZWOptionsSimpleSource::AutoUpdateConfigFileChanged, this, &QTOZWOptions_Internal::pvt_AutoUpdateConfigFileChanged);
connect(this, &QTOZWOptionsSimpleSource::ReloadAfterUpdateChanged, this, &QTOZWOptions_Internal::pvt_ReloadAfterUpdateChanged);
connect(this, &QTOZWOptionsSimpleSource::LanguageChanged, this, &QTOZWOptions_Internal::pvt_LanguageChanged);
connect(this, &QTOZWOptionsSimpleSource::IncludeInstanceLabelsChanged, this, &QTOZWOptions_Internal::pvt_IncludeInstanceLabelsChanged);
}
bool QTOZWOptions_Internal::AddOptionBool(QString option, bool value) {
return this->m_options->AddOptionBool(option.toStdString(), value);
}
bool QTOZWOptions_Internal::AddOptionInt(QString option, qint32 value) {
return this->m_options->AddOptionInt(option.toStdString(), value);
}
bool QTOZWOptions_Internal::AddOptionString(QString option, QString value) {
return this->m_options->AddOptionString(option.toStdString(), value.toStdString(), false);
}
bool QTOZWOptions_Internal::GetOptionAsBool(QString option) {
bool value;
if (this->m_options->GetOptionAsBool(option.toStdString(), &value)) {
return value;
}
emit this->error(QTOZWOptionsErrorCodes::InvalidOption);
return false;
}
qint32 QTOZWOptions_Internal::GetOptionAsInt(QString option) {
qint32 value;
if (this->m_options->GetOptionAsInt(option.toStdString(), &value)) {
return value;
}
emit this->error(QTOZWOptionsErrorCodes::InvalidOption);
return -1;
}
QString QTOZWOptions_Internal::GetOptionAsString(QString option) {
std::string value;
if (this->m_options->GetOptionAsString(option.toStdString(), &value)) {
return QString::fromStdString(value);
}
emit this->error(QTOZWOptionsErrorCodes::InvalidOption);
return QString();
}
bool QTOZWOptions_Internal::populateProperties() {
this->m_updating = true;
this->setConfigPath(this->GetOptionAsString("ConfigPath"));
this->setUserPath(this->GetOptionAsString("UserPath"));
this->setLogging(this->GetOptionAsBool("Logging"));
this->setLogFileName(this->GetOptionAsString("LogFileName"));
this->setAppendLogFile(this->GetOptionAsBool("AppendLogFile"));
this->setConsoleOutput(this->GetOptionAsBool("ConsoleOutput"));
this->setSaveLogLevel(this->GetOptionAsInt("SaveLogLevel"));
this->setQueueLogLevel(this->GetOptionAsInt("QueueLogLevel"));
this->setDumpTriggerLevel(this->GetOptionAsInt("DumpTriggerLevel"));
this->setAssociate(this->GetOptionAsBool("Associate"));
this->setExclude(this->GetOptionAsString("Exclude"));
this->setInclude(this->GetOptionAsString("Include"));
this->setNotifyTransactions(this->GetOptionAsBool("NotifyTransactions"));
this->setInterface(this->GetOptionAsString("Interface"));
this->setSaveConfiguration(this->GetOptionAsBool("SaveConfiguration"));
this->setDriverMaxAttempts(this->GetOptionAsInt("DriverMaxAttempts"));
this->setPollInterval(this->GetOptionAsInt("PollInterval"));
this->setIntervalBetweenPolls(this->GetOptionAsBool("IntervalBetweenPolls"));
this->setSuppressValueRefresh(this->GetOptionAsBool("SuppressValueRefresh"));
this->setPerformReturnRoutes(this->GetOptionAsBool("PerformReturnRoutes"));
this->setNetworkKey(this->GetOptionAsString("NetworkKey"));
this->setRefreshAllUserCodes(this->GetOptionAsBool("RefreshAllUserCodes"));
this->setRetryTimeout(this->GetOptionAsInt("RetryTimeout"));
this->setEnableSIS(this->GetOptionAsBool("EnableSIS"));
this->setAssumeAwake(this->GetOptionAsBool("AssumeAwake"));
this->setNotifyOnDriverUnload(this->GetOptionAsBool("NotifyOnDriverUnload"));
this->setSecurityStrategy(this->GetOptionAsString("SecurityStrategy"));
this->setCustomSecuredCC(this->GetOptionAsString("CustomSecuredCC"));
this->setEnforceSecureReception(this->GetOptionAsBool("EnforceSecureReception"));
this->setAutoUpdateConfigFile(this->GetOptionAsBool("AutoUpdateConfigFile"));
this->setReloadAfterUpdate(this->GetOptionAsString("ReloadAfterUpdate"));
this->setLanguage(this->GetOptionAsString("Language"));
this->setIncludeInstanceLabels(this->GetOptionAsBool("IncludeInstanceLabels"));
this->m_updating = false;
return true;
}
void QTOZWOptions_Internal::pvt_ConfigPathChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("ConfigPath", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_UserPathChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("UserPath", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_LoggingChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("Logging", value);
}
void QTOZWOptions_Internal::pvt_LogFileNameChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("LogFileName", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_AppendLogFileChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("AppendLogFile", value);
}
void QTOZWOptions_Internal::pvt_ConsoleOutputChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("ConsoleOutput", value);
}
void QTOZWOptions_Internal::pvt_SaveLogLevelChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("SaveLogLevel", value);
}
void QTOZWOptions_Internal::pvt_QueueLogLevelChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("QueueLogLevel", value);
}
void QTOZWOptions_Internal::pvt_DumpTriggerLevelChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("DumpTriggerLevel", value);
}
void QTOZWOptions_Internal::pvt_AssociateChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("Associate", value);
}
void QTOZWOptions_Internal::pvt_ExcludeChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("Exclude", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_IncludeChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("Include", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_NotifyTransactionChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("NotifyTransaction", value);
}
void QTOZWOptions_Internal::pvt_InterfaceChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("Interface", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_SaveConfigurationChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("SaveConfiguration", value);
}
void QTOZWOptions_Internal::pvt_DriverMaxAttemptsChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("DriverMaxAttempts", value);
}
void QTOZWOptions_Internal::pvt_PollIntervalChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("PollInterval", value);
}
void QTOZWOptions_Internal::pvt_IntervalBetweenPollsChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("IntervalBetweenPolls", value);
}
void QTOZWOptions_Internal::pvt_SuppressValueRefreshChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("SuppressValueRefresh", value);
}
void QTOZWOptions_Internal::pvt_PerformReturnRoutesChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("PerformReturnRoutes", value);
}
void QTOZWOptions_Internal::pvt_NetworkKeyChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("NetworkKey", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_RefreshAllUserCodesChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("RefreshAllUserCodes", value);
}
void QTOZWOptions_Internal::pvt_RetryTimeoutChanged(qint32 value) {
if (this->m_updating)
return;
this->m_options->AddOptionInt("RetryTimeout", value);
}
void QTOZWOptions_Internal::pvt_EnableSISChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("EnableSIS", value);
}
void QTOZWOptions_Internal::pvt_AssumeAwakeChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("AssumeAwake", value);
}
void QTOZWOptions_Internal::pvt_NotifyOnDriverUnloadChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("NotifyOnDriverUnload", value);
}
void QTOZWOptions_Internal::pvt_SecurityStrategyChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("SecurityStrategy", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_CustomSecuredCCChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("CustomSecuredCC", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_EnforceSecureReceptionChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("EnforceSecureReception", value);
}
void QTOZWOptions_Internal::pvt_AutoUpdateConfigFileChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("AutoUpdateConfigFile", value);
}
void QTOZWOptions_Internal::pvt_ReloadAfterUpdateChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("ReloadAfterUpdate", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_LanguageChanged(QString value) {
if (this->m_updating)
return;
this->m_options->AddOptionString("Language", value.toStdString(), false);
}
void QTOZWOptions_Internal::pvt_IncludeInstanceLabelsChanged(bool value) {
if (this->m_updating)
return;
this->m_options->AddOptionBool("IncludeInstanceLabels", value);
}

View file

@ -62,7 +62,7 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#if 1 #if 0
QLoggingCategory::setFilterRules("qt.remoteobjects.debug=true\n" QLoggingCategory::setFilterRules("qt.remoteobjects.debug=true\n"
"qt.remoteobjects.warning=true\n" "qt.remoteobjects.warning=true\n"
"qt.remoteobjects.models.debug=true\n" "qt.remoteobjects.models.debug=true\n"

View file

@ -14,7 +14,7 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
qDebug() << "Starting MainWindow"; qDebug() << "Starting MainWindow";
this->m_openzwave = new QTOpenZwave(this); this->m_openzwave = new QTOpenZwave(this, QDir("./config/"));
this->m_qtozwmanager = this->m_openzwave->GetManager(); this->m_qtozwmanager = this->m_openzwave->GetManager();
qDebug() << "QTOpenZWave Managers Created"; qDebug() << "QTOpenZWave Managers Created";
QObject::connect(this->m_qtozwmanager, &QTOZWManager::ready, this, &MainWindow::QTOZW_Ready); QObject::connect(this->m_qtozwmanager, &QTOZWManager::ready, this, &MainWindow::QTOZW_Ready);

View file

@ -33,8 +33,6 @@ HEADERS += \
qtozw_itemdelegate.h \ qtozw_itemdelegate.h \
startup.h startup.h
DISTFILES +=
RESOURCES += \ RESOURCES += \
simpleclient.qrc simpleclient.qrc
@ -43,6 +41,12 @@ macx {
QMAKE_CXXFLAGS += -F../qt-openzwave/ QMAKE_CXXFLAGS += -F../qt-openzwave/
LIBS += -F../qt-openzwave/ -framework qt-openzwave LIBS += -F../qt-openzwave/ -framework qt-openzwave
ICON = res/ozw_logo.icns ICON = res/ozw_logo.icns
BUNDLE.files = ../qt-openzwave/qt-openzwave.framework/
BUNDLE.path = Contents/Frameworks/qt-openzwave.framework/
LIBOZW.files = ../../open-zwave/libopenzwave-1.6.dylib
LIBOZW.path = Contents/Frameworks/
QMAKE_BUNDLE_DATA += BUNDLE LIBOZW
} else { } else {
LIBS += -L../qt-openzwave/ -lqt-openzwave LIBS += -L../qt-openzwave/ -lqt-openzwave
INCLUDEPATH += ../qt-openzwave/qt-openzwave/include/ INCLUDEPATH += ../qt-openzwave/qt-openzwave/include/