Help Center > > API Reference> AgentLite API Reference (C)> API Description> Management of Non-Directly Connected Devices on a Gateway> Deleting a Device

Deleting a Device

Updated at: Aug 28, 2019 GMT+08:00

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
HW_INT IOTA_HubDeviceRemove(HW_UINT uiCookie, const HW_CHAR *pcDeviceId);

Parameter Description

Parameter

Mandatory or Optional

Type

Description

uiCookie

Optional

HW_UINT

The value ranges from 1 to 65535.

pcDeviceId

Mandatory

String

Identifies a device. The value must end with \0.

Return Value

For details, see 4.2 Function Return Values.

Output

Broadcast Name

Broadcast Parameter

Member

Description

IOTA_TOPIC_HUB_RMVDEV_RSP

HW_MSG object

EN_IOTA_HUB_IE_TYPE

Specifies the device deletion result.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
//Developers call this API to delete a device.
HW_cHAR *pcDeviceId = stDevice.pcDeviceId;
IOTA_HubDeviceRemove(HW_NULL, pcDeviceId);
The device then waits for the deletion result.
HW_iNT Device_RemoveResultHandler(HW_UiNT uiCookie, HW_MSG pstMsg) 
{
    uiResult = HW_MsgGetUint (pstMsg, EN_IOTA_HUB_IE_RESULT);
    if (EN_IOTA_HUB_RESULT_SUCCESS != uiResult) 
    {
        // retry with uiCookie 
        return 0;
    }
    return 0;
}
HW_BroadCastReg("IOTA_TOPIC_HUB_RMVDEV_RSP", Device_RemovResultHandler);

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel