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.
getDeviceName(): Promise<string>;
getLocation()
The getLocation()
method returns location of the device. Location is requested from server on application start, automatically
updated when changed and persisted in local storage.
getLocation(): Promise<IDeviceLocation | null>;
getOrganizationTags()
The getOrganizationTags()
method returns all tags assigned to the device. Tags are requested from server on application start, automatically
updated when changed and persisted in local storage.
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.getOrganizationTags();
for (const { name } of tags) {
console.log('Tag: ', name);
}
};