incyclist-devices 1.4.19 → 1.4.22

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.
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Daum8iSerial = exports.Daum8iTcp = void 0;
15
16
  const constants_1 = require("../constants");
16
17
  const tcpserial_1 = __importDefault(require("./tcpserial"));
17
18
  const utils_1 = require("./utils");
@@ -407,7 +408,7 @@ class Daum8i {
407
408
  incoming = bufferData;
408
409
  }
409
410
  const response = [...incoming];
410
- this.logger.logEvent({ message: 'sendCommand:RECV', data: utils_1.hexstr(response) });
411
+ this.logger.logEvent({ message: 'sendCommand:RECV', data: (0, utils_1.hexstr)(response) });
411
412
  for (let i = 0; i < incoming.length; i++) {
412
413
  const getRemaining = () => {
413
414
  let remaining = '';
@@ -440,11 +441,11 @@ class Daum8i {
440
441
  }
441
442
  else if (c === 0x17) {
442
443
  const remaining = getRemaining();
443
- this.logger.logEvent({ message: "sendCommand:received:", duration: Date.now() - this.state.sending.tsRequest, port: portName, cmd: `${cmd} [${utils_1.hexstr(cmd)}]`, remaining: utils_1.hexstr(remaining) });
444
+ this.logger.logEvent({ message: "sendCommand:received:", duration: Date.now() - this.state.sending.tsRequest, port: portName, cmd: `${cmd} [${(0, utils_1.hexstr)(cmd)}]`, remaining: (0, utils_1.hexstr)(remaining) });
444
445
  this.state.waitingForEnd = false;
445
446
  const cmdStr = cmd.substring(0, cmd.length - 2);
446
447
  const checksumExtracted = cmd.slice(-2);
447
- const checksumCalculated = utils_1.checkSum(utils_1.getAsciiArrayFromStr(cmdStr), []);
448
+ const checksumCalculated = (0, utils_1.checkSum)((0, utils_1.getAsciiArrayFromStr)(cmdStr), []);
448
449
  if (checksumExtracted === checksumCalculated) {
449
450
  this.sendACK();
450
451
  if (this.state.sending && this.state.sending.responseCheckIv) {
@@ -486,8 +487,8 @@ class Daum8i {
486
487
  this.state.busy = true;
487
488
  }
488
489
  else {
489
- const message = utils_1.buildMessage(command, payload);
490
- this.logger.logEvent({ message: 'sendCommand:waiting', port: this.portName, cmd: command, hex: utils_1.hexstr(message) });
490
+ const message = (0, utils_1.buildMessage)(command, payload);
491
+ this.logger.logEvent({ message: 'sendCommand:waiting', port: this.portName, cmd: command, hex: (0, utils_1.hexstr)(message) });
491
492
  const busyWait = () => {
492
493
  return new Promise((done) => {
493
494
  let start = Date.now();
@@ -508,7 +509,7 @@ class Daum8i {
508
509
  };
509
510
  const res = yield busyWait();
510
511
  if (!res) {
511
- this.logger.logEvent({ message: 'sendCommand:busy timeout', port: this.portName, cmd: command, hex: utils_1.hexstr(message), duration: Date.now() - tsRequest });
512
+ this.logger.logEvent({ message: 'sendCommand:busy timeout', port: this.portName, cmd: command, hex: (0, utils_1.hexstr)(message), duration: Date.now() - tsRequest });
512
513
  return reject(new Error('BUSY timeout'));
513
514
  }
514
515
  this.state.busy = true;
@@ -526,10 +527,10 @@ class Daum8i {
526
527
  const portName = this.portName;
527
528
  this.state.received = [];
528
529
  try {
529
- const message = utils_1.buildMessage(command, payload);
530
+ const message = (0, utils_1.buildMessage)(command, payload);
530
531
  const start = Date.now();
531
532
  const timeout = start + this.getTimeoutValue();
532
- this.logger.logEvent({ message: "sendCommand:sending:", port: this.portName, cmd: command, hex: utils_1.hexstr(message) });
533
+ this.logger.logEvent({ message: "sendCommand:sending:", port: this.portName, cmd: command, hex: (0, utils_1.hexstr)(message) });
533
534
  this.state.writeBusy = true;
534
535
  if (!this.connected || port === undefined) {
535
536
  this.logger.logEvent({ message: "sendCommand:error: not connected", port: this.portName });
@@ -589,10 +590,10 @@ class Daum8i {
589
590
  buffer.writeUInt16LE(0, 2);
590
591
  }
591
592
  const cmdData = Uint8Array.from(buffer);
592
- return this.sendDaum8iCommand('M70', cmdType, utils_1.bin2esc(cmdData))
593
+ return this.sendDaum8iCommand('M70', cmdType, (0, utils_1.bin2esc)(cmdData))
593
594
  .then((res) => {
594
595
  const resData = Uint8Array.from(res, x => x.charCodeAt(0));
595
- const cmd = utils_1.esc2bin(resData);
596
+ const cmd = (0, utils_1.esc2bin)(resData);
596
597
  return cmd;
597
598
  });
598
599
  }
@@ -617,7 +618,7 @@ class Daum8i {
617
618
  else if (str === '7')
618
619
  deviceType = 'lyps';
619
620
  else
620
- throw (new Error(`unknown device type ${typeof str === 'string' ? utils_1.ascii(str.charAt(0)) : str}`));
621
+ throw (new Error(`unknown device type ${typeof str === 'string' ? (0, utils_1.ascii)(str.charAt(0)) : str}`));
621
622
  return deviceType;
622
623
  });
623
624
  }
@@ -632,7 +633,7 @@ class Daum8i {
632
633
  else if (str === '2')
633
634
  deviceType = constants_1.ACTUAL_BIKE_TYPE.MOUNTAIN;
634
635
  else {
635
- throw (new Error(`unknown actual device type ${typeof str === 'string' ? utils_1.ascii(str.charAt(0)) : str}`));
636
+ throw (new Error(`unknown actual device type ${typeof str === 'string' ? (0, utils_1.ascii)(str.charAt(0)) : str}`));
636
637
  }
637
638
  this.state.actualBikeType = deviceType;
638
639
  return deviceType;
@@ -674,12 +675,12 @@ class Daum8i {
674
675
  getTrainingData() {
675
676
  return this.sendDaum8iCommand('X70', 'AF', [])
676
677
  .then((data) => {
677
- const td = utils_1.parseTrainingData(data);
678
+ const td = (0, utils_1.parseTrainingData)(data);
678
679
  return td;
679
680
  });
680
681
  }
681
682
  setLoadControl(enabled) {
682
- const val = enabled ? utils_1.ascii('1') : utils_1.ascii('0');
683
+ const val = enabled ? (0, utils_1.ascii)('1') : (0, utils_1.ascii)('0');
683
684
  return this.sendDaum8iCommand('S20', 'BF', [val])
684
685
  .then((data) => {
685
686
  const res = data === '1';
@@ -713,7 +714,7 @@ class Daum8i {
713
714
  setPerson(person) {
714
715
  const { sex, age, length, weight } = person;
715
716
  this.logger.logEvent({ message: 'setPerson() request', sex, age, length, weight });
716
- return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PERSON_SET, 'BF', utils_1.getPersonData(person))
717
+ return this.sendReservedDaum8iCommand(utils_1.ReservedCommands.PERSON_SET, 'BF', (0, utils_1.getPersonData)(person))
717
718
  .then((res) => {
718
719
  const buffer = Buffer.from(res);
719
720
  const success = buffer.readInt16LE(0) === utils_1.ReservedCommands.PERSON_SET;
@@ -737,9 +738,9 @@ class Daum8i {
737
738
  }
738
739
  programUploadStart(bikeType, route) {
739
740
  const payload = Buffer.alloc(40);
740
- const epp = route ? utils_1.routeToEpp(route) : undefined;
741
+ const epp = route ? (0, utils_1.routeToEpp)(route) : undefined;
741
742
  const eppLength = epp ? epp.length : 0;
742
- const bikeTypeVal = utils_1.getBikeType(bikeType);
743
+ const bikeTypeVal = (0, utils_1.getBikeType)(bikeType);
743
744
  const wBits = route.lapMode ? DS_BITS_ENDLESS_RACE : DS_BITS_OFF;
744
745
  payload.writeInt32LE(0, 0);
745
746
  payload.writeInt8(bikeTypeVal, 4);
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getPersonData = exports.parseTrainingData = exports.routeToEpp = exports.getBikeType = exports.BikeType = exports.ReservedCommands = exports.Int32ToIntArray = exports.Int16ToIntArray = exports.Float32ToIntArray = exports.Float32ToHex = exports.getAsciiArrayFromStr = exports.asciiArrayToString = exports.charArrayToString = exports.ascii = exports.append = exports.getHex = exports.hexstr = exports.getMessageData = exports.buildMessage = exports.checkSum = exports.esc2bin = exports.bin2esc = void 0;
6
7
  const win32filetime_1 = __importDefault(require("win32filetime"));
7
8
  const sum = (arr) => arr.reduce((a, b) => a + b, 0);
8
9
  function bin2esc(arr) {
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SendState = exports.SerialCommsState = void 0;
15
16
  const gd_eventlog_1 = require("gd-eventlog");
16
17
  const utils_1 = require("../utils");
17
18
  const events_1 = __importDefault(require("events"));
@@ -193,7 +194,7 @@ class KettlerSerialComms extends events_1.default {
193
194
  write(cmd) {
194
195
  this.sendState = SendState.Sending;
195
196
  const { logStr, message, timeout = (this.settings.timeout || DEFAULT_RCV_TIMEOUT) } = cmd;
196
- const msg = typeof message === 'string' ? message : utils_1.hexstr(message);
197
+ const msg = typeof message === 'string' ? message : (0, utils_1.hexstr)(message);
197
198
  const onError = (err) => {
198
199
  this.logger.logEvent({ message: "sendCommand:error:", cmd: logStr, error: err.message, port: this.getPort() });
199
200
  if (cmd.onError)
@@ -37,11 +37,12 @@ export default class KettlerRacerAdapter extends DeviceAdapterBase implements De
37
37
  private iv;
38
38
  private requests;
39
39
  private data;
40
- private idata;
40
+ private internalData;
41
41
  private kettlerData;
42
42
  private updateBusy;
43
43
  private requestBusy;
44
44
  private comms;
45
+ private prevDistance;
45
46
  constructor(protocol: DeviceProtocol, settings: DeviceSettings);
46
47
  isBike(): boolean;
47
48
  isPower(): boolean;
@@ -76,7 +77,7 @@ export default class KettlerRacerAdapter extends DeviceAdapterBase implements De
76
77
  parseExtendedStatus(data: string): KettlerExtendedBikeData;
77
78
  parseStatus(data: string): KettlerBikeData;
78
79
  check(): Promise<boolean>;
79
- start(props?: any): Promise<any>;
80
+ start(props?: any): Promise<IncyclistBikeData>;
80
81
  startUpdatePull(): void;
81
82
  stop(): Promise<boolean>;
82
83
  pause(): Promise<boolean>;
@@ -91,7 +92,7 @@ export default class KettlerRacerAdapter extends DeviceAdapterBase implements De
91
92
  sendData(): void;
92
93
  refreshRequests(): void;
93
94
  processClientRequest(request: any): Promise<unknown>;
94
- waitForOpened(): Promise<boolean>;
95
+ waitForOpened(retries?: boolean): Promise<boolean>;
95
96
  waitForClosed(): Promise<boolean>;
96
97
  getSupportedCyclingModes(): any[];
97
98
  setCyclingMode(mode: CyclingMode | string, settings?: any): void;
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
22
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
23
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
27
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
28
  });
10
29
  };
11
- var __importStar = (this && this.__importStar) || function (mod) {
12
- if (mod && mod.__esModule) return mod;
13
- var result = {};
14
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15
- result["default"] = mod;
16
- return result;
17
- };
18
30
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
32
  };
@@ -220,7 +232,7 @@ class KettlerRacerAdapter extends Device_1.default {
220
232
  }
221
233
  const distance = parseInt(states[3]);
222
234
  if (!isNaN(distance)) {
223
- result.distance = distance;
235
+ result.distance = distance * 100;
224
236
  }
225
237
  const requestedPower = parseInt(states[4]);
226
238
  if (!isNaN(requestedPower)) {
@@ -228,7 +240,7 @@ class KettlerRacerAdapter extends Device_1.default {
228
240
  }
229
241
  const energy = parseInt(states[5]);
230
242
  if (!isNaN(energy)) {
231
- result.requestedPower = energy;
243
+ result.energy = energy;
232
244
  }
233
245
  const timeStr = states[6];
234
246
  const time = timeStr.split(':');
@@ -284,46 +296,49 @@ class KettlerRacerAdapter extends Device_1.default {
284
296
  });
285
297
  }
286
298
  start(props) {
287
- this.logger.logEvent({ message: 'start()' });
288
- var info = {};
289
- return utils_1.runWithRetries(() => __awaiter(this, void 0, void 0, function* () {
290
- try {
291
- if (!info.checkDone) {
292
- info.checkDone = yield this.check();
293
- }
299
+ return __awaiter(this, void 0, void 0, function* () {
300
+ this.logger.logEvent({ message: 'start()' });
301
+ var info = {};
302
+ yield this.waitForOpened(true);
303
+ return (0, utils_1.runWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
294
304
  try {
295
- if (!info.started) {
296
- info.started = yield this.startTraining();
305
+ if (!info.checkDone) {
306
+ info.checkDone = yield this.check();
297
307
  }
308
+ try {
309
+ if (!info.started) {
310
+ info.started = yield this.startTraining();
311
+ }
312
+ }
313
+ catch (e) {
314
+ this.logger.logEvent({ message: 'Error', error: e.message });
315
+ }
316
+ try {
317
+ yield this.setPower(100);
318
+ }
319
+ catch (e) {
320
+ this.logger.logEvent({ message: 'Error', error: e.message });
321
+ }
322
+ if (!info.data) {
323
+ yield this.update();
324
+ info.data = this.data;
325
+ }
326
+ return info.data;
298
327
  }
299
- catch (e) {
300
- this.logger.logEvent({ message: 'Error', error: e.message });
301
- }
302
- try {
303
- yield this.setPower(100);
304
- }
305
- catch (e) {
306
- this.logger.logEvent({ message: 'Error', error: e.message });
307
- }
308
- if (!info.data) {
309
- yield this.update();
310
- info.data = this.data;
311
- }
312
- return info.data;
313
- }
314
- catch (err) {
315
- try {
316
- yield this.reset();
317
- }
318
- catch (e) {
319
- this.logger.logEvent({ message: 'Error', error: e.message });
328
+ catch (err) {
329
+ try {
330
+ yield this.reset();
331
+ }
332
+ catch (e) {
333
+ this.logger.logEvent({ message: 'Error', error: e.message });
334
+ }
335
+ throw (new Error(`could not start device, reason:${err.message}`));
320
336
  }
321
- throw (new Error(`could not start device, reason:${err.message}`));
322
- }
323
- }), 5, 1000)
324
- .then(data => {
325
- this.startUpdatePull();
326
- return data;
337
+ }), 5, 1000)
338
+ .then((data) => {
339
+ this.startUpdatePull();
340
+ return data;
341
+ });
327
342
  });
328
343
  }
329
344
  startUpdatePull() {
@@ -394,6 +409,10 @@ class KettlerRacerAdapter extends Device_1.default {
394
409
  }
395
410
  transformData(internalData, bikeData) {
396
411
  let data = {};
412
+ const prevDistance = this.prevDistance || 0;
413
+ let distance = internalData.distanceInternal - prevDistance;
414
+ if (distance < 0)
415
+ distance = internalData.distanceInternal < 100 ? internalData.distanceInternal : 0;
397
416
  data.heartrate = internalData.heartrate;
398
417
  data.timestamp = Date.now();
399
418
  data.deviceTime = bikeData.time;
@@ -401,8 +420,10 @@ class KettlerRacerAdapter extends Device_1.default {
401
420
  data.speed = internalData.speed;
402
421
  data.power = internalData.power;
403
422
  data.cadence = internalData.pedalRpm;
404
- data.distance = internalData.distanceInternal;
423
+ data.distance = distance;
405
424
  data.deviceDistanceCounter = bikeData.distance;
425
+ data.internalDistanceCounter = internalData.distanceInternal;
426
+ this.prevDistance = internalData.distanceInternal;
406
427
  }
407
428
  if (this.ignoreHrm)
408
429
  delete this.data.heartrate;
@@ -415,13 +436,14 @@ class KettlerRacerAdapter extends Device_1.default {
415
436
  update() {
416
437
  return __awaiter(this, void 0, void 0, function* () {
417
438
  this.updateBusy = true;
418
- this.getStatus()
439
+ return this.getStatus()
419
440
  .then((bikeData) => {
420
441
  if (bikeData) {
421
442
  try {
422
443
  this.kettlerData = bikeData;
423
444
  let data = this.mapData(bikeData);
424
445
  data = this.getCyclingMode().updateData(data);
446
+ this.internalData = data;
425
447
  this.data = this.transformData(data, bikeData);
426
448
  }
427
449
  catch (err) {
@@ -533,34 +555,38 @@ class KettlerRacerAdapter extends Device_1.default {
533
555
  resolve(bikeRequest);
534
556
  }));
535
557
  }
536
- waitForOpened() {
537
- return utils_1.runWithRetries(() => {
538
- return new Promise((resolve, reject) => {
539
- try {
540
- if (this.comms.isConnected()) {
541
- resolve(true);
542
- return;
543
- }
544
- const cleanup = () => {
545
- this.comms.removeAllListeners();
546
- };
547
- const onOpen = () => {
548
- resolve(true);
549
- cleanup();
550
- };
551
- const onError = (err) => { reject(err); cleanup(); };
552
- const onClose = () => { cleanup(); };
553
- this.comms.on('opened', onOpen);
554
- this.comms.on('closed', onClose);
555
- this.comms.on('error', onError);
556
- this.logger.logEvent({ message: 'opening', port: this.getPort() });
557
- this.comms.open();
558
- }
559
- catch (err) {
560
- this.logger.logEvent({ message: 'error', fn: 'waitForOpened()', error: err.message || err });
561
- reject(err);
558
+ waitForOpened(retries = false) {
559
+ const run = (resolve, reject) => {
560
+ try {
561
+ if (this.comms.isConnected()) {
562
+ resolve(true);
563
+ return;
562
564
  }
563
- });
565
+ const cleanup = () => {
566
+ this.comms.removeAllListeners();
567
+ };
568
+ const onOpen = () => {
569
+ resolve(true);
570
+ cleanup();
571
+ };
572
+ const onError = (err) => { reject(err); cleanup(); };
573
+ const onClose = () => { cleanup(); };
574
+ this.comms.on('opened', onOpen);
575
+ this.comms.on('closed', onClose);
576
+ this.comms.on('error', onError);
577
+ this.logger.logEvent({ message: 'opening', port: this.getPort() });
578
+ this.comms.open();
579
+ }
580
+ catch (err) {
581
+ this.logger.logEvent({ message: 'error', fn: 'waitForOpened()', error: err.message || err });
582
+ reject(err);
583
+ }
584
+ };
585
+ if (!retries) {
586
+ return new Promise((resolve, reject) => run(resolve, reject));
587
+ }
588
+ return (0, utils_1.runWithRetries)(() => {
589
+ return new Promise((resolve, reject) => run(resolve, reject));
564
590
  }, 3, 1000);
565
591
  }
566
592
  waitForClosed() {
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
22
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
23
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
27
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
28
  });
10
29
  };
11
- var __importStar = (this && this.__importStar) || function (mod) {
12
- if (mod && mod.__esModule) return mod;
13
- var result = {};
14
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15
- result["default"] = mod;
16
- return result;
17
- };
18
30
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
32
  };
@@ -1,6 +1,11 @@
1
- import DeviceProtocolBase, { DeviceSettings } from '../DeviceProtocol';
1
+ import DeviceProtocolBase, { DeviceSettings, DeviceProtocol } from '../DeviceProtocol';
2
2
  import DeviceAdapter from '../Device';
3
3
  import { EventLogger } from 'gd-eventlog';
4
+ import CyclingMode, { IncyclistBikeData } from '../CyclingMode';
5
+ interface SimulatorSettings extends DeviceSettings {
6
+ isBot?: boolean;
7
+ settings?: any;
8
+ }
4
9
  export declare class Simulator extends DeviceAdapter {
5
10
  static NAME: string;
6
11
  logger: EventLogger;
@@ -14,13 +19,23 @@ export declare class Simulator extends DeviceAdapter {
14
19
  slope: number;
15
20
  limit: any;
16
21
  startProps?: any;
17
- constructor(protocol?: any);
22
+ cyclingMode: CyclingMode;
23
+ startTS: number;
24
+ data: IncyclistBikeData;
25
+ isBot: boolean;
26
+ ignoreHrm: boolean;
27
+ constructor(protocol?: DeviceProtocol, props?: SimulatorSettings);
18
28
  isBike(): boolean;
19
29
  isHrm(): boolean;
20
30
  isPower(): boolean;
21
31
  getID(): string;
22
32
  getName(): string;
23
33
  getPort(): string;
34
+ setIgnoreHrm(ignore: any): void;
35
+ getSupportedCyclingModes(): Array<any>;
36
+ getDefaultCyclingMode(): CyclingMode;
37
+ getCyclingMode(): CyclingMode;
38
+ setCyclingMode(mode: CyclingMode | string, settings?: any): void;
24
39
  start(props?: any): Promise<unknown>;
25
40
  stop(): Promise<boolean>;
26
41
  pause(): Promise<boolean>;
@@ -30,12 +45,12 @@ export declare class Simulator extends DeviceAdapter {
30
45
  slower(): void;
31
46
  update(): void;
32
47
  calculateDistance(speedKps: any, timeS: any): number;
33
- sendUpdate(request: any): any;
48
+ sendUpdate(request: any): import("../CyclingMode").UpdateRequest;
34
49
  }
35
50
  export default class SimulatorProtocol extends DeviceProtocolBase {
36
51
  static NAME: string;
37
52
  constructor();
38
- add(settings: DeviceSettings): void;
53
+ add(settings: SimulatorSettings): any;
39
54
  getName(): string;
40
55
  getInterfaces(): string[];
41
56
  isBike(): boolean;
@@ -43,3 +58,4 @@ export default class SimulatorProtocol extends DeviceProtocolBase {
43
58
  isPower(): boolean;
44
59
  getDevices(): import("../DeviceProtocol").Device[];
45
60
  }
61
+ export {};