IoTIoT

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Updated at: Feb 24, 2022 GMT+08:00

Updating the Device Status

API Function

This API is used to update status information about devices, including directly connected devices and indirectly connected devices managed by the IoT platform. The device status can be updated through this API when the device is offline or online.

The status of directly connected devices is updated based on the device login status. If a directly connected device is disconnected from the IoT platform, its status becomes offline. If a directly connected device is connected or reconnected to the IoT platform, its status becomes online and does not need to be updated through this API. Therefore, it is recommended that developers call this API to update the status of indirectly connected devices.

API Description

1
HW_INT IOTA_DeviceStatusUpdate(HW_UINT uiCookie, const HW_CHAR *pcDeviceId, const HW_CHAR *pcStatus, const HW_CHAR *pcStatusDetail);

Parameter Description

Parameter

Mandatory or Optional

Type

Description

uiCookie

Optional

HW_UINT

The value ranges from 1 to 65535.

pcDeviceId

Mandatory

HW_CHAR

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

pcStatus

Mandatory

HW_CHAR

Specifies the device status. The value must end with \0. The value is ONLINE or OFFLINE.

  • ONLINE: indicates that the device is in the online state.
  • OFFLINE: indicates that the device is in the offline state.

pcStatusDetail

Mandatory

HW_CHAR

Specifies the detailed device status information. The value must end with \0. Value:

  • None
  • CONFIGURATION_PENDING
  • COMMUNICATION_ERROR
  • CONFIGURATION_ERROR
  • BRIDGE_OFFLINE
  • FIRMWARE_UPDATING
  • DUTY_CYCLE
  • NOT_ACTIVE

Return Value

For details, see 4.2 Function Return Values.

Output

Broadcast Name

Broadcast Parameter

Member

Description

IOTA_TOPIC_DEVUPDATE_RSP/{deviceId}

HW_MSG object

None

Specifies the device status update result.

Example

1
2
3
HW_CHAR *pcDeviceId = stDevice.pcDeviceId; 

IOTA_DeviceStatusUpdate(0, pcDeviceId, "ONLINE", "NONE");

The device waits for the command execution result.

1
2
3
4
5
6
7
8
9
//Developers call this API to register the function for subsequent processing after the device is updated.
HW_iNT Device_StatusUpdateHandler(HW_UiNT uiCookie, HW_MSG pstMsg) 
{
    HW_cHAR pcCmdContentl;
    pcCmdContent = HW_MsgGetStr(pstMsg, EN_IOTA_DEVUPDATE_IE_RESULT);
    pcCmdContent = HW_MsgGetStr(pstMsg, EN_IOTA_DEVUPDATE_IE_DEVICEID);
    return 0;
}
//Bind the broadcast reception processing function HW_BroadCastReg ("IOTA_TOPIC_DEVUPDATE_RSP", Device_StatusUpdateHandler).

Did you find this page helpful?

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