incyclist-devices 1.4.78 → 1.4.79

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.
@@ -0,0 +1,7 @@
1
+ export declare const TACX_FE_C_BLE = "6e40fec1";
2
+ export declare const TACX_FE_C_RX = "6e40fec2";
3
+ export declare const TACX_FE_C_TX = "6e40fec3";
4
+ export declare const FTMS = "1826";
5
+ export declare const FTMS_CP = "2ad9";
6
+ export declare const FTMS_STATUS = "2ada";
7
+ export declare const INDOOR_BIKE_DATA = "2ad2";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INDOOR_BIKE_DATA = exports.FTMS_STATUS = exports.FTMS_CP = exports.FTMS = exports.TACX_FE_C_TX = exports.TACX_FE_C_RX = exports.TACX_FE_C_BLE = void 0;
4
+ exports.TACX_FE_C_BLE = '6e40fec1';
5
+ exports.TACX_FE_C_RX = '6e40fec2';
6
+ exports.TACX_FE_C_TX = '6e40fec3';
7
+ exports.FTMS = '1826';
8
+ exports.FTMS_CP = '2ad9';
9
+ exports.FTMS_STATUS = '2ada';
10
+ exports.INDOOR_BIKE_DATA = '2ad2';
package/lib/ble/fm.d.ts CHANGED
@@ -8,9 +8,6 @@ import { DeviceProtocol } from '../DeviceProtocol';
8
8
  import { EventLogger } from 'gd-eventlog';
9
9
  import CyclingMode from '../CyclingMode';
10
10
  import { IncyclistBikeData } from '../CyclingMode';
11
- export declare const FTMS_CP = "2ad9";
12
- export declare const FTMS_STATUS = "2ada";
13
- export declare const INDOOR_BIKE_DATA = "2ad2";
14
11
  declare type PowerData = {
15
12
  instantaneousPower?: number;
16
13
  balance?: number;
package/lib/ble/fm.js CHANGED
@@ -12,7 +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.FmAdapter = exports.INDOOR_BIKE_DATA = exports.FTMS_STATUS = exports.FTMS_CP = void 0;
15
+ exports.FmAdapter = void 0;
16
16
  const ble_device_1 = require("./ble-device");
17
17
  const ble_interface_1 = __importDefault(require("./ble-interface"));
18
18
  const Device_1 = __importDefault(require("../Device"));
@@ -20,9 +20,7 @@ const gd_eventlog_1 = require("gd-eventlog");
20
20
  const power_meter_1 = __importDefault(require("../modes/power-meter"));
21
21
  const ble_st_mode_1 = __importDefault(require("./ble-st-mode"));
22
22
  const ble_erg_mode_1 = __importDefault(require("./ble-erg-mode"));
23
- exports.FTMS_CP = '2ad9';
24
- exports.FTMS_STATUS = '2ada';
25
- exports.INDOOR_BIKE_DATA = '2ad2';
23
+ const consts_1 = require("./consts");
26
24
  const cwABike = {
27
25
  race: 0.35,
28
26
  triathlon: 0.29,
@@ -99,9 +97,10 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
99
97
  isMatching(characteristics) {
100
98
  if (!characteristics)
101
99
  return false;
102
- const hasStatus = characteristics.find(c => c === exports.FTMS_STATUS) !== undefined;
103
- const hasCP = characteristics.find(c => c === exports.FTMS_CP) !== undefined;
104
- const hasIndoorBike = characteristics.find(c => c === exports.INDOOR_BIKE_DATA) !== undefined;
100
+ const hasStatus = characteristics.find(c => c === consts_1.FTMS_STATUS) !== undefined;
101
+ const hasCP = characteristics.find(c => c === consts_1.FTMS_CP) !== undefined;
102
+ const hasIndoorBike = characteristics.find(c => c === consts_1.INDOOR_BIKE_DATA) !== undefined;
103
+ const hasTacx = characteristics.find(c => c === consts_1.TACX_FE_C_RX) !== undefined && characteristics.find(c => c === consts_1.TACX_FE_C_TX) !== undefined;
105
104
  return hasStatus && hasCP && hasIndoorBike;
106
105
  }
107
106
  subscribeWriteResponse(cuuid) {
@@ -131,7 +130,7 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
131
130
  });
132
131
  return __awaiter(this, void 0, void 0, function* () {
133
132
  try {
134
- yield this.subscribeWriteResponse(exports.FTMS_CP);
133
+ yield this.subscribeWriteResponse(consts_1.FTMS_CP);
135
134
  yield _super.initDevice.call(this);
136
135
  yield this.getFitnessMachineFeatures();
137
136
  this.logEvent({ message: 'device info', deviceInfo: this.deviceInfo, features: this.features });
@@ -310,13 +309,13 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
310
309
  const uuid = characteristic.toLocaleLowerCase();
311
310
  let res = undefined;
312
311
  switch (uuid) {
313
- case exports.INDOOR_BIKE_DATA:
312
+ case consts_1.INDOOR_BIKE_DATA:
314
313
  res = this.parseIndoorBikeData(data);
315
314
  break;
316
315
  case '2a37':
317
316
  res = this.parseHrm(data);
318
317
  break;
319
- case exports.FTMS_STATUS:
318
+ case consts_1.FTMS_STATUS:
320
319
  res = this.parseFitnessMachineStatus(data);
321
320
  break;
322
321
  case '2a63':
@@ -334,7 +333,7 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
334
333
  return __awaiter(this, void 0, void 0, function* () {
335
334
  try {
336
335
  this.logEvent({ message: 'fmts:write', data: data.toString('hex') });
337
- const res = yield this.write(exports.FTMS_CP, data);
336
+ const res = yield this.write(consts_1.FTMS_CP, data);
338
337
  const responseData = Buffer.from(res);
339
338
  const opCode = responseData.readUInt8(0);
340
339
  const request = responseData.readUInt8(1);
@@ -485,8 +484,8 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
485
484
  }
486
485
  }
487
486
  exports.default = BleFitnessMachineDevice;
488
- BleFitnessMachineDevice.services = ['1826'];
489
- BleFitnessMachineDevice.characteristics = ['2acc', exports.INDOOR_BIKE_DATA, '2ad6', '2ad8', exports.FTMS_CP, exports.FTMS_STATUS];
487
+ BleFitnessMachineDevice.services = [consts_1.FTMS];
488
+ BleFitnessMachineDevice.characteristics = ['2acc', consts_1.INDOOR_BIKE_DATA, '2ad6', '2ad8', consts_1.FTMS_CP, consts_1.FTMS_STATUS];
490
489
  ble_interface_1.default.register('BleFitnessMachineDevice', 'fm', BleFitnessMachineDevice, BleFitnessMachineDevice.services);
491
490
  class FmAdapter extends Device_1.default {
492
491
  constructor(device, protocol) {
package/lib/ble/tacx.js CHANGED
@@ -36,9 +36,7 @@ const ble_interface_1 = __importDefault(require("./ble-interface"));
36
36
  const Device_1 = require("../Device");
37
37
  const gd_eventlog_1 = require("gd-eventlog");
38
38
  const fm_1 = __importStar(require("./fm"));
39
- const TACX_FE_C_BLE = '6e40fec1';
40
- const TACX_FE_C_RX = '6e40fec2';
41
- const TACX_FE_C_TX = '6e40fec3';
39
+ const consts_1 = require("./consts");
42
40
  const SYNC_BYTE = 0xA4;
43
41
  const DEFAULT_CHANNEL = 5;
44
42
  const ACKNOWLEDGED_DATA = 0x4F;
@@ -82,9 +80,9 @@ class TacxAdvancedFitnessMachineDevice extends fm_1.default {
82
80
  isMatching(characteristics) {
83
81
  if (!characteristics)
84
82
  return false;
85
- const hasTacxCP = characteristics.find(c => c === TACX_FE_C_RX) !== undefined && characteristics.find(c => c === TACX_FE_C_TX) !== undefined;
86
- const hasFTMS = characteristics.find(c => c === fm_1.FTMS_CP) !== undefined;
87
- return hasTacxCP && !hasFTMS;
83
+ const hasTacxCP = characteristics.find(c => c === consts_1.TACX_FE_C_RX) !== undefined && characteristics.find(c => c === consts_1.TACX_FE_C_TX) !== undefined;
84
+ const hasFTMS = characteristics.find(c => c === consts_1.FTMS_CP) !== undefined;
85
+ return hasTacxCP;
88
86
  }
89
87
  init() {
90
88
  const _super = Object.create(null, {
@@ -438,7 +436,7 @@ class TacxAdvancedFitnessMachineDevice extends fm_1.default {
438
436
  this.prevMessages[uuid] = { uuid, ts, message };
439
437
  this.messageCnt++;
440
438
  let res = undefined;
441
- if (uuid && uuid.startsWith(TACX_FE_C_RX)) {
439
+ if (uuid && uuid.startsWith(consts_1.TACX_FE_C_RX)) {
442
440
  res = this.parseFECMessage(data);
443
441
  }
444
442
  else {
@@ -494,7 +492,7 @@ class TacxAdvancedFitnessMachineDevice extends fm_1.default {
494
492
  }
495
493
  sendMessage(message) {
496
494
  return __awaiter(this, void 0, void 0, function* () {
497
- yield this.write(TACX_FE_C_TX, message, true);
495
+ yield this.write(consts_1.TACX_FE_C_TX, message, true);
498
496
  return true;
499
497
  });
500
498
  }
@@ -646,8 +644,8 @@ class TacxAdvancedFitnessMachineDevice extends fm_1.default {
646
644
  }
647
645
  }
648
646
  exports.default = TacxAdvancedFitnessMachineDevice;
649
- TacxAdvancedFitnessMachineDevice.services = [TACX_FE_C_BLE];
650
- TacxAdvancedFitnessMachineDevice.characteristics = ['2acc', '2ad2', '2ad6', '2ad8', '2ad9', '2ada', TACX_FE_C_RX, TACX_FE_C_TX];
647
+ TacxAdvancedFitnessMachineDevice.services = [consts_1.TACX_FE_C_BLE];
648
+ TacxAdvancedFitnessMachineDevice.characteristics = ['2acc', '2ad2', '2ad6', '2ad8', '2ad9', '2ada', consts_1.TACX_FE_C_RX, consts_1.TACX_FE_C_TX];
651
649
  TacxAdvancedFitnessMachineDevice.PROFILE = PROFILE_ID;
652
650
  ble_interface_1.default.register('TacxBleFEDevice', 'tacx-ble-fec', TacxAdvancedFitnessMachineDevice, TacxAdvancedFitnessMachineDevice.services);
653
651
  class TacxBleFEAdapter extends fm_1.FmAdapter {
@@ -36,6 +36,7 @@ const ble_interface_1 = __importDefault(require("./ble-interface"));
36
36
  const Device_1 = require("../Device");
37
37
  const gd_eventlog_1 = require("gd-eventlog");
38
38
  const fm_1 = __importStar(require("./fm"));
39
+ const consts_1 = require("./consts");
39
40
  const WAHOO_ADVANCED_FTMS = 'a026ee0b';
40
41
  const WAHOO_ADVANCED_TRAINER_CP = 'a026e005';
41
42
  const cwABike = {
@@ -59,7 +60,7 @@ class WahooAdvancedFitnessMachineDevice extends fm_1.default {
59
60
  if (!characteristics)
60
61
  return false;
61
62
  const hasWahooCP = characteristics.find(c => c === WAHOO_ADVANCED_TRAINER_CP) !== undefined;
62
- const hasFTMS = characteristics.find(c => c === fm_1.FTMS_CP) !== undefined;
63
+ const hasFTMS = characteristics.find(c => c === consts_1.FTMS_CP) !== undefined;
63
64
  return hasWahooCP && !hasFTMS;
64
65
  }
65
66
  init() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.78",
3
+ "version": "1.4.79",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",