fix(sdk): usbboot command typos (#1758)

Change-type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
Gergely Imreh 2017-10-10 19:06:00 +01:00 committed by Juan Cruz Viotti
parent 179597b86f
commit f7b0291bf8

View File

@ -245,20 +245,20 @@ const startFileServer = (device, endpoint, files) => {
}, (error) => {
debug(`Got ${error.message} when reading a command, assuming everything is done`)
return {
command: protocol.FILE_MESSAGE_COMMAND_DONE
command: protocol.FILE_MESSAGE_COMMANDS.DONE
}
})
.then((fileMessage) => {
debug(`Received message: ${fileMessage.command} -> ${fileMessage.fileName}`)
if (fileMessage.command === protocol.FILE_MESSAGE_COMMAND_DONE) {
if (fileMessage.command === protocol.FILE_MESSAGE_COMMANDS.DONE) {
debug('Done')
return Bluebird.resolve()
}
return Bluebird.try(() => {
if (fileMessage.command === protocol.FILE_MESSAGE_COMMAND_GET_FILE_SIZE) {
if (fileMessage.command === protocol.FILE_MESSAGE_COMMANDS.GET_FILE_SIZE) {
debug(`Getting the size of ${fileMessage.fileName}`)
const fileSize = _.get(files, [ fileMessage.fileName, 'length' ])
@ -272,7 +272,7 @@ const startFileServer = (device, endpoint, files) => {
return protocol.sendBufferSize(device, fileSize)
}
if (fileMessage.command === protocol.FILE_MESSAGE_COMMAND_READ_FILE) {
if (fileMessage.command === protocol.FILE_MESSAGE_COMMANDS.READ_FILE) {
debug(`Reading ${fileMessage.fileName}`)
const fileBuffer = _.get(files, [ fileMessage.fileName ])