El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

decode API Description

Updated on 2022-02-24 GMT+08:00

The input parameter binaryData over the decode API is the payload in the CoAP message sent by a device.

Upstream packets of a device can be classified into the following types: data reported by device and responses of the device to the IoT platform (corresponding to messages 1 and 5 in the following figure). Message 4 is the protocol ACK message returned by the module. No plug-in processing is required. The decoding output fields vary depending on the upstream packet.

Figure 1 Upstream packet
Table 1 Data reported by the device

Field

Type

Description

Mandatory or Optional

identifier

String

Specifies the identifier of the device in the application protocol. The IoT platform obtains the parameter over the decode interface, encodes the parameter over the encode interface, and places the parameter in a stream.

Optional

msgType

String

This field has a fixed value of deviceReq, which indicates that the device reports data to the IoT platform.

Mandatory

hasMore

Int

Specifies whether the device has subsequent data to report.

  • 0: The device has subsequent data to report.
  • 1: The device has no subsequent data to report.

Subsequent data indicates that a piece of data reported by a device may be reported in multiple times. After the data is reported in the current time, the IoT platform determines whether there are subsequent messages using the hasMore field. The hasMore field is valid only in PSM mode. When the hasMore field of reported data is set to 1, the IoT platform does not deliver cached commands until it receives reported data whose hasMore field is set to 0. If the reported data does not contain the hasMore field, the IoT platform processes the data assuming that the hasMore field is set to 0.

Optional

data

ArrayNode

Specifies content of data reported by the device. For details, see Table 2.

Mandatory

Table 2 Definition of ArrayNode

Field

Type

Description

Mandatory or Optional

serviceId

String

Identifies a service.

Mandatory

serviceData

ObjectNode

Specifies the data of a service. Detailed fields are defined in the profile file.

Mandatory

eventTime

String

Specifies the data collection time, which is in the format of yyyyMMddTHHmmssZ, for example, 20161219T114920Z.

Optional

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{
"identifier":"123",
"msgType":"deviceReq",
"hasMore":0,
"data": [{"serviceId":"NBWaterMeterCommon", 
          "serviceData":{
                          "meterId":"xxxx",
                          "dailyActivityTime":120,
                          "flow": "565656",
                          "cellId":"5656",
                          "signalStrength":"99",
                          "batteryVoltage":"3.5"
                             }
           "eventTime":"20160503T121540Z"} ,
         {"serviceId":"waterMeter",
          "serviceData":{"internalTemperature":256},
          "eventTime":"20160503T121540Z"}
          ]
}
}
Table 3 Response sent by the device to the IoT platform

Field

Type

Description

Mandatory or Optional

identifier

String

Specifies the identifier of the device in the application protocol. The IoT platform obtains the parameter over the decode API, encodes the parameter over the encode API, and places the parameter in a stream.

Optional

msgType

String

This field has a fixed value of deviceRsp, which indicates that the IoT platform sends a response to the device.

Mandatory

mid

Int

Specifies a 2-byte unsigned command ID. If the device must return the command execution result (deviceRsp), this field is used to associate the command execution result (deviceRsp) with the corresponding command.

When the IoT platform delivers a command over the encode API, the IoT platform places the MID allocated by the IoT platform into a stream and delivers the stream to the device together with the command. When the device reports the command execution result (deviceRsp), the device returns the MID to the IoT platform. Otherwise, the IoT platform cannot associate the delivered command with the command execution result (deviceRsp). As a result, the IoT platform cannot update the command delivery status (success or failure) based on the command execution result (deviceRsp).

Mandatory

errcode

Int

Specifies the request processing result code. The IoT platform determines the command delivery status based on this field.

  • 0: success
  • 1: failure

Mandatory

body

ObjectNode

Specifies the response to the command sent by the IoT platform. Detailed fields are defined in the profile file.

NOTE:

The body is not an array.

Optional

Example:

1
2
3
4
5
6
7
8
9
{
    "identifier": "123",
    "msgType": "deviceRsp",
    "mid": 2016,
    "errcode": 0,
    "body": {
        "result": 0
    }
}

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback