Device Manager

All web applications hosted on the Senza platform must provide settings information to the end user.

The settings information must include:

  • Device ID
  • Senza Community
  • Senza Tenant

The Client Library API described below allows the HTML5 Web App to retrieve the device information.

️ Service Level Agreement

Failure of an application to provide the listed information in the web application is listed as an exemption in the Senza Service Level Agreement, Section 4.9 "Exceptions to target monthly availability"

Functions

getDeviceInfo() (deprecated from 3.19.0)

Deprecated: use deviceManager.deviceInfo instead. Returns the device information, including device id, connection id, community, tenant, client ip and country code

Constants

envInfo

getDeviceInfo() (deprecated from 3.19.0)

Returns the device information, including device ID, connection ID, community, tenant and client ip.

Deprecated: use deviceManager.deviceInfo instead.

Kind: global function

envInfo (from version 3.1.1)

Kind: global constant
Properties

NameTypeDescription
envInfo.remoteBrowserIpstringThe IP of the remote browser, can be used for remote debugging
envInfo.sdkVersionstringThe version of the Client Library

Example

import { envInfo } from 'senza-sdk';
console.info(envInfo.remoteBrowserIp)

Modules

deviceManagerDeviceManager

Classes

DeviceManager

DeviceManager is a singleton class that manages the device

deviceManager ⇒ DeviceManager

Returns: DeviceManager - pointer to the DeviceManager singleton.
Example

import { deviceManager } from "senza-sdk";
console.info(deviceManager.wifiInfo.ssid)
await deviceManager.clearWifi()
deviceManager.reboot()

DeviceManager

DeviceManager is a singleton class that manages the device.

Kind: global class
Emits: event:wifiInfoUpdated

deviceManager.deviceInfo

Kind: instance property of DeviceManager
Properties

NameType
DeviceInfoobject
DeviceInfo.deviceIdstring
DeviceInfo.connectionIdstring
DeviceInfo.communitystring
DeviceInfo.tenantstring
DeviceInfo.clientIpstring
DeviceInfo.countryCodestring

deviceManager.wifiInfo

Kind: instance property of DeviceManager
Properties

NameType
WifiInfoobject
WifiInfo.levelnumber
WifiInfo.qualitynumber
WifiInfo.ssidstring
WifiInfo.bssidstring

deviceManager.reboot() ⇒ Promise

Reboot the device.

Kind: instance method of DeviceManager
Returns: Promise - Promise which is resolved when the reboot command has been successfully processed.
Failure to process the reboot command will result in the promise being rejected.

deviceManager.clearWifi() ⇒ Promise

Delete current wifi configuration and forget network.

Kind: instance method of DeviceManager
Returns: Promise - Promise which is resolved when the clearWifi command has been successfully processed.
Failure to process the clearWifi command will result in the promise being rejected.

deviceManager.sendDataToDevice(data) ⇒ Promise

Send raw data directly to a customer's device via the USB serial connection of a Senza device.
This function is specifically designed for customers who have their devices connected to a Senza device.
Using this API, the customers can transmit messages or data directly to their connected devices.
The transmission occurs through the Senza device's USB serial interface, facilitating direct communication
between the customer's web application and their device.

Kind: instance method of DeviceManager
Returns: Promise - Promise which is resolved when the command has been successfully processed.
Failure to process the command will result in the promise being rejected.

ParamTypeDescription
dataStringraw data to be passed to the device

deviceManager.factoryReset([reboot]) ⇒ Promise

Perform device factory reset.

Kind: instance method of DeviceManager
Returns: Promise - Promise which is resolved when factoryReset has been successfully performed.
Failure to factoryReset for any reason, result in the promise being rejected.

ParamTypeDefaultDescription
[reboot]Booleantruea flag that is passed to the device to indicate whether it should reboot after the factory reset. Defaults to true.

"wifiInfoUpdated"

Kind: event emitted by DeviceManager
Example

deviceManager.addEventListener("wifiInfoUpdated", () => {
  console.info("Wifi info has been updated to", deviceManager.wifiInfo);
});

Example

deviceManager.addEventListener("wifiInfoUpdated", () => {
  console.info("Wifi info has been updated to", deviceManager.wifiInfo);
});

What’s Next