Deleting a Device
API Function
This API is used to delete indirectly connected devices from the IoT platform when a new device needs to be removed from the gateway.
API Description
1 | public static boolean rmvDevice(int cookie, String deviceId);
|
Class
HubService
Parameter Description
| Parameter | Mandatory or Optional | Type | Description |
|---|---|---|---|
| cookie | Optional | int | The value ranges from 1 to 65535. |
| deviceId | Mandatory | String | Identifier of a device. |
Return Value
| Return Value | Description |
|---|---|
| true | Success |
| false | Failure |
Return values only show API calling results. For example, the return value true indicates that the API is called successfully but does not indicate that the device is deleted successfully. The device is deleted successfully only after the HubService broadcast is received.
Example
Call this API to delete a device.
1 | HubService.rmvDevice(122, deviceId);
|
Implement the observer API provided by the AgentLite before calling this API.
1 2 3 4 5 6 | public class Subscribe implements MyObserver {
public Subscribe (Observable hubService) {
hubService. registerObserver (this);
}
@Override
Same as those used for adding a device.
|
Last Article: Updating the Device Status
Next Article: Reporting Device Data
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.