- 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.
- In the Eclipse, choose deviceId, serviceId, method, and paras., and change the values of
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.
- Right-click CreateDeviceCommand.java and choose .
- 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 .
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.