Skip to main content
Version: 8.12.0

deviceInfo

The sos.deviceInfo API groups together methods for retrieving information about the device set in the CloudControl, such as location or tags.

Methods​

getDeviceName()​

The getDeviceName() method returns a name of the device. Name is requested from server on application start, automatically updated when changed and persisted in local storage.

note

Device name can be set only in CloudControl on Device Info page, or via Rest API.

getDeviceName(): Promise<string | null>;

Return value​

A promise that resolves to the device name.

Example​

const deviceName = await sos.deviceInfo.getDeviceName();
console.log(`Device name is: ${deviceName}`);

getDeviceTags()​

The getDeviceTags() method returns all organization tags assigned to the device including parent tags, if available. Tags are requested from server on application start, automatically updated when changed and persisted in local storage.

note

Tags can be set only in CloudControl on Device Info page, or via Rest API.

getDeviceTags(): Promise<IDeviceTag[]>;

Return value​

A promise that returns the device tags.

getLocation()​

The getLocation() method returns location of the device with child tags if available. Location is requested from server on application start, automatically updated when changed and persisted in local storage.

note

Location can be set only in CloudControl on Device Info page, or via Rest API.

getLocation(): Promise<IDeviceLocation | null>;

Return value​

A promise that resolves to the device location or null if not set.

getPlatformUri()​

The getPlatformUri() method returns the URI of the signageOS platform the device connects to, or tries to connect to. Until the device fetches its configuration, it is the platform of the last known configuration.

getPlatformUri(): Promise<string | null>;

Return value​

A promise that resolves to the platform URI, or null if the device has no configuration yet.

Example​

const platformUri = await sos.deviceInfo.getPlatformUri();
console.log(`Device connects to ${platformUri}`);

getOrganizationTags()​

Deprecated

This method was deprecated. Please use getDeviceTags() method instead.

getOrganizationTags(): Promise<IOrganizationTag[]>;

API Example​

import { sos } from '@signageos/front-applet';

void sos.onReady(async () => {
await printLocation();
await printTags();
});

const printLocation = async () => {
const { name, customId, description } = (await sos.deviceInfo.getLocation()) ?? {};
console.log('Location: ', { name, customId, description });
};

const printTags = async () => {
const tags = await sos.deviceInfo.getDeviceTags();
for (const { name, parentTag } of tags) {
console.log('Tag: ', name);
if (parentTag) {
console.log(' Parent Tag: ', parentTag.name);
}
}
};