incyclist-devices 1.5.33 → 1.5.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/daum/premium/bike.js +10 -5
- package/package.json +1 -1
package/lib/daum/premium/bike.js
CHANGED
|
@@ -143,8 +143,8 @@ class Daum8i {
|
|
|
143
143
|
this.logEvent({ message: "creating SerialPort", port: this.port, settings });
|
|
144
144
|
this.sp = new __SerialPort(this.port, settings);
|
|
145
145
|
}
|
|
146
|
-
this.sp.
|
|
147
|
-
this.sp.
|
|
146
|
+
this.sp.on('open', this.onPortOpen.bind(this));
|
|
147
|
+
this.sp.on('close', this.onPortClose.bind(this));
|
|
148
148
|
this.sp.on('error', (error) => { this.onPortError(error); });
|
|
149
149
|
this.sp.on('data', (data) => { this.onData(data); });
|
|
150
150
|
}
|
|
@@ -317,10 +317,15 @@ class Daum8i {
|
|
|
317
317
|
if (!isClosed)
|
|
318
318
|
resolve(false);
|
|
319
319
|
}, timeout);
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
try {
|
|
321
|
+
this.sp.removeAllListeners('close');
|
|
322
|
+
this.sp.removeAllListeners('error');
|
|
323
|
+
}
|
|
324
|
+
catch (err) {
|
|
325
|
+
this.logger.logEvent({ message: 'error', fn: 'closePort()', error: err.message });
|
|
326
|
+
}
|
|
322
327
|
this.sp.on('error', () => { });
|
|
323
|
-
this.sp.
|
|
328
|
+
this.sp.on('close', () => {
|
|
324
329
|
clearTimeout(to);
|
|
325
330
|
isClosed = true;
|
|
326
331
|
resolve(true);
|