incyclist-services 1.7.17 → 1.7.18
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 +10 -0
- package/lib/cjs/devices/page/service.js +7 -7
- package/lib/cjs/ui/service.js +1 -1
- package/lib/esm/devices/access/service.js +10 -0
- package/lib/esm/devices/page/service.js +7 -7
- package/lib/esm/ui/service.js +1 -1
- package/lib/types/devices/access/service.d.ts +1 -0
- package/lib/types/devices/page/service.d.ts +2 -2
- package/package.json +2 -2
|
@@ -271,6 +271,16 @@ let DeviceAccessService = (() => {
|
|
|
271
271
|
this.emit('interface-changed', ifaceName, { ...this.interfaces[ifaceName] });
|
|
272
272
|
return disconnected;
|
|
273
273
|
}
|
|
274
|
+
async terminate(ifaceName) {
|
|
275
|
+
await this.disconnect(ifaceName);
|
|
276
|
+
if (!ifaceName) {
|
|
277
|
+
const promises = Object.keys(this.interfaces).map(i => this.terminate(i));
|
|
278
|
+
await Promise.allSettled(promises);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const impl = this.getInterface(ifaceName);
|
|
282
|
+
await impl.terminate();
|
|
283
|
+
}
|
|
274
284
|
async scan(filter = {}, props = {}) {
|
|
275
285
|
this.logEvent({ message: 'device scan start', filter, props });
|
|
276
286
|
const detected = [];
|
|
@@ -166,7 +166,7 @@ let DevicesPageService = (() => {
|
|
|
166
166
|
const caps = this.state.capabilities ?? [];
|
|
167
167
|
const ifs = this.state.interfaces ?? [];
|
|
168
168
|
(0, access_1.useDeviceAccess)().enrichWithAccessState(ifs);
|
|
169
|
-
const interfaces = ifs.map(i => this.getInterfaceDisplayProps(i));
|
|
169
|
+
const interfaces = ifs.map(i => { return this.getInterfaceDisplayProps(i); });
|
|
170
170
|
const capProps = caps.map(c => this.getCapabilityDisplayProps(c));
|
|
171
171
|
const loading = this.promiseOpen != undefined;
|
|
172
172
|
const CP = (cap) => capProps.find(c => c.capability === cap);
|
|
@@ -204,6 +204,7 @@ let DevicesPageService = (() => {
|
|
|
204
204
|
}
|
|
205
205
|
getInterfaceSettingsObserver() {
|
|
206
206
|
this.interfaceSettingsObserver = this.interfaceSettingsObserver ?? new types_1.Observer();
|
|
207
|
+
return this.interfaceSettingsObserver;
|
|
207
208
|
}
|
|
208
209
|
getInterfaceSettingsDisplayProps() {
|
|
209
210
|
if (!this.openedInterfaceSettings)
|
|
@@ -219,6 +220,11 @@ let DevicesPageService = (() => {
|
|
|
219
220
|
disableInterface(i) { }
|
|
220
221
|
reconnectInterface(i) { }
|
|
221
222
|
refreshInterface(i) { }
|
|
223
|
+
closeInterfaceSettings() {
|
|
224
|
+
this.openedInterfaceSettings = undefined;
|
|
225
|
+
this.interfaceSettingsObserver?.stop();
|
|
226
|
+
this.updatePage();
|
|
227
|
+
}
|
|
222
228
|
getCapabilityDisplayProps(data) {
|
|
223
229
|
const { capability: cap, deviceName, connectState, value, unit, disabled } = data;
|
|
224
230
|
const capability = this.getTCapability(cap);
|
|
@@ -281,15 +287,9 @@ let DevicesPageService = (() => {
|
|
|
281
287
|
}
|
|
282
288
|
openInterfaceSettings(i) {
|
|
283
289
|
const info = this.state.interfaces.find(id => id.name === i);
|
|
284
|
-
console.log('# open interface settings', i, info);
|
|
285
290
|
this.openedInterfaceSettings = i;
|
|
286
291
|
this.updatePage();
|
|
287
292
|
}
|
|
288
|
-
closeInterfaceSettings() {
|
|
289
|
-
this.openedInterfaceSettings = undefined;
|
|
290
|
-
this.interfaceSettingsObserver?.stop();
|
|
291
|
-
this.updatePage();
|
|
292
|
-
}
|
|
293
293
|
onEnableCapability(enabled) {
|
|
294
294
|
const all = this.state.capabilities ?? [];
|
|
295
295
|
const requested = all.find(c => c.capability === this.openedCapability);
|
package/lib/cjs/ui/service.js
CHANGED
|
@@ -144,7 +144,7 @@ let UserInterfaceServcie = (() => {
|
|
|
144
144
|
pages_1.IncyclistPageService.closePage();
|
|
145
145
|
await (0, utils_1.waitNextTick)();
|
|
146
146
|
await (0, devices_1.useDevicePairing)().exit();
|
|
147
|
-
await (0, devices_1.useDeviceAccess)().
|
|
147
|
+
await (0, devices_1.useDeviceAccess)().terminate();
|
|
148
148
|
this.appState = 'Stopped';
|
|
149
149
|
this.logEvent({ message: 'onAppExit finished' });
|
|
150
150
|
this.isTerminated = true;
|
|
@@ -265,6 +265,16 @@ let DeviceAccessService = (() => {
|
|
|
265
265
|
this.emit('interface-changed', ifaceName, { ...this.interfaces[ifaceName] });
|
|
266
266
|
return disconnected;
|
|
267
267
|
}
|
|
268
|
+
async terminate(ifaceName) {
|
|
269
|
+
await this.disconnect(ifaceName);
|
|
270
|
+
if (!ifaceName) {
|
|
271
|
+
const promises = Object.keys(this.interfaces).map(i => this.terminate(i));
|
|
272
|
+
await Promise.allSettled(promises);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const impl = this.getInterface(ifaceName);
|
|
276
|
+
await impl.terminate();
|
|
277
|
+
}
|
|
268
278
|
async scan(filter = {}, props = {}) {
|
|
269
279
|
this.logEvent({ message: 'device scan start', filter, props });
|
|
270
280
|
const detected = [];
|
|
@@ -163,7 +163,7 @@ let DevicesPageService = (() => {
|
|
|
163
163
|
const caps = this.state.capabilities ?? [];
|
|
164
164
|
const ifs = this.state.interfaces ?? [];
|
|
165
165
|
useDeviceAccess().enrichWithAccessState(ifs);
|
|
166
|
-
const interfaces = ifs.map(i => this.getInterfaceDisplayProps(i));
|
|
166
|
+
const interfaces = ifs.map(i => { return this.getInterfaceDisplayProps(i); });
|
|
167
167
|
const capProps = caps.map(c => this.getCapabilityDisplayProps(c));
|
|
168
168
|
const loading = this.promiseOpen != undefined;
|
|
169
169
|
const CP = (cap) => capProps.find(c => c.capability === cap);
|
|
@@ -201,6 +201,7 @@ let DevicesPageService = (() => {
|
|
|
201
201
|
}
|
|
202
202
|
getInterfaceSettingsObserver() {
|
|
203
203
|
this.interfaceSettingsObserver = this.interfaceSettingsObserver ?? new Observer();
|
|
204
|
+
return this.interfaceSettingsObserver;
|
|
204
205
|
}
|
|
205
206
|
getInterfaceSettingsDisplayProps() {
|
|
206
207
|
if (!this.openedInterfaceSettings)
|
|
@@ -216,6 +217,11 @@ let DevicesPageService = (() => {
|
|
|
216
217
|
disableInterface(i) { }
|
|
217
218
|
reconnectInterface(i) { }
|
|
218
219
|
refreshInterface(i) { }
|
|
220
|
+
closeInterfaceSettings() {
|
|
221
|
+
this.openedInterfaceSettings = undefined;
|
|
222
|
+
this.interfaceSettingsObserver?.stop();
|
|
223
|
+
this.updatePage();
|
|
224
|
+
}
|
|
219
225
|
getCapabilityDisplayProps(data) {
|
|
220
226
|
const { capability: cap, deviceName, connectState, value, unit, disabled } = data;
|
|
221
227
|
const capability = this.getTCapability(cap);
|
|
@@ -278,15 +284,9 @@ let DevicesPageService = (() => {
|
|
|
278
284
|
}
|
|
279
285
|
openInterfaceSettings(i) {
|
|
280
286
|
const info = this.state.interfaces.find(id => id.name === i);
|
|
281
|
-
console.log('# open interface settings', i, info);
|
|
282
287
|
this.openedInterfaceSettings = i;
|
|
283
288
|
this.updatePage();
|
|
284
289
|
}
|
|
285
|
-
closeInterfaceSettings() {
|
|
286
|
-
this.openedInterfaceSettings = undefined;
|
|
287
|
-
this.interfaceSettingsObserver?.stop();
|
|
288
|
-
this.updatePage();
|
|
289
|
-
}
|
|
290
290
|
onEnableCapability(enabled) {
|
|
291
291
|
const all = this.state.capabilities ?? [];
|
|
292
292
|
const requested = all.find(c => c.capability === this.openedCapability);
|
package/lib/esm/ui/service.js
CHANGED
|
@@ -141,7 +141,7 @@ let UserInterfaceServcie = (() => {
|
|
|
141
141
|
IncyclistPageService.closePage();
|
|
142
142
|
await waitNextTick();
|
|
143
143
|
await useDevicePairing().exit();
|
|
144
|
-
await useDeviceAccess().
|
|
144
|
+
await useDeviceAccess().terminate();
|
|
145
145
|
this.appState = 'Stopped';
|
|
146
146
|
this.logEvent({ message: 'onAppExit finished' });
|
|
147
147
|
this.isTerminated = true;
|
|
@@ -22,6 +22,7 @@ export declare class DeviceAccessService extends IncyclistService {
|
|
|
22
22
|
connect(ifaceName?: string): Promise<boolean>;
|
|
23
23
|
private getScanTimeout;
|
|
24
24
|
disconnect(ifaceName?: string): Promise<boolean>;
|
|
25
|
+
terminate(ifaceName?: string): Promise<void>;
|
|
25
26
|
scan(filter?: ScanFilter, props?: {
|
|
26
27
|
timeout?: number;
|
|
27
28
|
includeKnown?: boolean;
|
|
@@ -19,19 +19,19 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
19
19
|
pausePage(): Promise<void>;
|
|
20
20
|
resumePage(): Promise<void>;
|
|
21
21
|
getPageDisplayProperties(): PairingDisplayProps;
|
|
22
|
-
getInterfaceSettingsObserver():
|
|
22
|
+
getInterfaceSettingsObserver(): Observer;
|
|
23
23
|
getInterfaceSettingsDisplayProps(): InterfaceSettingsDisplayProps;
|
|
24
24
|
enableInterface(i?: TInterface): void;
|
|
25
25
|
disableInterface(i?: TInterface): void;
|
|
26
26
|
reconnectInterface(i?: TInterface): void;
|
|
27
27
|
refreshInterface(i?: TInterface): void;
|
|
28
|
+
closeInterfaceSettings(): void;
|
|
28
29
|
protected getCapabilityDisplayProps(data: CapabilityData): CapabilityDisplayProps;
|
|
29
30
|
protected mapInterfaceState(state: InterfaceState): InterfaceDisplayState;
|
|
30
31
|
protected getInterfaceDisplayProps(info: EnrichedInterfaceSetting): InterfaceDisplayProps;
|
|
31
32
|
protected getDeviceListDisplayProps(): DeviceSelectionProps | undefined;
|
|
32
33
|
protected updatePage(): void;
|
|
33
34
|
protected openInterfaceSettings(i: TInterface): void;
|
|
34
|
-
protected closeInterfaceSettings(): void;
|
|
35
35
|
protected onEnableCapability(enabled: boolean): void;
|
|
36
36
|
protected openDeviceSelection(cap: IncyclistCapability): void;
|
|
37
37
|
protected onDeviceSelected(d: DevicePairingData, addAll?: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.18",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"gd-eventlog": "^0.1.27"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"axios": "^1.13.5",
|
|
9
|
-
"incyclist-devices": "^3.0.
|
|
9
|
+
"incyclist-devices": "^3.0.9",
|
|
10
10
|
"promise.any": "^2.0.6",
|
|
11
11
|
"semver": "^7.7.4",
|
|
12
12
|
"tcx-builder": "^1.1.1",
|