Help Center > > Developer Guide> Product Development> Developing an Application> Command Delivery

Command Delivery

Updated at: Jul 31, 2019 GMT+08:00

Overview

The NA server calls the device command creation API or device service calling API of the IoT platform to deliver control instructions to devices. For details about the APIs, see the API reference document.
  • When the access protocol at the application layer is LWM2M, the Creating Device Commands API is called to deliver commands.
  • When the access protocol at the application layer is MQTT, the Calling Device Services API is called to deliver commands.

This topic describes how to deliver commands with the Calling Device Services API and the Java code sample of the API.

Procedure

  1. In the Eclipse, choose src > com.huawei.service.commandDelivery > CreateDeviceCommand.java, and change the values of deviceId, serviceId, method, and paras.

    Parameters are described as follows:

    • The value of deviceId is obtained when a device is registered.
    • The values of serviceId, method, and paras are the same as those defined in the profile file.

  2. Right-click CreateDeviceCommand.java and choose Run As > Java Application.
  3. View the command delivery log on the console. If the 201 Created response is received, the command is delivered to the IoT platform.

    If the application test function of the Developer Center is used to simulate device access and data reporting, developers can select the virtual device created in Device Access to the IoT Platform to view the received commands by choosing Application > Application Test.

    After the NA server delivers a command, view the received command (for example, a hexadecimal code stream) in Device Simulator and view processing logs of the IoT platform in Message Tracking.

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