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
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
Name | Type | Description |
---|---|---|
envInfo.remoteBrowserIp | string | The IP of the remote browser, can be used for remote debugging |
envInfo.sdkVersion | string | The version of the Client Library |
Example
import { envInfo } from 'senza-sdk';
console.info(envInfo.remoteBrowserIp)
Modules
Classes
- DeviceManager
DeviceManager is a singleton class that manages the device
deviceManager ⇒ 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
- .wifiInfo
- .reboot() ⇒
Promise
- .clearWifi() ⇒
Promise
- .sendDataToDevice(data) ⇒
Promise
- .factoryReset([reboot]) ⇒
Promise
- "wifiInfoUpdated"
deviceManager.deviceInfo
Kind: instance property of DeviceManager
Properties
Name | Type |
---|---|
DeviceInfo | object |
DeviceInfo.deviceId | string |
DeviceInfo.connectionId | string |
DeviceInfo.community | string |
DeviceInfo.tenant | string |
DeviceInfo.clientIp | string |
DeviceInfo.countryCode | string |
deviceManager.wifiInfo
Kind: instance property of DeviceManager
Properties
Name | Type |
---|---|
WifiInfo | object |
WifiInfo.level | number |
WifiInfo.quality | number |
WifiInfo.ssid | string |
WifiInfo.bssid | string |
deviceManager.reboot() ⇒ Promise
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
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
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.
Param | Type | Description |
---|---|---|
data | String | raw data to be passed to the device |
deviceManager.factoryReset([reboot]) ⇒ Promise
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.
Param | Type | Default | Description |
---|---|---|---|
[reboot] | Boolean | true | a 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);
});
Updated 2 months ago