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

Inspecting the Quality of the Codec

After the codec is packaged, quality inspection is performed to check whether the codec is functioning properly.

  1. Obtain the codec detection tool from the IoT platform service provider.
  2. Save the pluginDetector.jar file, the devicetype-capability.json file in the profile file, and the package.zip and tool folders to be checked to the same directory.

    Figure 1 Placing the files in the same directory

  3. Obtain a stream of reported device data, and enter the stream in hexadecimal format on the data report tab page of the detection tool, for example, AA72000032088D0320623399.
  4. Click start detect to view the decoded JSON data.

    The log text box displays the decoded data. If report data is success is displayed, the decoding is successful. If ERROR is displayed, an error occurs during decoding.

    Figure 2 Successful decoding of reported data
    Figure 3 Failed decoding of reported data

  5. After the decoding is successful, the detection tool continues to call the encode method of the codec package to encode a response.

    If encode ack result success is displayed, the response is encoded successfully.

  6. Obtain a command delivered by the application server. (The application server calls the API for creating device commands on the IoT platform to deliver the command.) Then, enter the command on the data report tab page of the detection tool.
  7. Click start detect of the detection tool. Then, the detection tool calls the encode API to encode a control command.

    If encode cmd result success is displayed, the command is successfully encoded. If ERROR is displayed, an error occurs during the command encoding.

    Figure 4 Successful encoding control command delivery

    Order example:

    {
        "identifier": "123",
        "msgType": "cloudReq",
        "serviceId": "NBWaterMeterCommon",
        "cmd": "SET_DEVICE_LEVEL",
        "mid": 2016,
        "paras": {
            "value": "10"
        },
        "hasMore": 0
    }

  8. Obtain a stream of reported device command execution results, and enter the stream in hexadecimal format on the data report tab page of the detection tool, for example, AA7201000107E0.
  9. Click start detect to view the decoded JSON data.

    The log text box displays the decoded data. If report command result success is displayed, the decoding is successful. If ERROR is displayed, an error occurs during decoding.

    Figure 5 Successful decoding of the command execution result