incyclist-devices 1.4.44 → 1.4.47

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 (57) hide show
  1. package/lib/CyclingMode.js +1 -0
  2. package/lib/Device.d.ts +2 -0
  3. package/lib/Device.js +2 -0
  4. package/lib/DeviceProtocol.js +1 -0
  5. package/lib/DeviceSupport.js +25 -8
  6. package/lib/ant/AntAdapter.d.ts +1 -0
  7. package/lib/ant/AntAdapter.js +7 -0
  8. package/lib/ant/AntScanner.js +24 -7
  9. package/lib/ant/antfe/AntFEAdapter.js +7 -7
  10. package/lib/ant/anthrm/AntHrmAdapter.js +1 -1
  11. package/lib/ant/antpwr/pwr-adapter.js +1 -1
  12. package/lib/ant/utils.js +3 -1
  13. package/lib/ble/ble-device.d.ts +14 -5
  14. package/lib/ble/ble-device.js +138 -69
  15. package/lib/ble/ble-erg-mode.d.ts +24 -0
  16. package/lib/ble/ble-erg-mode.js +148 -0
  17. package/lib/ble/ble-interface.d.ts +35 -5
  18. package/lib/ble/ble-interface.js +237 -190
  19. package/lib/ble/ble-peripheral.d.ts +34 -0
  20. package/lib/ble/ble-peripheral.js +170 -0
  21. package/lib/ble/ble-st-mode.d.ts +24 -0
  22. package/lib/ble/ble-st-mode.js +148 -0
  23. package/lib/ble/ble.d.ts +29 -1
  24. package/lib/ble/ble.js +3 -1
  25. package/lib/ble/fm.d.ts +17 -2
  26. package/lib/ble/fm.js +155 -14
  27. package/lib/ble/hrm.d.ts +1 -2
  28. package/lib/ble/hrm.js +7 -8
  29. package/lib/ble/incyclist-protocol.js +32 -8
  30. package/lib/ble/pwr.d.ts +2 -2
  31. package/lib/ble/pwr.js +20 -8
  32. package/lib/calculations.js +1 -0
  33. package/lib/daum/DaumAdapter.d.ts +1 -0
  34. package/lib/daum/DaumAdapter.js +35 -13
  35. package/lib/daum/SmartTrainerCyclingMode.js +1 -0
  36. package/lib/daum/classic/DaumClassicAdapter.js +1 -1
  37. package/lib/daum/classic/DaumClassicProtocol.js +23 -7
  38. package/lib/daum/classic/bike.js +26 -26
  39. package/lib/daum/classic/utils.js +1 -0
  40. package/lib/daum/constants.js +1 -0
  41. package/lib/daum/premium/DaumPremiumAdapter.js +1 -1
  42. package/lib/daum/premium/DaumPremiumProtocol.js +23 -7
  43. package/lib/daum/premium/bike.js +18 -17
  44. package/lib/daum/premium/utils.js +1 -0
  45. package/lib/kettler/comms.d.ts +1 -0
  46. package/lib/kettler/comms.js +2 -1
  47. package/lib/kettler/ergo-racer/adapter.d.ts +1 -0
  48. package/lib/kettler/ergo-racer/adapter.js +31 -9
  49. package/lib/kettler/ergo-racer/protocol.d.ts +1 -1
  50. package/lib/kettler/ergo-racer/protocol.js +23 -7
  51. package/lib/modes/power-meter.js +1 -0
  52. package/lib/simulator/Simulator.d.ts +2 -1
  53. package/lib/simulator/Simulator.js +29 -7
  54. package/lib/types/route.js +1 -0
  55. package/lib/types/user.js +1 -0
  56. package/lib/utils.js +3 -1
  57. package/package.json +1 -1
package/lib/ble/fm.js CHANGED
@@ -12,11 +12,13 @@ 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.FmAdapter = void 0;
15
16
  const ble_device_1 = require("./ble-device");
16
17
  const ble_interface_1 = __importDefault(require("./ble-interface"));
17
18
  const Device_1 = __importDefault(require("../Device"));
18
19
  const gd_eventlog_1 = require("gd-eventlog");
19
20
  const power_meter_1 = __importDefault(require("../modes/power-meter"));
21
+ const FTMS_CP = '2ad9';
20
22
  const bit = (nr) => (1 << nr);
21
23
  const IndoorBikeDataFlag = {
22
24
  MoreData: bit(0),
@@ -33,17 +35,109 @@ const IndoorBikeDataFlag = {
33
35
  ElapsedTimePresent: bit(11),
34
36
  RemainingTimePresent: bit(12)
35
37
  };
38
+ const FitnessMachineFeatureFlag = {
39
+ AverageSpeedSupported: bit(0),
40
+ CadenceSupported: bit(1),
41
+ TotalDistanceSupported: bit(2),
42
+ InclinationSupported: bit(3),
43
+ ElevationGainSupported: bit(4),
44
+ PaceSupported: bit(5),
45
+ StepCountSupported: bit(6),
46
+ ResistanceLevelSupported: bit(7),
47
+ StrideCountSupported: bit(8),
48
+ ExpendedEnergySupported: bit(9),
49
+ HeartRateMeasurementSupported: bit(10),
50
+ MetabolicEquivalentSupported: bit(11),
51
+ ElapsedTimeSupported: bit(12),
52
+ RemainingTimeSupported: bit(13),
53
+ PowerMeasurementSupported: bit(14),
54
+ ForceOnBeltAndPowerOutputSupported: bit(15),
55
+ UserDataRetentionSupported: bit(16)
56
+ };
57
+ const TargetSettingFeatureFlag = {
58
+ SpeedTargetSettingSupported: bit(0),
59
+ InclinationTargetSettingSupported: bit(1),
60
+ ResistanceTargetSettingSupported: bit(2),
61
+ PowerTargetSettingSupported: bit(3),
62
+ HeartRateTargetSettingSupported: bit(4),
63
+ TargetedExpendedEnergyConfigurationSupported: bit(5),
64
+ TargetedStepNumberConfigurationSupported: bit(6),
65
+ TargetedStrideNumberConfigurationSupported: bit(7),
66
+ TargetedDistanceConfigurationSupported: bit(8),
67
+ TargetedTrainingTimeConfigurationSupported: bit(9),
68
+ TargetedTimeInTwoHeartRateZonesConfigurationSupported: bit(10),
69
+ TargetedTimeInThreeHeartRateZonesConfigurationSupported: bit(11),
70
+ TargetedTimeInFiveHeartRateZonesConfigurationSupported: bit(12),
71
+ IndoorBikeSimulationParametersSupported: bit(13),
72
+ WheelCircumferenceConfigurationSupported: bit(14),
73
+ SpinDownControlSupported: bit(15),
74
+ TargetedCadenceConfigurationSupported: bit(16)
75
+ };
36
76
  class BleFitnessMachineDevice extends ble_device_1.BleDevice {
37
77
  constructor(props) {
38
78
  super(props);
79
+ this.features = undefined;
80
+ this.hasControl = false;
81
+ this.isCPSubscribed = false;
39
82
  this.data = {};
40
83
  }
84
+ init() {
85
+ const _super = Object.create(null, {
86
+ init: { get: () => super.init }
87
+ });
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ try {
90
+ this.logEvent({ message: 'get device info' });
91
+ yield _super.init.call(this);
92
+ yield this.getFitnessMachineFeatures();
93
+ this.logEvent({ message: 'device info', deviceInfo: this.deviceInfo, features: this.features });
94
+ }
95
+ catch (err) {
96
+ return Promise.resolve(false);
97
+ }
98
+ });
99
+ }
100
+ onDisconnect() {
101
+ super.onDisconnect();
102
+ this.hasControl = false;
103
+ }
41
104
  getProfile() {
42
105
  return 'Smart Trainer';
43
106
  }
44
107
  getServiceUUids() {
45
108
  return BleFitnessMachineDevice.services;
46
109
  }
110
+ isBike() {
111
+ return this.features !== undefined &&
112
+ (this.features.targetSettings & TargetSettingFeatureFlag.IndoorBikeSimulationParametersSupported) !== 0;
113
+ }
114
+ isPower() {
115
+ if (this.hasService('1818'))
116
+ return true;
117
+ if (this.features === undefined)
118
+ return false;
119
+ const { fitnessMachine } = this.features;
120
+ if (fitnessMachine & FitnessMachineFeatureFlag.PowerMeasurementSupported)
121
+ return true;
122
+ }
123
+ isHrm() {
124
+ return this.hasService('180d') || (this.features && (this.features.fitnessMachine & FitnessMachineFeatureFlag.HeartRateMeasurementSupported) !== 0);
125
+ }
126
+ parseHrm(_data) {
127
+ const data = Buffer.from(_data);
128
+ try {
129
+ const flags = data.readUInt8(0);
130
+ if (flags % 1 === 0) {
131
+ this.data.heartrate = data.readUInt8(1);
132
+ }
133
+ else {
134
+ this.data.heartrate = data.readUInt16LE(1);
135
+ }
136
+ }
137
+ catch (err) {
138
+ }
139
+ return Object.assign(Object.assign({}, this.data), { raw: data.toString('hex') });
140
+ }
47
141
  parseIndoorBikeData(_data) {
48
142
  const data = Buffer.from(_data);
49
143
  const flags = data.readUInt16LE(0);
@@ -65,19 +159,22 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
65
159
  offset += 2;
66
160
  }
67
161
  if (flags & IndoorBikeDataFlag.TotalDistancePresent) {
68
- this.data.totalDistance = data.readUInt16LE(offset);
162
+ const dvLow = data.readUInt8(offset);
163
+ offset += 1;
164
+ const dvHigh = data.readUInt16LE(offset);
69
165
  offset += 2;
166
+ this.data.totalDistance = dvHigh << 8 + dvLow;
70
167
  }
71
168
  if (flags & IndoorBikeDataFlag.ResistanceLevelPresent) {
72
- this.data.resistanceLevel = data.readUInt16LE(offset);
169
+ this.data.resistanceLevel = data.readInt16LE(offset);
73
170
  offset += 2;
74
171
  }
75
172
  if (flags & IndoorBikeDataFlag.InstantaneousPowerPresent) {
76
- this.data.instantaneousPower = data.readUInt16LE(offset);
173
+ this.data.instantaneousPower = data.readInt16LE(offset);
77
174
  offset += 2;
78
175
  }
79
176
  if (flags & IndoorBikeDataFlag.AveragePowerPresent) {
80
- this.data.averagePower = data.readUInt16LE(offset);
177
+ this.data.averagePower = data.readInt16LE(offset);
81
178
  offset += 2;
82
179
  }
83
180
  if (flags & IndoorBikeDataFlag.ExpendedEnergyPresent) {
@@ -102,20 +199,56 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
102
199
  }
103
200
  return Object.assign(Object.assign({}, this.data), { raw: data.toString('hex') });
104
201
  }
202
+ getFitnessMachineFeatures() {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ if (this.features)
205
+ return this.features;
206
+ try {
207
+ const data = yield this.read('2acc');
208
+ const buffer = data ? Buffer.from(data) : undefined;
209
+ if (buffer) {
210
+ const fitnessMachine = buffer.readUInt32LE(0);
211
+ const targetSettings = buffer.readUInt32LE(4);
212
+ this.features = { fitnessMachine, targetSettings };
213
+ }
214
+ }
215
+ catch (err) {
216
+ this.logEvent({ message: 'could not read FitnessMachineFeatures', error: err.message, stack: err.stack });
217
+ }
218
+ });
219
+ }
105
220
  onData(characteristic, data) {
106
- console.log(characteristic.toLocaleLowerCase(), data);
107
221
  if (characteristic.toLocaleLowerCase() === '2ad2') {
108
222
  const res = this.parseIndoorBikeData(data);
109
223
  this.emit('data', res);
110
224
  }
225
+ if (characteristic.toLocaleLowerCase() === '2a37') {
226
+ const res = this.parseHrm(data);
227
+ this.emit('data', res);
228
+ }
111
229
  }
112
- write(characteristic, data) {
113
- console.log('write', characteristic, data);
114
- return Promise.resolve(true);
230
+ requestControl() {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ if (this.hasControl)
233
+ return true;
234
+ const data = Buffer.alloc(1);
235
+ data.writeUInt8(0, 0);
236
+ const success = yield this.write(FTMS_CP, data);
237
+ if (success)
238
+ this.hasControl = true;
239
+ return this.hasControl;
240
+ });
115
241
  }
116
- read(characteristic) {
117
- console.log('read', characteristic);
118
- return Promise.resolve(Buffer.from([]));
242
+ setTargetPower(power) {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ const hasControl = yield this.requestControl();
245
+ if (!hasControl)
246
+ throw new Error('setTargetPower not possible - control is disabled');
247
+ const data = Buffer.alloc(3);
248
+ data.writeUInt8(5, 0);
249
+ data.writeInt16LE(Math.round(power), 1);
250
+ const res = yield this.write(FTMS_CP, data);
251
+ });
119
252
  }
120
253
  reset() {
121
254
  this.data = {};
@@ -136,9 +269,15 @@ class FmAdapter extends Device_1.default {
136
269
  this.mode = this.getDefaultCyclingMode();
137
270
  this.logger = new gd_eventlog_1.EventLogger('BLE-FM');
138
271
  }
139
- isBike() { return true; }
140
- isHrm() { return false; }
141
- isPower() { return true; }
272
+ isBike() { return this.device.isBike(); }
273
+ isHrm() { return this.device.isHrm(); }
274
+ isPower() { return this.device.isPower(); }
275
+ isSame(device) {
276
+ if (!(device instanceof FmAdapter))
277
+ return false;
278
+ const adapter = device;
279
+ return (adapter.getName() === this.getName() && adapter.getProfile() === this.getProfile());
280
+ }
142
281
  getProfile() {
143
282
  return 'Smart Trainer';
144
283
  }
@@ -218,6 +357,8 @@ class FmAdapter extends Device_1.default {
218
357
  start(props) {
219
358
  return __awaiter(this, void 0, void 0, function* () {
220
359
  this.logger.logEvent({ message: 'start requested', profile: this.getProfile(), props });
360
+ if (this.ble.isScanning())
361
+ yield this.ble.stopScan();
221
362
  try {
222
363
  const bleDevice = yield this.ble.connectDevice(this.device);
223
364
  if (bleDevice) {
package/lib/ble/hrm.d.ts CHANGED
@@ -21,8 +21,6 @@ export default class BleHrmDevice extends BleDevice {
21
21
  getServiceUUids(): string[];
22
22
  parseHrm(_data: Uint8Array): HrmData;
23
23
  onData(characteristic: string, data: Buffer): void;
24
- write(characteristic: any, data: any): Promise<boolean>;
25
- read(characteristic: any): Promise<Buffer>;
26
24
  }
27
25
  export declare class HrmAdapter extends DeviceAdapter {
28
26
  device: BleHrmDevice;
@@ -35,6 +33,7 @@ export declare class HrmAdapter extends DeviceAdapter {
35
33
  isBike(): boolean;
36
34
  isHrm(): boolean;
37
35
  isPower(): boolean;
36
+ isSame(device: DeviceAdapter): boolean;
38
37
  getProfile(): string;
39
38
  getName(): string;
40
39
  getDisplayName(): string;
package/lib/ble/hrm.js CHANGED
@@ -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.HrmAdapter = void 0;
15
16
  const ble_device_1 = require("./ble-device");
16
17
  const ble_interface_1 = __importDefault(require("./ble-interface"));
17
18
  const Device_1 = __importDefault(require("../Device"));
@@ -55,14 +56,6 @@ class BleHrmDevice extends ble_device_1.BleDevice {
55
56
  this.emit('data', res);
56
57
  }
57
58
  }
58
- write(characteristic, data) {
59
- console.log('write', characteristic, data);
60
- return Promise.resolve(true);
61
- }
62
- read(characteristic) {
63
- console.log('read', characteristic);
64
- return Promise.resolve(Buffer.from([]));
65
- }
66
59
  }
67
60
  exports.default = BleHrmDevice;
68
61
  BleHrmDevice.services = ['180d'];
@@ -80,6 +73,12 @@ class HrmAdapter extends Device_1.default {
80
73
  isBike() { return false; }
81
74
  isHrm() { return true; }
82
75
  isPower() { return false; }
76
+ isSame(device) {
77
+ if (!(device instanceof HrmAdapter))
78
+ return false;
79
+ const adapter = device;
80
+ return (adapter.getName() === this.getName() && adapter.getProfile() === this.getProfile());
81
+ }
83
82
  getProfile() {
84
83
  return 'Heartrate Monitor';
85
84
  }
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
32
  });
10
33
  };
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
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
36
  };
@@ -62,7 +78,15 @@ class BleProtocol extends DeviceProtocol_1.default {
62
78
  case 'fm':
63
79
  case 'smart trainer':
64
80
  case 'fitness machine':
65
- return new fm_1.FmAdapter(fromDevice ? bleDevice : new fm_1.default(props()), this);
81
+ let device;
82
+ if (fromDevice)
83
+ device = bleDevice;
84
+ else {
85
+ device = this.ble.findDeviceInCache(Object.assign(Object.assign({}, props()), { profile: 'Smart Trainer' }));
86
+ if (!device)
87
+ device = new fm_1.default(props());
88
+ }
89
+ return new fm_1.FmAdapter(device, this);
66
90
  case 'cp':
67
91
  case 'power meter':
68
92
  return new pwr_1.PwrAdapter(fromDevice ? bleDevice : new pwr_1.default(props()), this);
package/lib/ble/pwr.d.ts CHANGED
@@ -33,6 +33,7 @@ export default class BleCyclingPowerDevice extends BleDevice {
33
33
  currentCrankData: CrankData;
34
34
  prevCrankData: CrankData;
35
35
  constructor(props?: any);
36
+ init(): Promise<boolean>;
36
37
  getProfile(): string;
37
38
  getServiceUUids(): string[];
38
39
  parseCrankData(crankData: any): {
@@ -41,8 +42,6 @@ export default class BleCyclingPowerDevice extends BleDevice {
41
42
  };
42
43
  parsePower(_data: Uint8Array): PowerData;
43
44
  onData(characteristic: string, data: Buffer): void;
44
- write(characteristic: any, data: any): Promise<boolean>;
45
- read(characteristic: any): Promise<Buffer>;
46
45
  reset(): void;
47
46
  }
48
47
  export declare class PwrAdapter extends DeviceAdapter {
@@ -59,6 +58,7 @@ export declare class PwrAdapter extends DeviceAdapter {
59
58
  isBike(): boolean;
60
59
  isHrm(): boolean;
61
60
  isPower(): boolean;
61
+ isSame(device: DeviceAdapter): boolean;
62
62
  getProfile(): string;
63
63
  getName(): string;
64
64
  getDisplayName(): string;
package/lib/ble/pwr.js CHANGED
@@ -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.PwrAdapter = void 0;
15
16
  const ble_device_1 = require("./ble-device");
16
17
  const ble_interface_1 = __importDefault(require("./ble-interface"));
17
18
  const Device_1 = __importDefault(require("../Device"));
@@ -29,6 +30,19 @@ class BleCyclingPowerDevice extends ble_device_1.BleDevice {
29
30
  this.currentCrankData = undefined;
30
31
  this.prevCrankData = undefined;
31
32
  }
33
+ init() {
34
+ const _super = Object.create(null, {
35
+ init: { get: () => super.init }
36
+ });
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ try {
39
+ yield _super.init.call(this);
40
+ }
41
+ catch (err) {
42
+ return Promise.resolve(false);
43
+ }
44
+ });
45
+ }
32
46
  getProfile() {
33
47
  return 'Power Meter';
34
48
  }
@@ -100,14 +114,6 @@ class BleCyclingPowerDevice extends ble_device_1.BleDevice {
100
114
  this.emit('data', res);
101
115
  }
102
116
  }
103
- write(characteristic, data) {
104
- console.log('write', characteristic, data);
105
- return Promise.resolve(true);
106
- }
107
- read(characteristic) {
108
- console.log('read', characteristic);
109
- return Promise.resolve(Buffer.from([]));
110
- }
111
117
  reset() {
112
118
  this.instantaneousPower = undefined;
113
119
  this.balance = undefined;
@@ -137,6 +143,12 @@ class PwrAdapter extends Device_1.default {
137
143
  isBike() { return true; }
138
144
  isHrm() { return false; }
139
145
  isPower() { return true; }
146
+ isSame(device) {
147
+ if (!(device instanceof PwrAdapter))
148
+ return false;
149
+ const adapter = device;
150
+ return (adapter.getName() === this.getName() && adapter.getProfile() === this.getProfile());
151
+ }
140
152
  getProfile() {
141
153
  return 'Power Meter';
142
154
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.solveCubic = exports.IllegalArgumentException = void 0;
3
4
  const g = 9.80665;
4
5
  const rho = 1.2041;
5
6
  const cwABike = {
@@ -39,6 +39,7 @@ export default class DaumAdapterBase extends IncyclistDevice implements DeviceAd
39
39
  isBike(): boolean;
40
40
  isPower(): boolean;
41
41
  isHrm(): boolean;
42
+ isSame(device: DeviceAdapter): boolean;
42
43
  setIgnoreHrm(ignore: any): void;
43
44
  setIgnoreBike(ignore: any): void;
44
45
  isStopped(): boolean;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
32
  });
10
33
  };
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
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
36
  };
@@ -115,6 +131,12 @@ class DaumAdapterBase extends Device_1.default {
115
131
  isHrm() {
116
132
  return true;
117
133
  }
134
+ isSame(device) {
135
+ if (!(device instanceof DaumAdapterBase))
136
+ return false;
137
+ const adapter = device;
138
+ return (adapter.getName() === this.getName() && adapter.getPort() === this.getPort());
139
+ }
118
140
  setIgnoreHrm(ignore) {
119
141
  this.ignoreHrm = ignore;
120
142
  }
@@ -300,16 +322,16 @@ class DaumAdapterBase extends Device_1.default {
300
322
  return;
301
323
  let distance = 0;
302
324
  if (this.distanceInternal !== undefined && this.cyclingData.distanceInternal !== undefined) {
303
- distance = utils_1.intVal(this.cyclingData.distanceInternal - this.distanceInternal);
325
+ distance = (0, utils_1.intVal)(this.cyclingData.distanceInternal - this.distanceInternal);
304
326
  }
305
327
  if (this.cyclingData.distanceInternal !== undefined)
306
328
  this.distanceInternal = this.cyclingData.distanceInternal;
307
329
  let data = {
308
- speed: utils_1.floatVal(this.cyclingData.speed),
309
- slope: utils_1.floatVal(this.cyclingData.slope),
310
- power: utils_1.intVal(this.cyclingData.power),
311
- cadence: utils_1.intVal(this.cyclingData.pedalRpm),
312
- heartrate: utils_1.intVal(this.cyclingData.heartrate),
330
+ speed: (0, utils_1.floatVal)(this.cyclingData.speed),
331
+ slope: (0, utils_1.floatVal)(this.cyclingData.slope),
332
+ power: (0, utils_1.intVal)(this.cyclingData.power),
333
+ cadence: (0, utils_1.intVal)(this.cyclingData.pedalRpm),
334
+ heartrate: (0, utils_1.intVal)(this.cyclingData.heartrate),
313
335
  distance,
314
336
  timestamp: Date.now(),
315
337
  deviceTime: this.cyclingData.time,
@@ -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.direction = void 0;
6
7
  const gd_eventlog_1 = require("gd-eventlog");
7
8
  const CyclingMode_1 = require("../CyclingMode");
8
9
  const calculations_1 = __importDefault(require("../calculations"));
@@ -86,7 +86,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
86
86
  const { user } = props;
87
87
  this.initData();
88
88
  let startState = {};
89
- return utils_1.runWithRetries(() => __awaiter(this, void 0, void 0, function* () {
89
+ return (0, utils_1.runWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
90
90
  try {
91
91
  if (!this.bike.isConnected())
92
92
  yield this.bike.saveConnect();
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
32
  });
10
33
  };
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
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
19
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
20
36
  };