CUSTOMDEVICE
It supports to receive instances of customdevices and defines an administrator call setting that can manage instances.
customdevice class gets the customdevice's instance calling sucessCallback function for using custom device and calls the manager to receive a custom device's constant like connection/disconnection, status.
Add the following line for customdevice class into a html file your own : <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js"></script> |
You can declare customdevice class like this : ex) var customdevice = deviceapis.customdevice; |
Constants
Name | Value | Description |
ERROR_CODE_NO_ERR | 0 | there was no error(success) |
ERROR_CODE_ERR | 9999 | there was error |
MGR_EVENT_DEV_CONNECT | 11 | device connection event |
MGR_EVENT_DEV_DISCONNECT | 12 | device disconnection event |
MGR_EVENT_DEV_STATUS | 13 | device status event |
DEV_SMART_DEVICE | 33 | Smart phone or tablet type of device connected over WiFi |
DEV_EVENT_MESSAGE_RECEIVED | 150 | message received from smart device event |
DEV_EVENT_JOINED_GROUP | 151 | smart device joined group event |
DEV_EVENT_LEFT_GROUP | 152 | smart device left group event |
Methods
getCustomDevices | ||
Description | ||
request to get custom devices instances. | ||
Parameters | ■successCallback - Function ■errorCallback - Function | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
deviceapis.customdevice.getCustomDevices(successCallback, errorCallback); |
registerManagerCallback | ||
Description | ||
request to set callback function to receive custom device manager event such as MGR_EVENT_DEV_CONNECT / MGR_EVENT_DEV_DISCONNECT / MGR_EVENT_DEV_STATUS. | ||
Parameters | ■callbackFn - Function - callback function that has prototype given as “void callbackFn(ManagerEvent)” | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
deviceapis.customdevice.registerManagerCallback(cbFunc); |