incyclist-devices 2.0.21 → 2.0.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.
|
@@ -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';
|