Help Center > > Developer Guide> Product Development> Developing a Product Model> Development Guide

Development Guide

Updated at: Jun 26, 2019 GMT+08:00

Overview

A product model (or profile file) describes the capabilities and features of a device. You can construct an abstract model of a device type by defining a profile file on the IoT platform, allowing it to understand the services, properties, and commands supported by the device.

  • Device Capability

    For a water meter, the device capabilities include the type, manufacturer, model, protocol, and services to be provided.

    For example, for a water meter, the manufacturer is HZYB, the manufacturer ID is TestUtf8ManuId, the model is NBIoTDevice, and the protocol is CoAP.

    The water meter provides the following services: WaterMeterBasic, WaterMeterAlarm, Battery, DeliverySchedule, and Connectivity. The Battery service is optional and the other services are mandatory.

  • Service

    Service defines service capabilities of a device. Each service contains properties, commands, and parameters.

    For example, the preceding five services of the water meter contain corresponding properties or commands.

Procedure

If you have used a default template when creating a project and product, the corresponding profile file template is selected automatically. You can directly use or modify the template. If a customized product is created, you must define your profile file.

  1. On the Product Development page, click a product to enter its development space.

  2. In the development space, click Profile Definition and click Add Service.

  3. In the Add Service area, define the service name, properties, and commands. A service can contain properties and/or commands. Configure the properties and commands based on your requirements.

    1. Enter Service Name using the camelcase naming method, such as waterMeter or battery.

    2. Click Add under Property List, set the parameters in the dialog box displayed, and click OK. For Name, the first letter of the first word must be lowercase, and the first letters of subsequent words must be capitalized, for example, batteryLevel or internalTemperature. For other parameters, set them based on your requirements.

      The rules for configuring Data Type are as follows:

      • int: Select this value if the reported data is an integer or Boolean values.
      • decimal: Select this value if the reported data is a decimal.
      • string: Select this value if the reported data is a string, enumerated values, or Boolean values. If enumerated or Boolean values are reported, use commas (,) to separate the values.
      • DateTime: Select this value if the reported data is a date.
      • jsonObject: Select this value if the reported data is in JSON structure.

    3. Click Add under Command List. In the dialog box displayed, set Command Name and click OK. It is recommended that the value of Command Name consist of only uppercase letters and underscores (_), for example, DISCOVERY or CHANGE_STATUS.

    4. Click Add under Command Fields. In the dialog box displayed, set the parameters and click OK. For Name of the command field, the first letter of the first word must be lowercase, and the first letters of the subsequent words must be capitalized, for example, statusValue. For other parameters, set them based on your requirements.

    5. Click Add under Command Response Fields. In the dialog box displayed, set the parameters and click OK. For Name of the command response field, the first letter of the first word must be lowercase, and the first letters of the subsequent words must be capitalized, for example, commandResult. For other parameters, set them based on your requirements.

      The command response field is optional. It must be defined only if the device is required to return a command execution result.

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