Unbinding a Device
API Function
This API is used to passively receive the unbinding command delivered by the IoT platform. After the command is received, the configuration information of the directly connected device is deleted, and all resources are released. (If this command is received, the device has been deleted from the IoT platform.)
API Description
1 |
HubService.TOPIC_UNBINDDEVICE;
|
Class
HubService
Example
Implement the observer API provided by the AgentLite before calling this API.
1 2 3 4 |
public class AgentLiteHub implements MyObserver {
public Subscribe (Observable hubService) {
hubService. registerObserver (this);
}
|
Receive a device unbinding response.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
//After the device is unbound successfully, developers need to delete the configuration information of the directly connected device and release all resources after receiving the callback.
public void update(IotaMessage arg0) {
// TODO Auto-generated method stub
System.out.println("Receive a notification from HubService:" + arg0);
int mMsgType = arg0.getMsgType();
switch(mMsgType) {
//Receive a device adding response.
case IodevService.IODEV_MSG_ADD_DEVICE_RSP:
getAddDeviceAnswer(arg0);
break;
//Receive a device deleting response.
case IodevService.IODEV_MSG_RMV_DEVICE_RSP:
getRmvDeviceAnswer(arg0);
break;
//Receive a device status update response.
case IodevService.IODEV_MSG_UPDATE_DEVSTATUS_RSP:
getUpdateStatusAnswer(arg0);
break;
case IodevService.IODEV_MSG_RECEIVE_CMD:
getUnbindAnswer(arg0);
break;
default:
break;
}
}
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot