incyclist-devices 2.0.21 → 2.0.23
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.
|
@@ -28,5 +28,6 @@ export default class AntPwrAdapter extends ControllableAntAdapter<BicyclePowerSe
|
|
|
28
28
|
mapData(deviceData: any): IncyclistBikeData;
|
|
29
29
|
transformData(bikeData: IncyclistBikeData): PowerSensorData;
|
|
30
30
|
hasData(): boolean;
|
|
31
|
+
start(props?: any): Promise<any>;
|
|
31
32
|
}
|
|
32
33
|
export {};
|
package/lib/antv2/pwr/adapter.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -131,9 +140,22 @@ class AntPwrAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
131
140
|
}
|
|
132
141
|
hasData() {
|
|
133
142
|
const { Power, Cadence, TimeStamp } = this.deviceData;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
const hasData = (Power !== undefined && Power !== null) || (Cadence !== undefined && Cadence !== null) || (TimeStamp !== undefined && TimeStamp !== null);
|
|
144
|
+
return hasData;
|
|
145
|
+
}
|
|
146
|
+
start(props) {
|
|
147
|
+
const _super = Object.create(null, {
|
|
148
|
+
start: { get: () => super.start }
|
|
149
|
+
});
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
const wasPaused = this.paused;
|
|
152
|
+
if (wasPaused)
|
|
153
|
+
this.resume();
|
|
154
|
+
if (this.started && !wasPaused) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return yield _super.start.call(this, props);
|
|
158
|
+
});
|
|
137
159
|
}
|
|
138
160
|
}
|
|
139
161
|
AntPwrAdapter.INCYCLIST_PROFILE_NAME = 'Power Meter';
|
package/lib/ble/base/comms.js
CHANGED
|
@@ -508,7 +508,8 @@ class BleComms extends events_1.default {
|
|
|
508
508
|
return new Promise((resolve, reject) => {
|
|
509
509
|
const characteristic = this.characteristics.find(c => c.uuid === characteristicUuid || (0, utils_2.uuid)(c.uuid) === characteristicUuid);
|
|
510
510
|
if (!characteristic) {
|
|
511
|
-
|
|
511
|
+
this.logEvent({ message: 'write: Characteristic not found', characteristicUuid, characteristics: this.characteristics.map(c => c.uuid) });
|
|
512
|
+
reject(new Error(`Characteristic not found`));
|
|
512
513
|
return;
|
|
513
514
|
}
|
|
514
515
|
if (fireAndForget) {
|
|
@@ -552,6 +553,7 @@ class BleComms extends events_1.default {
|
|
|
552
553
|
return reject(new Error('not connected'));
|
|
553
554
|
const characteristic = this.characteristics.find(c => c.uuid === characteristicUuid || (0, utils_2.uuid)(c.uuid) === characteristicUuid);
|
|
554
555
|
if (!characteristic) {
|
|
556
|
+
this.logEvent({ message: 'read: Characteristic not found', characteristicUuid, characteristics: this.characteristics.map(c => c.uuid) });
|
|
555
557
|
reject(new Error('Characteristic not found'));
|
|
556
558
|
return;
|
|
557
559
|
}
|
package/lib/ble/tacx/comms.js
CHANGED
|
@@ -474,6 +474,7 @@ class TacxAdvancedFitnessMachineDevice extends comms_1.default {
|
|
|
474
474
|
}
|
|
475
475
|
sendMessage(message) {
|
|
476
476
|
return __awaiter(this, void 0, void 0, function* () {
|
|
477
|
+
this.logEvent({ message: 'write', characteristic: this.tacxTx, data: message.toString('hex') });
|
|
477
478
|
yield this.write(this.tacxTx, message, { withoutResponse: true });
|
|
478
479
|
return true;
|
|
479
480
|
});
|