diff --git a/lib/drivers/onetouch/oneTouchVerio.js b/lib/drivers/onetouch/oneTouchVerio.js index d7f8957f0..ed439ceb0 100644 --- a/lib/drivers/onetouch/oneTouchVerio.js +++ b/lib/drivers/onetouch/oneTouchVerio.js @@ -438,9 +438,13 @@ class NativeMessaging { } } - closeDevice() { + closeDevice(callback) { chrome.runtime.sendMessage(this.extensionId, { command: 'closeDevice' }, (response) => { console.log("Closed:". response); + if (callback) { + return callback(); + } + return null; }); } @@ -465,10 +469,7 @@ class NativeMessaging { const seekOffset = lbaNumber * BLOCKDEVICE_BLOCKSIZE; chrome.runtime.sendMessage(this.extensionId, { command: 'retrieveData', request: Array.from(requestData), seekOffset }, (response) => { - console.log('Response:', response); - if (response.msgType === 'data') { - console.log('Details:', String.fromCharCode(null, response.details)); callback(null, Buffer.from(response.details)); } else { callback(new Error(response.details)); @@ -638,7 +639,7 @@ class OneTouchVerio { if (err) { return callback(err); } - const recordCount = commandData.readUInt16LE(); + const recordCount = commandData.readUInt16LE(0); debug('retrieveRecordCount:', recordCount); const data = {}; data.recordCount = recordCount; @@ -733,6 +734,7 @@ export default function (config) { // With no date & time settings changes available, // timezone is applied across-the-board cfg.tzoUtil = new TZOUtil(cfg.timezone, new Date().toISOString(), []); + cfg.deviceInfo = {}; assign(cfg.deviceInfo, { tags: ['bgm'], manufacturers: ['LifeScan'], @@ -788,6 +790,7 @@ export default function (config) { cb(err2, null); return; } + assign(cfg.deviceInfo, { model: deviceModel.deviceModel }); data.deviceModel = cfg.deviceInfo.model; // for metrics progress(100); @@ -872,7 +875,7 @@ export default function (config) { deviceManufacturers: cfg.deviceInfo.manufacturers, deviceModel: cfg.deviceInfo.model, deviceSerialNumber: cfg.deviceInfo.serialNumber, - deviceTime: data.deviceInfo.deviceTime, + deviceTime: cfg.deviceInfo.deviceTime, deviceId: cfg.deviceInfo.deviceId, start: sundial.utcDateString(), timeProcessing: cfg.tzoUtil.type,