incyclist-services 1.4.2 → 1.4.4

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.
@@ -254,7 +254,7 @@ let ActivityRideService = (() => {
254
254
  const powerDetails = { value: (0, utils_1.formatNumber)((_c = stats === null || stats === void 0 ? void 0 : stats.power) === null || _c === void 0 ? void 0 : _c.max, 0), label: 'max' };
255
255
  const heartrateDetails = { value: (0, utils_1.formatNumber)((_d = stats === null || stats === void 0 ? void 0 : stats.hrm) === null || _d === void 0 ? void 0 : _d.max, 0), label: 'max' };
256
256
  const cadenceDetails = { value: (0, utils_1.formatNumber)((_e = stats === null || stats === void 0 ? void 0 : stats.cadence) === null || _e === void 0 ? void 0 : _e.max, 0), label: 'max' };
257
- const elevationGain = { value: (0, utils_1.formatNumber)((_f = this.current.elevationGainDisplay) !== null && _f !== void 0 ? _f : 0, 0), label: 'elev gain', unit: 'm' };
257
+ const elevationGain = { value: (0, utils_1.formatNumber)((_f = this.current.elevationGainDisplay) !== null && _f !== void 0 ? _f : 0, 0), label: 'elev. done', unit: 'm' };
258
258
  return { speedDetails, powerDetails, heartrateDetails, cadenceDetails, elevationGain };
259
259
  }
260
260
  getMaximumValues() {
@@ -269,8 +269,8 @@ let ActivityRideService = (() => {
269
269
  elevationGainRemaining = undefined;
270
270
  if (elevationGainRemaining < 0)
271
271
  elevationGainRemaining = 0;
272
- const value = elevationGainRemaining !== undefined ? `-${(0, utils_1.formatNumber)(elevationGainRemaining, 0)}` : undefined;
273
- const elevationGain = { value, label: 'elev gain', unit: 'm' };
272
+ const value = elevationGainRemaining !== undefined ? `${(0, utils_1.formatNumber)(elevationGainRemaining, 0)}` : undefined;
273
+ const elevationGain = { value, label: 'elev. todo', unit: 'm' };
274
274
  return { speedDetails, powerDetails, heartrateDetails, cadenceDetails, elevationGain };
275
275
  }
276
276
  getActivitySummaryDisplayProperties() {
@@ -398,7 +398,7 @@ let DeviceConfigurationService = (() => {
398
398
  });
399
399
  return info;
400
400
  }
401
- const { capabilities, devices } = this.settings || {};
401
+ const { capabilities = [], devices = [] } = this.settings || {};
402
402
  const adapters = [];
403
403
  capabilities.forEach(c => {
404
404
  if (c.disabled || !c.selected)
@@ -37,6 +37,7 @@ export declare class DevicePairingService extends IncyclistService {
37
37
  protected initConfigHandlers(): void;
38
38
  protected removeConfigHandlers(): void;
39
39
  stop(adapterFilter?: Array<string>): Promise<void>;
40
+ prepareStart(adapterFilter?: Array<string>): Promise<void>;
40
41
  startDeviceSelection(capability: IncyclistCapability, onDeviceSelectStateChanged: (newState: DeviceSelectState) => void): DeviceSelectState;
41
42
  stopDeviceSelection(): Promise<void>;
42
43
  selectDevice(capability: IncyclistCapability, udid: string, addAll?: boolean): Promise<void>;
@@ -113,7 +113,7 @@ class DevicePairingService extends service_2.IncyclistService {
113
113
  }
114
114
  stop() {
115
115
  return __awaiter(this, arguments, void 0, function* (adapterFilter = []) {
116
- this.logEvent({ message: 'Stop Pairing' });
116
+ this.logEvent({ message: 'Stop Pairing (Skip)' });
117
117
  try {
118
118
  this.state.stopRequested = true;
119
119
  yield this._stop();
@@ -132,6 +132,34 @@ class DevicePairingService extends service_2.IncyclistService {
132
132
  }
133
133
  });
134
134
  }
135
+ prepareStart() {
136
+ return __awaiter(this, arguments, void 0, function* (adapterFilter = []) {
137
+ const stillPairing = this.isPairing();
138
+ const stillScanning = this.isScanning();
139
+ this.logEvent({ message: 'Stop Pairing (OK)', stillPairing, stillScanning });
140
+ try {
141
+ this.pauseAdapters(this.state.adapters.filter(a => !adapterFilter.includes(a.udid)));
142
+ if (this.isPairing()) {
143
+ this.removePairingCallbacks();
144
+ }
145
+ if (this.isScanning()) {
146
+ this.state.stopRequested = true;
147
+ yield this._stop();
148
+ }
149
+ this.removeConfigHandlers();
150
+ this.settings = {};
151
+ this.state.initialized = false;
152
+ this.state.waiting = false;
153
+ this.state.check = null;
154
+ this.state.scan = null;
155
+ this.state.stopRequested = false;
156
+ this.state.stopped = true;
157
+ }
158
+ catch (err) {
159
+ this.logError(err, 'prepareStart');
160
+ }
161
+ });
162
+ }
135
163
  startDeviceSelection(capability, onDeviceSelectStateChanged) {
136
164
  try {
137
165
  const capabilityData = this.getCapability(capability);
@@ -760,6 +788,7 @@ class DevicePairingService extends service_2.IncyclistService {
760
788
  const prev = this.state.canStartRide;
761
789
  const canStartRide = this.checkPairingSuccess();
762
790
  if (canStartRide !== prev) {
791
+ this.state.canStartRide = canStartRide;
763
792
  this.emitStartStatus();
764
793
  }
765
794
  }
@@ -122,6 +122,7 @@ let DeviceRideService = (() => {
122
122
  return this.data;
123
123
  }
124
124
  getSelectedAdapters() {
125
+ this.adapters = this.getConfiguredAdapters();
125
126
  if (!this.simulatorEnforced)
126
127
  return this.adapters;
127
128
  const adapter = incyclist_devices_1.AdapterFactory.create({ interface: 'simulator', name: 'Simulator' });
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
20
  };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.math = exports.geo = void 0;
30
40
  __exportStar(require("./logging"), exports);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.26"
6
6
  },
7
7
  "devDependencies": {
8
8
  "@types/jest": "^29.5.14",
9
- "@types/node": "^22.9.0",
10
- "@typescript-eslint/eslint-plugin": "^8.16.0",
11
- "@typescript-eslint/parser": "^8.15.0",
9
+ "@types/node": "^22.10.2",
10
+ "@typescript-eslint/eslint-plugin": "^8.19.0",
11
+ "@typescript-eslint/parser": "^8.18.2",
12
12
  "dotenv": "^16.4.7",
13
13
  "eslint": "^9.15.0",
14
14
  "formdata-node": "^6.0.3",
@@ -18,7 +18,7 @@
18
18
  "typedoc": "^0.27.4",
19
19
  "typedoc-plugin-markdown": "^4.3.2",
20
20
  "typedoc-plugin-no-inherit": "^1.4.0",
21
- "typescript": "^5.6.3"
21
+ "typescript": "^5.7.2"
22
22
  },
23
23
  "scripts": {
24
24
  "lint": "eslint . --ext .ts",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "axios": "^1.7.7",
45
- "incyclist-devices": "^2.3.2",
45
+ "incyclist-devices": "^2.3.5",
46
46
  "promise.any": "^2.0.6",
47
47
  "semver": "^7.6.3",
48
48
  "tcx-builder": "^1.1.1",