Merge PR #22: Add support for IAS Zone enrollment
This commit is contained in:
commit
ec8c13ad33
@ -54,6 +54,41 @@ ZigbeeClusterIasZone::ZoneStatusFlags ZigbeeClusterIasZone::zoneStatus() const
|
|||||||
return m_zoneStatus;
|
return m_zoneStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZigbeeClusterReply *ZigbeeClusterIasZone::sendZoneEnrollRequest(ZigbeeClusterIasZone::ZoneType zoneType, quint16 manufacturerCode)
|
||||||
|
{
|
||||||
|
QByteArray payload;
|
||||||
|
QDataStream stream(&payload, QIODevice::WriteOnly);
|
||||||
|
stream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
stream << static_cast<quint16>(zoneType);
|
||||||
|
stream << manufacturerCode;
|
||||||
|
ZigbeeClusterReply *reply = executeClusterCommand(ServerCommandZoneEnrollRequest, payload);
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZigbeeClusterReply* ZigbeeClusterIasZone::sendZoneEnrollResponse(quint8 zoneId, EnrollResponseCode code)
|
||||||
|
{
|
||||||
|
QByteArray payload;
|
||||||
|
QDataStream stream(&payload, QIODevice::WriteOnly);
|
||||||
|
stream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
stream << static_cast<quint8>(code);
|
||||||
|
stream << zoneId;
|
||||||
|
ZigbeeClusterReply *reply = executeClusterCommand(ClientCommandEnrollResponse, payload);
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZigbeeClusterReply *ZigbeeClusterIasZone::sendZoneStatusChangeNotification(ZigbeeClusterIasZone::ZoneStatus status, quint8 zoneId, quint16 delay)
|
||||||
|
{
|
||||||
|
QByteArray payload;
|
||||||
|
QDataStream stream(&payload, QIODevice::WriteOnly);
|
||||||
|
stream.setByteOrder(QDataStream::LittleEndian);
|
||||||
|
stream << static_cast<quint16>(status);
|
||||||
|
stream << static_cast<quint8>(0); // extended status, reserved for future use
|
||||||
|
stream << zoneId;
|
||||||
|
stream << delay;
|
||||||
|
ZigbeeClusterReply *reply = executeClusterCommand(ClientCommandEnrollResponse, payload);
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
void ZigbeeClusterIasZone::setAttribute(const ZigbeeClusterAttribute &attribute)
|
void ZigbeeClusterIasZone::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||||
{
|
{
|
||||||
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
||||||
|
|||||||
@ -127,6 +127,12 @@ public:
|
|||||||
ZoneType zoneType() const;
|
ZoneType zoneType() const;
|
||||||
ZoneStatusFlags zoneStatus() const;
|
ZoneStatusFlags zoneStatus() const;
|
||||||
|
|
||||||
|
// Request a Zone enrollment from the client (Server to client)
|
||||||
|
ZigbeeClusterReply *sendZoneEnrollRequest(ZigbeeClusterIasZone::ZoneType zoneType, quint16 manufacturerCode);
|
||||||
|
// Enroll a Zone on the server (Client to server)
|
||||||
|
ZigbeeClusterReply *sendZoneEnrollResponse(quint8 zoneId, ZigbeeClusterIasZone::EnrollResponseCode code = EnrollResponseCodeSuccess);
|
||||||
|
// Inform the client of Zone status changes (Server to client)
|
||||||
|
ZigbeeClusterReply *sendZoneStatusChangeNotification(ZoneStatus status, quint8 zoneId, quint16 delay = 0);
|
||||||
private:
|
private:
|
||||||
ZoneState m_zoneState = ZoneStateNotEnrolled;
|
ZoneState m_zoneState = ZoneStateNotEnrolled;
|
||||||
ZoneType m_zoneType = ZoneTypeInvalidZone;
|
ZoneType m_zoneType = ZoneTypeInvalidZone;
|
||||||
|
|||||||
@ -489,7 +489,7 @@ QDebug operator<<(QDebug debug, ZigbeeCluster *cluster)
|
|||||||
<< cluster->clusterName() << ", ";
|
<< cluster->clusterName() << ", ";
|
||||||
switch (cluster->direction()) {
|
switch (cluster->direction()) {
|
||||||
case ZigbeeCluster::Server:
|
case ZigbeeCluster::Server:
|
||||||
debug.nospace().noquote() << "Servers)";
|
debug.nospace().noquote() << "Server)";
|
||||||
break;
|
break;
|
||||||
case ZigbeeCluster::Client:
|
case ZigbeeCluster::Client:
|
||||||
debug.nospace().noquote() << "Client)";
|
debug.nospace().noquote() << "Client)";
|
||||||
|
|||||||
@ -162,10 +162,10 @@ public:
|
|||||||
HomeAutomationDeviceFlowSensor = 0x0306,
|
HomeAutomationDeviceFlowSensor = 0x0306,
|
||||||
|
|
||||||
// Intruder Alarm System (IAS) devices
|
// Intruder Alarm System (IAS) devices
|
||||||
HomeAutomationDeviceIsaControlEquipment = 0x0400, // CIE
|
HomeAutomationDeviceIasControlEquipment = 0x0400, // CIE
|
||||||
HomeAutomationDeviceIsaAncillaryControlEquipment = 0x0401, // ACE
|
HomeAutomationDeviceIasAncillaryControlEquipment = 0x0401, // ACE
|
||||||
HomeAutomationDeviceIsaZone = 0x0402,
|
HomeAutomationDeviceIasZone = 0x0402,
|
||||||
HomeAutomationDeviceIsaWarningDevice = 0x0403 // WD
|
HomeAutomationDeviceIasWarningDevice = 0x0403 // WD
|
||||||
};
|
};
|
||||||
Q_ENUM(HomeAutomationDevice)
|
Q_ENUM(HomeAutomationDevice)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user