mirror of
https://github.com/Fishwaldo/qt-openzwave.git
synced 2025-03-16 03:51:25 +00:00
redo the association model so its a bit cleaner and start work on a simple daemon
This commit is contained in:
parent
e128571e19
commit
11ecc7f27d
21 changed files with 474 additions and 361 deletions
|
@ -8,4 +8,5 @@ TEMPLATE = subdirs
|
|||
|
||||
CONFIG += ordered silent
|
||||
|
||||
SUBDIRS = qt-openzwave simpleclient
|
||||
SUBDIRS = qt-openzwave simpleclient \
|
||||
qt-ozwdaemon
|
||||
|
|
|
@ -52,6 +52,7 @@ SOURCES += \
|
|||
HEADERS += \
|
||||
qtopenzwave.h \
|
||||
qt-openzwave_global.h \ \
|
||||
qtozw_logging.h \
|
||||
qtozwassociations.h \
|
||||
qtozwproxymodels.h \
|
||||
qtozwmanager.h \
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
#include "qtopenzwave.h"
|
||||
#include "qtozw_logging.h"
|
||||
|
||||
|
||||
Q_LOGGING_CATEGORY(manager, "ozw.manager");
|
||||
Q_LOGGING_CATEGORY(valueModel, "ozw.values");
|
||||
Q_LOGGING_CATEGORY(nodeModel, "ozw.nodes");
|
||||
Q_LOGGING_CATEGORY(associationModel, "ozw.assocations");
|
||||
Q_LOGGING_CATEGORY(notifications, "ozw.notifications");
|
||||
|
||||
|
||||
QTOpenZwave::QTOpenZwave
|
||||
|
@ -14,6 +22,7 @@ QTOpenZwave::QTOpenZwave
|
|||
qRegisterMetaType<QTOZW_ValueIDBitSet>("QTOZW_ValueIDBitSet");
|
||||
qRegisterMetaTypeStreamOperators<QTOZW_ValueIDBitSet>("QTOZW_ValueIDBitSet");
|
||||
|
||||
qSetMessagePattern("%{category} %{message}");
|
||||
}
|
||||
|
||||
QTOZWManager *QTOpenZwave::GetManager
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "qtozwmanager.h"
|
||||
#include "websocketiodevice.h"
|
||||
|
||||
|
||||
|
||||
class QTOPENZWAVESHARED_EXPORT QTOpenZwave : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
12
qt-openzwave/qtozw_logging.h
Normal file
12
qt-openzwave/qtozw_logging.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <QLoggingCategory>
|
||||
|
||||
#ifndef QTOZW_LOGGING_H
|
||||
#define QTOZW_LOGGING_H
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(manager);
|
||||
Q_DECLARE_LOGGING_CATEGORY(valueModel);
|
||||
Q_DECLARE_LOGGING_CATEGORY(nodeModel);
|
||||
Q_DECLARE_LOGGING_CATEGORY(associationModel);
|
||||
Q_DECLARE_LOGGING_CATEGORY(notifications);
|
||||
|
||||
#endif // QTOZW_LOGGING_H
|
|
@ -1,5 +1,6 @@
|
|||
#include <QDebug>
|
||||
#include <QBitArray>
|
||||
#include "qtozw_logging.h"
|
||||
#include "qtozwassociations.h"
|
||||
#include "qtopenzwave.h"
|
||||
|
||||
|
@ -10,11 +11,13 @@ QTOZW_Associations::QTOZW_Associations(QObject *parent)
|
|||
}
|
||||
|
||||
int QTOZW_Associations::rowCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return this->m_associationData.count();
|
||||
}
|
||||
int QTOZW_Associations::columnCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return QTOZW_Associations::associationColumns::Count;
|
||||
}
|
||||
QVariant QTOZW_Associations::data(const QModelIndex &index, int role) const {
|
||||
|
@ -27,7 +30,7 @@ QVariant QTOZW_Associations::data(const QModelIndex &index, int role) const {
|
|||
if (role == Qt::DisplayRole) {
|
||||
QMap<associationColumns, QVariant> node = this->m_associationData[index.row()];
|
||||
if (node.size() == 0) {
|
||||
qWarning() << "data: Cant find any Node on Row " << index.row();
|
||||
qCWarning(associationModel) << "data: Cant find any Node on Row " << index.row();
|
||||
return QVariant();
|
||||
}
|
||||
return node[static_cast<associationColumns>(index.column())];
|
||||
|
@ -57,11 +60,8 @@ QVariant QTOZW_Associations::headerData(int section, Qt::Orientation orientation
|
|||
case MaxAssocations:
|
||||
return tr("Max Assocations");
|
||||
|
||||
case MemberNodeID:
|
||||
return tr("Member");
|
||||
|
||||
case MemberNodeInstance:
|
||||
return tr("Member Node Instance");
|
||||
case Members:
|
||||
return tr("Members");
|
||||
|
||||
case Flags:
|
||||
return tr("Flags");
|
||||
|
@ -73,15 +73,15 @@ QVariant QTOZW_Associations::headerData(int section, Qt::Orientation orientation
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant QTOZW_Associations::getassocationData(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, associationColumns _column) {
|
||||
int32_t row = this->getassocationRow(_node, _groupIDX, _targetNodeId, _targetNodeInstance);
|
||||
QVariant QTOZW_Associations::getassocationData(quint8 _node, quint8 _groupIDX, associationColumns _column) {
|
||||
int32_t row = this->getassocationRow(_node, _groupIDX);
|
||||
if (row >= 0)
|
||||
return this->m_associationData[row][_column];
|
||||
qWarning() << "Can't find Group " << _groupIDX << " for node " << _node << " with Target Node: " << _targetNodeId << ":" << _targetNodeInstance << " in m_associationData";
|
||||
qCWarning(associationModel) << "Can't find Group " << _groupIDX << " for node " << _node << " in m_associationData";
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int32_t QTOZW_Associations::getassocationRow(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance) {
|
||||
int32_t QTOZW_Associations::getassocationRow(quint8 _node, quint8 _groupIDX) {
|
||||
if (this->m_associationData.count() == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -90,212 +90,153 @@ int32_t QTOZW_Associations::getassocationRow(quint8 _node, quint8 _groupIDX, qui
|
|||
QMap<associationColumns, QVariant> group = it.value();
|
||||
if (group.value(associationColumns::NodeID) == _node) {
|
||||
if (group.value(associationColumns::GroupID) == _groupIDX) {
|
||||
if (group.value(associationColumns::MemberNodeID) == _targetNodeId) {
|
||||
if (group.value(associationColumns::MemberNodeInstance) == _targetNodeInstance) {
|
||||
return it.key();
|
||||
}
|
||||
}
|
||||
qCDebug(associationModel) << "getAssociationRow: Found Association at Row " << it.key();
|
||||
return it.key();
|
||||
}
|
||||
}
|
||||
}
|
||||
qWarning() << "Can't Find Group " << _groupIDX << " for node " << _node << " with Target Node: " << _targetNodeId << ":" << _targetNodeInstance << " in m_associationData";
|
||||
qCWarning(associationModel) << "Can't Find Group " << _groupIDX << " for node " << _node << " in m_associationData";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QTOZW_Associations_internal::QTOZW_Associations_internal(QObject *parent)
|
||||
: QTOZW_Associations(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::addAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance)
|
||||
{
|
||||
if (this->getassocationRow(_nodeID, _groupIDX, _targetNodeId, _targetNodeInstance) >= 0) {
|
||||
qWarning() << "Association Group " << _groupIDX << " for node " << _nodeID << " with Target Node: " << _targetNodeId << ":" << _targetNodeInstance << " Already Exists";
|
||||
void QTOZW_Associations_internal::addGroup(quint8 _nodeID, quint8 _groupIDX) {
|
||||
if (getassocationRow(_nodeID, _groupIDX) != -1) {
|
||||
qCWarning(associationModel) << "addGroup: Group " << _groupIDX << "already exists on node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
QMap<associationColumns, QVariant> newNode;
|
||||
newNode[associationColumns::NodeID] = _nodeID;
|
||||
newNode[associationColumns::GroupID] = _groupIDX;
|
||||
newNode[associationColumns::MemberNodeID] = _targetNodeId;
|
||||
newNode[associationColumns::MemberNodeInstance] = _targetNodeInstance;
|
||||
if (this->m_defaultData.count(_nodeID) && this->m_defaultData[_nodeID].count(_groupIDX)) {
|
||||
QMap<QTOZW_Associations::associationColumns, QVariant>::iterator it;
|
||||
for (it = this->m_defaultData[_nodeID][_groupIDX].begin(); it != this->m_defaultData[_nodeID][_groupIDX].end(); ++it) {
|
||||
newNode[it.key()] = it.value();
|
||||
}
|
||||
}
|
||||
if (newNode[associationColumns::Flags].toBitArray().size() == 0) {
|
||||
QBitArray flags(static_cast<int>(associationColumns::Count));
|
||||
newNode[associationColumns::Flags] = flags;
|
||||
}
|
||||
newNode[associationColumns::Members] = QStringList();
|
||||
QBitArray flags(static_cast<int>(QTOZW_Nodes::flagCount));
|
||||
newNode[associationColumns::Flags] = flags;
|
||||
|
||||
this->beginInsertRows(QModelIndex(), this->rowCount(QModelIndex()), this->rowCount(QModelIndex()));
|
||||
this->m_associationData[this->rowCount(QModelIndex())] = newNode;
|
||||
this->endInsertRows();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::delAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance) {
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> >::iterator it;
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> > newAssociationMap;
|
||||
int32_t newrow = 0;
|
||||
for (it = this->m_associationData.begin(); it != this->m_associationData.end(); ++it) {
|
||||
if (it.value()[associationColumns::NodeID] == _nodeID) {
|
||||
if (it.value()[associationColumns::GroupID] == _groupIDX) {
|
||||
if (it.value()[associationColumns::MemberNodeID] == _targetNodeId) {
|
||||
if (it.value()[associationColumns::MemberNodeInstance] == _targetNodeInstance) {
|
||||
qDebug() << "Removing Node " << it.value()[associationColumns::NodeID] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_associationData.erase(it);
|
||||
this->endRemoveRows();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newAssociationMap[newrow] = it.value();
|
||||
newrow++;
|
||||
}
|
||||
this->m_associationData.swap(newAssociationMap);
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::setAssociationData(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, QTOZW_Associations::associationColumns column, QVariant data)
|
||||
{
|
||||
int row = this->getassocationRow(_nodeID, _groupIDX, _targetNodeId, _targetNodeInstance);
|
||||
if (row == -1) {
|
||||
qWarning() << "setAssocationData: Group " << _groupIDX << "for node " << _nodeID << " does not exist";
|
||||
return;
|
||||
}
|
||||
if (this->m_associationData[row][column] != data) {
|
||||
this->m_associationData[row][column] = data;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, column), this->createIndex(row, column), roles);
|
||||
}
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::setAssociationFlags(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, QTOZW_Associations::associationFlags _flags, bool _value)
|
||||
{
|
||||
int row = this->getassocationRow(_nodeID, _groupIDX, _targetNodeId, _targetNodeInstance);
|
||||
if (row == -1) {
|
||||
qWarning() << "setAssocationFlags: Group " << _groupIDX << " for node " << _nodeID << " does not exist";
|
||||
return;
|
||||
}
|
||||
QBitArray flag = this->m_associationData[row][associationColumns::Flags].toBitArray();
|
||||
if (flag.at(_flags) != _value) {
|
||||
flag.setBit(_flags, _value);
|
||||
this->m_associationData[row][associationColumns::Flags] = flag;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, associationColumns::Flags), this->createIndex(row, associationColumns::Flags), roles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QTOZW_Associations_internal::delNode(quint8 _nodeID) {
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> >::iterator it;
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> > newAssociationMap;
|
||||
int32_t newrow = 0;
|
||||
for (it = this->m_associationData.begin(); it != this->m_associationData.end(); ++it) {
|
||||
if (it.value()[associationColumns::NodeID] == _nodeID) {
|
||||
qDebug() << "Removing Node " << it.value()[associationColumns::NodeID] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_associationData.erase(it);
|
||||
this->endRemoveRows();
|
||||
continue;
|
||||
} else {
|
||||
newAssociationMap[newrow] = it.value();
|
||||
newrow++;
|
||||
}
|
||||
}
|
||||
this->m_associationData.swap(newAssociationMap);
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::delGroup(quint8 _nodeID, quint8 _groupIDX) {
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> >::iterator it;
|
||||
QMap<int32_t, QMap<associationColumns, QVariant> > newAssociationMap;
|
||||
int32_t newrow = 0;
|
||||
for (it = this->m_associationData.begin(); it != this->m_associationData.end(); ++it) {
|
||||
if (it.value()[associationColumns::NodeID] == _nodeID) {
|
||||
if (it.value()[associationColumns::GroupID] == _groupIDX) {
|
||||
qDebug() << "Removing Node " << it.value()[associationColumns::NodeID] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_associationData.erase(it);
|
||||
this->endRemoveRows();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newAssociationMap[newrow] = it.value();
|
||||
newrow++;
|
||||
}
|
||||
this->m_associationData.swap(newAssociationMap);
|
||||
}
|
||||
|
||||
|
||||
void QTOZW_Associations_internal::resetModel() {
|
||||
this->beginRemoveRows(QModelIndex(), 0, this->m_associationData.count());
|
||||
this->m_associationData.clear();
|
||||
this->endRemoveRows();
|
||||
}
|
||||
|
||||
|
||||
void QTOZW_Associations_internal::setDefaultGroupData(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationColumns column, QVariant data) {
|
||||
void QTOZW_Associations_internal::setGroupData(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationColumns column, QVariant data) {
|
||||
switch (column) {
|
||||
case NodeID:
|
||||
case GroupID:
|
||||
case MemberNodeID:
|
||||
case MemberNodeInstance:
|
||||
case Members:
|
||||
case Flags:
|
||||
{
|
||||
qWarning() << "Can Not Set Default Data for " << static_cast<associationColumns>(column);
|
||||
qCWarning(associationModel) << "Can Not Set Group Data for " << static_cast<associationColumns>(column);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->m_defaultData.count(_nodeID) == 0) {
|
||||
QMap<quint8, QMap<QTOZW_Associations::associationColumns, QVariant> > newNode;
|
||||
this->m_defaultData.insert(_nodeID, newNode);
|
||||
qint32 row = getassocationRow(_nodeID, _groupIDX);
|
||||
if (row == -1) {
|
||||
qCWarning(associationModel) << "setGroupData: Can't Find Group " << _groupIDX << "on node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
if (this->m_defaultData[_nodeID].count(_groupIDX) == 0) {
|
||||
QBitArray flags(static_cast<int>(QTOZW_Nodes::flagCount));
|
||||
this->m_defaultData[_nodeID][_groupIDX][associationColumns::Flags] = flags;
|
||||
this->m_associationData[row][column] = data;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, column), this->createIndex(row, column), roles);
|
||||
}
|
||||
void QTOZW_Associations_internal::setGroupFlags(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationFlags _flags, bool _value) {
|
||||
qint32 row = getassocationRow(_nodeID, _groupIDX);
|
||||
if (row == -1) {
|
||||
qCWarning(associationModel) << "setGroupFlags: Can't Find Group " << _groupIDX << "on node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
this->m_defaultData[_nodeID][_groupIDX][column] = data;
|
||||
QMap<int32_t, QMap<QTOZW_Associations::associationColumns, QVariant> >::iterator it;
|
||||
for (it = this->m_associationData.begin(); it != this->m_associationData.end(); ++it) {
|
||||
if (it.value()[associationColumns::NodeID] == _nodeID) {
|
||||
if (it.value()[associationColumns::GroupID] == _groupIDX) {
|
||||
this->setAssociationData(_nodeID, _groupIDX, it.value()[associationColumns::MemberNodeID].value<quint8>(), it.value()[associationColumns::MemberNodeInstance].value<quint8>(), column, data);
|
||||
QBitArray flags(static_cast<int>(QTOZW_Nodes::flagCount));
|
||||
flags = this->m_associationData[row][associationColumns::Flags].toBitArray();
|
||||
flags.setBit(_flags, _value);
|
||||
this->m_associationData[row][associationColumns::Flags] = flags;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, associationColumns::Flags), this->createIndex(row, associationColumns::Flags), roles);
|
||||
|
||||
};
|
||||
|
||||
void QTOZW_Associations_internal::delNode(quint8 _nodeID) {
|
||||
for (int i = 0; i <= rowCount(QModelIndex()); i++) {
|
||||
if (this->m_associationData[i][associationColumns::NodeID] == _nodeID) {
|
||||
qCDebug(associationModel) << "Removing Node " << this->m_associationData[i][associationColumns::NodeID] << i;
|
||||
this->beginRemoveRows(QModelIndex(), i, i);
|
||||
this->m_associationData.remove(i);
|
||||
for (int j = i+1; i <= rowCount(QModelIndex()); j++) {
|
||||
this->m_associationData[i] = this->m_associationData[j];
|
||||
}
|
||||
this->m_associationData.remove(rowCount(QModelIndex()));
|
||||
this->endRemoveRows();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::setDefaultGroupFlags(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationFlags flag, bool data) {
|
||||
if (this->m_defaultData.count(_nodeID) == 0) {
|
||||
QMap<quint8, QMap<QTOZW_Associations::associationColumns, QVariant> > newNode;
|
||||
this->m_defaultData.insert(_nodeID, newNode);
|
||||
void QTOZW_Associations_internal::addAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance) {
|
||||
qint32 row = getassocationRow(_nodeID, _groupIDX);
|
||||
if (row == -1) {
|
||||
qCWarning(associationModel) << "addAssciation: Can't Find Group " << _groupIDX << "for node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
if (this->m_defaultData[_nodeID].count(_groupIDX) == 0) {
|
||||
QBitArray flags(static_cast<int>(QTOZW_Nodes::flagCount));
|
||||
this->m_defaultData[_nodeID][_groupIDX][associationColumns::Flags] = flags;
|
||||
}
|
||||
QBitArray flags = this->m_defaultData[_nodeID][_groupIDX][associationColumns::Flags].toBitArray();
|
||||
flags.setBit(flag, data);
|
||||
this->m_defaultData[_nodeID][_groupIDX][associationColumns::Flags].toBitArray() = flags;
|
||||
QMap<int32_t, QMap<QTOZW_Associations::associationColumns, QVariant> >::iterator it;
|
||||
for (it = this->m_associationData.begin(); it != this->m_associationData.end(); ++it) {
|
||||
if (it.value()[associationColumns::NodeID] == _nodeID) {
|
||||
if (it.value()[associationColumns::GroupID] == _groupIDX) {
|
||||
this->setAssociationFlags(_nodeID, _groupIDX, it.value()[associationColumns::MemberNodeID].value<quint8>(), it.value()[associationColumns::MemberNodeInstance].value<quint8>(), flag, data);
|
||||
}
|
||||
}
|
||||
QString target;
|
||||
target.append(QString::number(_targetNode)).append(":").append(QString::number(_targetInstance));
|
||||
QStringList targetlist = this->m_associationData[row][associationColumns::Members].toStringList();
|
||||
if (targetlist.contains(target)) {
|
||||
qCWarning(associationModel) << "addAssociation: Target " << target << "already exists in Group " << _groupIDX << "for node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
targetlist << target;
|
||||
this->m_associationData[row][associationColumns::Members] = targetlist;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, associationColumns::Members), this->createIndex(row, associationColumns::Members), roles);
|
||||
}
|
||||
|
||||
bool QTOZW_Associations_internal::isAssociationExists(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance) {
|
||||
return this->getassocationRow(_node, _groupIDX, _targetNodeId, _targetNodeInstance) == -1 ? false : true;
|
||||
void QTOZW_Associations_internal::delAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance) {
|
||||
qint32 row = getassocationRow(_nodeID, _groupIDX);
|
||||
if (row == -1) {
|
||||
qCWarning(associationModel) << "delAssciation: Can't Find Group " << _groupIDX << "for node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
QString target;
|
||||
target.append(QString::number(_targetNode)).append(":").append(QString::number(_targetInstance));
|
||||
QStringList targetlist = this->m_associationData[row][associationColumns::Members].toStringList();
|
||||
if (!targetlist.contains(target)) {
|
||||
qCWarning(associationModel) << "delAssociation: Target " << target << "does not exist in Group " << _groupIDX << "for node " << _nodeID;
|
||||
return;
|
||||
}
|
||||
targetlist.removeAll(target);
|
||||
this->m_associationData[row][associationColumns::Members] = targetlist;
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole;
|
||||
this->dataChanged(this->createIndex(row, associationColumns::Members), this->createIndex(row, associationColumns::Members), roles);
|
||||
}
|
||||
|
||||
bool QTOZW_Associations_internal::findAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance) {
|
||||
qint32 row = getassocationRow(_nodeID, _groupIDX);
|
||||
if (row == -1) {
|
||||
qCWarning(associationModel) << "delAssciation: Can't Find Group " << _groupIDX << "for node " << _nodeID;
|
||||
return false;
|
||||
}
|
||||
QString target;
|
||||
target.append(QString::number(_targetNode)).append(":").append(QString::number(_targetInstance));
|
||||
QStringList targetlist = this->m_associationData[row][associationColumns::Members].toStringList();
|
||||
if (!targetlist.contains(target)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void QTOZW_Associations_internal::resetModel() {
|
||||
this->beginRemoveRows(QModelIndex(), 0, this->m_associationData.count());
|
||||
this->m_associationData.clear();
|
||||
this->endRemoveRows();
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public:
|
|||
GroupName,
|
||||
GroupHelp,
|
||||
MaxAssocations,
|
||||
MemberNodeID,
|
||||
MemberNodeInstance,
|
||||
Members,
|
||||
Flags,
|
||||
Count
|
||||
};
|
||||
|
@ -29,16 +28,16 @@ public:
|
|||
friend class QTOZWManager_Internal;
|
||||
|
||||
QTOZW_Associations(QObject *parent=nullptr);
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
protected:
|
||||
QVariant getassocationData(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, QTOZW_Associations::associationColumns _column);
|
||||
int32_t getassocationRow(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance);
|
||||
QVariant getassocationData(quint8 _node, quint8 _groupIDX, QTOZW_Associations::associationColumns _column);
|
||||
int32_t getassocationRow(quint8 _node, quint8 _groupIDX);
|
||||
|
||||
QMap<int32_t, QMap<QTOZW_Associations::associationColumns, QVariant> > m_associationData;
|
||||
QMap<qint32, QMap<QTOZW_Associations::associationColumns, QVariant> > m_associationData;
|
||||
};
|
||||
|
||||
class QTOZW_Associations_internal : public QTOZW_Associations {
|
||||
|
@ -46,19 +45,14 @@ class QTOZW_Associations_internal : public QTOZW_Associations {
|
|||
public:
|
||||
QTOZW_Associations_internal(QObject *parent=nullptr);
|
||||
public Q_SLOTS:
|
||||
void addAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance);
|
||||
void delAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance);
|
||||
void setAssociationData(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, QTOZW_Associations::associationColumns column, QVariant data);
|
||||
void setAssociationFlags(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance, QTOZW_Associations::associationFlags _flags, bool _value);
|
||||
bool isAssociationExists(quint8 _node, quint8 _groupIDX, quint8 _targetNodeId, quint8 _targetNodeInstance);
|
||||
void setDefaultGroupData(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationColumns column, QVariant data);
|
||||
void setDefaultGroupFlags(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationFlags _flags, bool _value);
|
||||
void addGroup(quint8 _nodeID, quint8 _groupIDX);
|
||||
void setGroupData(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationColumns column, QVariant data);
|
||||
void setGroupFlags(quint8 _nodeID, quint8 _groupIDX, QTOZW_Associations::associationFlags _flags, bool _value);
|
||||
void delNode(quint8 _nodeID);
|
||||
void delGroup(quint8 _nodeID, quint8 _groupIDX);
|
||||
void addAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance);
|
||||
void delAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance);
|
||||
bool findAssociation(quint8 _nodeID, quint8 _groupIDX, quint8 _targetNode, quint8 _targetInstance);
|
||||
void resetModel();
|
||||
private:
|
||||
|
||||
QMap<quint8, QMap<quint8, QMap<QTOZW_Associations::associationColumns, QVariant> > > m_defaultData;
|
||||
};
|
||||
|
||||
#endif // QTOZWASSOCIATIONS_H
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <QDebug>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractItemModelReplica>
|
||||
#include "qtozw_logging.h"
|
||||
#include "qtozwmanager.h"
|
||||
#include "qtozwnodemodel.h"
|
||||
#include "qtozwassociations.h"
|
||||
|
@ -21,26 +22,22 @@ QTOZWManager_Internal::QTOZWManager_Internal(QObject *parent)
|
|||
: QTOZWManagerSimpleSource (parent)
|
||||
{
|
||||
this->setObjectName("QTOZW_Manager");
|
||||
pthread_mutexattr_t mutexattr;
|
||||
|
||||
pthread_mutexattr_init ( &mutexattr );
|
||||
pthread_mutexattr_settype( &mutexattr, PTHREAD_MUTEX_RECURSIVE );
|
||||
pthread_mutex_init( &m_manager_mutex, &mutexattr );
|
||||
pthread_mutexattr_destroy( &mutexattr );
|
||||
|
||||
try {
|
||||
this->m_options = OpenZWave::Options::Create( "", "", "" );
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qDebug() << "Failed to Load Options Class" << QString(e.GetMsg().c_str());
|
||||
qCWarning(manager) << "Failed to Load Options Class" << QString(e.GetMsg().c_str());
|
||||
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", true);
|
||||
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);
|
||||
QObject::connect(this->m_nodeModel, &QTOZW_Nodes_internal::dataChanged, this, &QTOZWManager_Internal::pvt_nodeModelDataChanged);
|
||||
|
@ -48,6 +45,8 @@ QTOZWManager_Internal::QTOZWManager_Internal(QObject *parent)
|
|||
QObject::connect(this->m_valueModel, &QTOZW_ValueIds_internal::dataChanged, this, &QTOZWManager_Internal::pvt_valueModelDataChanged);
|
||||
this->m_associationsModel = new QTOZW_Associations_internal(this);
|
||||
|
||||
qCDebug(manager) << "Models Created";
|
||||
|
||||
}
|
||||
|
||||
bool QTOZWManager_Internal::open(QString SerialPort)
|
||||
|
@ -59,22 +58,25 @@ bool QTOZWManager_Internal::open(QString SerialPort)
|
|||
} catch (OpenZWave::OZWException &e) {
|
||||
emit this->error(QTOZWErrorCodes::OZWException);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
qWarning() << "Failed to Load Manager Class" << QString(e.GetMsg().c_str());
|
||||
qCWarning(manager) << "Failed to Load Manager Class" << QString(e.GetMsg().c_str());
|
||||
return false;
|
||||
}
|
||||
qCDebug(manager) << "OpenZWave Manager Instance Created";
|
||||
try {
|
||||
if (this->m_manager->AddWatcher( OZWNotification::processNotification, this ) != true) {
|
||||
emit this->error(QTOZWErrorCodes::setupFailed);
|
||||
this->setErrorString("Failed to Add Notification Callback");
|
||||
qWarning() << "Failed to Add Notification Callback";
|
||||
qCWarning(manager) << "Failed to Add Notification Callback";
|
||||
return false;
|
||||
}
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
emit this->error(QTOZWErrorCodes::OZWException);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
qWarning() << "Failed to Add Notification Callback " << QString(e.GetMsg().c_str());
|
||||
qCWarning(manager) << "Failed to Add Notification Callback " << QString(e.GetMsg().c_str());
|
||||
return false;
|
||||
}
|
||||
qCDebug(manager) << "OpenZWave Watcher Registered";
|
||||
|
||||
/* setup all our Connections to the Notifications
|
||||
** these are set as QueuedConnections as the Notifications can happen on a different thread
|
||||
** to our main QT thread thats running this manager
|
||||
|
@ -107,20 +109,23 @@ bool QTOZWManager_Internal::open(QString SerialPort)
|
|||
QObject::connect(OZWNotification::Get(), &OZWNotification::ozwUserAlert, this, &QTOZWManager_Internal::pvt_ozwUserAlert, Qt::QueuedConnection);
|
||||
QObject::connect(OZWNotification::Get(), &OZWNotification::manufacturerSpecificDBReady, this, &QTOZWManager_Internal::pvt_manufacturerSpecificDBReady, Qt::QueuedConnection);
|
||||
|
||||
qCDebug(manager) << "Notification Signals Setup";
|
||||
|
||||
try {
|
||||
if (this->m_manager->AddDriver( SerialPort.toStdString()) != true) {
|
||||
emit this->error(QTOZWErrorCodes::setupFailed);
|
||||
this->setErrorString("Failed to Add Serial Port");
|
||||
qWarning() << "Failed to Add Serial Port";
|
||||
qCWarning(manager) << "Failed to Add Serial Port";
|
||||
return false;
|
||||
}
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
emit this->error(QTOZWErrorCodes::OZWException);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
qWarning() << "Failed to Add Serial Port: " << QString(e.GetMsg().c_str());
|
||||
qCWarning(manager) << "Failed to Add Serial Port: " << QString(e.GetMsg().c_str());
|
||||
return false;
|
||||
}
|
||||
qCDebug(manager) << "AddDriver Completed";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -437,24 +442,6 @@ bool QTOZWManager_Internal::downloadLatestMFSRevision() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool QTOZWManager_Internal::Lock() {
|
||||
if (pthread_mutex_lock( &this->m_manager_mutex ) == 0) {
|
||||
return true;
|
||||
}
|
||||
qDebug() << "Failed to Lock Manager Mutex";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QTOZWManager_Internal::Unlock()
|
||||
{
|
||||
if (pthread_mutex_unlock( &this->m_manager_mutex ) == 0) {
|
||||
return true;
|
||||
}
|
||||
qDebug() << "Failed to Unlock Manager Mutex";
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
QTOZW_Nodes *QTOZWManager_Internal::getNodeModel() {
|
||||
return static_cast<QTOZW_Nodes *>(this->m_nodeModel);
|
||||
}
|
||||
|
@ -541,7 +528,7 @@ bool QTOZWManager_Internal::convertValueID(quint64 vidKey) {
|
|||
this->m_manager->GetValueListItems(vid, &items);
|
||||
this->m_manager->GetValueListValues(vid, &values);
|
||||
if (items.size() != values.size()) {
|
||||
qWarning() << "ValueList Item Size Does not equal Value Size";
|
||||
qCWarning(manager) << "ValueList Item Size Does not equal Value Size";
|
||||
} else {
|
||||
std::vector<std::string>::iterator it;
|
||||
size_t i = 0;
|
||||
|
@ -613,12 +600,6 @@ bool QTOZWManager_Internal::convertValueID(quint64 vidKey) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
qDebug() << (quint32)bsmask;
|
||||
this->m_manager->GetBitMask(vid, &bsmask);
|
||||
qDebug().noquote() << BitSettoQString(vidbs.mask);
|
||||
qDebug().noquote() << BitSettoQString(vidbs.values);
|
||||
#endif
|
||||
this->m_valueModel->setValueData(vidKey, QTOZW_ValueIds::ValueIdColumns::Value, QVariant::fromValue(vidbs));
|
||||
this->m_valueModel->setValueData(vidKey, QTOZW_ValueIds::ValueIdColumns::Type, QTOZW_ValueIds::ValueIdTypes::BitSet);
|
||||
return true;
|
||||
|
@ -630,7 +611,7 @@ bool QTOZWManager_Internal::convertValueID(quint64 vidKey) {
|
|||
|
||||
void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valueAdded";
|
||||
qCDebug(notifications) << "Notification pvt_valueAdded:" << vidKey;
|
||||
if (!this->m_validValues.contains(vidKey))
|
||||
this->m_validValues.push_back(vidKey);
|
||||
|
||||
|
@ -656,7 +637,7 @@ void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey)
|
|||
|
||||
this->convertValueID(vidKey);
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -664,82 +645,78 @@ void QTOZWManager_Internal::pvt_valueAdded(quint64 vidKey)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_valueRemoved(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valueRemoved";
|
||||
qCDebug(notifications) << "Notification pvt_valueRemoved: " << vidKey;
|
||||
if (this->m_validValues.contains(vidKey))
|
||||
this->m_validValues.removeAll(vidKey);
|
||||
this->m_valueModel->delValue(vidKey);
|
||||
emit this->valueRemoved(vidKey);
|
||||
Q_UNUSED(vidKey);
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_valueChanged(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valueChanged";
|
||||
qCDebug(notifications) << "Notification pvt_valueChanged: " << vidKey;
|
||||
this->convertValueID(vidKey);
|
||||
emit this->valueChanged(vidKey);
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_valueRefreshed(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valueRefreshed";
|
||||
qCDebug(notifications) << "Notification pvt_valueRefreshed: " << vidKey;
|
||||
|
||||
this->convertValueID(vidKey);
|
||||
emit this->valueRefreshed(vidKey);
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_valuePollingEnabled(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valuePollingEnabled";
|
||||
qCDebug(notifications) << "Notification pvt_valuePollingEnabled " << vidKey;
|
||||
this->m_valueModel->setValueFlags(vidKey, QTOZW_ValueIds::ValueIDFlags::ValuePolled, true);
|
||||
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_valuePollingDisabled(quint64 vidKey)
|
||||
{
|
||||
qDebug() << "Notification pvt_valuePollingDisabled";
|
||||
qCDebug(notifications) << "Notification pvt_valuePollingDisabled " << vidKey;
|
||||
this->m_valueModel->setValueFlags(vidKey, QTOZW_ValueIds::ValueIDFlags::ValuePolled, false);
|
||||
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_nodeGroupChanged(quint8 node, quint8 group)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeGroupChanged";
|
||||
qCDebug(notifications) << "Notification pvt_nodeGroupChanged " << node << " Group: " << group;
|
||||
|
||||
if (this->m_associationDefaultsSet[node][group] == false) {
|
||||
for (int i = 0; i < this->m_manager->GetNumGroups(this->homeId(), node); i++) {
|
||||
this->m_associationsModel->setDefaultGroupData(node, group, QTOZW_Associations::associationColumns::MaxAssocations, this->m_manager->GetMaxAssociations(this->homeId(), node, group));
|
||||
this->m_associationsModel->setDefaultGroupFlags(node, group, QTOZW_Associations::associationFlags::isMultiInstance, this->m_manager->IsMultiInstance(this->homeId(), node, group));
|
||||
this->m_associationsModel->setDefaultGroupData(node, group, QTOZW_Associations::associationColumns::GroupName, this->m_manager->GetGroupLabel(this->homeId(), node, group).c_str());
|
||||
}
|
||||
this->m_associationDefaultsSet[node][group] = true;
|
||||
if (this->m_associationsModel->getassocationRow(node, group) == -1) {
|
||||
this->m_associationsModel->addGroup(node, group);
|
||||
this->m_associationsModel->setGroupData(node, group, QTOZW_Associations::associationColumns::MaxAssocations, this->m_manager->GetMaxAssociations(this->homeId(), node, group));
|
||||
this->m_associationsModel->setGroupFlags(node, group, QTOZW_Associations::associationFlags::isMultiInstance, this->m_manager->IsMultiInstance(this->homeId(), node, group));
|
||||
this->m_associationsModel->setGroupData(node, group, QTOZW_Associations::associationColumns::GroupName, this->m_manager->GetGroupLabel(this->homeId(), node, group).c_str());
|
||||
}
|
||||
|
||||
OpenZWave::InstanceAssociation *ia;
|
||||
quint32 count = this->m_manager->GetAssociations(this->homeId(), node, group, &ia);
|
||||
for (quint32 i = 0; i < count; i++) {
|
||||
if (!this->m_associationsModel->isAssociationExists(node, group, ia[i].m_nodeId, ia[i].m_instance)) {
|
||||
if (!this->m_associationsModel->findAssociation(node, group, ia[i].m_nodeId, ia[i].m_instance)) {
|
||||
this->m_associationsModel->addAssociation(node, group, ia[i].m_nodeId, ia[i].m_instance);
|
||||
}
|
||||
}
|
||||
/* now see if we need to delete any entries for this node/group */
|
||||
for (int row = 0; row < this->m_associationsModel->rowCount(QModelIndex()); ++row) {
|
||||
QMap<QTOZW_Associations::associationColumns, QVariant> data = this->m_associationsModel->m_associationData[row];
|
||||
|
||||
QStringList list = this->m_associationsModel->getassocationData(node, group, QTOZW_Associations::associationColumns::Members).toStringList();
|
||||
QStringList removeitems;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QString member = list.at(i);
|
||||
int targetnode = member.split(":")[0].toInt();
|
||||
int targetinstance = member.split(":")[1].toInt();
|
||||
bool found = false;
|
||||
for (quint32 i = 0; i < count; i++) {
|
||||
if (data[QTOZW_Associations::associationColumns::NodeID] == node) {
|
||||
if (data[QTOZW_Associations::associationColumns::GroupID] == group) {
|
||||
if (data[QTOZW_Associations::associationColumns::MemberNodeID] == ia[i].m_nodeId) {
|
||||
if (data[QTOZW_Associations::associationColumns::MemberNodeInstance] == ia[i].m_instance) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (quint32 j = 0; j < count; j++) {
|
||||
if (targetnode == ia[i].m_nodeId && targetinstance == ia[i].m_instance)
|
||||
found = true;
|
||||
}
|
||||
if (found == false) {
|
||||
this->m_associationsModel->delAssociation(node, group, data[QTOZW_Associations::associationColumns::MemberNodeID].value<quint8>(), data[QTOZW_Associations::associationColumns::MemberNodeInstance].value<quint8>());
|
||||
this->m_associationsModel->delAssociation(node, group, static_cast<quint8>(targetnode), static_cast<quint8>(targetinstance));
|
||||
}
|
||||
}
|
||||
|
||||
if (ia != nullptr)
|
||||
delete [] ia;
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_nodeNew(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeNew";
|
||||
qCDebug(notifications) << "Notification pvt_nodeNew " << node;
|
||||
if (!this->m_validNodes.contains(node))
|
||||
this->m_validNodes.push_back(node);
|
||||
this->m_nodeModel->addNode(node);
|
||||
|
@ -753,7 +730,7 @@ void QTOZWManager_Internal::pvt_nodeNew(quint8 node)
|
|||
|
||||
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -762,7 +739,7 @@ void QTOZWManager_Internal::pvt_nodeNew(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeAdded(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeAdded";
|
||||
qCDebug(notifications) << "Notification pvt_nodeAdded " << node;
|
||||
if (!this->m_validNodes.contains(node))
|
||||
this->m_validNodes.push_back(node);
|
||||
|
||||
|
@ -777,7 +754,7 @@ void QTOZWManager_Internal::pvt_nodeAdded(quint8 node)
|
|||
|
||||
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -786,7 +763,7 @@ void QTOZWManager_Internal::pvt_nodeAdded(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeRemoved(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeRemoved";
|
||||
qCDebug(notifications) << "Notification pvt_nodeRemoved " << node;
|
||||
if (this->m_validNodes.contains(node))
|
||||
this->m_validNodes.removeAll(node);
|
||||
this->m_associationsModel->delNode(node);
|
||||
|
@ -798,7 +775,7 @@ void QTOZWManager_Internal::pvt_nodeRemoved(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeReset(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeReset";
|
||||
qCDebug(notifications) << "Notification pvt_nodeReset " << node;
|
||||
if (this->m_validNodes.contains(node))
|
||||
this->m_validNodes.removeAll(node);
|
||||
|
||||
|
@ -811,7 +788,7 @@ void QTOZWManager_Internal::pvt_nodeReset(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeNaming(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeNaming";
|
||||
qCDebug(notifications) << "Notification pvt_nodeNaming " << node;
|
||||
try {
|
||||
QString data = this->m_manager->GetNodeName(this->homeId(), node).c_str();
|
||||
this->m_nodeModel->setNodeData(node, QTOZW_Nodes::NodeName, data);
|
||||
|
@ -827,7 +804,7 @@ void QTOZWManager_Internal::pvt_nodeNaming(quint8 node)
|
|||
|
||||
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -835,7 +812,7 @@ void QTOZWManager_Internal::pvt_nodeNaming(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeEvent(quint8 node, quint8 event)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeEvent";
|
||||
qCDebug(notifications) << "Notification pvt_nodeEvent " << node << " Event: " << event;
|
||||
try {
|
||||
QVariant data = this->m_manager->GetNodeQueryStage(this->homeId(), node).c_str();
|
||||
this->m_nodeModel->setNodeData(node, QTOZW_Nodes::NodeQueryStage, data);
|
||||
|
@ -844,7 +821,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));
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -852,7 +829,7 @@ void QTOZWManager_Internal::pvt_nodeEvent(quint8 node, quint8 event)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeProtocolInfo(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeProtocolInfo";
|
||||
qCDebug(notifications) << "Notification pvt_nodeProtocolInfo " << node;
|
||||
try {
|
||||
QVariant data = this->m_manager->GetNodeProductName(this->homeId(), node).c_str();
|
||||
this->m_nodeModel->setNodeData(node, QTOZW_Nodes::NodeProductName, data);
|
||||
|
@ -918,7 +895,7 @@ void QTOZWManager_Internal::pvt_nodeProtocolInfo(quint8 node)
|
|||
|
||||
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -926,7 +903,7 @@ void QTOZWManager_Internal::pvt_nodeProtocolInfo(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeEssentialNodeQueriesComplete(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeEssentialNodeQueriesComplete";
|
||||
qCDebug(notifications) << "Notification pvt_nodeEssentialNodeQueriesComplete " << node;
|
||||
try {
|
||||
QVariant data = this->m_manager->GetNodeQueryStage(this->homeId(), node).c_str();
|
||||
this->m_nodeModel->setNodeData(node, QTOZW_Nodes::NodeQueryStage, data);
|
||||
|
@ -995,7 +972,7 @@ void QTOZWManager_Internal::pvt_nodeEssentialNodeQueriesComplete(quint8 node)
|
|||
this->m_nodeModel->setNodeData(node, QTOZW_Nodes::NodeGroups, this->m_manager->GetNumGroups(this->homeId(), node));
|
||||
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -1003,7 +980,7 @@ void QTOZWManager_Internal::pvt_nodeEssentialNodeQueriesComplete(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_nodeQueriesComplete(quint8 node)
|
||||
{
|
||||
qDebug() << "Notification pvt_nodeQueriesComplete";
|
||||
qCDebug(notifications) << "Notification pvt_nodeQueriesComplete " << node;
|
||||
/* Plus Type Info here */
|
||||
try {
|
||||
QVariant data = this->m_manager->GetNodeDeviceType(this->homeId(), node);
|
||||
|
@ -1084,7 +1061,7 @@ void QTOZWManager_Internal::pvt_nodeQueriesComplete(quint8 node)
|
|||
this->m_nodeModel->setNodeFlags(node, QTOZW_Nodes::isFailed, this->m_manager->IsNodeFailed(this->homeId(), node));
|
||||
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -1092,14 +1069,14 @@ void QTOZWManager_Internal::pvt_nodeQueriesComplete(quint8 node)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_driverReady(quint32 _homeID)
|
||||
{
|
||||
qDebug() << "Notification pvt_driverRead";
|
||||
qCDebug(notifications) << "Notification pvt_driverRead " << _homeID;
|
||||
this->setHomeId(_homeID);
|
||||
emit this->started(_homeID);
|
||||
emit this->driverReady(_homeID);
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_driverFailed(quint32 _homeID)
|
||||
{
|
||||
qDebug() << "Notification pvt_driverFailed";
|
||||
qCDebug(notifications) << "Notification pvt_driverFailed " << _homeID;
|
||||
this->m_associationsModel->resetModel();
|
||||
this->m_valueModel->resetModel();
|
||||
this->m_nodeModel->resetModel();
|
||||
|
@ -1109,7 +1086,7 @@ void QTOZWManager_Internal::pvt_driverFailed(quint32 _homeID)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_driverReset(quint32 _homeID)
|
||||
{
|
||||
qDebug() << "Notification pvt_driverReset";
|
||||
qCDebug(notifications) << "Notification pvt_driverReset " << _homeID;
|
||||
this->m_associationsModel->resetModel();
|
||||
this->m_valueModel->resetModel();
|
||||
this->m_nodeModel->resetModel();
|
||||
|
@ -1119,7 +1096,7 @@ void QTOZWManager_Internal::pvt_driverReset(quint32 _homeID)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_driverRemoved(quint32 _homeID)
|
||||
{
|
||||
qDebug() << "Notification pvt_driverRemoved";
|
||||
qCDebug(notifications) << "Notification pvt_driverRemoved " << _homeID;
|
||||
this->m_associationsModel->resetModel();
|
||||
this->m_valueModel->resetModel();
|
||||
this->m_nodeModel->resetModel();
|
||||
|
@ -1129,39 +1106,37 @@ void QTOZWManager_Internal::pvt_driverRemoved(quint32 _homeID)
|
|||
}
|
||||
void QTOZWManager_Internal::pvt_driverAllNodesQueriedSomeDead()
|
||||
{
|
||||
qDebug() << "Notification pvt_driverAllNodesQueriedSomeDead";
|
||||
qCDebug(notifications) << "Notification pvt_driverAllNodesQueriedSomeDead";
|
||||
emit this->driverAllNodesQueriedSomeDead();
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_driverAllNodesQueried()
|
||||
{
|
||||
qDebug() << "Notification pvt_driverAllNodesQueried";
|
||||
qCDebug(notifications) << "Notification pvt_driverAllNodesQueried";
|
||||
emit this->driverAllNodesQueried();
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_driverAwakeNodesQueried()
|
||||
{
|
||||
qDebug() << "Notification pvt_driverAwakeNodesQueried";
|
||||
qCDebug(notifications) << "Notification pvt_driverAwakeNodesQueried";
|
||||
emit this->driverAllNodesQueried();
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_controllerCommand(quint8 command)
|
||||
{
|
||||
qDebug() << "Notification pvt_controllerCommand";
|
||||
qCDebug(notifications) << "Notification pvt_controllerCommand " << command;
|
||||
emit this->controllerCommand(command);
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_ozwNotification(OpenZWave::Notification::NotificationCode event)
|
||||
{
|
||||
qDebug() << "Notification pvt_ozwNotification";
|
||||
Q_UNUSED(event);
|
||||
qCDebug(notifications) << "Notification pvt_ozwNotification" << event;
|
||||
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_ozwUserAlert(OpenZWave::Notification::UserAlertNotification event)
|
||||
{
|
||||
qDebug() << "Notification pvt_ozwUserAlert";
|
||||
Q_UNUSED(event);
|
||||
qCDebug(notifications) << "Notification pvt_ozwUserAlert" << event;
|
||||
|
||||
}
|
||||
void QTOZWManager_Internal::pvt_manufacturerSpecificDBReady()
|
||||
{
|
||||
qDebug() << "Notification pvt_manufacturerSpecificDBReady";
|
||||
qCDebug(notifications) << "Notification pvt_manufacturerSpecificDBReady";
|
||||
emit this->manufacturerSpecificDBReady();
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1146,7 @@ void QTOZWManager_Internal::pvt_nodeModelDataChanged(const QModelIndex &topLeft,
|
|||
if (!roles.contains(QTOZW_UserRoles::ModelDataChanged)) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "nodeModel Changed!" << static_cast<QTOZW_Nodes::NodeColumns>(topLeft.column()) << ": "<< topLeft.data();
|
||||
qCDebug(nodeModel) << "nodeModel Changed!" << static_cast<QTOZW_Nodes::NodeColumns>(topLeft.column()) << ": "<< topLeft.data();
|
||||
/* get the Node Number */
|
||||
QModelIndex nodeIdIndex = topLeft.siblingAtColumn(QTOZW_Nodes::NodeColumns::NodeID);
|
||||
quint8 nodeId = this->m_nodeModel->data(nodeIdIndex, Qt::DisplayRole).value<quint8>();
|
||||
|
@ -1184,11 +1159,11 @@ void QTOZWManager_Internal::pvt_nodeModelDataChanged(const QModelIndex &topLeft,
|
|||
this->m_manager->SetNodeLocation(this->homeId(), nodeId, topLeft.data().toString().toStdString());
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Got a nodeModelDataChanged Singal but not a Column we handle: " << static_cast<QTOZW_Nodes::NodeColumns>(topLeft.column()) ;
|
||||
qCWarning(nodeModel) << "Got a nodeModelDataChanged Singal but not a Column we handle: " << static_cast<QTOZW_Nodes::NodeColumns>(topLeft.column()) ;
|
||||
return;
|
||||
}
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -1200,7 +1175,7 @@ void QTOZWManager_Internal::pvt_valueModelDataChanged(const QModelIndex &topLeft
|
|||
if (!roles.contains(QTOZW_UserRoles::ModelDataChanged)) {
|
||||
return;
|
||||
}
|
||||
qDebug() << "valueModel Changed!" << static_cast<QTOZW_ValueIds::ValueIdColumns>(topLeft.column()) << ": "<< topLeft.data();
|
||||
qCDebug(valueModel) << "valueModel Changed!" << static_cast<QTOZW_ValueIds::ValueIdColumns>(topLeft.column()) << ": "<< topLeft.data();
|
||||
/* get the Node Number */
|
||||
quint64 vidKey = this->m_valueModel->data(topLeft.siblingAtColumn(QTOZW_ValueIds::ValueIdColumns::ValueIDKey), Qt::DisplayRole).value<quint64>();
|
||||
try {
|
||||
|
@ -1228,12 +1203,12 @@ void QTOZWManager_Internal::pvt_valueModelDataChanged(const QModelIndex &topLeft
|
|||
}
|
||||
case OpenZWave::ValueID::ValueType_List:
|
||||
{
|
||||
qWarning() << "ValueType List TODO";
|
||||
qCWarning(valueModel) << "ValueType List TODO";
|
||||
return;
|
||||
}
|
||||
case OpenZWave::ValueID::ValueType_Schedule:
|
||||
{
|
||||
qWarning() << "ValueType_Schedule TODO";
|
||||
qCWarning(valueModel) << "ValueType_Schedule TODO";
|
||||
return;
|
||||
}
|
||||
case OpenZWave::ValueID::ValueType_Short:
|
||||
|
@ -1248,12 +1223,12 @@ void QTOZWManager_Internal::pvt_valueModelDataChanged(const QModelIndex &topLeft
|
|||
}
|
||||
case OpenZWave::ValueID::ValueType_Button:
|
||||
{
|
||||
qWarning() << "ValueType_Button TODO";
|
||||
qCWarning(valueModel) << "ValueType_Button TODO";
|
||||
return;
|
||||
}
|
||||
case OpenZWave::ValueID::ValueType_Raw:
|
||||
{
|
||||
qWarning() << "ValueType_Raw TODO";
|
||||
qCWarning(valueModel) << "ValueType_Raw TODO";
|
||||
return;
|
||||
}
|
||||
case OpenZWave::ValueID::ValueType_BitSet:
|
||||
|
@ -1278,7 +1253,7 @@ void QTOZWManager_Internal::pvt_valueModelDataChanged(const QModelIndex &topLeft
|
|||
|
||||
}
|
||||
} catch (OpenZWave::OZWException &e) {
|
||||
qWarning() << "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);
|
||||
this->setErrorString(e.GetMsg().c_str());
|
||||
}
|
||||
|
@ -1303,7 +1278,9 @@ QString nodeBasicStr (uint8 basic)
|
|||
}
|
||||
|
||||
QTOZWManager::QTOZWManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
: QObject(parent),
|
||||
m_running(false)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1318,10 +1295,10 @@ bool QTOZWManager::initilizeSource(bool enableServer) {
|
|||
if (enableServer) {
|
||||
this->m_sourceNode = new QRemoteObjectHost(QUrl(QStringLiteral("tcp://0.0.0.0:1983")), this);
|
||||
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);
|
||||
QVector<int> roles;
|
||||
roles << Qt::DisplayRole << Qt::BackgroundRole << 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->getValueModel(), "QTOZW_valueModel", roles);
|
||||
this->m_sourceNode->enableRemoting(this->d_ptr_internal->getAssociationModel(), "QTOZW_associationModel", roles);
|
||||
|
@ -1350,12 +1327,12 @@ bool QTOZWManager::initilizeReplica(QUrl remote) {
|
|||
}
|
||||
|
||||
void QTOZWManager::onReplicaError(QRemoteObjectNode::ErrorCode error) {
|
||||
qDebug() << "Replica Error: " << error;
|
||||
qCWarning(manager) << "Replica Error: " << error;
|
||||
/* raise this upto the application */
|
||||
}
|
||||
|
||||
void QTOZWManager::onSourceError(QRemoteObjectHost::ErrorCode error) {
|
||||
qDebug() << "Host Error: " << error;
|
||||
qCWarning(manager) << "Host Error: " << error;
|
||||
/* raise this upto the application */
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1369,7 @@ bool QTOZWManager::isRunning() {
|
|||
}
|
||||
|
||||
void QTOZWManager::setStarted() {
|
||||
qDebug() << "setStarted";
|
||||
qCDebug(manager) << "setStarted";
|
||||
this->m_running = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,10 +105,6 @@ public Q_SLOTS:
|
|||
void pvt_nodeModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||
void pvt_valueModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||
|
||||
private:
|
||||
bool Lock();
|
||||
bool Unlock();
|
||||
|
||||
private:
|
||||
|
||||
bool checkHomeId();
|
||||
|
@ -122,7 +118,6 @@ private:
|
|||
QTOZW_Nodes_internal *m_nodeModel;
|
||||
QTOZW_ValueIds_internal *m_valueModel;
|
||||
QTOZW_Associations_internal *m_associationsModel;
|
||||
pthread_mutex_t m_manager_mutex;
|
||||
QVector<quint8> m_validNodes;
|
||||
QVector<quint64> m_validValues;
|
||||
QMap<quint8, QMap<quint8, bool > > m_associationDefaultsSet;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <QDebug>
|
||||
#include <QBitArray>
|
||||
#include "qtozw_logging.h"
|
||||
#include "qtozwnodemodel.h"
|
||||
#include "qtopenzwave.h"
|
||||
|
||||
|
@ -10,11 +11,13 @@ QTOZW_Nodes::QTOZW_Nodes(QObject *parent)
|
|||
}
|
||||
|
||||
int QTOZW_Nodes::rowCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return this->m_nodeData.count();
|
||||
}
|
||||
int QTOZW_Nodes::columnCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return QTOZW_Nodes::NodeCount;
|
||||
}
|
||||
QVariant QTOZW_Nodes::data(const QModelIndex &index, int role) const {
|
||||
|
@ -27,7 +30,7 @@ QVariant QTOZW_Nodes::data(const QModelIndex &index, int role) const {
|
|||
if (role == Qt::DisplayRole) {
|
||||
QMap<NodeColumns, QVariant> node = this->m_nodeData[index.row()];
|
||||
if (node.size() == 0) {
|
||||
qWarning() << "data: Cant find any Node on Row " << index.row();
|
||||
qCWarning(nodeModel) << "data: Cant find any Node on Row " << index.row();
|
||||
return QVariant();
|
||||
}
|
||||
return node[static_cast<NodeColumns>(index.column())];
|
||||
|
@ -124,7 +127,7 @@ QVariant QTOZW_Nodes::headerData(int section, Qt::Orientation orientation, int r
|
|||
}
|
||||
Qt::ItemFlags QTOZW_Nodes::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return Qt::ItemIsEnabled;
|
||||
return Qt::NoItemFlags;
|
||||
switch (static_cast<NodeColumns>(index.column())) {
|
||||
case NodeName:
|
||||
case NodeLocation:
|
||||
|
@ -157,7 +160,7 @@ QVariant QTOZW_Nodes::getNodeData(quint8 _node, QTOZW_Nodes::NodeColumns _column
|
|||
int32_t row = this->getNodeRow(_node);
|
||||
if (row >= 0)
|
||||
return this->m_nodeData[row][_column];
|
||||
qWarning() << "Can't find NodeData for Node " << _node;
|
||||
qCWarning(nodeModel) << "Can't find NodeData for Node " << _node;
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -172,7 +175,7 @@ int32_t QTOZW_Nodes::getNodeRow(quint8 _node) {
|
|||
return it.key();
|
||||
}
|
||||
}
|
||||
qWarning() << "Can't Find NodeID " << _node << " in NodeData";
|
||||
qCWarning(nodeModel) << "Can't Find NodeID " << _node << " in NodeData";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -188,7 +191,7 @@ QTOZW_Nodes_internal::QTOZW_Nodes_internal(QObject *parent)
|
|||
void QTOZW_Nodes_internal::addNode(quint8 _nodeID)
|
||||
{
|
||||
if (this->getNodeRow(_nodeID) >= 0) {
|
||||
qWarning() << "Node " << _nodeID << " Already Exists";
|
||||
qCWarning(nodeModel) << "Node " << _nodeID << " Already Exists";
|
||||
return;
|
||||
}
|
||||
QMap<QTOZW_Nodes::NodeColumns, QVariant> newNode;
|
||||
|
@ -205,7 +208,7 @@ void QTOZW_Nodes_internal::setNodeData(quint8 _nodeID, QTOZW_Nodes::NodeColumns
|
|||
{
|
||||
int row = this->getNodeRow(_nodeID);
|
||||
if (row == -1) {
|
||||
qWarning() << "setNodeData: Node " << _nodeID << " does not exist";
|
||||
qCWarning(nodeModel) << "setNodeData: Node " << _nodeID << " does not exist";
|
||||
return;
|
||||
}
|
||||
if (this->m_nodeData[row][column] != data) {
|
||||
|
@ -220,7 +223,7 @@ void QTOZW_Nodes_internal::setNodeFlags(quint8 _nodeID, QTOZW_Nodes::nodeFlags _
|
|||
{
|
||||
int row = this->getNodeRow(_nodeID);
|
||||
if (row == -1) {
|
||||
qWarning() << "setNodeData: Node " << _nodeID << " does not exist";
|
||||
qCWarning(nodeModel) << "setNodeData: Node " << _nodeID << " does not exist";
|
||||
return;
|
||||
}
|
||||
QBitArray flag = this->m_nodeData[row][QTOZW_Nodes::NodeFlags].toBitArray();
|
||||
|
@ -238,7 +241,7 @@ void QTOZW_Nodes_internal::delNode(quint8 _nodeID) {
|
|||
int32_t newrow = 0;
|
||||
for (it = this->m_nodeData.begin(); it != this->m_nodeData.end(); ++it) {
|
||||
if (it.value()[QTOZW_Nodes::NodeColumns::NodeID] == _nodeID) {
|
||||
qDebug() << "Removing Node " << it.value()[QTOZW_Nodes::NodeColumns::NodeID] << it.key();
|
||||
qCDebug(nodeModel) << "Removing Node " << it.value()[QTOZW_Nodes::NodeColumns::NodeID] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_nodeData.erase(it);
|
||||
this->endRemoveRows();
|
||||
|
|
|
@ -50,15 +50,15 @@ public:
|
|||
flagCount
|
||||
};
|
||||
|
||||
Q_ENUM(nodeFlags);
|
||||
Q_ENUM(nodeFlags)
|
||||
|
||||
QTOZW_Nodes(QObject *parent=nullptr);
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override;
|
||||
|
||||
protected:
|
||||
QVariant getNodeData(quint8, NodeColumns);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <QBitArray>
|
||||
#include <QDataStream>
|
||||
|
||||
|
||||
#include "qtozw_logging.h"
|
||||
#include "qtozwvalueidmodel.h"
|
||||
#include "qtozwmanager.h"
|
||||
|
||||
|
@ -36,11 +36,13 @@ QTOZW_ValueIds::QTOZW_ValueIds(QObject *parent)
|
|||
}
|
||||
|
||||
int QTOZW_ValueIds::rowCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return this->m_valueData.count();
|
||||
}
|
||||
int QTOZW_ValueIds::columnCount(const QModelIndex &parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
return ValueIdColumns::ValueIdCount;
|
||||
}
|
||||
QVariant QTOZW_ValueIds::data(const QModelIndex &index, int role) const {
|
||||
|
@ -53,7 +55,7 @@ QVariant QTOZW_ValueIds::data(const QModelIndex &index, int role) const {
|
|||
if (role == Qt::DisplayRole) {
|
||||
QMap<ValueIdColumns, QVariant> value = this->m_valueData[index.row()];
|
||||
if (value.size() == 0) {
|
||||
qWarning() << "data: Cant find any Node on Row " << index.row();
|
||||
qCWarning(valueModel) << "data: Cant find any Node on Row " << index.row();
|
||||
return QVariant();
|
||||
}
|
||||
return value[static_cast<ValueIdColumns>(index.column())];
|
||||
|
@ -61,7 +63,7 @@ QVariant QTOZW_ValueIds::data(const QModelIndex &index, int role) const {
|
|||
if (role == Qt::ToolTipRole) {
|
||||
QMap<ValueIdColumns, QVariant> value = this->m_valueData[index.row()];
|
||||
if (value.size() == 0) {
|
||||
qWarning() << "data: Cant find any Node on Row " << index.row();
|
||||
qCWarning(valueModel) << "data: Cant find any Node on Row " << index.row();
|
||||
return QVariant();
|
||||
}
|
||||
return value[static_cast<ValueIdColumns>(ValueIdColumns::Help)];
|
||||
|
@ -125,7 +127,7 @@ QVariant QTOZW_ValueIds::headerData(int section, Qt::Orientation orientation, in
|
|||
}
|
||||
Qt::ItemFlags QTOZW_ValueIds::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return Qt::ItemIsEnabled;
|
||||
return Qt::NoItemFlags;
|
||||
switch (static_cast<ValueIdColumns>(index.column())) {
|
||||
case Value: {
|
||||
QBitArray flags = index.sibling(index.row(), ValueIdColumns::ValueFlags).data().value<QBitArray>();
|
||||
|
@ -163,7 +165,7 @@ QVariant QTOZW_ValueIds::getValueData(quint64 _vidKey, ValueIdColumns _column) {
|
|||
int32_t row = this->getValueRow(_vidKey);
|
||||
if (row >= 0)
|
||||
return this->m_valueData[row][_column];
|
||||
qWarning() << "Can't find ValueData for ValueID " << _vidKey;
|
||||
qCWarning(valueModel) << "Can't find ValueData for ValueID " << _vidKey;
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -178,7 +180,7 @@ int32_t QTOZW_ValueIds::getValueRow(quint64 _vidKey) {
|
|||
return it.key();
|
||||
}
|
||||
}
|
||||
qWarning() << "Can't Find ValueID " << _vidKey << " in valueData";
|
||||
qCWarning(valueModel) << "Can't Find ValueID " << _vidKey << " in valueData";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -192,7 +194,7 @@ QTOZW_ValueIds_internal::QTOZW_ValueIds_internal(QObject *parent)
|
|||
void QTOZW_ValueIds_internal::addValue(quint64 _vidKey)
|
||||
{
|
||||
if (this->getValueRow(_vidKey) >= 0) {
|
||||
qWarning() << "ValueID " << _vidKey << " Already Exists";
|
||||
qCWarning(valueModel) << "ValueID " << _vidKey << " Already Exists";
|
||||
return;
|
||||
}
|
||||
QMap<ValueIdColumns, QVariant> newValue;
|
||||
|
@ -209,7 +211,7 @@ void QTOZW_ValueIds_internal::setValueData(quint64 _vidKey, QTOZW_ValueIds::Valu
|
|||
{
|
||||
int row = this->getValueRow(_vidKey);
|
||||
if (row == -1) {
|
||||
qWarning() << "setValueData: Value " << _vidKey << " does not exist";
|
||||
qCWarning(valueModel) << "setValueData: Value " << _vidKey << " does not exist";
|
||||
return;
|
||||
}
|
||||
if (this->m_valueData[row][column] != data) {
|
||||
|
@ -222,7 +224,7 @@ void QTOZW_ValueIds_internal::setValueFlags(quint64 _vidKey, QTOZW_ValueIds::Val
|
|||
{
|
||||
int row = this->getValueRow(_vidKey);
|
||||
if (row == -1) {
|
||||
qWarning() << "setValueFlags: Value " << _vidKey << " does not exist";
|
||||
qCWarning(valueModel) << "setValueFlags: Value " << _vidKey << " does not exist";
|
||||
return;
|
||||
}
|
||||
if (this->m_valueData[row][QTOZW_ValueIds::ValueFlags].toBitArray().at(_flags) != _value) {
|
||||
|
@ -239,7 +241,7 @@ void QTOZW_ValueIds_internal::delValue(quint64 _vidKey) {
|
|||
int32_t newrow = 0;
|
||||
for (it = this->m_valueData.begin(); it != this->m_valueData.end(); ++it) {
|
||||
if (it.value()[QTOZW_ValueIds::ValueIdColumns::ValueIDKey] == _vidKey) {
|
||||
qDebug() << "Removing Value " << it.value()[QTOZW_ValueIds::ValueIdColumns::Label] << it.key();
|
||||
qCDebug(valueModel) << "Removing Value " << it.value()[QTOZW_ValueIds::ValueIdColumns::Label] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_valueData.erase(it);
|
||||
this->endRemoveRows();
|
||||
|
@ -258,7 +260,7 @@ void QTOZW_ValueIds_internal::delNodeValues(quint8 _node) {
|
|||
qint32 newrow = 0;
|
||||
for (it = this->m_valueData.begin(); it != this->m_valueData.end(); ++it) {
|
||||
if (it.value()[QTOZW_ValueIds::ValueIdColumns::Node] == _node) {
|
||||
qDebug() << "Removing Value " << it.value()[QTOZW_ValueIds::ValueIdColumns::Label] << it.key();
|
||||
qCDebug(valueModel) << "Removing Value " << it.value()[QTOZW_ValueIds::ValueIdColumns::Label] << it.key();
|
||||
this->beginRemoveRows(QModelIndex(), it.key(), it.key());
|
||||
this->m_valueData.erase(it);
|
||||
this->endRemoveRows();
|
||||
|
|
|
@ -83,12 +83,13 @@ public:
|
|||
};
|
||||
Q_ENUM(ValueIDFlags)
|
||||
QTOZW_ValueIds(QObject *parent = nullptr);
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override;
|
||||
|
||||
protected:
|
||||
QVariant getValueData(quint64, ValueIdColumns);
|
||||
int32_t getValueRow(quint64 _node);
|
||||
|
|
62
qt-ozwdaemon/main.cpp
Normal file
62
qt-ozwdaemon/main.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QLoggingCategory>
|
||||
#include <QCommandLineParser>
|
||||
#include "qtozwdaemon.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
QCoreApplication::setApplicationName("qt-ozwdaemon");
|
||||
QCoreApplication::setApplicationVersion("1.0");
|
||||
QCoreApplication::setOrganizationName("OpenZWave");
|
||||
QCoreApplication::setOrganizationDomain("openzwave.com");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("QT OpenZWave Remote Daemon");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption serialPort(QStringList() << "s" << "serial-port",
|
||||
"Serial Port of USB Stick",
|
||||
"serialPort"
|
||||
);
|
||||
|
||||
parser.addOption(serialPort);
|
||||
|
||||
QCommandLineOption configDir(QStringList() << "c" << "config-dir",
|
||||
"Directory containing the OZW Config Files",
|
||||
"configDir"
|
||||
);
|
||||
|
||||
parser.addOption(configDir);
|
||||
|
||||
QCommandLineOption userDir(QStringList() << "u" << "user-dir",
|
||||
"Directory for the OZW User Files",
|
||||
"userDir"
|
||||
);
|
||||
|
||||
parser.addOption(userDir);
|
||||
|
||||
parser.process(a);
|
||||
if (!parser.isSet(serialPort)) {
|
||||
fputs(qPrintable("Serial Port is Required\n"), stderr);
|
||||
fputs("\n\n", stderr);
|
||||
fputs(qPrintable(parser.helpText()), stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
QLoggingCategory::setFilterRules("qt.remoteobjects.debug=true\n"
|
||||
"qt.remoteobjects.warning=true\n"
|
||||
"qt.remoteobjects.models.debug=true\n"
|
||||
"qt.remoteobjects.models.debug=true\n"
|
||||
"qt.remoteobjects.io.debug=true\n"
|
||||
"default.debug=true");
|
||||
#else
|
||||
QLoggingCategory::setFilterRules("default.debug=true");
|
||||
#endif
|
||||
qtozwdaemon daemon;
|
||||
daemon.setSerialPort(parser.value(serialPort));
|
||||
daemon.startOZW();
|
||||
return a.exec();
|
||||
}
|
34
qt-ozwdaemon/qt-ozwdaemon.pro
Normal file
34
qt-ozwdaemon/qt-ozwdaemon.pro
Normal file
|
@ -0,0 +1,34 @@
|
|||
QT -= gui
|
||||
|
||||
QT += remoteobjects
|
||||
|
||||
CONFIG += c++11 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
LIBS += -L../qt-openzwave/ -lqt-openzwave -lresolv
|
||||
INCLUDEPATH += ../qt-openzwave
|
||||
|
||||
include(../qt-openzwave.pri)
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
qtozwdaemon.cpp
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
HEADERS += \
|
||||
qtozwdaemon.h
|
21
qt-ozwdaemon/qtozwdaemon.cpp
Normal file
21
qt-ozwdaemon/qtozwdaemon.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <QtDebug>
|
||||
#include "qtozwdaemon.h"
|
||||
|
||||
qtozwdaemon::qtozwdaemon(QObject *parent) : QObject(parent)
|
||||
{
|
||||
this->m_openzwave = new QTOpenZwave(this);
|
||||
this->m_qtozwmanager = this->m_openzwave->GetManager();
|
||||
QObject::connect(this->m_qtozwmanager, &QTOZWManager::ready, this, &qtozwdaemon::QTOZW_Ready);
|
||||
this->m_qtozwmanager->initilizeSource(true);
|
||||
}
|
||||
|
||||
void qtozwdaemon::QTOZW_Ready() {
|
||||
qDebug() << "Ready";
|
||||
}
|
||||
void qtozwdaemon::startOZW() {
|
||||
if (getSerialPort().size() == 0) {
|
||||
qWarning() << "Serial Port is not Set";
|
||||
return;
|
||||
}
|
||||
//this->m_qtozwmanager->open(this->getSerialPort());
|
||||
}
|
32
qt-ozwdaemon/qtozwdaemon.h
Normal file
32
qt-ozwdaemon/qtozwdaemon.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef QTOZWDAEMON_H
|
||||
#define QTOZWDAEMON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include "qtopenzwave.h"
|
||||
#include "qtozwmanager.h"
|
||||
|
||||
class qtozwdaemon : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString serialPort READ getSerialPort WRITE setSerialPort)
|
||||
public:
|
||||
explicit qtozwdaemon(QObject *parent = nullptr);
|
||||
QString getSerialPort() { return this->m_serialPort; }
|
||||
void setSerialPort(QString serialPort) { this->m_serialPort = serialPort;}
|
||||
|
||||
void startOZW();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void QTOZW_Ready();
|
||||
|
||||
|
||||
private:
|
||||
QTOpenZwave *m_openzwave;
|
||||
QTOZWManager *m_qtozwmanager;
|
||||
QString m_serialPort;
|
||||
};
|
||||
|
||||
#endif // QTOZWDAEMON_H
|
|
@ -62,7 +62,7 @@
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
QLoggingCategory::setFilterRules("qt.remoteobjects.debug=true\n"
|
||||
"qt.remoteobjects.warning=true\n"
|
||||
"qt.remoteobjects.models.debug=true\n"
|
||||
|
@ -70,7 +70,8 @@ int main(int argc, char **argv)
|
|||
"qt.remoteobjects.io.debug=true\n"
|
||||
"default.debug=true");
|
||||
#else
|
||||
QLoggingCategory::setFilterRules("default.debug=true");
|
||||
QLoggingCategory::setFilterRules("default.debug=true\n"
|
||||
"qt.modeltest.*=true");
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
QIcon icon(":res/ozw_SF2_notext.png");
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
#include "ui_mainwindow.h"
|
||||
#include "startup.h"
|
||||
#include "qtozw_itemdelegate.h"
|
||||
#include <qtozwproxymodels.h>
|
||||
#include "qtozwproxymodels.h"
|
||||
#include <QAbstractItemModelTester>
|
||||
|
||||
#define CONNECTSIGNALS(x) QObject::connect(this->m_qtozwmanager, &QTOZWManager::x, this, &MainWindow::x)
|
||||
|
||||
|
@ -11,8 +12,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
qDebug() << "Starting MainWindow";
|
||||
this->m_openzwave = new QTOpenZwave(this);
|
||||
this->m_qtozwmanager = this->m_openzwave->GetManager();
|
||||
qDebug() << "QTOpenZWave Managers Created";
|
||||
QObject::connect(this->m_qtozwmanager, &QTOZWManager::ready, this, &MainWindow::QTOZW_Ready);
|
||||
CONNECTSIGNALS(valueAdded);
|
||||
CONNECTSIGNALS(valueRemoved);
|
||||
|
@ -74,7 +77,10 @@ void MainWindow::QTOZW_Ready() {
|
|||
this->ui->statusbar->showMessage("OpenZWave Ready");
|
||||
qDebug() << "OZW Ready " << this->m_serialPort;
|
||||
if (this->m_qtozwmanager->isRunning() == false) {
|
||||
qDebug() << "Opening Serial Port";
|
||||
this->m_qtozwmanager->open(this->m_serialPort);
|
||||
} else {
|
||||
qDebug() << "OpenZWave Is already Running!";
|
||||
}
|
||||
QTOZW_proxyNodeModel *proxyNodeModel = new QTOZW_proxyNodeModel(this);
|
||||
proxyNodeModel->setSourceModel(this->m_qtozwmanager->getNodeModel());
|
||||
|
@ -88,6 +94,7 @@ void MainWindow::QTOZW_Ready() {
|
|||
this->ui->nodeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
QItemSelectionModel *selectNodeModel = this->ui->nodeView->selectionModel();
|
||||
|
||||
QAbstractItemModelTester *nodeTester = new QAbstractItemModelTester(this->m_qtozwmanager->getNodeModel(), QAbstractItemModelTester::FailureReportingMode::Fatal, this);
|
||||
|
||||
QTOZW_proxyValueModel *proxyUserValueModel = new QTOZW_proxyValueModel(this);
|
||||
proxyUserValueModel->setSourceModel(this->m_qtozwmanager->getValueModel());
|
||||
|
@ -107,6 +114,7 @@ void MainWindow::QTOZW_Ready() {
|
|||
this->ui->userView->setEditTriggers(QAbstractItemView::AllEditTriggers);
|
||||
this->ui->userView->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
QAbstractItemModelTester *valueTester = new QAbstractItemModelTester(this->m_qtozwmanager->getValueModel(), QAbstractItemModelTester::FailureReportingMode::Fatal, this);
|
||||
|
||||
|
||||
QTOZW_proxyValueModel *proxyConfigValueModel = new QTOZW_proxyValueModel(this);
|
||||
|
@ -158,6 +166,9 @@ void MainWindow::QTOZW_Ready() {
|
|||
this->ui->AssociationView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
this->ui->AssociationView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
|
||||
//QAbstractItemModelTester *associationTester = new QAbstractItemModelTester(this->m_qtozwmanager->getAssociationModel(), QAbstractItemModelTester::FailureReportingMode::Fatal, this);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::valueAdded(quint64 vidKey) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -152,8 +152,16 @@
|
|||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionE_xit"/>
|
||||
<addaction name="actionlahlah"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTest">
|
||||
<property name="title">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
<addaction name="actionTest_This"/>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
<addaction name="menuTest"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionE_xit">
|
||||
|
@ -161,6 +169,16 @@
|
|||
<string>E&xit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTest_This">
|
||||
<property name="text">
|
||||
<string>Test This</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionlahlah">
|
||||
<property name="text">
|
||||
<string>lahlah</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="simpleclient.qrc"/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
QT += widgets remoteobjects
|
||||
QT += widgets remoteobjects testlib
|
||||
|
||||
CONFIG += silent
|
||||
DEFINES += remote
|
||||
|
|
Loading…
Add table
Reference in a new issue