---
sidebar_position: 0
---

# 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.

:::note GitHub Example
- [Basic usage of the Management API](https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/basics)
- [Getting basic management data](https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/js-management-getters)
- [Setting management data](https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/js-management-setters)
:::

<details>
    <summary>Management Capabilities</summary>
		| 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()`](https://developers.signageos.io/sdk/sos_management/#supports).
</details>

## Methods

### factoryReset()

The `factoryReset()` method initializes the factory reset of the device.

```ts expandable
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.

<Separator />

### getBatteryStatus()

The `getBatteryStatus()` method returns information about the battery of the device.

:::note
- Emulator has mocked this method and will always return a battery status with 100% charge.
:::

```ts expandable
getBatteryStatus(): Promise<IBatteryStatus>;
// show-more
interface IBatteryStatus {
    readonly chargeType: string;
    readonly isCharging: boolean;
    readonly lastChargingTime: Date;
    readonly percentage: number;
    readonly updatedAt: Date;
}

```

#### 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

```ts
const batteryStatus = await sos.management.getBatteryStatus();
console.log(`Battery status: ${batteryStatus.percentage}% charged`);
```

<Separator />

### getBrand()

The `getBrand()` method returns the manufacturer brand of the device.

```ts expandable
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

```ts
const brand = await sos.management.getBrand();
console.log(`Device brand is: ${brand}`); // e.g., 'Samsung', 'LG', BrightSign, etc.
```

<Separator />

### getExtendedManagementUrl()

The `getExtendedManagementUrl()` method returns the management URL of the device.

:::info
This is currently only implemented for the MagicInfo on the Tizen platform.
:::

```ts expandable
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.

<Separator />

### getModel()

The `getModel()` method returns the model of the device.

```ts expandable
getModel(): Promise<string>;
```

#### Return value

A promise that resolves to the model name of the device.

#### Example

```ts
const model = await sos.management.getModel();
console.log(`Device model is: ${model}`); // e.g. 'XC4055' (BrightSign)
```

<Separator />

### getSerialNumber()

The `getSerialNumber()` method returns the serial number of the device.

```ts expandable
getSerialNumber(): Promise<string>;
```

#### Return value

A promise that resolves to the serial number of the device.

#### Example

```ts
const serialNumber = await sos.management.getSerialNumber();
console.log(`Device serial number is: ${serialNumber}`); // e.g. '1234567890'
```

<Separator />

### getTemperature()

The `getTemperature()` method returns the temperature of the device (in the 0-100 range of degrees Celsius).

```ts expandable
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

```ts
const temperature = await sos.management.getTemperature();
console.log(`Current device temperature is: ${temperature}°C`); // e.g. 25°C
```

<Separator />

### isHardwareAccelerationEnabled()

The `isHardwareAccelerationEnabled()` method returns whether hardware acceleration is enabled.

```ts expandable
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

```ts
const isEnabled = await sos.management.isHardwareAccelerationEnabled();
console.log(`Hardware acceleration is ${isEnabled ? 'enabled' : 'disabled'}.`);
```

<Separator />

### resetSettings()

The `resetSettings()` method initializes the reset of the specific device settings.

:::warning
This is currently only implemented on the Linux platform.
:::

```ts expandable
resetSettings(): Promise<void>;
```

#### Return value

A promise that resolves when the settings are reset.

#### Possible errors

If the device does not support settings reset.

<Separator />

### setExtendedManagementUrl()

The `getExtendedManagementUrl()` sets the management URL of the device.

:::info
This is currently only implemented for the MagicInfo on the Tizen platform.
:::

```ts expandable
setExtendedManagementUrl(url: string | null): Promise<void>;
```

#### Params

| Name  | Type             | Required         | Description                                                           |
|-------|------------------|------------------|-----------------------------------------------------------------------|
| `url` | `string \| null` |  <div>Yes</div>  | 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

```ts
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'
```

<Separator />

### setHardwareAcceleration()

The `setHardwareAcceleration()` method turns hardware acceleration on or off.

:::note
- This is currently only implemented for the BrightSign platform.
- Device must always be rebooted for the changes to take effect.
:::

```ts expandable
setHardwareAcceleration(enabled: boolean): Promise<void>;
```

#### Params

| Name      | Type      | Required         | Description                                      |
|-----------|-----------|------------------|--------------------------------------------------|
| `enabled` | `boolean` |  <div>Yes</div>  | 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

```ts
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);
});
```

<Separator />

### 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](https://developers.signageos.io/sdk/sos/display#supports).

:::tip
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.
:::

```ts expandable
supports(capability: ManagementCapability): Promise<boolean>;
// show-more
type ManagementCapability = 'MODEL' | 'SERIAL_NUMBER' | 'BRAND' | 'OS_VERSION' | 'BATTERY_STATUS' | 'STORAGE_UNITS' | 'TEMPERATURE' | 'SCREENSHOT_UPLOAD' | 'NETWORK_INFO' | 'WIFI' | 'WIFI_SCAN' | 'WIFI_AP' | 'WIFI_STRENGTH' | 'TIMERS_PROPRIETARY' | 'BRIGHTNESS_SCHEDULING' | 'TIMERS_NATIVE' | 'SET_BRIGHTNESS' | 'GET_BRIGHTNESS' | 'SCREEN_RESIZE' | 'SET_TIME' | 'SET_TIMEZONE' | 'GET_TIMEZONE' | 'NTP_TIME' | 'APP_UPGRADE' | 'FIRMWARE_UPGRADE' | 'PACKAGE_INSTALL' | 'SET_VOLUME' | 'GET_VOLUME' | 'SET_REMOTE_CONTROL_ENABLED' | 'SET_DEBUG' | 'SYSTEM_REBOOT' | 'APP_RESTART' | 'DISPLAY_POWER' | 'SERVLET' | 'HARDWARE_LED_SET_COLOR' | 'PROXIMITY_SENSOR' | 'FACTORY_RESET' | 'ORIENTATION_LANDSCAPE' | 'ORIENTATION_PORTRAIT' | 'ORIENTATION_LANDSCAPE_FLIPPED' | 'ORIENTATION_PORTRAIT_FLIPPED' | 'ORIENTATION_AUTO' | 'SCHEDULE_POWER_ACTION' | 'EXTENDED_MANAGEMENT' | 'SYSTEM_CPU' | 'SYSTEM_MEMORY' | 'PROXY' | 'AUTO_RECOVERY' | 'PEER_RECOVERY' | 'FILE_SYSTEM_WIPEOUT' | 'REMOTE_DESKTOP' | 'HOTEL_MODE' | 'VPN' | 'CUSTOM_SCRIPTS' | 'NATIVE_COMMANDS_MDC' | 'DEVICE_OWNER' | 'ACCESSIBILITY_SERVICE' | 'DISPLAY_MANAGER' | 'SECRETS' | 'HARDWARE_ACCELERATION' | 'WIFI_COUNTRY' | 'STOP_PACKAGE' | AnyString;

type AnyString = string & {};

```

#### Params

| Name         | Type                   | Required         | Description                          |
|--------------|------------------------|------------------|--------------------------------------|
| `capability` | `ManagementCapability` |  <div>Yes</div>  | 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

```ts
const isSupported = await sos.management.supports('OS_VERSION');
console.log(`Is OS_VERSION supported? ${isSupported}`);
```

<Separator />

### ~getNetworkInfo()~

:::danger Deprecated

This method was deprecated. Use `sos.management.network.listInterfaces()` instead.

:::

```ts expandable
getNetworkInfo(): Promise<INetworkInfo>;
// show-more
/**
 * @deprecated use `INetworkInterface` instead
 */
interface INetworkInfo {
    localAddress: string;
    ethernetMacAddress: string;
    wifiMacAddress: string;
    activeInterface: NetworkInterface;
    gateway?: string;
    netmask?: string;
    dns?: string[];
    interfaceName?: string;
    /**
     * Number in range from 0 to 100 (percentage)
     * mapped from -90 dBm unusable signal
     * to -30 dBm excellent signal.
     */
    wifiStrength?: number;
    wifiSsid?: string;
}

type NetworkInterface = 'wifi' | 'ethernet';

```