From 5222afc7279b47b8a45a06019cfb6511fd47f95c Mon Sep 17 00:00:00 2001 From: Justin Hammond Date: Thu, 28 Apr 2016 17:06:44 +0800 Subject: [PATCH] OSX Builds and Custom OZW Log Class and Window --- logwindow.cpp | 209 +++++++++++++++++++++++++++++++++++++++++++++++++ logwindow.h | 81 +++++++++++++++++++ mainwindow.cpp | 12 ++- mainwindow.h | 3 + mainwindow.ui | 25 +++--- nodes.cpp | 203 +++++++++++++++++++++++++++++++++++------------ nodes.h | 103 ++++++------------------ ozw-admin.pro | 19 ++++- 8 files changed, 505 insertions(+), 150 deletions(-) create mode 100644 logwindow.cpp create mode 100644 logwindow.h diff --git a/logwindow.cpp b/logwindow.cpp new file mode 100644 index 0000000..4896c2f --- /dev/null +++ b/logwindow.cpp @@ -0,0 +1,209 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "logwindow.h" + +ozwAdminLog::ozwAdminLog() +{ + +} +ozwAdminLog::~ozwAdminLog() +{ +} +void ozwAdminLog::Write( OpenZWave::LogLevel _level, uint8 const _nodeId, char const* _format, va_list _args ) { + char lineBuf[1024] = {0}; + //int lineLen = 0; + if( _format != NULL && _format[0] != '\0' ) + { + va_list saveargs; + va_copy( saveargs, _args ); + + vsnprintf( lineBuf, sizeof(lineBuf), _format, _args ); + va_end( saveargs ); + } + printf("%s\n", lineBuf); + emit newLogMsg(_level, _nodeId, QString(lineBuf)); + +} + +void ozwAdminLog::QueueDump() { + +} + +void ozwAdminLog::QueueClear() { + +} + +void ozwAdminLog::SetLoggingState( OpenZWave::LogLevel _saveLevel, OpenZWave::LogLevel _queueLevel, OpenZWave::LogLevel _dumpTrigger ) { + Q_UNUSED(_saveLevel); + Q_UNUSED(_queueLevel); + Q_UNUSED(_dumpTrigger); +} + +void ozwAdminLog::SetLogFileName( const std::string &_filename ) { + Q_UNUSED(_filename); +} + + + +LogBrowserDialog::LogBrowserDialog(QWidget *parent) +: QDialog(parent) +{ + QVBoxLayout *layout = new QVBoxLayout; + setLayout(layout); + + browser = new QTextBrowser(this); + layout->addWidget(browser); + + QHBoxLayout *buttonLayout = new QHBoxLayout; + buttonLayout->setContentsMargins(0, 0, 0, 0); + layout->addLayout(buttonLayout); + + buttonLayout->addStretch(10); + + clearButton = new QPushButton(this); + clearButton->setText("clear"); + buttonLayout->addWidget(clearButton); + connect(clearButton, SIGNAL(clicked()), browser, SLOT(clear())); + + saveButton = new QPushButton(this); + saveButton->setText("save output"); + buttonLayout->addWidget(saveButton); + connect(saveButton, SIGNAL(clicked()), this, SLOT(save())); + + resize(200, 400); + this->setWindowTitle("Log Window"); + this->setAttribute(Qt::WA_DeleteOnClose); +} + + +LogBrowserDialog::~LogBrowserDialog() +{ + +} + + +void LogBrowserDialog::outputMessage(OpenZWave::LogLevel type, const QString &msg) +{ + browser->append(msg); +return; +#if 0 +switch (type) { + case QtDebugMsg: + break; + + case QtWarningMsg: + browser->append(tr("-- WARNING: %1").arg(msg)); + break; + + case QtCriticalMsg: + browser->append(tr("-- CRITICAL: %1").arg(msg)); + break; + + case QtFatalMsg: + browser->append(tr("-- FATAL: %1").arg(msg)); + break; + } +#endif +} + + +void LogBrowserDialog::save() +{ + QString saveFileName = QFileDialog::getSaveFileName( + this, + tr("Save Log Output"), + tr("%1/logfile.txt").arg(QDir::homePath()), + tr("Text Files (*.txt);;All Files (*)") + ); + + if(saveFileName.isEmpty()) + return; + + QFile file(saveFileName); + if(!file.open(QIODevice::WriteOnly)) { + QMessageBox::warning( + this, + tr("Error"), + QString(tr("File '%1'
cannot be opened for writing.

" + "The log output could not be saved!
")) + .arg(saveFileName)); + return; + } + + QTextStream stream(&file); + stream << browser->toPlainText(); + file.close(); +} + + +void LogBrowserDialog::closeEvent(QCloseEvent *e) +{ + QMessageBox::StandardButton answer = QMessageBox::question( + this, + tr("Close Log Browser?"), + tr("Do you really want to close the log browser?"), + QMessageBox::Yes | QMessageBox::No + ); + + if (answer == QMessageBox::Yes) + e->accept(); + else + e->ignore(); +} + + +void LogBrowserDialog::keyPressEvent(QKeyEvent *e) +{ + // ignore all keyboard events + // protects against accidentally closing of the dialog + // without asking the user + e->ignore(); +} + + + + +LogBrowser::LogBrowser(QObject *parent) : + QObject(parent) +{ +// qRegisterMetaType("QtMsgType"); + qRegisterMetaType("OpenZWave::LogLevel"); + this->logAdapter = new ozwAdminLog(); + this->browserDialog = new LogBrowserDialog; + + connect(this, SIGNAL(sendMessage(OpenZWave::LogLevel,QString)), browserDialog, SLOT(outputMessage(OpenZWave::LogLevel,QString)), Qt::QueuedConnection); + connect(this->logAdapter, SIGNAL(newLogMsg(OpenZWave::LogLevel,uint8,QString)), this, SLOT(outputMessage(OpenZWave::LogLevel,uint8,QString))); + + OpenZWave::Log::SetLoggingClass(this->logAdapter); + +} + + +LogBrowser::~LogBrowser() +{ + delete browserDialog; +} + + +void LogBrowser::outputMessage(OpenZWave::LogLevel Level, uint8 node, const QString &msg) +{ + //std::cout << msg.toStdString() << std::endl; + emit sendMessage( Level, msg ); +} + +void LogBrowser::show() { + //qobject_cast(this->parent)->mdiArea->addSubWindow(browserDialog); + //win->addSubWindow(browserDialog); + browserDialog->show(); +} diff --git a/logwindow.h b/logwindow.h new file mode 100644 index 0000000..5513aee --- /dev/null +++ b/logwindow.h @@ -0,0 +1,81 @@ +#ifndef LOGWINDOW_H +#define LOGWINDOW_H + +#include +#include +#include +#include +#include + +/* our Custom Logging Class */ + +class ozwAdminLog : public QObject, public OpenZWave::i_LogImpl +{ + Q_OBJECT +public: + ozwAdminLog(); + virtual ~ozwAdminLog(); + virtual void Write( OpenZWave::LogLevel _level, uint8 const _nodeId, char const* _format, va_list _args ); + virtual void QueueDump(); + virtual void QueueClear(); + virtual void SetLoggingState( OpenZWave::LogLevel _saveLevel, OpenZWave::LogLevel _queueLevel, OpenZWave::LogLevel _dumpTrigger ); + virtual void SetLogFileName( const std::string &_filename ); +signals: + void newLogMsg(OpenZWave::LogLevel, uint8, const QString); +}; + + + + +class LogBrowserDialog; + +class LogBrowser : public QObject +{ + Q_OBJECT +public: + explicit LogBrowser(QObject *parent = 0); + ~LogBrowser(); + ozwAdminLog *logAdapter; + +public slots: + void outputMessage( OpenZWave::LogLevel Level, uint8, const QString &msg ); + void show(); + +signals: + void sendMessage( OpenZWave::LogLevel Level, const QString &msg ); + +private: + LogBrowserDialog *browserDialog; + +}; + + + + +class QTextBrowser; +class QPushButton; + +class LogBrowserDialog : public QDialog +{ + Q_OBJECT + +public: + LogBrowserDialog(QWidget *parent = 0); + ~LogBrowserDialog(); + +public slots: + void outputMessage( OpenZWave::LogLevel type, const QString &msg ); + +protected slots: + void save(); + +protected: + virtual void keyPressEvent( QKeyEvent *e ); + virtual void closeEvent( QCloseEvent *e ); + + QTextBrowser *browser; + QPushButton *clearButton; + QPushButton *saveButton; +}; + +#endif // LOGWINDOW_H diff --git a/mainwindow.cpp b/mainwindow.cpp index 3ba76f0..4c4e21c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -25,6 +25,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "nodes.h" +#include "logwindow.h" #include "Options.h" #include "Manager.h" @@ -40,7 +41,6 @@ static pthread_mutex_t g_criticalSection; -static pthread_cond_t initCond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER; NodeList *ozwNodes; @@ -56,6 +56,7 @@ void OnNotification void* _context ) { + Q_UNUSED(_context); // Must do this inside a critical section to avoid conflicts with the main thread pthread_mutex_lock( &g_criticalSection ); @@ -160,6 +161,9 @@ MainWindow::MainWindow(QWidget *parent) : { this->ui->setupUi(this); + this->logBrowser = new LogBrowser; + connect(ui->actionOpen_Log_Window, SIGNAL(triggered()), this, SLOT(openLogWindow())); + connect(ui->actionOpen_Serial_Port, SIGNAL(triggered()), this, SLOT(OpenSerialPort())); connect(ui->action_Save_Cache, SIGNAL(triggered()), this, SLOT(saveCache())); @@ -247,6 +251,7 @@ void MainWindow::OpenSerialPort() { void MainWindow::newNode(qint8 nodeID) { + Q_UNUSED(nodeID); } @@ -310,3 +315,8 @@ void MainWindow::NodeSelected(QModelIndex current,QModelIndex previous) { } + + +void MainWindow::openLogWindow() { + this->logBrowser->show(); +} diff --git a/mainwindow.h b/mainwindow.h index 1792647..f04e4bd 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -21,6 +21,7 @@ #include #include #include +#include "logwindow.h" namespace Ui { class MainWindow; @@ -39,6 +40,7 @@ public slots: void saveCache(); void resizeColumns(); void NodeSelected(QModelIndex,QModelIndex); + void openLogWindow(); @@ -46,6 +48,7 @@ private: Ui::MainWindow *ui; QString m_serialport; QSettings settings; + LogBrowser *logBrowser; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index abb3578..23c0f8b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -44,8 +44,8 @@ 0 0 - 605 - 289 + 588 + 283 @@ -196,8 +196,8 @@ 0 0 - 605 - 398 + 588 + 428 @@ -497,9 +497,6 @@ - groupBox_3 - groupBox_4 - groupBox_4 @@ -520,8 +517,8 @@ 0 0 - 618 - 246 + 588 + 278 @@ -544,8 +541,8 @@ 0 0 - 618 - 246 + 588 + 278 @@ -568,8 +565,8 @@ 0 0 - 618 - 246 + 588 + 278 @@ -587,7 +584,7 @@ 0 0 660 - 21 + 22 diff --git a/nodes.cpp b/nodes.cpp index 31e9a06..0d93dfd 100644 --- a/nodes.cpp +++ b/nodes.cpp @@ -27,6 +27,95 @@ Node::Node(qint8 m_nodeid, int homeid) this->m_homeid = homeid; } +qint8 Node::getNodeID() const { + return this->m_nodeid; +} + +QString Node::getNodeName() const { + return OpenZWave::Manager::Get()->GetNodeName(this->m_homeid, this->m_nodeid).c_str(); +} +void Node::setNodeName(QString name) { + if (this->getNodeName() != name) { + OpenZWave::Manager::Get()->SetNodeName(this->m_homeid, this->m_nodeid, name.toStdString()); + emit NodeNameChanged(name); + } +} +QString Node::getNodeLocation() const { + return OpenZWave::Manager::Get()->GetNodeLocation(this->m_homeid, this->m_nodeid).c_str(); +} +void Node::setNodeLocation(QString location) { + if (this->getNodeLocation() != location) { + OpenZWave::Manager::Get()->SetNodeLocation(this->m_homeid, this->m_nodeid, location.toStdString()); + emit NodeLocationChanged(location); + } +} +QString Node::getNodeManufacturer() const { + return OpenZWave::Manager::Get()->GetNodeManufacturerName(this->m_homeid, this->m_nodeid).c_str(); +} +QString Node::getNodeProduct() const { + return OpenZWave::Manager::Get()->GetNodeProductName(this->m_homeid, this->m_nodeid).c_str(); +} +QString Node::getNodeBasicType() const { + if (OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid)) { + QString mystr(OpenZWave::Manager::Get()->GetNodePlusTypeString(this->m_homeid, this->m_nodeid).c_str()); + mystr.append(" "); + mystr.append(OpenZWave::Manager::Get()->GetNodeRoleString(this->m_homeid, this->m_nodeid).c_str()); + return mystr; + } else { + return nodeBasicStr(OpenZWave::Manager::Get()->GetNodeBasic(this->m_homeid, this->m_nodeid)); + } +} +QString Node::getNodeGenericType() const { + if (OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid)) { + return OpenZWave::Manager::Get()->GetNodeDeviceTypeString(this->m_homeid, this->m_nodeid).c_str(); + } else { + return OpenZWave::Manager::Get()->GetNodeType(this->m_homeid, this->m_nodeid).c_str(); + } +} +bool Node::getIsZWPlus() const { + return OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid); +} +bool Node::getIsListening() const { + return OpenZWave::Manager::Get()->IsNodeListeningDevice(this->m_homeid, this->m_nodeid); +} +bool Node::getIsBeaming() const { + return OpenZWave::Manager::Get()->IsNodeBeamingDevice(this->m_homeid, this->m_nodeid); +} +bool Node::getIsRouting() const { + return OpenZWave::Manager::Get()->IsNodeRoutingDevice(this->m_homeid, this->m_nodeid); +} +bool Node::getIsFLiRS() const { + return OpenZWave::Manager::Get()->IsNodeFrequentListeningDevice(this->m_homeid, this->m_nodeid); +} +bool Node::getIsSecurity() const { + return OpenZWave::Manager::Get()->IsNodeSecurityDevice(this->m_homeid, this->m_nodeid); +} +bool Node::getIsNodeFailed() const { + return OpenZWave::Manager::Get()->IsNodeFailed(this->m_homeid, this->m_nodeid); +} +bool Node::getIsNodeAwake() const { + return OpenZWave::Manager::Get()->IsNodeAwake(this->m_homeid, this->m_nodeid); +} +QString Node::getNodeProductID() const { + return OpenZWave::Manager::Get()->GetNodeProductId(this->m_homeid, this->m_nodeid).c_str(); +} +QString Node::getNodeProductType() const { + return OpenZWave::Manager::Get()->GetNodeProductType(this->m_homeid, this->m_nodeid).c_str(); +} +QString Node::getNodeZWVersion() const { + return QString::number(OpenZWave::Manager::Get()->GetNodeVersion(this->m_homeid, this->m_nodeid)); +} +QString Node::getNodeBaudRate() const { + return QString::number(OpenZWave::Manager::Get()->GetNodeMaxBaudRate(this->m_homeid, this->m_nodeid)); +} +QString Node::getNodeQueryStage() const { + return OpenZWave::Manager::Get()->GetNodeQueryStage(this->m_homeid, this->m_nodeid).c_str(); +} + +OpenZWave::Node::NodeData &Node::getNodeStatistics() { + OpenZWave::Manager::Get()->GetNodeStatistics(this->m_homeid, this->m_nodeid, &this->m_stats); + return this->m_stats; +} @@ -57,22 +146,24 @@ QVariant NodeList::data(const QModelIndex &index, int role) const { return QVariant(); } switch ((NodeColumnNames)index.column()) { - case NCN_NodeID: - return node->getNodeID(); - case NCN_NodeName: - return node->getNodeName(); - case NCN_NodeLocation: - return node->getNodeLocation(); - case NCN_NodeManufacturerName: - return node->getNodeManufacturer(); - case NCN_NodeProductName: - return node->getNodeProduct(); - case NCN_NodeBasicType: - return node->getNodeBasicType(); - case NCN_NodeGenericType: - return node->getNodeGenericType(); - case NCN_QueryStage: - return node->getNodeQueryStage(); + case NCN_NodeID: + return node->getNodeID(); + case NCN_NodeName: + return node->getNodeName(); + case NCN_NodeLocation: + return node->getNodeLocation(); + case NCN_NodeManufacturerName: + return node->getNodeManufacturer(); + case NCN_NodeProductName: + return node->getNodeProduct(); + case NCN_NodeBasicType: + return node->getNodeBasicType(); + case NCN_NodeGenericType: + return node->getNodeGenericType(); + case NCN_QueryStage: + return node->getNodeQueryStage(); + case NCN_Count: + return QVariant(); } } return QVariant(); @@ -84,29 +175,32 @@ QVariant NodeList::headerData(int section, Qt::Orientation orientation, int role if (orientation == Qt::Horizontal) { switch ((NodeColumnNames)section) { - case NCN_NodeID: - return tr("NodeID"); + case NCN_NodeID: + return tr("NodeID"); - case NCN_NodeName: - return tr("Node Name"); + case NCN_NodeName: + return tr("Node Name"); - case NCN_NodeLocation: - return tr("Location"); + case NCN_NodeLocation: + return tr("Location"); - case NCN_NodeManufacturerName: - return tr("Manufacturer"); + case NCN_NodeManufacturerName: + return tr("Manufacturer"); - case NCN_NodeProductName: - return tr("Product"); + case NCN_NodeProductName: + return tr("Product"); - case NCN_NodeBasicType: - return tr("Basic Type"); + case NCN_NodeBasicType: + return tr("Basic Type"); - case NCN_NodeGenericType: - return tr("Generic Type"); + case NCN_NodeGenericType: + return tr("Generic Type"); - case NCN_QueryStage: - return tr("Query Stage"); + case NCN_QueryStage: + return tr("Query Stage"); + + case NCN_Count: + return QVariant(); } } @@ -121,27 +215,28 @@ Qt::ItemFlags NodeList::flags(const QModelIndex &index) const { bool NodeList::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.isValid() && role == Qt::EditRole) { - int row = index.row(); + int row = index.row(); - Node *p = this->m_Nodelist.at(row); + Node *p = this->m_Nodelist.at(row); - switch ((NodeColumnNames)index.column()) { - case NCN_NodeID: - case NCN_NodeManufacturerName: - case NCN_NodeProductName: - case NCN_NodeBasicType: - case NCN_NodeGenericType: - case NCN_QueryStage: - /* read only */ - return false; - break; - case NCN_NodeName: - p->setNodeName(value.toString()); - break; - case NCN_NodeLocation: - p->setNodeLocation(value.toString()); - break; - } + switch ((NodeColumnNames)index.column()) { + case NCN_NodeID: + case NCN_NodeManufacturerName: + case NCN_NodeProductName: + case NCN_NodeBasicType: + case NCN_NodeGenericType: + case NCN_QueryStage: + case NCN_Count: + /* read only */ + return false; + break; + case NCN_NodeName: + p->setNodeName(value.toString()); + break; + case NCN_NodeLocation: + p->setNodeLocation(value.toString()); + break; + } } else { return false; } @@ -151,11 +246,17 @@ bool NodeList::setData(const QModelIndex &index, const QVariant &value, int role } bool NodeList::insertRows(int position, int rows, const QModelIndex &index) { + Q_UNUSED(position); + Q_UNUSED(rows); + Q_UNUSED(index); return false; } bool NodeList::removeRows(int position, int rows, const QModelIndex &index) { + Q_UNUSED(position); + Q_UNUSED(rows); + Q_UNUSED(index); return false; } diff --git a/nodes.h b/nodes.h index 1507c2a..b2e84ce 100644 --- a/nodes.h +++ b/nodes.h @@ -62,86 +62,29 @@ public: Node(qint8 m_nodeid, int homeid); - qint8 getNodeID() const { return this->m_nodeid; } - QString getNodeName() const { return OpenZWave::Manager::Get()->GetNodeName(this->m_homeid, this->m_nodeid).c_str(); } - void setNodeName(QString name) { - if (this->getNodeName() != name) { - OpenZWave::Manager::Get()->SetNodeName(this->m_homeid, this->m_nodeid, name.toStdString()); - emit NodeNameChanged(name); - } - } - QString getNodeLocation() const { return OpenZWave::Manager::Get()->GetNodeLocation(this->m_homeid, this->m_nodeid).c_str(); } - void setNodeLocation(QString location) { - if (this->getNodeLocation() != location) { - OpenZWave::Manager::Get()->SetNodeLocation(this->m_homeid, this->m_nodeid, location.toStdString()); - emit NodeLocationChanged(location); - } - } - QString getNodeManufacturer() const { return OpenZWave::Manager::Get()->GetNodeManufacturerName(this->m_homeid, this->m_nodeid).c_str(); } - QString getNodeProduct() const { return OpenZWave::Manager::Get()->GetNodeProductName(this->m_homeid, this->m_nodeid).c_str(); } - QString getNodeBasicType() const { - if (OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid)) { - QString mystr(OpenZWave::Manager::Get()->GetNodePlusTypeString(this->m_homeid, this->m_nodeid).c_str()); - mystr.append(" "); - mystr.append(OpenZWave::Manager::Get()->GetNodeRoleString(this->m_homeid, this->m_nodeid).c_str()); - return mystr; - } else { - return nodeBasicStr(OpenZWave::Manager::Get()->GetNodeBasic(this->m_homeid, this->m_nodeid)); - } - } - QString getNodeGenericType() const { - if (OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid)) { - return OpenZWave::Manager::Get()->GetNodeDeviceTypeString(this->m_homeid, this->m_nodeid).c_str(); - } else { - return OpenZWave::Manager::Get()->GetNodeType(this->m_homeid, this->m_nodeid).c_str(); - } - } - bool getIsZWPlus() const { - return OpenZWave::Manager::Get()->IsNodeZWavePlus(this->m_homeid, this->m_nodeid); - } - bool getIsListening() const { - return OpenZWave::Manager::Get()->IsNodeListeningDevice(this->m_homeid, this->m_nodeid); - } - bool getIsBeaming() const { - return OpenZWave::Manager::Get()->IsNodeBeamingDevice(this->m_homeid, this->m_nodeid); - } - bool getIsRouting() const { - return OpenZWave::Manager::Get()->IsNodeRoutingDevice(this->m_homeid, this->m_nodeid); - } - bool getIsFLiRS() const { - return OpenZWave::Manager::Get()->IsNodeFrequentListeningDevice(this->m_homeid, this->m_nodeid); - } - bool getIsSecurity() const { - return OpenZWave::Manager::Get()->IsNodeSecurityDevice(this->m_homeid, this->m_nodeid); - } - bool getIsNodeFailed() const { - return OpenZWave::Manager::Get()->IsNodeFailed(this->m_homeid, this->m_nodeid); - } - bool getIsNodeAwake() const { - return OpenZWave::Manager::Get()->IsNodeAwake(this->m_homeid, this->m_nodeid); - } - - - QString getNodeProductID() const { - return OpenZWave::Manager::Get()->GetNodeProductId(this->m_homeid, this->m_nodeid).c_str(); - } - QString getNodeProductType() const { - return OpenZWave::Manager::Get()->GetNodeProductType(this->m_homeid, this->m_nodeid).c_str(); - } - QString getNodeZWVersion() const { - return QString::number(OpenZWave::Manager::Get()->GetNodeVersion(this->m_homeid, this->m_nodeid)); - } - QString getNodeBaudRate() const { - return QString::number(OpenZWave::Manager::Get()->GetNodeMaxBaudRate(this->m_homeid, this->m_nodeid)); - } - QString getNodeQueryStage() const { - return OpenZWave::Manager::Get()->GetNodeQueryStage(this->m_homeid, this->m_nodeid).c_str(); - } - - OpenZWave::Node::NodeData &getNodeStatistics() { - OpenZWave::Manager::Get()->GetNodeStatistics(this->m_homeid, this->m_nodeid, &this->m_stats); - return this->m_stats; - } + qint8 getNodeID() const; + QString getNodeName() const; + void setNodeName(QString name); + QString getNodeLocation() const; + void setNodeLocation(QString location); + QString getNodeManufacturer() const; + QString getNodeProduct() const; + QString getNodeBasicType() const; + QString getNodeGenericType() const; + bool getIsZWPlus() const; + bool getIsListening() const; + bool getIsBeaming() const; + bool getIsRouting() const; + bool getIsFLiRS() const; + bool getIsSecurity() const; + bool getIsNodeFailed() const; + bool getIsNodeAwake() const; + QString getNodeProductID() const; + QString getNodeProductType() const; + QString getNodeZWVersion() const; + QString getNodeBaudRate() const; + QString getNodeQueryStage() const; + OpenZWave::Node::NodeData &getNodeStatistics(); signals: void NodeNameChanged(QString); diff --git a/ozw-admin.pro b/ozw-admin.pro index 9f471fc..e0c0854 100644 --- a/ozw-admin.pro +++ b/ozw-admin.pro @@ -15,13 +15,24 @@ TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp \ nodes.cpp \ - util.cpp + util.cpp \ + logwindow.cpp HEADERS += mainwindow.h \ nodes.h \ - util.h + util.h \ + logwindow.h FORMS += mainwindow.ui -unix: CONFIG += link_pkgconfig -unix: PKGCONFIG += libopenzwave +unix:!macx { + CONFIG += link_pkgconfig + PKGCONFIG += libopenzwave +} +macx: { + CONFIG += c++11 + INCLUDEPATH += $$PWD/../open-zwave/cpp/src/ + LIBS += -L$$PWD/../open-zwave -lopenzwave + LIBS += $$PWD/../open-zwave/libopenzwave.a -framework IOKit -framework CoreFoundation + QMAKE_MAC_SDK = macosx10.11 +}