Development Guide
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.
- On the Product Development page, click a product to enter its development space.
- In the development space, click Profile Definition and click Add Service.
- 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.
- Enter Service Name using the camelcase naming method, such as waterMeter or battery.
- 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.
- 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.
- 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.
- 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.
- Enter Service Name using the camelcase naming method, such as waterMeter or battery.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot