From d7695e3ce4f89a6469e966c4ab6d619d4c498b94 Mon Sep 17 00:00:00 2001 From: Manuel Pietschmann Date: Sun, 11 Sep 2016 23:10:56 +0200 Subject: [PATCH] Queue query of sw build id after receiving otau upgrade end request --- de_otau.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/de_otau.cpp b/de_otau.cpp index 7286abc9dd..31df10edaa 100644 --- a/de_otau.cpp +++ b/de_otau.cpp @@ -23,6 +23,7 @@ #define OTAU_QUERY_NEXT_IMAGE_REQUEST_CMD_ID 0x01 #define OTAU_IMAGE_BLOCK_REQUEST_CMD_ID 0x03 #define OTAU_IMAGE_PAGE_REQUEST_CMD_ID 0x04 +#define OTAU_UPGRADE_END_REQUEST_CMD_ID 0x06 #define DONT_CARE_FILE_VERSION 0xFFFFFFFFUL @@ -89,6 +90,23 @@ void DeRestPluginPrivate::otauDataIndication(const deCONZ::ApsDataIndication &in lightNode->setSwBuildId(version); updateEtag(lightNode->etag); + + // read real sw build id + lightNode->setLastRead(READ_SWBUILD_ID, idleTotalCounter); + lightNode->enableRead(READ_SWBUILD_ID); + lightNode->setNextReadTime(READ_SWBUILD_ID, queryTime); + queryTime = queryTime.addSecs(5); + } + } + else if ((ind.clusterId() == OTAU_CLUSTER_ID) && (zclFrame.commandId() == OTAU_UPGRADE_END_REQUEST_CMD_ID)) + { + LightNode *lightNode = getLightNodeForAddress(ind.srcAddress(), ind.srcEndpoint()); + + if (lightNode) + { + lightNode->setLastRead(READ_SWBUILD_ID, idleTotalCounter); + lightNode->enableRead(READ_SWBUILD_ID); + lightNode->setNextReadTime(READ_SWBUILD_ID, queryTime.addSecs(120)); } }