autoRecovery
The sos.management.autoRecovery
API provides methods for managing the auto-recovery feature of the signageOS app.
The Auto Recovery feature is designed to automatically recover the signageOS app in case of a crash or unexpected shutdown or switching input to a different value, e.g., HDMI.
Auto Recovery Management Capabilities
Capability | Description |
---|---|
AUTO_RECOVERY | If the device can enable or disable the auto recovery function. |
If you want to check if the device supports this capability, use sos.management.supports()
.
Methods
get()
The get()
method retrieves the current auto-recovery configuration.
get(): Promise<IAutoRecoveryConfiguration>;
Return value
A promise that resolves to the current auto-recovery configuration.
Example
const autoRecoveryConfig = await sos.management.autoRecovery.get();
if (autoRecoveryConfig.enabled) {
console.log(`Auto-recovery is enabled with a healthcheck interval of ${autoRecoveryConfig.healthcheckIntervalMs} ms.`);
}
set()
The set()
method allows to enable or disable the auto-recovery feature and configure its settings.
The configuration object has different properties depending on if enabled is true or false.
set(configuration: IAutoRecoveryConfiguration): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
configuration | IAutoRecoveryConfiguration | Yes | The configuration object for auto-recovery settings. |
configuration.enabled | true | Yes | A boolean to set auto-recovery to enabled or disabled state. |
configuration.autoEnableTimeoutMs | number | No | The timeout in milliseconds after which the auto-recovery will be automatically enabled if it was disabled. |
configuration.healthcheckIntervalMs | number | Yes | The interval in milliseconds for the health check if application is running in foreground. |
Return value
A promise that resolves when the auto-recovery settings are successfully set.
Possible errors
If the configuration is invalid.
Example
// Enable auto-recovery with a healthcheck interval of 5000 ms
await sos.management.autoRecovery.set({
enabled: true,
healthcheckIntervalMs: 5000,
});