incyclist-devices 2.3.19 → 2.3.24
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.
- package/lib/ble/base/adapter.d.ts +1 -0
- package/lib/ble/base/adapter.js +8 -3
- package/lib/ble/fm/sensor.js +1 -1
- package/lib/ble/tacx/sensor.d.ts +2 -1
- package/lib/ble/tacx/sensor.js +3 -1
- package/lib/ble/tacx/types.d.ts +2 -1
- package/lib/serial/daum/premium/utils.d.ts +1 -1
- package/lib/serial/index.js +17 -7
- package/package.json +7 -7
|
@@ -46,6 +46,7 @@ export default class BleAdapter<TDeviceData extends BleDeviceData, TDevice exten
|
|
|
46
46
|
protected waitForInitialData(startupTimeout: any): Promise<void>;
|
|
47
47
|
protected checkCapabilities(): Promise<void>;
|
|
48
48
|
protected initControl(_props?: BleStartProperties): Promise<void>;
|
|
49
|
+
protected getStartLogProps(props: BleStartProperties): BleStartProperties;
|
|
49
50
|
protected startAdapter(startProps?: BleStartProperties): Promise<boolean>;
|
|
50
51
|
startSensor(): Promise<boolean>;
|
|
51
52
|
protected onDisconnectDone(): Promise<void>;
|
package/lib/ble/base/adapter.js
CHANGED
|
@@ -256,9 +256,14 @@ class BleAdapter extends adpater_1.default {
|
|
|
256
256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
+
getStartLogProps(props) {
|
|
260
|
+
const { user, userWeight, bikeWeight, timeout, wheelDiameter, restart, scanOnly } = props !== null && props !== void 0 ? props : {};
|
|
261
|
+
return { user, userWeight, bikeWeight, wheelDiameter, timeout, restart, scanOnly };
|
|
262
|
+
}
|
|
259
263
|
startAdapter(startProps) {
|
|
260
264
|
return __awaiter(this, void 0, void 0, function* () {
|
|
261
265
|
const props = this.getStartProps(startProps);
|
|
266
|
+
const logProps = this.getStartLogProps(props);
|
|
262
267
|
const { timeout = this.getDefaultStartupTimeout() } = startProps !== null && startProps !== void 0 ? startProps : {};
|
|
263
268
|
const wasPaused = this.paused;
|
|
264
269
|
const preCheckResult = yield this.startPreChecks(props);
|
|
@@ -272,16 +277,16 @@ class BleAdapter extends adpater_1.default {
|
|
|
272
277
|
yield (0, utils_1.resolveNextTick)();
|
|
273
278
|
return false;
|
|
274
279
|
}
|
|
275
|
-
this.logEvent({ message: 'starting device', device: this.getName(), interface: this.getInterface(), props, isStarted: this.started });
|
|
280
|
+
this.logEvent({ message: 'starting device', device: this.getName(), interface: this.getInterface(), props: logProps, isStarted: this.started });
|
|
276
281
|
try {
|
|
277
282
|
this.resetData();
|
|
278
283
|
this.stopped = false;
|
|
279
284
|
const connected = yield this.startSensor();
|
|
280
285
|
if (connected) {
|
|
281
|
-
this.logEvent({ message: 'peripheral connected', device: this.getName(), interface: this.getInterface()
|
|
286
|
+
this.logEvent({ message: 'peripheral connected', device: this.getName(), interface: this.getInterface() });
|
|
282
287
|
}
|
|
283
288
|
else {
|
|
284
|
-
this.logEvent({ message: 'peripheral connection failed', device: this.getName(), interface: this.getInterface(), reason: 'unknown'
|
|
289
|
+
this.logEvent({ message: 'peripheral connection failed', device: this.getName(), interface: this.getInterface(), reason: 'unknown' });
|
|
285
290
|
this.stopped = true;
|
|
286
291
|
return false;
|
|
287
292
|
}
|
package/lib/ble/fm/sensor.js
CHANGED
|
@@ -207,7 +207,7 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
catch (err) {
|
|
210
|
-
this.logEvent({ message: 'error', fn: 'parseIndoorBikeData()', data: data.toString('hex'), offset, error: err.message
|
|
210
|
+
this.logEvent({ message: 'error', fn: 'parseIndoorBikeData()', data: data.toString('hex'), offset, error: err.message, stack: err.stack });
|
|
211
211
|
}
|
|
212
212
|
return Object.assign(Object.assign({}, this.data), { raw: `2ad2:${data.toString('hex')}` });
|
|
213
213
|
}
|
package/lib/ble/tacx/sensor.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CrankData } from "../cp";
|
|
|
3
3
|
import { IndoorBikeData } from "../fm";
|
|
4
4
|
import BleFitnessMachineDevice from "../fm/sensor";
|
|
5
5
|
import { BleProtocol } from "../types";
|
|
6
|
-
import { BleFeBikeData } from "./types";
|
|
6
|
+
import { BleFeBikeData, FECState } from "./types";
|
|
7
7
|
export default class TacxAdvancedFitnessMachineDevice extends BleFitnessMachineDevice {
|
|
8
8
|
static readonly profile: LegacyProfile;
|
|
9
9
|
static readonly protocol: BleProtocol;
|
|
@@ -17,6 +17,7 @@ export default class TacxAdvancedFitnessMachineDevice extends BleFitnessMachineD
|
|
|
17
17
|
protected data: BleFeBikeData;
|
|
18
18
|
protected hasFECData: boolean;
|
|
19
19
|
protected messageCnt: number;
|
|
20
|
+
protected currentState: FECState;
|
|
20
21
|
protected tacxRx: string;
|
|
21
22
|
protected tacxTx: string;
|
|
22
23
|
protected prevMessages: Record<string, {
|
package/lib/ble/tacx/sensor.js
CHANGED
|
@@ -221,7 +221,8 @@ class TacxAdvancedFitnessMachineDevice extends sensor_1.default {
|
|
|
221
221
|
break;
|
|
222
222
|
case 2:
|
|
223
223
|
this.data.State = 'READY';
|
|
224
|
-
this.
|
|
224
|
+
if (this.currentState !== 'READY')
|
|
225
|
+
this.resetState();
|
|
225
226
|
break;
|
|
226
227
|
case 3:
|
|
227
228
|
this.data.State = 'IN_USE';
|
|
@@ -235,6 +236,7 @@ class TacxAdvancedFitnessMachineDevice extends sensor_1.default {
|
|
|
235
236
|
}
|
|
236
237
|
if (capStateBF & 0x80) {
|
|
237
238
|
}
|
|
239
|
+
this.currentState = this.data.State;
|
|
238
240
|
}
|
|
239
241
|
parseGeneralFE(data) {
|
|
240
242
|
const equipmentTypeBF = data.readUInt8(1);
|
package/lib/ble/tacx/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IndoorBikeData } from "../fm";
|
|
2
|
+
export type FECState = 'OFF' | 'READY' | 'IN_USE' | 'FINISHED';
|
|
2
3
|
export interface BleFeBikeData extends IndoorBikeData {
|
|
3
4
|
EquipmentType?: 'Treadmill' | 'Elliptical' | 'StationaryBike' | 'Rower' | 'Climber' | 'NordicSkier' | 'Trainer' | 'General';
|
|
4
5
|
RealSpeed?: number;
|
|
5
6
|
VirtualSpeed?: number;
|
|
6
7
|
HeartRateSource?: 'HandContact' | 'EM' | 'ANT+';
|
|
7
|
-
State?:
|
|
8
|
+
State?: FECState;
|
|
8
9
|
EventCount?: number;
|
|
9
10
|
AccumulatedPower?: number;
|
|
10
11
|
TrainerStatus?: number;
|
|
@@ -47,5 +47,5 @@ export declare const FileTimeSupport: {
|
|
|
47
47
|
};
|
|
48
48
|
export declare function routeToEpp(route: Route, date?: Date): Uint8Array;
|
|
49
49
|
export declare function parseTrainingData(payload: string): IncyclistBikeData;
|
|
50
|
-
export declare function getPersonData(user: User): Buffer
|
|
50
|
+
export declare function getPersonData(user: User): Buffer<ArrayBuffer>;
|
|
51
51
|
export declare function parsePersonData(buffer: Buffer): User;
|
package/lib/serial/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-devices",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.24",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@serialport/bindings-interface": "^1.2.2",
|
|
6
6
|
"@serialport/parser-byte-length": "^9.0.1",
|
|
7
7
|
"@serialport/parser-delimiter": "^9.0.1",
|
|
8
8
|
"@serialport/parser-readline": "^10.5.0",
|
|
9
9
|
"@serialport/stream": "^10.5.0",
|
|
10
|
-
"incyclist-ant-plus": "^0.3.
|
|
10
|
+
"incyclist-ant-plus": "^0.3.5",
|
|
11
11
|
"win32filetime": "^1.0.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"@serialport/binding-mock": "^10.2.2",
|
|
18
18
|
"@serialport/bindings-cpp": "^10.8.0",
|
|
19
19
|
"@stoprocent/noble": "^1.15.2",
|
|
20
|
-
"@types/jest": "^29.5.
|
|
21
|
-
"@types/node": "^22.
|
|
20
|
+
"@types/jest": "^29.5.14",
|
|
21
|
+
"@types/node": "^22.15.18",
|
|
22
22
|
"bonjour-service": "^1.3.0",
|
|
23
|
-
"eslint": "^8.
|
|
23
|
+
"eslint": "^8.57.1",
|
|
24
24
|
"eslint-config-react-app": "^7.0.1",
|
|
25
25
|
"jest": "^29.7.0",
|
|
26
|
-
"ts-jest": "^29.
|
|
27
|
-
"typescript": "^5.
|
|
26
|
+
"ts-jest": "^29.3.4",
|
|
27
|
+
"typescript": "^5.8.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"lint": "eslint . --ext .ts",
|