A couple of bug fixes

This commit is contained in:
Zaid Abdulla committed 2016-12-28 16:21:04 -08:00
1 parent 2ca3ec86a8
commit 179211ce53
1 file changed
+9 -17
+9 -17
View File
@@ -453,14 +453,6 @@ runDeclarations = (sessionData, declarations) ->
if (path.alias | path.wildcard) & 1 or path[0] == 'FactoryReset' if (path.alias | path.wildcard) & 1 or path[0] == 'FactoryReset'
sessionData.deviceData.paths.add(['FactoryReset']) sessionData.deviceData.paths.add(['FactoryReset'])
if path[0] == 'Files' and
!(path.alias | path.wildcard) and
path.length == 3 and
path[2] == 'Download' and
(declaration[4]?.value? or sessionData.deviceData.attributes.has(path))
sessionData.syncState.download ?= new Map()
sessionData.syncState.download.set(path, 0)
if path.alias if path.alias
aliasDecs = device.getAliasDeclarations(path, declaration[1] or 1) aliasDecs = device.getAliasDeclarations(path, declaration[1] or 1)
for ad in aliasDecs for ad in aliasDecs
@@ -526,7 +518,7 @@ runDeclarations = (sessionData, declarations) ->
if ((path.wildcard | path.alias) & ((1 << (path.length - 1)) - 1)) == 0 if ((path.wildcard | path.alias) & ((1 << (path.length - 1)) - 1)) == 0
parent = sessionData.deviceData.paths.add(parent) parent = sessionData.deviceData.paths.add(parent)
unpacked ?= device.unpack(sessionData.device, path) unpacked ?= device.unpack(sessionData.deviceData, path)
processInstances(sessionData, parent, unpacked, keys, minInstances, maxInstances) processInstances(sessionData, parent, unpacked, keys, minInstances, maxInstances)
else else
parentsUnpacked = device.unpack(sessionData.deviceData, parent) parentsUnpacked = device.unpack(sessionData.deviceData, parent)
@@ -1092,6 +1084,14 @@ processDeclarations = (sessionData, allDeclareTimestamps, allDeclareAttributeTim
for attrName of attrs for attrName of attrs
declareAttributeValues[attrName] = attrs[attrName] declareAttributeValues[attrName] = attrs[attrName]
if currentAttributes
leafParam = currentPath
leafIsObject = currentAttributes.object?[1]
if leafIsObject == 0
leafTimestamp = Math.max(leafTimestamp, currentAttributes.object[0])
else
leafTimestamp = Math.max(leafTimestamp, currentTimestamp)
switch (if currentPath[0] != '*' then currentPath[0] else leafParam[0]) switch (if currentPath[0] != '*' then currentPath[0] else leafParam[0])
when 'Reboot' when 'Reboot'
if currentPath.length == 1 if currentPath.length == 1
@@ -1163,14 +1163,6 @@ processDeclarations = (sessionData, allDeclareTimestamps, allDeclareAttributeTim
if declareAttributeValues.value? if declareAttributeValues.value?
syncState.spv.set(currentPath, declareAttributeValues.value) syncState.spv.set(currentPath, declareAttributeValues.value)
if currentAttributes
leafParam = currentPath
leafIsObject = currentAttributes.object?[1]
if leafIsObject == 0
leafTimestamp = Math.max(leafTimestamp, currentAttributes.object[0])
else
leafTimestamp = Math.max(leafTimestamp, currentTimestamp)
for child of children for child of children
# This fine expression avoids duplicate visits # This fine expression avoids duplicate visits
if ((currentPath.wildcard ^ children[child][0].wildcard) & ((1 << currentPath.length) - 1)) >> leafParam.length == 0 if ((currentPath.wildcard ^ children[child][0].wildcard) & ((1 << currentPath.length) - 1)) >> leafParam.length == 0