public abstract class DeviceActionHandler extends Object
If a Gateway or Device supports device actions like reboot and factory reset,
this abstract class DeviceActionHandler
should be extended by the Gateway or Device code.
The handleReboot(com.ibm.wiotp.sdk.devicemgmt.DeviceAction) and
handleFactoryReset(com.ibm.wiotp.sdk.devicemgmt.DeviceAction)
must be implemented by the subclass to handle the actions sent by the IBM Watson IoT Platform.
| Constructor and Description |
|---|
DeviceActionHandler() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
handleFactoryReset(DeviceAction action)
Subclass must implement this method.
|
abstract void |
handleReboot(DeviceAction action)
Subclass must implement this method.
|
public abstract void handleReboot(DeviceAction action)
If the device supports reboot, subclass must add logic to reboot the
device.
If reboot attempt fails, the "rc" is set to 500 and the "message"
field should be set accordingly, if the reboot is not supported,
set "rc" to 501 and optionally set "message" accordingly
Gateway must use the class DeviceAction to retrieve the
DeviceType and DeviceId for which the reboot request is received and act accordingly.
action - DeviceAction where the device code can set the failure status and messageDeviceActionpublic abstract void handleFactoryReset(DeviceAction action)
If the device supports factory reset, subclass must add logic to reset the
device to factory settings
If the factory reset attempt fails, the "rc" should be 500 and the "message"
field should be set accordingly, if the factory reset action is not supported,
set "rc" to 501 and optionally set "message" accordingly.
Gateway must use the class DeviceAction to retrieve the
DeviceType and DeviceId for which the Factory reset request is received and act accordingly.
action - DeviceAction where the device code can set the failure status and messageDeviceActionCopyright © 2019. All rights reserved.