Skip to content

Commit

Permalink
Merge pull request gregjhogan#1 from energee/master
Browse files Browse the repository at this point in the history
Fixes undefined when cancelling file selection
  • Loading branch information
energee authored Jan 31, 2019
2 parents 08d666a + 6bba4bf commit 76f344d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/ecu.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EcuWorker {
return
}
}

throw new Error(`failed to find device with serial number: ${serialNumber}`)
}

Expand All @@ -63,11 +63,12 @@ class EcuWorker {
}

async setFirmwareFile(file) {
console.log('parse rwd file ...')
console.log(file.name)
var data = await FileReaderAsync(file)
this.rwd = rwd.parse(data)
//this.client.debug = true
if (file) {
console.log('parse rwd file ...')
console.log(file.name)
var data = await FileReaderAsync(file)
this.rwd = rwd.parse(data)
}
}

async getFirmwareInfo() {
Expand Down Expand Up @@ -101,15 +102,15 @@ class EcuWorker {

return serialNumber
}

async getApplicationSoftwareId() {
console.log('read data by id: application software id ...')
var software_version = await this.client.read_data_by_identifier(DATA_IDENTIFIER_TYPE.APPLICATION_SOFTWARE_IDENTIFICATION)
software_version = software_version.toString()
console.log(software_version)
return software_version
}

async getSecurityAccessSeed() {
console.log('session: extended diagnostic ...')
await this.client.diagnostic_session_control(SESSION_TYPE.EXTENDED_DIAGNOSTIC)
Expand All @@ -129,17 +130,17 @@ class EcuWorker {
throw e
}
}

return sa_seed
}

async unlock(security_access_key) {
console.log('security access: send key ...')
console.log(`-key: ${security_access_key.toString('hex')}`)
await this.client.security_access(ACCESS_TYPE.SEND_KEY, security_access_key)
return true
}

async flash(postMessage) {
console.log('session: programming ...')
postMessage({ command: 'flash-status', result: 'entering programming session ...' })
Expand Down

0 comments on commit 76f344d

Please sign in to comment.