sos.management
The sos.management
API group provides methods for managing the device. Through this API, things like device firmware,
battery status, brightness, network information, remote control, power, time, or volume can be monitored.
Management Capabilities
Capability | Description |
---|---|
MODEL | If device can return proper model name |
SERIAL_NUMBER | If device can return serial number |
BATTERY_STATUS | If device can return battery status |
TEMPERATURE | If device can return current temperature |
BRAND | If device can return manufacturer brand |
FACTORY_RESET | If device can perform factory reset |
EXTENDED_MANAGEMENT | If device can return or set extended management URL |
HARDWARE_ACCELERATION | If device can turn hardware acceleration on or off |
If you want to check if the device supports those capabilities, use sos.management.supports()
.
Methods
factoryReset()
The factoryReset()
method initializes the factory reset of the device.
factoryReset(): Promise<void>;
Return value
A promise that resolves when the factory reset is initiated.
Possible errors
If the device does not support factory reset.
getBatteryStatus()
The getBatteryStatus()
method returns information about the battery of the device.
- Emulator has mocked this method and will always return a battery status with 100% charge.
getBatteryStatus(): Promise<IBatteryStatus>;
Return value
A promise that resolves to an object containing the battery status.
Possible errors
If the device does not support battery status monitoring.
Example
const batteryStatus = await sos.management.getBatteryStatus();
console.log(`Battery status: ${batteryStatus.percentage}% charged`);
getBrand()
The getBrand()
method returns the manufacturer brand of the device.
getBrand(): Promise<string>;
Return value
A promise that resolves to the brand name of the device.
Possible errors
If the device does not support brand information.
Example
const brand = await sos.management.getBrand();
console.log(`Device brand is: ${brand}`); // e.g., 'Samsung', 'LG', BrightSign, etc.
getExtendedManagementUrl()
The getExtendedManagementUrl()
method returns the management URL of the device.
This is currently only implemented for the MagicInfo on the Tizen platform.
getExtendedManagementUrl(): Promise<string | null>;
Return value
A promise that resolves to the management URL of the device, or null
if not set.
Possible errors
If the device does not support the extended management URL.
getModel()
The getModel()
method returns the model of the device.
getModel(): Promise<string>;
Return value
A promise that resolves to the model name of the device.
Example
const model = await sos.management.getModel();
console.log(`Device model is: ${model}`); // e.g. 'XC4055' (BrightSign)
getSerialNumber()
The getSerialNumber()
method returns the serial number of the device.
getSerialNumber(): Promise<string>;
Return value
A promise that resolves to the serial number of the device.
Example
const serialNumber = await sos.management.getSerialNumber();
console.log(`Device serial number is: ${serialNumber}`); // e.g. '1234567890'
getTemperature()
The getTemperature()
method returns the temperature of the device (in the 0-100 range of degrees Celsius).
getTemperature(): Promise<number>;
Return value
A promise that resolves to the current temperature of the device.
Possible errors
If the device does not support temperature monitoring.
Example
const temperature = await sos.management.getTemperature();
console.log(`Current device temperature is: ${temperature}°C`); // e.g. 25°C
isHardwareAccelerationEnabled()
The isHardwareAccelerationEnabled()
method returns whether hardware acceleration is enabled.
isHardwareAccelerationEnabled(): Promise<boolean>;
Return value
A promise that resolves to true
if hardware acceleration is enabled, otherwise false
.
Possible errors
If the device does not support hardware acceleration management.
Example
const isEnabled = await sos.management.isHardwareAccelerationEnabled();
console.log(`Hardware acceleration is ${isEnabled ? 'enabled' : 'disabled'}.`);
resetSettings()
The resetSettings()
method initializes the reset of the specific device settings.
This is currently only implemented on the Linux platform.
resetSettings(): Promise<void>;
Return value
A promise that resolves when the settings are reset.
Possible errors
If the device does not support settings reset.
setExtendedManagementUrl()
The getExtendedManagementUrl()
sets the management URL of the device.
This is currently only implemented for the MagicInfo on the Tizen platform.
setExtendedManagementUrl(url: string | null): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
url | string | null | Yes | The management URL to set. If null , it will remove the current URL. |
Return value
A promise that resolves when the URL is set.
Possible errors
- If the URL is not a valid string or if the device
- If the device does not support the extended management URL.
Example
await sos.management.setExtendedManagementUrl('https://example.com/management');
// later
const url = await sos.management.getExtendedManagementUrl();
console.log(`Extended management URL is: ${url}`); // e.g. 'https://example.com/management'
setHardwareAcceleration()
The setHardwareAcceleration()
method turns hardware acceleration on or off.
- This is currently only implemented for the BrightSign platform.
- Device must always be rebooted for the changes to take effect.
setHardwareAcceleration(enabled: boolean): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
enabled | boolean | Yes | Whether hardware acceleration should be enabled. |
Return value
A promise that resolves when the hardware acceleration setting is applied.
Possible errors
- If the
enabled
parameter is not a boolean. - If the device does not support hardware acceleration management.
Example
await sos.management.setHardwareAcceleration(true).then(async () => {
console.log('Hardware acceleration enabled.');
await sos.management.reboot();
}).catch((error) => {
console.error('Failed to set hardware acceleration:', error);
});
supports()
The supports()
method determines whether a queried capability is supported.
What are capabilities?
Capabilities are features or functionalities that a device can support. We divided those capabilities into front
and management
capabilities.
This section is about management capabilities, which include features to manage the device, receive information about the device, or change its settings.
On the other hand, the front
capabilities are features that are related to the application running on the device, such as displaying content, handling user input, etc.
To check front
capabilities, refer to the sos.display.supports()
method or this section.
If you want to check specific capabilities, refer to the sidebar for the selected management section. Every section has its capabilities written in the description,
or check the ManagementCapability type in supports()
method. It has a list of all available capabilities for all platforms.
supports(capability: ManagementCapability): Promise<boolean>;
Params
Name | Type | Required | Description |
---|---|---|---|
capability | ManagementCapability | Yes | The capability to check for support. |
Return value
A promise that resolves to true
if the capability is supported, otherwise false
.
Possible errors
If the capability is not a valid string.
Example
const isSupported = await sos.management.supports('OS_VERSION');
console.log(`Is OS_VERSION supported? ${isSupported}`);
getNetworkInfo()
This method was deprecated. Use sos.management.network.listInterfaces()
instead.
getNetworkInfo(): Promise<INetworkInfo>;