Add develco profile and manufacturer, implement manufacturer specific cluster methods, improve binary input cluster
parent
977938c49f
commit
5072ad7c1e
|
|
@ -34,8 +34,26 @@ ZigbeeClusterBinaryInput::ZigbeeClusterBinaryInput(ZigbeeNetwork *network, Zigbe
|
|||
|
||||
}
|
||||
|
||||
bool ZigbeeClusterBinaryInput::presentValue() const
|
||||
{
|
||||
return m_presentValue;
|
||||
}
|
||||
|
||||
void ZigbeeClusterBinaryInput::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||
{
|
||||
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
||||
updateOrAddAttribute(attribute);
|
||||
|
||||
// Parse the information for convenience
|
||||
if (attribute.id() == AttributePresentValue) {
|
||||
bool valueOk = false;
|
||||
bool value = attribute.dataType().toBool(&valueOk);
|
||||
if (valueOk) {
|
||||
m_presentValue = value;
|
||||
qCDebug(dcZigbeeCluster()) << "Binary input state changed on" << m_node << m_endpoint << this << m_presentValue;
|
||||
emit presentValueChanged(m_presentValue);
|
||||
} else {
|
||||
qCWarning(dcZigbeeCluster()) << "Failed to parse attribute data" << m_node << m_endpoint << this << attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,14 @@ public:
|
|||
|
||||
explicit ZigbeeClusterBinaryInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
|
||||
|
||||
bool presentValue() const;
|
||||
|
||||
signals:
|
||||
void presentValueChanged(bool presentValue);
|
||||
|
||||
private:
|
||||
bool m_presentValue = false;
|
||||
|
||||
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ void ZigbeeCluster::setAttribute(const ZigbeeClusterAttribute &attribute)
|
|||
updateOrAddAttribute(attribute);
|
||||
}
|
||||
|
||||
ZigbeeClusterReply *ZigbeeCluster::readAttributes(QList<quint16> attributes)
|
||||
ZigbeeClusterReply *ZigbeeCluster::readAttributes(QList<quint16> attributes, quint16 manufacturerCode)
|
||||
{
|
||||
qCDebug(dcZigbeeCluster()) << "Read attributes from" << m_node << m_endpoint << this << attributes;
|
||||
|
||||
|
|
@ -108,10 +108,10 @@ ZigbeeClusterReply *ZigbeeCluster::readAttributes(QList<quint16> attributes)
|
|||
stream << attribute;
|
||||
}
|
||||
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandReadAttributes, payload);
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandReadAttributes, payload, manufacturerCode);
|
||||
}
|
||||
|
||||
ZigbeeClusterReply *ZigbeeCluster::writeAttributes(QList<ZigbeeClusterLibrary::WriteAttributeRecord> writeAttributeRecords)
|
||||
ZigbeeClusterReply *ZigbeeCluster::writeAttributes(QList<ZigbeeClusterLibrary::WriteAttributeRecord> writeAttributeRecords, quint16 manufacturerCode)
|
||||
{
|
||||
qCDebug(dcZigbeeCluster()) << "Write attributes on" << m_node << m_endpoint << this;
|
||||
QByteArray payload;
|
||||
|
|
@ -119,10 +119,10 @@ ZigbeeClusterReply *ZigbeeCluster::writeAttributes(QList<ZigbeeClusterLibrary::W
|
|||
payload += ZigbeeClusterLibrary::buildWriteAttributeRecord(writeAttributeRecord);
|
||||
}
|
||||
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandWriteAttributes, payload);
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandWriteAttributes, payload, manufacturerCode);
|
||||
}
|
||||
|
||||
ZigbeeClusterReply *ZigbeeCluster::configureReporting(QList<ZigbeeClusterLibrary::AttributeReportingConfiguration> reportingConfigurations)
|
||||
ZigbeeClusterReply *ZigbeeCluster::configureReporting(QList<ZigbeeClusterLibrary::AttributeReportingConfiguration> reportingConfigurations, quint16 manufacturerCode)
|
||||
{
|
||||
qCDebug(dcZigbeeCluster()) << "Configure reporting on" << m_node << m_endpoint << this << reportingConfigurations;
|
||||
|
||||
|
|
@ -131,11 +131,11 @@ ZigbeeClusterReply *ZigbeeCluster::configureReporting(QList<ZigbeeClusterLibrary
|
|||
payload += ZigbeeClusterLibrary::buildAttributeReportingConfiguration(reportingConfiguration);
|
||||
}
|
||||
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandConfigureReporting, payload);
|
||||
return executeGlobalCommand(ZigbeeClusterLibrary::CommandConfigureReporting, payload, manufacturerCode);
|
||||
}
|
||||
|
||||
|
||||
ZigbeeClusterReply *ZigbeeCluster::executeGlobalCommand(quint8 command, const QByteArray &payload)
|
||||
ZigbeeClusterReply *ZigbeeCluster::executeGlobalCommand(quint8 command, const QByteArray &payload, quint16 manufacturerCode)
|
||||
{
|
||||
// Build the request
|
||||
ZigbeeNetworkRequest request = createGeneralRequest();
|
||||
|
|
@ -145,7 +145,12 @@ ZigbeeClusterReply *ZigbeeCluster::executeGlobalCommand(quint8 command, const QB
|
|||
// Note: for basic commands the frame control files has to be zero accoring to spec ZCL 2.4.1.1
|
||||
ZigbeeClusterLibrary::FrameControl frameControl;
|
||||
frameControl.frameType = ZigbeeClusterLibrary::FrameTypeGlobal;
|
||||
frameControl.manufacturerSpecific = false;
|
||||
if (manufacturerCode != 0) {
|
||||
frameControl.manufacturerSpecific = true;
|
||||
} else {
|
||||
frameControl.manufacturerSpecific = false;
|
||||
}
|
||||
|
||||
if (m_direction == Direction::Server) {
|
||||
frameControl.direction = ZigbeeClusterLibrary::DirectionClientToServer;
|
||||
} else {
|
||||
|
|
@ -157,6 +162,9 @@ ZigbeeClusterReply *ZigbeeCluster::executeGlobalCommand(quint8 command, const QB
|
|||
ZigbeeClusterLibrary::Header header;
|
||||
header.frameControl = frameControl;
|
||||
header.command = command;
|
||||
if (manufacturerCode != 0) {
|
||||
header.manufacturerCode = manufacturerCode;
|
||||
}
|
||||
header.transactionSequenceNumber = m_transactionSequenceNumber++;
|
||||
|
||||
// Put them together
|
||||
|
|
@ -186,7 +194,6 @@ ZigbeeClusterReply *ZigbeeCluster::executeGlobalCommand(quint8 command, const QB
|
|||
return zclReply;
|
||||
}
|
||||
|
||||
|
||||
ZigbeeClusterReply *ZigbeeCluster::createClusterReply(const ZigbeeNetworkRequest &request, ZigbeeClusterLibrary::Frame frame)
|
||||
{
|
||||
ZigbeeClusterReply *zclReply = new ZigbeeClusterReply(request, frame, this);
|
||||
|
|
|
|||
|
|
@ -90,12 +90,9 @@ public:
|
|||
ZigbeeClusterAttribute attribute(quint16 attributeId);
|
||||
|
||||
// ZCL global commands
|
||||
ZigbeeClusterReply *readAttributes(QList<quint16> attributes);
|
||||
ZigbeeClusterReply *writeAttributes(QList<ZigbeeClusterLibrary::WriteAttributeRecord> writeAttributeRecords);
|
||||
ZigbeeClusterReply *configureReporting(QList<ZigbeeClusterLibrary::AttributeReportingConfiguration> reportingConfigurations);
|
||||
|
||||
|
||||
|
||||
ZigbeeClusterReply *readAttributes(QList<quint16> attributes, quint16 manufacturerCode = 0x0000);
|
||||
ZigbeeClusterReply *writeAttributes(QList<ZigbeeClusterLibrary::WriteAttributeRecord> writeAttributeRecords, quint16 manufacturerCode = 0x0000);
|
||||
ZigbeeClusterReply *configureReporting(QList<ZigbeeClusterLibrary::AttributeReportingConfiguration> reportingConfigurations, quint16 manufacturerCode = 0x0000);
|
||||
|
||||
protected:
|
||||
ZigbeeNetwork *m_network = nullptr;
|
||||
|
|
@ -112,7 +109,8 @@ protected:
|
|||
QHash<quint8, ZigbeeClusterReply *> m_pendingReplies;
|
||||
|
||||
// Global commands
|
||||
ZigbeeClusterReply *executeGlobalCommand(quint8 command, const QByteArray &payload = QByteArray());
|
||||
ZigbeeClusterReply *executeGlobalCommand(quint8 command, const QByteArray &payload = QByteArray(), quint16 manufacturerCode = 0x0000);
|
||||
ZigbeeClusterReply *executeManufacturerSpecificGlobalCommand(quint8 command, quint16 manufacturerCode, const QByteArray &payload = QByteArray());
|
||||
|
||||
// Cluster specific
|
||||
ZigbeeClusterReply *createClusterReply(const ZigbeeNetworkRequest &request, ZigbeeClusterLibrary::Frame frame);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public:
|
|||
ZigbeeProfilePersonalHomeHospitalCare = 0x0108,
|
||||
ZigbeeProfileAdvancedMetering = 0x0109,
|
||||
ZigbeeProfileLightLink = 0xC05E,
|
||||
ZigbeeProfileDevelco = 0xC0C9,
|
||||
ZigbeeProfileGreenPower = 0xA1E0
|
||||
};
|
||||
Q_ENUM(ZigbeeProfile)
|
||||
|
|
@ -286,6 +287,7 @@ public:
|
|||
Chipcon = 0x1001,
|
||||
Ember = 0x1003,
|
||||
Philips = 0x100b,
|
||||
Develco = 0x1015,
|
||||
Ikea = 0x117C,
|
||||
FeiBit = 0x117E
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ ZigbeeNetwork::ZigbeeNetwork(const QUuid &networkUuid, QObject *parent) :
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
m_reachableRefreshTimer = new QTimer(this);
|
||||
m_reachableRefreshTimer->setInterval(120000);
|
||||
m_reachableRefreshTimer->setSingleShot(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue