incyclist-services 1.7.58 → 1.7.59
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/cjs/devices/access/service.js +1 -1
- package/lib/cjs/devices/pairing/service.js +2 -1
- package/lib/cjs/ui/service.js +12 -9
- package/lib/cjs/video/VideoSyncHelper.js +1 -1
- package/lib/esm/devices/access/service.js +1 -1
- package/lib/esm/devices/pairing/service.js +2 -1
- package/lib/esm/ui/service.js +12 -9
- package/lib/esm/video/VideoSyncHelper.js +1 -1
- package/lib/types/ui/service.d.ts +1 -1
- package/package.json +2 -2
|
@@ -222,7 +222,7 @@ let DeviceAccessService = (() => {
|
|
|
222
222
|
this.interfaces[ifaceName].state = 'connecting';
|
|
223
223
|
this.emit('interface-changed', ifaceName, { ...this.interfaces[ifaceName], state: 'connecting' });
|
|
224
224
|
await impl.disconnect();
|
|
225
|
-
const connected = await impl.connect();
|
|
225
|
+
const connected = await impl.connect(true);
|
|
226
226
|
const state = connected ? 'connected' : 'disconnected';
|
|
227
227
|
this.interfaces[ifaceName].state = state;
|
|
228
228
|
this.emit('interface-changed', ifaceName, this.interfaces[ifaceName]);
|
|
@@ -205,9 +205,10 @@ let DevicePairingService = (() => {
|
|
|
205
205
|
async prepareStart(adapterFilter = []) {
|
|
206
206
|
const stillPairing = this.isPairing();
|
|
207
207
|
const stillScanning = this.isScanning();
|
|
208
|
+
const adapters = this.state?.adapters ?? [];
|
|
208
209
|
this.logEvent({ message: 'Stop Pairing (OK)', stillPairing, stillScanning });
|
|
209
210
|
try {
|
|
210
|
-
this.pauseAdapters(
|
|
211
|
+
this.pauseAdapters(adapters.filter(a => !adapterFilter.includes(a.udid)));
|
|
211
212
|
if (this.isPairing()) {
|
|
212
213
|
this.removePairingCallbacks();
|
|
213
214
|
}
|
package/lib/cjs/ui/service.js
CHANGED
|
@@ -183,15 +183,18 @@ let UserInterfaceServcie = (() => {
|
|
|
183
183
|
this.isTerminated = false;
|
|
184
184
|
this.isTerminating = false;
|
|
185
185
|
try {
|
|
186
|
+
let resumeRequired = true;
|
|
187
|
+
if (this.backgroundTimer) {
|
|
188
|
+
clearTimeout(this.backgroundTimer);
|
|
189
|
+
resumeRequired = false;
|
|
190
|
+
}
|
|
191
|
+
this.logEvent({ message: 'onAppResume called' });
|
|
186
192
|
this.startHeartbeatWorker();
|
|
187
193
|
this.backgroundPausedByService = false;
|
|
188
194
|
this.appState = 'Active';
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
clearTimeout(this.backgroundTimer);
|
|
192
|
-
return;
|
|
195
|
+
if (resumeRequired) {
|
|
196
|
+
this.resume();
|
|
193
197
|
}
|
|
194
|
-
this.resume();
|
|
195
198
|
}
|
|
196
199
|
catch (err) {
|
|
197
200
|
this.logError(err, 'onAppPause');
|
|
@@ -228,15 +231,15 @@ let UserInterfaceServcie = (() => {
|
|
|
228
231
|
}
|
|
229
232
|
async pause() {
|
|
230
233
|
await pages_1.IncyclistPageService.pausePage();
|
|
231
|
-
(0, devices_1.useDeviceAccess)().disconnect();
|
|
234
|
+
await (0, devices_1.useDeviceAccess)().disconnect();
|
|
232
235
|
if (this.getMessageQueue().disconnect)
|
|
233
236
|
this.getMessageQueue().disconnect();
|
|
234
237
|
}
|
|
235
|
-
resume() {
|
|
238
|
+
async resume() {
|
|
236
239
|
if (this.getMessageQueue().connect)
|
|
237
240
|
this.getMessageQueue().connect();
|
|
238
|
-
(0, devices_1.useDeviceAccess)().connect();
|
|
239
|
-
pages_1.IncyclistPageService.resumePage();
|
|
241
|
+
await (0, devices_1.useDeviceAccess)().connect();
|
|
242
|
+
await pages_1.IncyclistPageService.resumePage();
|
|
240
243
|
}
|
|
241
244
|
startHeartbeatWorker() {
|
|
242
245
|
if (this.heartbeatIv)
|
|
@@ -442,7 +442,7 @@ class VideoSyncHelper extends service_1.IncyclistService {
|
|
|
442
442
|
}
|
|
443
443
|
const s0 = mapping.distance;
|
|
444
444
|
const v = mapping.videoSpeed / 3.6;
|
|
445
|
-
const t = mapping.time + (distance - s0) / v;
|
|
445
|
+
const t = mapping.time === 0 ? mapping.time + distance / v : mapping.time + (distance - s0) / v;
|
|
446
446
|
if (!Number.isNaN(t)) {
|
|
447
447
|
return t;
|
|
448
448
|
}
|
|
@@ -216,7 +216,7 @@ let DeviceAccessService = (() => {
|
|
|
216
216
|
this.interfaces[ifaceName].state = 'connecting';
|
|
217
217
|
this.emit('interface-changed', ifaceName, { ...this.interfaces[ifaceName], state: 'connecting' });
|
|
218
218
|
await impl.disconnect();
|
|
219
|
-
const connected = await impl.connect();
|
|
219
|
+
const connected = await impl.connect(true);
|
|
220
220
|
const state = connected ? 'connected' : 'disconnected';
|
|
221
221
|
this.interfaces[ifaceName].state = state;
|
|
222
222
|
this.emit('interface-changed', ifaceName, this.interfaces[ifaceName]);
|
|
@@ -199,9 +199,10 @@ let DevicePairingService = (() => {
|
|
|
199
199
|
async prepareStart(adapterFilter = []) {
|
|
200
200
|
const stillPairing = this.isPairing();
|
|
201
201
|
const stillScanning = this.isScanning();
|
|
202
|
+
const adapters = this.state?.adapters ?? [];
|
|
202
203
|
this.logEvent({ message: 'Stop Pairing (OK)', stillPairing, stillScanning });
|
|
203
204
|
try {
|
|
204
|
-
this.pauseAdapters(
|
|
205
|
+
this.pauseAdapters(adapters.filter(a => !adapterFilter.includes(a.udid)));
|
|
205
206
|
if (this.isPairing()) {
|
|
206
207
|
this.removePairingCallbacks();
|
|
207
208
|
}
|
package/lib/esm/ui/service.js
CHANGED
|
@@ -180,15 +180,18 @@ let UserInterfaceServcie = (() => {
|
|
|
180
180
|
this.isTerminated = false;
|
|
181
181
|
this.isTerminating = false;
|
|
182
182
|
try {
|
|
183
|
+
let resumeRequired = true;
|
|
184
|
+
if (this.backgroundTimer) {
|
|
185
|
+
clearTimeout(this.backgroundTimer);
|
|
186
|
+
resumeRequired = false;
|
|
187
|
+
}
|
|
188
|
+
this.logEvent({ message: 'onAppResume called' });
|
|
183
189
|
this.startHeartbeatWorker();
|
|
184
190
|
this.backgroundPausedByService = false;
|
|
185
191
|
this.appState = 'Active';
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
clearTimeout(this.backgroundTimer);
|
|
189
|
-
return;
|
|
192
|
+
if (resumeRequired) {
|
|
193
|
+
this.resume();
|
|
190
194
|
}
|
|
191
|
-
this.resume();
|
|
192
195
|
}
|
|
193
196
|
catch (err) {
|
|
194
197
|
this.logError(err, 'onAppPause');
|
|
@@ -225,15 +228,15 @@ let UserInterfaceServcie = (() => {
|
|
|
225
228
|
}
|
|
226
229
|
async pause() {
|
|
227
230
|
await IncyclistPageService.pausePage();
|
|
228
|
-
useDeviceAccess().disconnect();
|
|
231
|
+
await useDeviceAccess().disconnect();
|
|
229
232
|
if (this.getMessageQueue().disconnect)
|
|
230
233
|
this.getMessageQueue().disconnect();
|
|
231
234
|
}
|
|
232
|
-
resume() {
|
|
235
|
+
async resume() {
|
|
233
236
|
if (this.getMessageQueue().connect)
|
|
234
237
|
this.getMessageQueue().connect();
|
|
235
|
-
useDeviceAccess().connect();
|
|
236
|
-
IncyclistPageService.resumePage();
|
|
238
|
+
await useDeviceAccess().connect();
|
|
239
|
+
await IncyclistPageService.resumePage();
|
|
237
240
|
}
|
|
238
241
|
startHeartbeatWorker() {
|
|
239
242
|
if (this.heartbeatIv)
|
|
@@ -439,7 +439,7 @@ export class VideoSyncHelper extends IncyclistService {
|
|
|
439
439
|
}
|
|
440
440
|
const s0 = mapping.distance;
|
|
441
441
|
const v = mapping.videoSpeed / 3.6;
|
|
442
|
-
const t = mapping.time + (distance - s0) / v;
|
|
442
|
+
const t = mapping.time === 0 ? mapping.time + distance / v : mapping.time + (distance - s0) / v;
|
|
443
443
|
if (!Number.isNaN(t)) {
|
|
444
444
|
return t;
|
|
445
445
|
}
|
|
@@ -29,7 +29,7 @@ export declare class UserInterfaceServcie extends IncyclistService {
|
|
|
29
29
|
onAppResume(): Promise<boolean>;
|
|
30
30
|
protected onSessionStart(): void;
|
|
31
31
|
protected pause(): Promise<void>;
|
|
32
|
-
protected resume(): void
|
|
32
|
+
protected resume(): Promise<void>;
|
|
33
33
|
protected startHeartbeatWorker(): void;
|
|
34
34
|
protected stopHeartbeatWorker(): void;
|
|
35
35
|
protected sendHeartbeat(): void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.59",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"gd-eventlog": "^0.1.27"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@garmin/fitsdk": "^21.200.0",
|
|
9
9
|
"axios": "^1.15.2",
|
|
10
|
-
"incyclist-devices": "^3.0.
|
|
10
|
+
"incyclist-devices": "^3.0.15",
|
|
11
11
|
"promise.any": "^2.0.6",
|
|
12
12
|
"semver": "^7.7.4",
|
|
13
13
|
"tcx-builder": "^1.1.1",
|