@zimo-elektronik/zcan 1.0.40 → 1.0.42

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.
Files changed (43) hide show
  1. package/__tests__/connection.test.ts +1 -1
  2. package/dist/MX10.d.ts +3 -2
  3. package/dist/MX10.js +9 -8
  4. package/dist/MX10.js.map +1 -1
  5. package/dist/data/dataGroup.d.ts +5 -4
  6. package/dist/data/dataGroup.js +103 -20
  7. package/dist/data/dataGroup.js.map +1 -1
  8. package/dist/data/dataMsg.d.ts +1 -2
  9. package/dist/data/dataMsg.js +4 -7
  10. package/dist/data/dataMsg.js.map +1 -1
  11. package/dist/data/lanDataGroup.d.ts +5 -3
  12. package/dist/data/lanDataGroup.js +35 -26
  13. package/dist/data/lanDataGroup.js.map +1 -1
  14. package/dist/data/lanDataMsg.d.ts +26 -0
  15. package/dist/data/lanDataMsg.js +57 -0
  16. package/dist/data/lanDataMsg.js.map +1 -0
  17. package/dist/info/infoGroup.js +6 -6
  18. package/dist/info/infoGroup.js.map +1 -1
  19. package/dist/loco/vehicleGroup.js +21 -21
  20. package/dist/loco/vehicleGroup.js.map +1 -1
  21. package/dist/network/lanNetworkGroup.js +6 -6
  22. package/dist/network/lanNetworkGroup.js.map +1 -1
  23. package/dist/network/networkGroup.js +1 -1
  24. package/dist/network/networkGroup.js.map +1 -1
  25. package/dist/track/trackGroup.js +9 -9
  26. package/dist/track/trackGroup.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/MX10.ts +13 -13
  29. package/src/data/dataGroup.ts +114 -21
  30. package/src/data/dataMsg.ts +59 -60
  31. package/src/data/lanDataGroup.ts +69 -33
  32. package/src/data/lanDataMsg.ts +71 -0
  33. package/src/file/fileControlGroup.ts +1 -1
  34. package/src/file/fileTransferGroup.ts +1 -1
  35. package/src/info/infoGroup.ts +7 -8
  36. package/src/loco/vehicleGroup.ts +25 -25
  37. package/src/misc/propertyConfigGroup.ts +1 -1
  38. package/src/misc/railwayControlGroup.ts +1 -1
  39. package/src/network/lanNetworkGroup.ts +6 -6
  40. package/src/network/networkGroup.ts +6 -7
  41. package/src/script/lanScriptGroup.ts +1 -1
  42. package/src/script/scriptGroup.ts +1 -1
  43. package/src/track/trackGroup.ts +14 -14
@@ -0,0 +1,71 @@
1
+ import { FunctionMode, MsgMode } from "../common/enums";
2
+ import { Header, Message } from "../common/communication";
3
+ import { TrainFunction } from "../docs_entrypoint";
4
+
5
+
6
+ export class MsgLocoGuiReq extends Message
7
+ {
8
+ public static header(mode: MsgMode, nid: number): Header
9
+ {return {group: 0x17, cmd: 0x27, mode: mode, nid: nid}}
10
+
11
+ constructor(header: Header, locoNid: number, subNid: number)
12
+ {
13
+ super(header);
14
+ super.push({value: locoNid, length: 2});
15
+ super.push({value: subNid, length: 2});
16
+ }
17
+ locoNid(): number {return (this.data[0].value as number)}
18
+ subNid(): number {return (this.data[1].value as number)}
19
+ }
20
+
21
+ export class MsgLocoGuiRsp extends Message
22
+ {
23
+ public static header(mode: MsgMode, nid: number): Header
24
+ {return {group: 0x17, cmd: 0x27, mode: mode, nid: nid}}
25
+
26
+ constructor(header: Header, locoNid: number, subNid: number, group: number, name: string, imageId: number,
27
+ tacho: number, speedFwd: number, speedRev: number, speedRange: number, driveType: number, era: number,
28
+ country: number, functions: number[])
29
+ {
30
+ super(header);
31
+ super.push({value: locoNid, length: 2});
32
+ super.push({value: subNid, length: 2});
33
+ super.push({value: group, length: 2});
34
+ super.push({value: name, length: 32});
35
+ super.push({value: imageId, length: 2});
36
+ super.push({value: tacho, length: 2});
37
+ super.push({value: speedFwd, length: 2});
38
+ super.push({value: speedRev, length: 2});
39
+ super.push({value: speedRange, length: 2});
40
+ super.push({value: driveType, length: 2});
41
+ super.push({value: era, length: 2});
42
+ super.push({value: country, length: 2});
43
+ functions.forEach(funk => {
44
+ super.push({value: funk, length: 2});
45
+ });
46
+ }
47
+ locoNid(): number {return (this.data[0].value as number)}
48
+ subNid(): number {return (this.data[1].value as number)}
49
+ group(): number {return (this.data[2].value as number)}
50
+ name(): string {return (this.data[3].value as string)}
51
+ imageId(): number {return (this.data[4].value as number)}
52
+ tacho(): number {return (this.data[5].value as number)}
53
+ speedFwd(): number {return (this.data[6].value as number)}
54
+ speedRev(): number {return (this.data[7].value as number)}
55
+ speedRange(): number {return (this.data[8].value as number)}
56
+ driveType(): number {return (this.data[9].value as number)}
57
+ era(): number {return (this.data[10].value as number)}
58
+ country(): number {return (this.data[11].value as number)}
59
+ functions(): Array<TrainFunction>
60
+ {
61
+ const rv = Array<TrainFunction>();
62
+ for (let i = 12; i < this.data.length; i++) {
63
+ const icon = (this.data[i].value as number);
64
+ const iconString = icon === 0 ? String(i).padStart(2, '0') : String(icon);
65
+ rv.push({mode: FunctionMode.switch, active: false,
66
+ icon: iconString.padStart(4, icon === 0 ? '07' : '0'),
67
+ });
68
+ }
69
+ return rv;
70
+ }
71
+ }
@@ -20,6 +20,6 @@ export default class FileControlGroup {
20
20
  nid: number,
21
21
  buffer: Buffer,
22
22
  ) {
23
- // console.log('parse file control group');
23
+ // this.mx10.logInfo.next('parse file control group');
24
24
  }
25
25
  }
@@ -20,6 +20,6 @@ parse(
20
20
  nid: number,
21
21
  buffer: Buffer,
22
22
  ) {
23
- // console.log('parse file transfer group');
23
+ // this.mx10.logInfo.next('parse file transfer group');
24
24
  }
25
25
  }
@@ -27,26 +27,26 @@ export default class InfoGroup
27
27
  async getModuleInfo(nid: number, type: ModInfoType | number): Promise<MsgModInfo | undefined>
28
28
  {
29
29
  if(this.modInfoQ !== undefined && !await this.modInfoQ.lock()) {
30
- this.mx10.log.next("mx10.getModuleInfo: failed to acquire lock");
30
+ this.mx10.logInfo.next("mx10.getModuleInfo: failed to acquire lock");
31
31
  return undefined;
32
32
  }
33
33
 
34
34
  this.modInfoQ = new Query(MsgModInfo.header(MsgMode.REQ, nid), this.onModuleInfoChange);
35
35
  this.modInfoQ.log = ((msg) => {
36
- this.mx10.log.next(msg);
36
+ this.mx10.logInfo.next(msg);
37
37
  });
38
38
  this.modInfoQ.tx = ((header) => {
39
39
  const msg = new MsgModInfo(header, type);
40
- this.mx10.log.next('mx10 query tx: ' + JSON.stringify(msg));
40
+ this.mx10.logInfo.next('mx10 query tx: ' + JSON.stringify(msg));
41
41
  this.mx10.sendMsg(msg);
42
42
  });
43
43
  this.modInfoQ.match = ((msg) => {
44
- this.mx10.log.next('mx10 query rx: ' + JSON.stringify(msg));
44
+ this.mx10.logInfo.next('mx10 query rx: ' + JSON.stringify(msg));
45
45
  return (msg.type() === type);
46
46
  })
47
47
  // this.modInfoQ.subscribe();
48
48
  const rv = await this.modInfoQ.run();
49
- this.mx10.log.next("mx10.getModuleInfo.rv: " + JSON.stringify(rv));
49
+ this.mx10.logInfo.next("mx10.getModuleInfo.rv: " + JSON.stringify(rv));
50
50
  this.modInfoQ.unlock();
51
51
  this.modInfoQ = undefined;
52
52
  return rv;
@@ -62,8 +62,7 @@ export default class InfoGroup
62
62
  this.parseModuleInfo(size, mode, nid, buffer);
63
63
  break;
64
64
  default:
65
- // eslint-disable-next-line no-console
66
- console.log('command not parsed: ' + command.toString());
65
+ this.mx10.logInfo.next('command not parsed: ' + command.toString());
67
66
  }
68
67
  }
69
68
 
@@ -74,7 +73,7 @@ export default class InfoGroup
74
73
  const type = buffer.readUInt16LE(2);
75
74
  const info = buffer.readUInt32LE(4);
76
75
  const msg = new MsgModInfo(MsgModInfo.header(mode, NID), type, [{value: info, length: 4}]);
77
- // this.mx10.log.next('onModuleInfoChange <- ' + JSON.stringify(msg));
76
+ // this.mx10.logInfo.next('onModuleInfoChange <- ' + JSON.stringify(msg));
78
77
  this.onModuleInfoChange.next(msg);
79
78
  }
80
79
  }
@@ -30,22 +30,22 @@ export default class VehicleGroup
30
30
  async getVehicleMode(trainNid: number)
31
31
  {
32
32
  if(this.modeQ !== undefined && !await this.modeQ.lock()) {
33
- this.mx10.log.next("mx10.getVehicleMode: failed to acquire lock");
33
+ this.mx10.logInfo.next("mx10.getVehicleMode: failed to acquire lock");
34
34
  return undefined;
35
35
  }
36
36
  this.modeQ = new Query(MsgVehicleMode.header(MsgMode.REQ, trainNid), this.onVehicleMode);
37
- this.modeQ.log = ((msg) => {this.mx10.log.next(msg)});
37
+ this.modeQ.log = ((msg) => {this.mx10.logInfo.next(msg)});
38
38
  this.modeQ.tx = ((header) => {
39
39
  const msg = new MsgVehicleMode(header);
40
- // this.mx10.log.next('mode query tx: ' + JSON.stringify(msg));
40
+ // this.mx10.logInfo.next('mode query tx: ' + JSON.stringify(msg));
41
41
  this.mx10.sendMsg(msg);
42
42
  });
43
43
  this.modeQ.match = ((msg) => {
44
- // this.mx10.log.next('mode query rx: ' + JSON.stringify(msg));
44
+ // this.mx10.logInfo.next('mode query rx: ' + JSON.stringify(msg));
45
45
  return (msg.trainNid() === trainNid);
46
46
  })
47
47
  const rv = await this.modeQ.run();
48
- this.mx10.log.next("mx10.getVehicleMode.rv: " + JSON.stringify(rv));
48
+ this.mx10.logInfo.next("mx10.getVehicleMode.rv: " + JSON.stringify(rv));
49
49
  this.modeQ.unlock();
50
50
  this.modeQ = undefined;
51
51
  return rv;
@@ -53,24 +53,24 @@ export default class VehicleGroup
53
53
 
54
54
  async setVehicleMode(trainNid: number, opMode: OperatingMode, speedSteps: MaxSpeedSteps)
55
55
  {
56
- MsgVehicleMode.log = (msg) => {this.mx10.log.next(msg)};
56
+ MsgVehicleMode.log = (msg) => {this.mx10.logInfo.next(msg)};
57
57
  if(this.modeQ !== undefined && !await this.modeQ.lock()) {
58
- this.mx10.log.next("mx10.setVehicleMode: failed to acquire lock");
58
+ this.mx10.logInfo.next("mx10.setVehicleMode: failed to acquire lock");
59
59
  return undefined;
60
60
  }
61
61
  this.modeQ = new Query(MsgVehicleMode.header(MsgMode.CMD, trainNid), this.onVehicleMode);
62
- this.modeQ.log = (msg) => {this.mx10.log.next(msg)};
62
+ this.modeQ.log = (msg) => {this.mx10.logInfo.next(msg)};
63
63
  this.modeQ.tx = ((header) => {
64
64
  const msg = new MsgVehicleMode(header, {opMode, speedSteps});
65
- this.mx10.log.next('mode query tx: ' + JSON.stringify(msg));
65
+ this.mx10.logInfo.next('mode query tx: ' + JSON.stringify(msg));
66
66
  this.mx10.sendMsg(msg);
67
67
  });
68
68
  this.modeQ.match = ((msg) => {
69
- this.mx10.log.next('mode query rx: ' + JSON.stringify(msg));
69
+ this.mx10.logInfo.next('mode query rx: ' + JSON.stringify(msg));
70
70
  return (msg.trainNid() === trainNid);
71
71
  })
72
72
  const rv = await this.modeQ.run(MsgVehicleMode.rxDelay());
73
- this.mx10.log.next("mx10.setVehicleMode.rv: " + JSON.stringify(rv));
73
+ this.mx10.logInfo.next("mx10.setVehicleMode.rv: " + JSON.stringify(rv));
74
74
  this.modeQ.unlock();
75
75
  this.modeQ = undefined;
76
76
  return rv;
@@ -79,22 +79,22 @@ export default class VehicleGroup
79
79
  async getVehicleSpeed(trainNid: number)
80
80
  {
81
81
  if(this.speedQ !== undefined && !await this.speedQ.lock()) {
82
- this.mx10.log.next("mx10.getVehicleSpeed: failed to acquire lock");
82
+ this.mx10.logInfo.next("mx10.getVehicleSpeed: failed to acquire lock");
83
83
  return undefined;
84
84
  }
85
85
  this.speedQ = new Query(MsgVehicleSpeed.header(MsgMode.REQ, trainNid), this.onVehicleSpeed);
86
- this.speedQ.log = ((msg) => {this.mx10.log.next(msg)});
86
+ this.speedQ.log = ((msg) => {this.mx10.logInfo.next(msg)});
87
87
  this.speedQ.tx = ((header) => {
88
88
  const msg = new MsgVehicleSpeed(header);
89
- // this.mx10.log.next('speed query tx: ' + JSON.stringify(msg));
89
+ // this.mx10.logInfo.next('speed query tx: ' + JSON.stringify(msg));
90
90
  this.mx10.sendMsg(msg);
91
91
  });
92
92
  this.speedQ.match = ((msg) => {
93
- // this.mx10.log.next('speed query rx: ' + JSON.stringify(msg));
93
+ // this.mx10.logInfo.next('speed query rx: ' + JSON.stringify(msg));
94
94
  return (msg.trainNid() === trainNid);
95
95
  })
96
96
  const rv = await this.speedQ.run();
97
- this.mx10.log.next("mx10.getVehicleSpeed.rv: " + JSON.stringify(rv));
97
+ this.mx10.logInfo.next("mx10.getVehicleSpeed.rv: " + JSON.stringify(rv));
98
98
  this.speedQ.unlock();
99
99
  this.speedQ = undefined;
100
100
  return rv;
@@ -103,25 +103,25 @@ export default class VehicleGroup
103
103
  async setVehicleSpeed(trainNid: number, speedStep: number, divisor: number = 0, forward: boolean = true,
104
104
  emergencyStop: boolean = false, eastWest: Direction = Direction.UNDEFINED)
105
105
  {
106
- MsgVehicleSpeed.log = (msg) => {this.mx10.log.next(msg)};
106
+ MsgVehicleSpeed.log = (msg) => {this.mx10.logInfo.next(msg)};
107
107
  if(this.speedQ !== undefined && !await this.speedQ.lock()) {
108
- this.mx10.log.next("mx10.setVehicleSpeed: failed to acquire lock");
108
+ this.mx10.logInfo.next("mx10.setVehicleSpeed: failed to acquire lock");
109
109
  return undefined;
110
110
  }
111
111
  this.speedQ = new Query(MsgVehicleSpeed.header(MsgMode.CMD, trainNid), this.onVehicleSpeed);
112
- this.speedQ.log = (msg) => {this.mx10.log.next(msg)};
112
+ this.speedQ.log = (msg) => {this.mx10.logInfo.next(msg)};
113
113
  this.speedQ.tx = ((header) => {
114
114
  const speedAndDir= MsgVehicleSpeed.speedAndDir(speedStep, forward, emergencyStop, eastWest);
115
115
  const msg = new MsgVehicleSpeed(header, speedAndDir, divisor);
116
- this.mx10.log.next('speed query tx: ' + JSON.stringify(msg));
116
+ this.mx10.logInfo.next('speed query tx: ' + JSON.stringify(msg));
117
117
  this.mx10.sendMsg(msg);
118
118
  });
119
119
  this.speedQ.match = ((msg) => {
120
- this.mx10.log.next('speed query rx: ' + JSON.stringify(msg));
120
+ this.mx10.logInfo.next('speed query rx: ' + JSON.stringify(msg));
121
121
  return (msg.trainNid() === trainNid);
122
122
  })
123
123
  const rv = await this.speedQ.run(MsgVehicleSpeed.rxDelay());
124
- this.mx10.log.next("mx10.setVehicleSpeed.rv: " + JSON.stringify(rv));
124
+ this.mx10.logInfo.next("mx10.setVehicleSpeed.rv: " + JSON.stringify(rv));
125
125
  this.speedQ.unlock();
126
126
  this.speedQ = undefined;
127
127
  return rv;
@@ -177,7 +177,7 @@ export default class VehicleGroup
177
177
 
178
178
  parse(size: number, command: number, mode: number, nid: number, buffer: Buffer)
179
179
  {
180
- this.mx10.log.next("mx10.vehicleGroup.parse: " + command + "," + nid + "," + JSON.stringify(buffer));
180
+ this.mx10.logInfo.next("mx10.vehicleGroup.parse: " + command + "," + nid + "," + JSON.stringify(buffer));
181
181
  switch (command) {
182
182
  case 0x00: this.parseVehicleState(size, mode, nid, buffer); break;
183
183
  case 0x01: this.parseVehicleMode(size, mode, nid, buffer); break;
@@ -210,7 +210,7 @@ export default class VehicleGroup
210
210
  if (this.onVehicleMode.observed) {
211
211
  const NID = buffer.readUInt16LE(0);
212
212
  const vMode = [buffer.readUInt8(2), buffer.readUInt8(3), buffer.readUInt8(4)];
213
- this.mx10.log.next("parseVehicleMode: " + NID + " = " + JSON.stringify(vMode));
213
+ this.mx10.logInfo.next("parseVehicleMode: " + NID + " = " + JSON.stringify(vMode));
214
214
  this.onVehicleMode.next(new MsgVehicleMode(MsgVehicleMode.header(mode, NID), vMode));
215
215
  }
216
216
  }
@@ -222,7 +222,7 @@ export default class VehicleGroup
222
222
  return;
223
223
 
224
224
  const msg = MsgVehicleSpeed.fromBuffer(mode, buffer);
225
- this.mx10.log.next('parseVehicleSpeed: ' + JSON.stringify(msg));
225
+ this.mx10.logInfo.next('parseVehicleSpeed: ' + JSON.stringify(msg));
226
226
  this.onVehicleSpeed.next(msg);
227
227
 
228
228
 
@@ -20,6 +20,6 @@ export default class PropertyConfigGroup {
20
20
  nid: number,
21
21
  buffer: Buffer,
22
22
  ) {
23
- // console.log('parse property config group');
23
+ // this.mx10.logInfo.next('parse property config group');
24
24
  }
25
25
  }
@@ -20,6 +20,6 @@ export default class RailwayControlGroup {
20
20
  nid: number,
21
21
  buffer: Buffer,
22
22
  ) {
23
- // console.log('parse railway control group');
23
+ // this.mx10.logInfo.next('parse railway control group');
24
24
  }
25
25
  }
@@ -37,20 +37,20 @@ export default class LanNetworkGroup
37
37
  async portOpen(clientName: string, clientId: number, comFlags = 0xffffffff): Promise<MsgPortOpen | undefined>
38
38
  {
39
39
  if(this.portOpenQ !== undefined && !await this.portOpenQ.lock()) {
40
- this.mx10.log.next("mx10.portOpen: failed to acquire lock");
40
+ this.mx10.logInfo.next("mx10.portOpen: failed to acquire lock");
41
41
  return undefined;
42
42
  }
43
43
  this.portOpenQ = new Query(MsgPortOpen.header(MsgMode.CMD, this.mx10.myNID), this.onPortOpen);
44
44
  this.portOpenQ.log = ((msg) => {
45
- this.mx10.log.next(msg);
45
+ this.mx10.logInfo.next(msg);
46
46
  });
47
47
  this.portOpenQ.tx = ((header) => {
48
48
  const msg = new MsgPortOpen(header, clientId, comFlags, clientName);
49
- this.mx10.log.next('portOpen query tx: ' + JSON.stringify(msg));
49
+ this.mx10.logInfo.next('portOpen query tx: ' + JSON.stringify(msg));
50
50
  this.mx10.sendMsg(msg, true);
51
51
  });
52
52
  this.portOpenQ.match = ((msg) => {
53
- this.mx10.log.next('portOpen query rx: ' + JSON.stringify(msg));
53
+ this.mx10.logInfo.next('portOpen query rx: ' + JSON.stringify(msg));
54
54
  return (msg.clientId() === clientId);
55
55
  });
56
56
  this.portOpenQ.subscribe(false);
@@ -59,7 +59,7 @@ export default class LanNetworkGroup
59
59
  // this.mx10.mx10NID = this.portOpenQ.header.nid || 0;
60
60
  // this.mx10.connected = true;
61
61
  // }
62
- this.mx10.log.next("mx10.portOpen.rv: " + JSON.stringify(rv));
62
+ this.mx10.logInfo.next("mx10.portOpen.rv: " + JSON.stringify(rv));
63
63
  this.portOpenQ.unlock();
64
64
  this.portOpenQ = undefined;
65
65
  return rv;
@@ -70,7 +70,7 @@ export default class LanNetworkGroup
70
70
  {
71
71
  switch (command) {
72
72
  case 0x06:
73
- this.mx10.log.next('parsePortOpen, nid = ' + nid + ', buf = ' + JSON.stringify(buffer))
73
+ this.mx10.logInfo.next('parsePortOpen, nid = ' + nid + ', buf = ' + JSON.stringify(buffer))
74
74
  this.parsePortOpen(size, mode, nid, buffer);
75
75
  break;
76
76
  case 0x0e:
@@ -34,25 +34,25 @@ export default class NetworkGroup
34
34
  async portClose()
35
35
  {
36
36
  // if(this.portCloseQ !== undefined && !await this.portCloseQ.lock()) {
37
- // this.mx10.log.next("mx10.portClose: failed to acquire lock");
37
+ // this.mx10.logInfo.next("mx10.portClose: failed to acquire lock");
38
38
  // return undefined;
39
39
  // }
40
40
  // this.portCloseQ = new Query(MsgPortClose.header(MsgMode.CMD, this.mx10.mx10NID), this.onPortClose);
41
41
  // this.portCloseQ.log = ((msg) => {
42
- // this.mx10.log.next(msg);
42
+ // this.mx10.logInfo.next(msg);
43
43
  // });
44
44
  // this.portCloseQ.tx = ((header) => {
45
45
  // const msg = new MsgPortClose(header, this.mx10.myNID);
46
- // this.mx10.log.next('portClose query tx: ' + JSON.stringify(msg));
46
+ // this.mx10.logInfo.next('portClose query tx: ' + JSON.stringify(msg));
47
47
  // this.mx10.sendMsg(msg, true);
48
48
  // });
49
49
  // this.portCloseQ.match = ((msg) => {
50
- // this.mx10.log.next('portClose query rx: ' + JSON.stringify(msg));
50
+ // this.mx10.logInfo.next('portClose query rx: ' + JSON.stringify(msg));
51
51
  // return true;
52
52
  // });
53
53
  // this.portCloseQ.subscribe(false);
54
54
  // const rv = await this.portCloseQ.run();
55
- // this.mx10.log.next("mx10.portClose.rv: " + JSON.stringify(rv));
55
+ // this.mx10.logInfo.next("mx10.portClose.rv: " + JSON.stringify(rv));
56
56
  // this.portCloseQ.unlock();
57
57
  // this.portCloseQ = undefined;
58
58
  // return rv;
@@ -96,8 +96,7 @@ export default class NetworkGroup
96
96
  this.onPingResponse.next({
97
97
  connected: this.mx10.connected,
98
98
  });
99
- // eslint-disable-next-line no-console
100
- console.log('No ping for 2 seconds, disconnected');
99
+ this.mx10.logInfo.next('No ping for 2 seconds, disconnected');
101
100
  }, 2000);
102
101
  } else {
103
102
  throw new Error(
@@ -22,6 +22,6 @@ export default class LanZimoProgrammableScriptGroup
22
22
  nid: number,
23
23
  buffer: Buffer,
24
24
  ) {
25
- // console.log('parse data group');
25
+ // this.mx10.logInfo.next('parse data group');
26
26
  }
27
27
  }
@@ -21,6 +21,6 @@ export default class ZimoProgrammableScriptGroup
21
21
  nid: number,
22
22
  buffer: Buffer,
23
23
  ) {
24
- // console.log('parse zcs group');
24
+ // this.mx10.logInfo.next('parse zcs group');
25
25
  }
26
26
  }
@@ -24,7 +24,7 @@ export default class TrackCfgGroup
24
24
 
25
25
  parse(size: number, command: number, mode: number, nid: number, buffer: Buffer)
26
26
  {
27
- // this.mx10.log.next("parseTse: " + command + "." + mode + ":" + nid + " ... " + JSON.stringify(buffer));
27
+ // this.mx10.logInfo.next("parseTse: " + command + "." + mode + ":" + nid + " ... " + JSON.stringify(buffer));
28
28
  switch (command) {
29
29
  case 0x02: this.parseTseInfo(size, mode, nid, buffer); break;
30
30
  case 0x08: this.parseTseProgRead(size, mode, nid, buffer); break;
@@ -62,7 +62,7 @@ export default class TrackCfgGroup
62
62
  const NID = buffer.readUInt16LE(2);
63
63
  const cfgNum = buffer.readUInt32LE(4);
64
64
  const cvValue = buffer.readUInt16LE(8);
65
- // this.mx10.log.next("parseTseProgRead: " + JSON.stringify(buffer));
65
+ // this.mx10.logInfo.next("parseTseProgRead: " + JSON.stringify(buffer));
66
66
 
67
67
  this.onTseProgReadExtended.next(new MsgCvRead(MsgCvRead.header(mode, nid), NID, cfgNum, cvValue));
68
68
  }
@@ -76,7 +76,7 @@ export default class TrackCfgGroup
76
76
  const NID = buffer.readUInt16LE(0);
77
77
  const cfgNum = buffer.readUInt32LE(2);
78
78
  const cvValue = buffer.readUint8(6);
79
- // this.mx10.log.next("parseTseProgWrite: " + JSON.stringify(buffer));
79
+ // this.mx10.logInfo.next("parseTseProgWrite: " + JSON.stringify(buffer));
80
80
 
81
81
  this.onTseProgWriteExtended.next(new MsgCvWrite(MsgCvWrite.header(mode, nid), NID, cfgNum, cvValue));
82
82
  }
@@ -126,13 +126,13 @@ export default class TrackCfgGroup
126
126
  async getCv(trainNid: number, cvNum: number): Promise<MsgCvRead | undefined>
127
127
  {
128
128
  if(this.getCvQ !== undefined && !await this.getCvQ.lock()) {
129
- this.mx10.log.next("mx10.getCv: failed to acquire lock");
129
+ this.mx10.logInfo.next("mx10.getCv: failed to acquire lock");
130
130
  return undefined;
131
131
  }
132
132
 
133
133
  this.getCvQ = new Query(MsgCvRead.header(MsgMode.CMD, this.mx10.mx10NID), this.onTseProgReadExtended);
134
134
  this.getCvQ.log = ((msg) => {
135
- this.mx10.log.next(msg);
135
+ this.mx10.logInfo.next(msg);
136
136
  });
137
137
  this.getCvQ.tx = ((header) => {
138
138
  const msg = new MsgCvRead(header, trainNid, cvNum);
@@ -144,7 +144,7 @@ export default class TrackCfgGroup
144
144
  return (msg.trainNid() === trainNid && msg.cvNum() === cvNum);
145
145
  })
146
146
  const rv = await this.getCvQ.run();
147
- this.mx10.log.next("mx10.getCv.rv: " + JSON.stringify(rv));
147
+ this.mx10.logInfo.next("mx10.getCv.rv: " + JSON.stringify(rv));
148
148
  this.getCvQ.unlock();
149
149
  this.getCvQ = undefined;
150
150
  return rv;
@@ -153,25 +153,25 @@ export default class TrackCfgGroup
153
153
  async setCv(trainNid: number, cvNum: number, cvVal: number): Promise<MsgCvWrite | undefined>
154
154
  {
155
155
  if(this.setCvQ !== undefined && !await this.setCvQ.lock()) {
156
- this.mx10.log.next("mx10.setCv: failed to acquire lock");
156
+ this.mx10.logInfo.next("mx10.setCv: failed to acquire lock");
157
157
  return undefined;
158
158
  }
159
159
 
160
160
  this.setCvQ = new Query(MsgCvWrite.header(MsgMode.CMD, this.mx10.mx10NID), this.onTseProgWriteExtended);
161
161
  this.setCvQ.log = ((msg) => {
162
- this.mx10.log.next(msg);
162
+ this.mx10.logInfo.next(msg);
163
163
  });
164
164
  this.setCvQ.tx = ((header) => {
165
165
  const msg = new MsgCvWrite(header, trainNid, cvNum, cvVal);
166
- // this.mx10.log.next('cv write query tx: ' + JSON.stringify(msg));
166
+ // this.mx10.logInfo.next('cv write query tx: ' + JSON.stringify(msg));
167
167
  this.mx10.sendMsg(msg);
168
168
  });
169
169
  this.setCvQ.match = ((msg) => {
170
- // this.mx10.log.next('cv write query rx: ' + JSON.stringify(msg));
170
+ // this.mx10.logInfo.next('cv write query rx: ' + JSON.stringify(msg));
171
171
  return (msg.trainNid() === trainNid && msg.cvNum() === cvNum && msg.cvVal() === cvVal);
172
172
  })
173
173
  const rv = await this.setCvQ.run();
174
- this.mx10.log.next("mx10.setCv.rv: " + JSON.stringify(rv));
174
+ this.mx10.logInfo.next("mx10.setCv.rv: " + JSON.stringify(rv));
175
175
  this.setCvQ.unlock();
176
176
  this.setCvQ = undefined;
177
177
  return rv;
@@ -180,13 +180,13 @@ export default class TrackCfgGroup
180
180
  async setCv16(trainNid: number, cvNum: number, cvVal: number): Promise<MsgCvWrite16 | undefined>
181
181
  {
182
182
  if(this.setCvQ !== undefined && !await this.setCvQ.lock()) {
183
- this.mx10.log.next("mx10.setCv: failed to acquire lock");
183
+ this.mx10.logInfo.next("mx10.setCv: failed to acquire lock");
184
184
  return undefined;
185
185
  }
186
186
 
187
187
  this.setCvQ = new Query(MsgCvWrite16.header(MsgMode.CMD, this.mx10.mx10NID), this.onTseProgWrite16Extended);
188
188
  this.setCvQ.log = ((msg) => {
189
- this.mx10.log.next(msg);
189
+ this.mx10.logInfo.next(msg);
190
190
  });
191
191
  this.setCvQ.tx = ((header) => {
192
192
  const msg = new MsgCvWrite16(header, trainNid, cvNum, cvVal);
@@ -198,7 +198,7 @@ export default class TrackCfgGroup
198
198
  return (msg.trainNid() === trainNid && msg.cvNum() === cvNum && msg.cvVal() === cvVal);
199
199
  })
200
200
  const rv = await this.setCvQ.run();
201
- this.mx10.log.next("mx10.setCv.rv: " + JSON.stringify(rv));
201
+ this.mx10.logInfo.next("mx10.setCv.rv: " + JSON.stringify(rv));
202
202
  this.setCvQ.unlock();
203
203
  this.setCvQ = undefined;
204
204
  return rv;