incyclist-services - v1.2.2 / DeviceConfigurationService
Manages the user configuration of devices and interfaces
- Detected Devices and Sensors
- Selected Devices and Sensors per Capability
- Cycling Mode settings for all devices.
- Enabled/Disabled Interfaces
-
EventEmitter↳
DeviceConfigurationService
- init
- setFeature
- isInitialized
- initFromLegacy
- load
- disableCapability
- unselect
- add
- delete
- getUdid
- setDisplayName
- getAdapter
- updateUserSettings
- canStartRide
- getModeSettings
- setMode
- setModeSettings
- emitModeChanged
- getAdapters
- getAllAdapters
- getSelected
- getSelectedDevices
- getInterfaceSettings
- isInterfaceEnabled
- enableInterface
- disableInterface
- setInterfaceSettings
- emitInterfaceChanged
- emitDeviceDeleted
- getInstance
• new DeviceConfigurationService(): DeviceConfigurationService
EventEmitter.constructor
• settings: DeviceConfigurationSettings
• userSettings: UserSettingsService
• adapters: DeviceAdapterList = {}
▸ init(): Promise<void>
Initializes the Device Settings
It will use the [[UserSettingsService]] to read the data and stores it in the [[settings]] property
The init method will check if the settings format is
Promise<void>
Emits
initialized Emitted once the configuration is fully initialized
▸ setFeature(name, enabled): void
| Name | Type |
|---|---|
name |
string |
enabled |
boolean |
void
▸ isInitialized(): boolean
Provides the initialization state of the interface
boolean
true if the interface has been initialized, false otherwise
▸ initFromLegacy(settings?): void
| Name | Type |
|---|---|
settings |
LegacySettings |
void
▸ load(): Object
Object
| Name | Type |
|---|---|
capabilities |
DeviceConfigurationInfo |
interfaces |
InterfaceSetting[] |
▸ disableCapability(cability, disabled?): void
| Name | Type | Default value |
|---|---|---|
cability |
ExtendedIncyclistCapability |
undefined |
disabled |
boolean |
true |
void
▸ unselect(capability, shouldEmit?): void
| Name | Type | Default value |
|---|---|---|
capability |
ExtendedIncyclistCapability |
undefined |
shouldEmit |
boolean |
true |
void
▸ add(deviceSettings, props?): string
| Name | Type |
|---|---|
deviceSettings |
IncyclistDeviceSettings |
props? |
Object |
props.legacy? |
boolean |
string
▸ delete(udid, capability?, forceSingle?): void
| Name | Type | Default value |
|---|---|---|
udid |
string |
undefined |
capability? |
ExtendedIncyclistCapability |
undefined |
forceSingle |
boolean |
false |
void
▸ getUdid(deviceSettings): string
| Name | Type |
|---|---|
deviceSettings |
IncyclistDeviceSettings |
string
▸ setDisplayName(deviceSettings, displayName?): void
| Name | Type |
|---|---|
deviceSettings |
IncyclistDeviceSettings |
displayName? |
string |
void
▸ getAdapter(udid): IncyclistDeviceAdapter
| Name | Type |
|---|---|
udid |
string |
IncyclistDeviceAdapter
▸ updateUserSettings(): void
void
▸ canStartRide(): boolean
provides information if for all requires capabilities a device has been selected, so that a training can be started
boolean
▸ getModeSettings(requestedUdid?, requestedMode?): DeviceModeInfo
| Name | Type |
|---|---|
requestedUdid? |
string |
requestedMode? |
string |
▸ setMode(udid, mode): void
| Name | Type |
|---|---|
udid |
string |
mode |
string |
void
▸ setModeSettings(udid, mode, settings): void
| Name | Type |
|---|---|
udid |
string |
mode |
string |
settings |
any |
void
▸ emitModeChanged(udid, mode, settings): void
| Name | Type |
|---|---|
udid |
string |
mode |
string |
settings |
any |
void
▸ getAdapters(onlySelected?): AdapterInfo[]
provides the list of adapters (to be used by the DeviceRideService and DevicePairingService )
| Name | Type | Default value | Description |
|---|---|---|---|
onlySelected |
boolean |
true |
if set to true, only Adapters of selected devices will be returned |
The AdapterInfo List or an empty array
▸ getAllAdapters(): AdapterInfo[]
provides the list of all adapters (to be used by the DeviceRideService)
▸ getSelected(capability): IncyclistDeviceAdapter
| Name | Type |
|---|---|
capability |
ExtendedIncyclistCapability |
IncyclistDeviceAdapter
▸ getSelectedDevices(capability?): { capability: IncyclistCapability ; selected?: string }[]
| Name | Type |
|---|---|
capability? |
IncyclistCapability |
{ capability: IncyclistCapability ; selected?: string }[]
▸ getInterfaceSettings(ifName): InterfaceSetting
| Name | Type |
|---|---|
ifName |
string |
▸ isInterfaceEnabled(ifName): boolean
| Name | Type |
|---|---|
ifName |
string |
boolean
▸ enableInterface(ifName): void
| Name | Type |
|---|---|
ifName |
string |
void
▸ disableInterface(ifName): void
| Name | Type |
|---|---|
ifName |
string |
void
▸ setInterfaceSettings(ifName, settings): void
| Name | Type |
|---|---|
ifName |
any |
settings |
InterfaceSetting |
void
▸ emitInterfaceChanged(ifName): void
| Name | Type |
|---|---|
ifName |
string |
void
▸ emitDeviceDeleted(settings): void
| Name | Type |
|---|---|
settings |
IncyclistDeviceSettings |
void
▸ getInstance(): DeviceConfigurationService
▸ select(udid, capability, props?): void
Marks a device as selected for a given capability
| Name | Type | Description |
|---|---|---|
udid |
string |
The unique device id of the device |
capability |
ExtendedIncyclistCapability |
The cability for which the device should be marked as selected device-changed in case the settings were changed device-added in case the device was not yet known |
props? |
Object |
- |
props.noRecursive? |
boolean |
- |
props.legacy? |
boolean |
- |
props.emit? |
boolean |
- |
void