incyclist-services 1.3.58 → 1.3.60
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/activities/ride/service.d.ts +1 -1
- package/lib/activities/ride/service.js +13 -8
- package/lib/base/decorators/index.d.ts +2 -0
- package/lib/base/decorators/index.js +18 -0
- package/lib/devices/configuration/service.js +4 -0
- package/lib/devices/ride/service.d.ts +10 -14
- package/lib/devices/ride/service.js +995 -921
- package/package.json +4 -4
|
@@ -188,6 +188,8 @@ let ActivityRideService = (() => {
|
|
|
188
188
|
delete this.current.endPos;
|
|
189
189
|
}
|
|
190
190
|
getDashboardDisplayProperties() {
|
|
191
|
+
if (!this.current)
|
|
192
|
+
return [];
|
|
191
193
|
try {
|
|
192
194
|
const currentValues = this.getCurrentValues();
|
|
193
195
|
const { time } = currentValues;
|
|
@@ -226,20 +228,23 @@ let ActivityRideService = (() => {
|
|
|
226
228
|
return info;
|
|
227
229
|
}
|
|
228
230
|
getCurrentValues() {
|
|
229
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
231
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
230
232
|
const distance = ((_b = (_a = this.activity) === null || _a === void 0 ? void 0 : _a.distance) !== null && _b !== void 0 ? _b : 0) / 1000;
|
|
231
|
-
const speed = ((_c = this.current.deviceData.speed) !== null &&
|
|
232
|
-
const power = ((
|
|
233
|
-
const slope = (
|
|
234
|
-
const heartrate = this.current.deviceData.heartrate;
|
|
235
|
-
const cadence = ((
|
|
236
|
-
const time = (
|
|
233
|
+
const speed = ((_d = (_c = this.current.deviceData) === null || _c === void 0 ? void 0 : _c.speed) !== null && _d !== void 0 ? _d : 0);
|
|
234
|
+
const power = ((_f = (_e = this.current.deviceData) === null || _e === void 0 ? void 0 : _e.power) !== null && _f !== void 0 ? _f : 0);
|
|
235
|
+
const slope = (_g = this.current.position) === null || _g === void 0 ? void 0 : _g.slope;
|
|
236
|
+
const heartrate = (_h = this.current.deviceData) === null || _h === void 0 ? void 0 : _h.heartrate;
|
|
237
|
+
const cadence = ((_k = (_j = this.current.deviceData) === null || _j === void 0 ? void 0 : _j.cadence) !== null && _k !== void 0 ? _k : 0);
|
|
238
|
+
const time = (_m = (_l = this.activity) === null || _l === void 0 ? void 0 : _l.time) !== null && _m !== void 0 ? _m : 0;
|
|
237
239
|
let distanceRemaining = (this.getTotalDistance() / 1000 - distance);
|
|
238
240
|
if (isNaN(distanceRemaining))
|
|
239
241
|
distanceRemaining = undefined;
|
|
240
242
|
if (distanceRemaining < 0)
|
|
241
243
|
distanceRemaining = 0;
|
|
242
|
-
|
|
244
|
+
let timeRemaining;
|
|
245
|
+
if (speed > 0) {
|
|
246
|
+
timeRemaining = this.durationCalculator.getRemainingTime({ route: this.current.route, speed: (_o = this.current.deviceData) === null || _o === void 0 ? void 0 : _o.speed, routePos: this.activity.distance + ((_q = (_p = this.activity) === null || _p === void 0 ? void 0 : _p.startPos) !== null && _q !== void 0 ? _q : 0), endPos: (_r = this.current) === null || _r === void 0 ? void 0 : _r.endPos });
|
|
247
|
+
}
|
|
243
248
|
return { distance, time, speed, power, slope, heartrate, cadence, timeRemaining, distanceRemaining };
|
|
244
249
|
}
|
|
245
250
|
getAverageValues() {
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Injection"), exports);
|
|
18
|
+
__exportStar(require("../types/singleton"), exports);
|
|
@@ -614,6 +614,8 @@ class DeviceConfigurationService extends events_1.default {
|
|
|
614
614
|
const info = [];
|
|
615
615
|
udids.forEach(udid => {
|
|
616
616
|
const adapter = this.adapters[udid];
|
|
617
|
+
if (!adapter)
|
|
618
|
+
return;
|
|
617
619
|
info.push({ udid, adapter, capabilities: adapter.getCapabilities() });
|
|
618
620
|
});
|
|
619
621
|
return info;
|
|
@@ -626,6 +628,8 @@ class DeviceConfigurationService extends events_1.default {
|
|
|
626
628
|
if (!devices.find(d => d.udid === c.selected))
|
|
627
629
|
return;
|
|
628
630
|
const adapter = this.adapters[c.selected];
|
|
631
|
+
if (!adapter)
|
|
632
|
+
return;
|
|
629
633
|
const idx = adapters.findIndex(a => a.udid === c.selected);
|
|
630
634
|
if (idx === -1) {
|
|
631
635
|
adapters.push({ udid: c.selected, adapter, capabilities: [c.capability] });
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DeviceAccessService } from "../access/service";
|
|
3
|
-
import { AdapterInfo, DeviceConfigurationService, IncyclistDeviceSettings } from "../configuration";
|
|
1
|
+
import { AdapterInfo, IncyclistDeviceSettings } from "../configuration";
|
|
4
2
|
import { AdapterRideInfo, AdapterStateInfo, PreparedRoute, RideServiceCheckFilter, RideServiceDeviceProperties } from "./model";
|
|
5
|
-
import { UserSettingsService } from "../../settings";
|
|
6
3
|
import { EventLogger } from 'gd-eventlog';
|
|
7
4
|
import { CyclingMode, DeviceData, DeviceSettings, IncyclistCapability, IncyclistDeviceAdapter, UpdateRequest } from "incyclist-devices";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
protected configurationService: DeviceConfigurationService;
|
|
11
|
-
protected userSettings: UserSettingsService;
|
|
12
|
-
protected accessService: DeviceAccessService;
|
|
5
|
+
import { IncyclistService } from "../../base/service";
|
|
6
|
+
export declare class DeviceRideService extends IncyclistService {
|
|
13
7
|
protected initizialized: boolean;
|
|
14
8
|
protected adapters: AdapterRideInfo[];
|
|
15
9
|
protected startPromises: Promise<boolean>[];
|
|
16
10
|
protected data: DeviceData;
|
|
17
11
|
protected simulatorEnforced: boolean;
|
|
18
12
|
protected logger: EventLogger;
|
|
19
|
-
protected debug: any;
|
|
20
13
|
protected promiseSendUpdate: Promise<UpdateRequest | void>[];
|
|
21
14
|
protected originalMode: CyclingMode;
|
|
22
15
|
protected deviceDataHandler: any;
|
|
23
|
-
static getInstance(): DeviceRideService;
|
|
24
16
|
constructor();
|
|
25
|
-
logEvent(event: any): void;
|
|
26
|
-
setDebug(enabled: boolean): void;
|
|
27
17
|
protected waitForInit(): Promise<void>;
|
|
28
18
|
lazyInit(): Promise<void>;
|
|
29
19
|
getAdapterStateInfo(adapterInfo: AdapterInfo): AdapterStateInfo;
|
|
30
20
|
getData(): DeviceData;
|
|
31
|
-
protected
|
|
21
|
+
protected getSelectedAdapters(): AdapterRideInfo[];
|
|
22
|
+
protected getAllAdapters(): AdapterRideInfo[];
|
|
23
|
+
protected getConfiguredAdapters(onlySelected?: boolean): AdapterRideInfo[];
|
|
32
24
|
prepareEppRoute(props: RideServiceDeviceProperties): PreparedRoute;
|
|
33
25
|
waitForPreviousStartToFinish(): Promise<boolean>;
|
|
34
26
|
startCheck(filter: RideServiceCheckFilter): Promise<void>;
|
|
@@ -76,5 +68,9 @@ export declare class DeviceRideService extends EventEmitter {
|
|
|
76
68
|
onDeviceDeleted(settings: IncyclistDeviceSettings): void;
|
|
77
69
|
enforceSimulator(enforced?: boolean): void;
|
|
78
70
|
canEnforceSimulator(): boolean;
|
|
71
|
+
protected storeOriginalCyclingMode(): void;
|
|
72
|
+
protected getDeviceConfiguration(): import("../configuration").DeviceConfigurationService;
|
|
73
|
+
protected getUserSettings(): import("../../settings").UserSettingsService;
|
|
74
|
+
protected getDeviceAccess(): import("../access/service").DeviceAccessService;
|
|
79
75
|
}
|
|
80
76
|
export declare const useDeviceRide: () => DeviceRideService;
|