Generate download requests before reboot

This commit is contained in:
Zaid Abdulla committed 2017-05-14 18:03:48 -07:00
1 parent 87007e20c6
commit 729a4dc6ae
1 file changed
+16 -16
+16 -16
View File
@@ -987,6 +987,22 @@ generateSetRpcRequest = (sessionContext) ->
parameterList: ([p[0].join('.'), p[1], p[2]] for p in parameterValues) parameterList: ([p[0].join('.'), p[1], p[2]] for p in parameterValues)
} }
# Download
iter = syncState.downloadsDownload.entries()
while pair = iter.next().value
if not (pair[1] <= deviceData.attributes.get(pair[0])?.value?[1][0])
fileTypePath = deviceData.paths.get(pair[0].slice(0, -1).concat('FileType'))
fileNamePath = deviceData.paths.get(pair[0].slice(0, -1).concat('FileName'))
targetFileNamePath = deviceData.paths.get(pair[0].slice(0, -1).concat('TargetFileName'))
return {
name: 'Download'
commandKey: generateRpcId(sessionContext)
instance: pair[0][1]
fileType: deviceData.attributes.get(fileTypePath)?.value?[1][0]
fileName: deviceData.attributes.get(fileNamePath)?.value?[1][0]
targetFileName: deviceData.attributes.get(targetFileNamePath)?.value?[1][0]
}
# Reboot # Reboot
if syncState.reboot? if syncState.reboot?
p = sessionContext.deviceData.paths.get(['Reboot']) p = sessionContext.deviceData.paths.get(['Reboot'])
@@ -1005,22 +1021,6 @@ generateSetRpcRequest = (sessionContext) ->
name: 'FactoryReset' name: 'FactoryReset'
} }
# Download
iter = syncState.downloadsDownload.entries()
while pair = iter.next().value
if not (pair[1] <= deviceData.attributes.get(pair[0])?.value?[1][0])
fileTypePath = deviceData.paths.get(pair[0].slice(0, -1).concat('FileType'))
fileNamePath = deviceData.paths.get(pair[0].slice(0, -1).concat('FileName'))
targetFileNamePath = deviceData.paths.get(pair[0].slice(0, -1).concat('TargetFileName'))
return {
name: 'Download'
commandKey: generateRpcId(sessionContext)
instance: pair[0][1]
fileType: deviceData.attributes.get(fileTypePath)?.value?[1][0]
fileName: deviceData.attributes.get(fileNamePath)?.value?[1][0]
targetFileName: deviceData.attributes.get(targetFileNamePath)?.value?[1][0]
}
return null return null