Updated on 2024-11-04 GMT+08:00

Online Debugging

Overview

After the product model and codec are developed, the application can receive data reported by the device and deliver commands to the device through the IoT platform.

The IoTDA provides application and device simulators for you to commission data reporting and command delivery before developing real applications and physical devices. You can also use the application simulator to verify the service flow after the physical device is developed.

Debugging a Product by Using a Virtual Device

When both device development and application development are not completed, you can create virtual devices and use the application simulator and device simulator to test product models and codecs. The simulated device commissioning interface consists of four parts:

1. Application simulator display area on the left: displays the property data received by the application server and the commands delivered by the application server.

2. Device simulator area on the left: displays the properties reported by the device and the commands received by the device.

3. Application simulator and device simulator on the right: simulate an application to deliver commands or a device to report properties.

4. Message tracing area: displays the processing logs of the IoT platform during device access, property reporting, and command delivery, helping developers demarcate and locate faults.

Figure 1 Online debugging - Virtual device structure
  1. On the product details page, click the Online Debugging tab and click Add Test Device.
  2. In the Add Test Device dialog box, select Virtual device for Device Type and click OK. The virtual device name contains DeviceSimulator. Only one virtual device can be created for each product.
  3. In the device list, select the newly created virtual device,

    Figure 2 Creating a virtual device

  4. Click Debug on the right. The debugging page is displayed.

    Figure 3 Entering debugging

  5. In Device Simulator, enter a hexadecimal code stream or JSON data (for example, enter a hexadecimal code stream) and click Send. View the data reporting result in Application Simulator and the processing logs of the IoT platform in Message Tracing.

    Figure 4 Online debugging - Simulating data reporting (smokeInfo)

  6. Deliver a command in Application Simulator. View the received command (for example, a hexadecimal code stream) in Device Simulator and the processing logs of the IoT platform in Message Tracing.

    Figure 5 Online debugging - Command delivery

Debugging a Product by Using a Physical Device

When the device development is complete but the application development is not, you can add physical devices and use the application simulator to test devices, product models, and codecs. The physical device commissioning page consists of three parts:

  1. Application simulator display area on the left: displays the property data received by the application server and the commands delivered by the application server.
  2. Application simulator area on the right: simulates an application to deliver commands.
  3. Message tracing area: displays the processing logs of the IoT platform during device access, property reporting, and command delivery, helping developers demarcate and locate faults.
Figure 6 Online debugging - Real device structure
  1. On the product details page of the smoke detector, click the Online Debugging tab and click Add Test Device.
  2. In the Add Test Device dialog box, select Physical device for Device Type, set the parameters of the device, and click OK.

    Figure 7 Adding a test device

    Note: If DTLS is used for access, keep the key secure.

    The newly added device is in the inactive state. In this case, online debugging cannot be performed. For details, see Device Connection Authentication. After the device is connected to the platform, perform the debugging.

  3. Click Debug to access the debugging page.

    Figure 8 Entering debugging

  4. Simulate a scenario where a control command is remotely delivered. In Application Simulator, Set Service to StreetLight, Command to SWITCH_LIGHT, and Command Value to ON, and click Send. The street lamp is turned on.