incyclist-devices 1.5.36 → 1.5.38

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.
@@ -217,8 +217,7 @@ class DaumAdapterBase extends device_1.default {
217
217
  clearInterval(this.iv.update);
218
218
  this.iv = undefined;
219
219
  }
220
- if (this.bike.stopWorker && typeof (this.bike.stopWorker) === 'function')
221
- this.bike.stopWorker();
220
+ this.bike.stopWorker();
222
221
  this.logEvent({ message: 'stop request completed' });
223
222
  this.paused = undefined;
224
223
  resolve(true);
@@ -220,6 +220,7 @@ class Daum8008 {
220
220
  }, 50);
221
221
  }
222
222
  stopWorker() {
223
+ this.logEvent({ message: "stop worker", port: this.getPort() });
223
224
  if (this.queue !== undefined)
224
225
  this.queue.clear();
225
226
  if (this.bikeCmdWorker !== undefined) {
@@ -230,7 +231,7 @@ class Daum8008 {
230
231
  this.queue.clear();
231
232
  }
232
233
  sendDaum8008CommandfromQueue() {
233
- if (!this.connected || this.closing)
234
+ if (!this.connected || this.closing || !this.sp)
234
235
  return;
235
236
  if (this.cmdStart !== undefined && this.error !== undefined) {
236
237
  if (this.cmdStart !== undefined) {
@@ -75,6 +75,7 @@ declare class Daum8i {
75
75
  sendACK(): void;
76
76
  sendNAK(): void;
77
77
  sendReservedDaum8iCommand(command: ReservedCommands, cmdType: any, data?: Buffer): Promise<any[]>;
78
+ stopWorker(): void;
78
79
  getProtocolVersion(): Promise<string>;
79
80
  getDashboardVersion(): Promise<unknown>;
80
81
  getDeviceType(): Promise<any>;
@@ -34,13 +34,19 @@ const DEBUG_LOGGER = {
34
34
  log: (e, ...args) => console.log(e, ...args),
35
35
  logEvent: (event) => console.log(JSON.stringify(event))
36
36
  };
37
+ const validateHost = (host) => {
38
+ const ipParts = host.split('.');
39
+ if (ipParts.length > 1)
40
+ return ipParts.map(p => Number(p)).join('.');
41
+ return host;
42
+ };
37
43
  class Daum8i {
38
44
  constructor(props) {
39
45
  this.props = props || {};
40
46
  this.logger = process.env.DEBUG ? DEBUG_LOGGER : new gd_eventlog_1.EventLogger('DaumPremium');
41
47
  if (this.props.interface === 'tcpip') {
42
48
  const port = this.props.port || DAUM_PREMIUM_DEFAULT_PORT;
43
- const host = this.props.host || DAUM_PREMIUM_DEFAULT_HOST;
49
+ const host = validateHost(this.props.host || DAUM_PREMIUM_DEFAULT_HOST);
44
50
  this.portName = `${host}:51955`;
45
51
  this.tcpip = true;
46
52
  this.serial = false;
@@ -636,6 +642,9 @@ class Daum8i {
636
642
  return cmd;
637
643
  });
638
644
  }
645
+ stopWorker() {
646
+ this.logEvent({ message: "stop worker", port: this.getPort() });
647
+ }
639
648
  getProtocolVersion() {
640
649
  return this.sendDaum8iCommand('V00', 'AF', [])
641
650
  .then((data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.5.36",
3
+ "version": "1.5.38",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",