Register the OTA server cluster on the TI backend
This is required by some devices (at least Tradfri) in order to query us for images.
This commit is contained in:
parent
a70afb965d
commit
7ebe593379
@ -605,7 +605,7 @@ ZigbeeInterfaceTiReply *ZigbeeBridgeControllerTi::start()
|
||||
return sendCommand(Ti::SubSystemZDO, Ti::ZDOCommandStartupFromApp, payload);
|
||||
}
|
||||
|
||||
ZigbeeInterfaceTiReply *ZigbeeBridgeControllerTi::registerEndpoint(quint8 endpointId, Zigbee::ZigbeeProfile profile, quint16 deviceId, quint8 deviceVersion)
|
||||
ZigbeeInterfaceTiReply *ZigbeeBridgeControllerTi::registerEndpoint(quint8 endpointId, Zigbee::ZigbeeProfile profile, quint16 deviceId, quint8 deviceVersion, const QList<quint16> &inputClusters, const QList<quint16> &outputClusters)
|
||||
{
|
||||
if (m_registeredEndpointIds.contains(endpointId)) {
|
||||
ZigbeeInterfaceTiReply *reply = new ZigbeeInterfaceTiReply(this);
|
||||
@ -621,10 +621,14 @@ ZigbeeInterfaceTiReply *ZigbeeBridgeControllerTi::registerEndpoint(quint8 endpoi
|
||||
stream << deviceId;
|
||||
stream << deviceVersion;
|
||||
stream << static_cast<quint8>(0x00); // latency requirement
|
||||
stream << static_cast<quint8>(0x00); // num input clusters
|
||||
// stream << static_cast<quint16>(0x0000); // input clusters
|
||||
stream << static_cast<quint8>(0x00); // num outout clusters
|
||||
// stream << static_cast<quint16>(0x0000); // output clusters
|
||||
stream << static_cast<quint8>(inputClusters.count());
|
||||
foreach (quint16 inputCluster, inputClusters) {
|
||||
stream << inputCluster;
|
||||
}
|
||||
stream << static_cast<quint8>(outputClusters.count());
|
||||
foreach (quint16 outputCluster, outputClusters) {
|
||||
stream << static_cast<quint16>(outputCluster);
|
||||
}
|
||||
|
||||
|
||||
ZigbeeInterfaceTiReply *reply = sendCommand(Ti::SubSystemAF, Ti::AFCommandRegister, payload);
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
ZigbeeInterfaceTiReply *setLed(bool on);
|
||||
|
||||
ZigbeeInterfaceTiReply *requestPermitJoin(quint8 seconds, const quint16 &networkAddress);
|
||||
ZigbeeInterfaceTiReply *registerEndpoint(quint8 endpointId, Zigbee::ZigbeeProfile profile, quint16 deviceId, quint8 deviceVersion);
|
||||
ZigbeeInterfaceTiReply *registerEndpoint(quint8 endpointId, Zigbee::ZigbeeProfile profile, quint16 deviceId, quint8 deviceVersion, const QList<quint16> &inputClusters = QList<quint16>(), const QList<quint16> &outputClusters = QList<quint16>());
|
||||
ZigbeeInterfaceTiReply *addEndpointToGroup(quint8 endpointId, quint16 groupId);
|
||||
|
||||
// Send APS request data
|
||||
|
||||
@ -382,7 +382,7 @@ void ZigbeeNetworkTi::onControllerStateChanged(ZigbeeBridgeControllerTi::Control
|
||||
// TODO: This should be public API of libnymea-zigbee so that the application layer (e.g. nymea-plugins)
|
||||
// can register the endpoints it needs for the particular application/device.
|
||||
// Fow now we're registering HomeAutomation, LightLink and GreenPower endpoints.
|
||||
m_controller->registerEndpoint(1, Zigbee::ZigbeeProfileHomeAutomation, 5, 0);
|
||||
m_controller->registerEndpoint(1, Zigbee::ZigbeeProfileHomeAutomation, 5, 0, {ZigbeeClusterLibrary::ClusterIdOtaUpgrade});
|
||||
m_controller->registerEndpoint(12, Zigbee::ZigbeeProfileLightLink, 5, 0);
|
||||
|
||||
// The Green Power endpoing is a bit special, it also needs to be added to a group
|
||||
@ -411,14 +411,22 @@ void ZigbeeNetworkTi::onControllerStateChanged(ZigbeeBridgeControllerTi::Control
|
||||
m_coordinatorNode = coordinatorNode;
|
||||
addUnitializedNode(coordinatorNode);
|
||||
}
|
||||
// Introspecing ourselves on every start. Most of the times this wouldn't be needed, but if the above
|
||||
// endpoints are changed (e.g. on a future upgrade), we'll want to refresh.
|
||||
m_coordinatorNode->startInitialization();
|
||||
|
||||
|
||||
ZigbeeInterfaceTiReply *ledReply = m_controller->setLed(false);
|
||||
connect(ledReply, &ZigbeeInterfaceTiReply::finished, this, [=]() {
|
||||
|
||||
setState(StateRunning);
|
||||
|
||||
// Introspecing ourselves on every start. Most of the times this wouldn't be needed, but if the above
|
||||
// endpoints are changed (e.g. on a future upgrade), we'll want to refresh.
|
||||
m_coordinatorNode->startInitialization();
|
||||
connect(m_coordinatorNode, &ZigbeeNode::stateChanged, this, [=](ZigbeeNode::State state){
|
||||
if (state == ZigbeeNode::StateInitialized) {
|
||||
setNodeInformation(m_coordinatorNode, "z-Stack", "", bridgeController()->firmwareVersion());
|
||||
}
|
||||
});
|
||||
|
||||
while (!m_requestQueue.isEmpty()) {
|
||||
ZigbeeNetworkReply *reply = m_requestQueue.takeFirst();
|
||||
ZigbeeInterfaceTiReply *interfaceReply = m_controller->requestSendRequest(reply->request());
|
||||
|
||||
Reference in New Issue
Block a user