IoM Solution V100R001C10 Huawei IoT Device Resource Package Development Guide Issue 01 Date 2016-09-22 HUAWEI TECHNOLOGIES CO., LTD. Copyright © Huawei Technologies Co., Ltd. 2016. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Huawei Technologies Co., Ltd. Trademarks and Permissions and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd. All other trademarks and trade names mentioned in this document are the property of their respective holders. Notice The purchased products, services and features are stipulated by the contract made between Huawei and the customer. All or part of the products, services and features described in this document may not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information, and recommendations in this document are provided "AS IS" without warranties, guarantees or representations of any kind, either express or implied. The information in this document is subject to change without notice. Every effort has been made in the preparation of this document to ensure accuracy of the contents, but all statements, information, and recommendations in this document do not constitute a warranty of any kind, express or implied. Huawei Technologies Co., Ltd. Address: Huawei Industrial Base Bantian, Longgang Shenzhen 518129 People's Republic of China Website: http://www.huawei.com Email: [email protected] Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. i IoM Solution Huawei IoT Device Resource Package Development Guide Contents Contents 1 About This Document .................................................................................................................. 1 2 Overview......................................................................................................................................... 3 3 Developing the Device Resource Package ............................................................................... 8 3.1 Compiling the Device Capability Profile and Service Capability Profile ..................................................................... 8 3.2 Compiling the Device Presentation Profile and Service Presentation Profile ............................................................... 8 3.3 Developing Image Resources ..................................................................................................................................... 11 3.4 Compiling Text Description Files ............................................................................................................................... 12 3.5 Summarizing and Packaging Resources ..................................................................................................................... 12 4 Sample Device Resource Package ............................................................................................ 14 Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. ii IoM Solution Huawei IoT Device Resource Package Development Guide 1 1 About This Document About This Document Purpose This document describes specific processes and steps for integrating various smart home devices, including how to develop device resource packages for smart home devices and how to simply present smart home devices. This document provides guidance for developers to quickly develop device resource packages for the smart home devices to be integrated. Intended Audience This document is intended for smart home device developers, who must: Be familiar with the functions of the smart home device to be integrated Have knowledge of Internet of Things (IoT) protocols and relevant interfaces Understand basic IoT technologies This document is intended for: Device developers UCD designers Symbol Conventions The symbols that may be found in this document are defined as follows. Symbol Description Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Indicates a potentially hazardous situation which, if not avoided, could result in death or serious injury. Indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 1 IoM Solution Huawei IoT Device Resource Package Development Guide Symbol 1 About This Document Description Indicates a potentially hazardous situation which, if not avoided, could result in equipment damage, data loss, performance deterioration, or unanticipated results. NOTICE is used to address practices not related to personal injury. Calls attention to important information, best practices and tips. NOTE is used to address information not related to personal injury, equipment damage, and environment deterioration. Change History Changes between document issues are cumulative. The latest document issue contains all the changes made in earlier issues. Issue Release Date Description 1 2016-05-01 This is the first official release. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. Impact 2 IoM Solution Huawei IoT Device Resource Package Development Guide 2 Overview 2 Overview A device resource package, which is presented in .zip format, contains image resources, text resources, a device capability profile, and a device presentation profile. It is used to configure the capabilities and presentation of a smart home device. Each smart home device has only one resource package, which is identified by the manufacturer ID and model of the device. Related Concepts App default template The App default template is a template to be used by Huawei HiHo App by default, and defines the default layout of device details. The default layout includes a title bar, a secondary area, a master area, an event area, and a command area from top to bottom. Templates are available for all of the master area, secondary area, and command area. Developers can customize the properties and commands of corresponding areas based on the templates. A template is a customization of properties or commands. Master area This area displays the properties of master services. It may include multiple pages. Secondary area This area displays the properties of secondary services on only one page on which at most six properties can be displayed. Event area This area displays historical events. It, however, displays only the last historical event. You can click the event area to check all historical events of the current device in a device event list. Command area This area displays commands. It may include multiple pages. Development Process For details on steps (1) to (5), see the five sections in chapter "Developing the Device Resource Package." Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 3 IoM Solution Huawei IoT Device Resource Package Development Guide 2 Overview Device Resource Package Structure This section uses a contact sensor (whose device type is ContactSensor) as an example. The device resource package is ContactSensor_0001_0002-0003.zip, where ContactSensor indicates the device type (devicetype), 0001 indicates the manufacturer ID (manufacturerId), and 0002-0003 indicates the device model (model). Root directory of resource files, such as /data/data/{appPackageName} └res_{manufacturerId} Manufacturer resource directory, such as res_0001 ├{devicetype}_{manufacturerId}_{model}.zip File name, such as ContactSensor_0001_0002-0003.zip ├{devicetype}_{manufacturerId}_{mode2}.zip └{devicetype}_{manufacturerId}_{mode3}.zip Internal structure of the resource package: {devicetype}_{manufacturerId}_{mode1}.zip Package directory structure: ├─manual Text descriptions and images related to the device │ ├ deviceType. Png This icon needs to be provided only when a new device type is added. (1) │ ├ largeIcon.pdf Large icon of an iOS platform device in PDF format (2) │ ├ largeIcon.png Large icon of an Android platform device in PNG format (2) │ ├ smallIcon.pdf Small icon of an iOS platform device in PDF format (3) │ ├ smallIcon.png Small icon of an Android platform device in PNG format (3) │ │ │ ├─discovery_guide Introductory materials involved in device installation │ │ ├─introduction Introductory materials involved in device discovery (At most four pages) │ │ │ ├─page1 First page of introductory materials │ │ │ │ ├ guide_desc_en.txt Text description in English, which is mandatory. Text descriptions in other languages may be added according to actual needs. (4) │ │ │ │ ├ guide_desc_zh.txt Text description in Chinese (4) │ │ │ │ ├ guide_icon.pdf Introductory icon of the iOS platform in PDF format (4) │ │ │ │ └ guide_icon.png Introductory icon of the Android platform in PNG format (4) │ │ │ │ │ │ │ └─page2 Second page of introductory materials │ │ │ ├ guide_desc_en.txt │ │ │ ├ guide_desc_zh.txt │ │ │ ├ guide_icon.pdf │ │ │ └ guide_icon.png │ │ │ │ │ ├─search Introductory materials during search (Only one page) │ │ │ └─page1 │ │ │ ├ guide_desc_en.txt │ │ │ ├ guide_desc_zh.txt │ │ │ ├ guide_icon.pdf │ │ │ └ guide_icon.png │ │ │ │ │ └─check Device detection (to detect whether the device is within the coverage of the gateway) │ │ ├─page1 First page of introductory materials (At most four pages) │ │ │ ├ guide_desc_en.txt │ │ │ ├ guide_desc_zh.txt │ │ │ ├ guide_icon.pdf │ │ │ └ guide_icon.png Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 4 IoM Solution Huawei IoT Device Resource Package Development Guide 2 Overview │ │ │ │ │ └─page2 Second page of introductory materials │ │ ├ guide_desc_en.txt │ │ ├ guide_desc_zh.txt │ │ ├ guide_icon.pdf │ │ └ guide_icon.png │ │ │ └─remove_guide Introductory materials involved in device deletion │ ├─page1 First page of introductory materials (At most four pages) │ │ ├ guide_desc_en.txt │ │ ├ guide_desc_zh.txt │ │ ├ guide_icon.pdf │ │ └ guide_icon.png │ │ │ └─page2 Second page of introductory materials │ ├ guide_desc_en.txt │ ├ guide_desc_zh.txt │ ├ guide_icon.pdf │ └ guide_icon.png │ ├─profile │ ├ devicetype-capability.json Device capability profile (9) │ └ devicetype-display.json Device presentation profile (10) │ └─service ├─manual │ │ largeIcon.pdf Large icon of an iOS platform service in PDF format (11) │ │ largeIcon.png Large icon of an Android platform service in PNG format (11) │ │ smallIcon.pdf Small icon of an iOS platform service in PDF format (12) │ │ smallIcon.png Small icon of an Android platform service in PNG format (12) │ │ │ ├─command Custom icon for storing a command. The name of the icon is the same as the name of the command. │ │ {commandname1}_small_icon.pdf iOS platform command icon in PDF format (5) │ │ {commandname1}_small_icon.png Android platform command icon in PNG format (5) │ │ {commandname2}_small_icon.pdf │ │ {commandname2}_small_icon.png │ │ │ └─property Custom icon for storing a property. The name of the icon is the same as the name of the property. │ ├ {propertyName1}_small_icon.pdf Small icon of an iOS platform property in PDF format (6) │ ├ {propertyName1}_small_icon.png Small icon of an Android platform property in PNG format (6) │ ├ {propertyName1}_large_icon.pdf Large icon of an iOS platform property in PDF format (7) │ ├ { propertyName1}_large_icon.png Large icon of an Android platform property in PNG format (7) │ ├ {propertyName2}_small_icon.pdf │ ├ { propertyName2}_small_icon.png │ ├ {propertyName2}_large_icon.pdf │ └ { propertyName2}_large_icon.png │ └─profile Each service has two profiles: service capability profile and service presentation profile. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 5 IoM Solution Huawei IoT Device Resource Package Development Guide ├ servicetype-capability.json └ servicetype-display.json 2 Overview Service capability profile (9) Service presentation profile (8) (1) to (8): For details, see section "Mapping Between Images/Text Descriptions in the Resource Package and HiHo App UI Presentation." (9): For details, see section "Compiling the Device Capability Profile and Service Capability Profile." (10): For details, see section "Device Presentation Profile." Specifications Specifications of image resources No. Description iOS Specification (px) Android Specification (px) Remarks or Requirements (1) Device type icon 98 x 98 98 x 98 1. This icon needs to be provided only when a new device type (which is not supported previously) is added. 2. The icon is in PNG format for both iOS and Android platforms. 3. The default icon is displayed if no deviceType.png exists for the device type newly added. (2) Large icon of a device 56 x 56 189 x 189 iOS: PDF format Small icon of a device 28 x 28 Introductory icon to be used in the device addition or deletion process 276 x 200 Command icon 72 x 72 Small icon of a property 48 x 48 Large icon of a property 384 x 384 Large icon of a service 384 x 384 (3) (4) (5) (6) (7) (11) Issue 01 (2016-09-22) Android: PNG format 90 x 90 iOS: PDF format Android: PNG format 936 x 672 iOS: PDF format Android: PNG format 96 x 96 iOS: PDF format Android: PNG format 72 x 72 iOS: PDF format Android: PNG format 672 x 672 iOS: PDF format Android: PNG format 672 x 672 Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. iOS: PDF format Android: PNG format 6 IoM Solution Huawei IoT Device Resource Package Development Guide 2 Overview No. Description iOS Specification (px) Android Specification (px) Remarks or Requirements (12) Small icon of a service 48 x 48 72 x 72 iOS: PDF format Android: PNG format Specifications of text descriptions No. Description Specification Remarks or Requirements (4) Text description in the device addition or deletion process Not more than 240 characters The description in English is mandatory, and descriptions in other languages depend on actual needs. (8) Text description of a property or command in the device presentation profile Not more than 10 characters The description in English is mandatory, and descriptions in other languages depend on actual needs. The numbers given in the two tables are consistent with the numbers given in section "Device Resource Package Structure." Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 7 IoM Solution Huawei IoT Device Resource Package Development Guide 3 3 Developing the Device Resource Package Developing the Device Resource Package 3.1 Compiling the Device Capability Profile and Service Capability Profile 3.2 Compiling the Device Presentation Profile and Service Presentation Profile 3.3 Developing Image Resources 3.4 Compiling Text Description Files 3.5 Summarizing and Packaging Resources 3.1 Compiling the Device Capability Profile and Service Capability Profile It is recommended that the technical engineer should write the device capability profile and the service capability profile with reference to Huawei IoT Device Capability Profile Development Guide.docx. For details on the contents of the device capability profile and service capability profile, see chapter "Sample Device Resource Package" and Huawei IoT Device Capability Profile Development Guide.docx. The developer shall determine whether to add a device type or service type with reference to Huawei IoT Device Capability Profile Development Guide.docx. 3.2 Compiling the Device Presentation Profile and Service Presentation Profile The presentation profiles, which serve as primary customization of device presentation, will be used in Huawei HiHo App to make presentation based on Huawei HiHo App default template. Device Presentation Profile Currently, the device presentation profile is not involved; therefore, the developer can simply use a blank file and does not need to modify it. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 8 IoM Solution Huawei IoT Device Resource Package Development Guide 3 Developing the Device Resource Package Service Presentation Profile This section uses the presentation of the service Battery as an example. File location and content Battery\profile\servicetype-display.json {"services": [ { "serviceType":"Battery", "properties":[ { "propertyName": "batteryLevel", "visible":true, "propertyLabel":[ {"language":"en", "desc":"BATTERY"}, {"language":"zh", "desc":"Battery"} ] }, { "propertyName": "batteryThreshold", "visible":false } ] } ]} Field description Field Description services Complete presentation of the service serviceType Service type, which is the same as the service type defined in the service capability profile servicetype-capability.json in the Battery\profile\ directory properties Presentation of all properties of the service propertyName Property name, which is the same as the property name defined in the service capability profile servicetype-capability.json in the Battery\profile\ directory visible Visibility If the property needs to be presented on App pages, set this parameter to true; otherwise, set this parameter to false. propertyLabel Property label The text description of a property on App pages can be customized. language Language Descriptions can be given in the language Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 9 IoM Solution Huawei IoT Device Resource Package Development Guide Field 3 Developing the Device Resource Package Description used by the App. At least the description in English shall be given. desc Specific description If commands are involved, the commands shall be added behind the properties. First add a comma and then the commands. For instance, to add the SWITCH command, do as follows: {"services": [ { "serviceType":"Battery", "properties":[ { "propertyName": "batteryLevel", "visible":true, "propertyLabel":[ {"language":"en", "desc":"BATTERY"}, {"language":"zh", "desc":"Battery"} ] }, { "propertyName": "batteryThreshold", "visible":false } ] , "commands": [ { "commandName": "SWITCH", "visible":true, "commandLabel": [ { "language": "en", "desc": "ON/OFF"}, { "language": "zh", "desc": "ON/OFF"} ], "paras":[ { "paraName": "status", "dataType": "string", "required": true, "min": 0, "max": 0, "step": 0, "maxLength": 20, "unit": "null", "enumList": ["ON","OFF"] }, { "paraName": "timeout", "dataType": "int", "required": true, "min": 1, "max": 1000, "step": 0, Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 10 IoM Solution Huawei IoT Device Resource Package Development Guide 3 Developing the Device Resource Package "maxLength": 20, "unit": "s", "enumList": null }] } ] } ]} Field description Field Description commandName Command name, which is the same as the command name defined in the service capability profile servicetype-capability.json in the Battery\profile\ directory commandLabel Command label, which is similar to propertyLabel For details, see the description of the propertyLabel field. paras Parameter If a parameter is involved, the parameter shall be the same as the parameter defined in the service capability profile servicetype-capability.json in the Battery\profile\ directory. If no parameter is involved, this field is not required. Comply with the JSON syntax when compiling all the profiles. The developer shall comply with the JSON syntax when adding, deleting, or modifying a profile. 3.3 Developing Image Resources The UCD designer makes image slices according to specifications (such as size and format) for each image resource. The UCD designer needs to pay attention to the size of each image file. After all image resources and files are compressed into the device resource package, the size of the device resource package cannot be greater than 4 MB. Issue 01 (2016-09-22) For details on required image resources, see section "Device Resource Package Structure" and chapter "Sample Device Resource Package." For details on the image specifications, see section "Specifications." Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 11 IoM Solution Huawei IoT Device Resource Package Development Guide 3 Developing the Device Resource Package 3.4 Compiling Text Description Files Text description files (in .txt format) are involved only in device addition and deletion processes. It is recommended that the UCD designer should give text descriptions according to the maximum number of words in a text description and according to the steps for adding or deleting the smart home device to be integrated. The text descriptions shall be saved in UTF-8 format. The content of each text description file must correspond to the content of the image in each step. For details on the text specifications, see section "Specifications." 3.5 Summarizing and Packaging Resources After making the resource files as described in the preceding scenario, place the resource files into the corresponding directory. Use the following method to package the resource files: 1. Select and right-click all folders in the root directory of the resource package. A shortcut menu is displayed. Choose Add to archive …from the shortcut menu, as shown in the following figure. 2. Select ZIP below Archive format, enter the name of the .zip package (Device type_Manufacturer ID_Device model.zip), and then click OK. Ensure that the device type, manufacturer ID, and device model are consistent with the actual situation, with an underline in between. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 12 IoM Solution Huawei IoT Device Resource Package Development Guide 3 Developing the Device Resource Package The developer may read chapter 6 "Common Sensor Ecological Development Guide" in Huawei IoT Agent Integration Development Guide.docx to determine the device type, manufacturer ID, and device model. After making the device resource package, the developer sends it in an email to [email protected]. The email title shall indicate the information [Device resource package review] Whether a new device type and service type are added, such as [Device resource package review] Properties are added to an existing service or [Device resource package review] New device type and service type are added. Huawei technical support personnel will complete the review and return feedback information within one working day. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 13 IoM Solution Huawei IoT Device Resource Package Development Guide 4 4 Sample Device Resource Package Sample Device Resource Package Name of the sample device resource package: App Resource Package Demo.zip Archive path: Demo\ App Resource Package Demo.zip The device resource package must be in .zip format. In this sample, a contact sensor (whose device type is ContactSensor) is used as an example. The developer needs to change the device resource package according to the actual product. For details on the profiles, image files and text description files involved in the device resource package and the specifications of images and text, see sections "Device Resource Package Structure" and "Specifications." Ensure that the fields manufacturerId, model, and deviceType defined in the devicetype-capability.json file in the profile\ directory are consistent with the data reported by the device, and consistent with the devicetype, manufacturerId, and model in the resource package name {devicetype}_{manufacturerId}_{model}.zip; otherwise, the App will be unable to search resource files such as the profiles and images according to the information, the device list and the device details page will fail to display the images or text descriptions of the resource package, and certain functions of the device will fail. For details on the service types currently supported, see Huawei IoT Device Capability Profile Development Guide.docx. After modifying a profile, the developer can use the online JSON compiler to check whether the format of the profile is correct. The developer needs to ensure the correctness of the format of each profile. Mapping Between Images/Text Descriptions in the Resource Package and HiHo App UI Presentation (1) Device type icon: It is used in a device type list, which will be displayed during device addition. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 14 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package The numbers (1) to (8) here correspond to the numbers in section "Device Resource Package Structure.." (2) Large icon of a device: It is used in a device list, which will be displayed on the first page. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 15 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package (3) Small icon of a device: It is used in a device model list, which will be displayed during device addition. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 16 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package (4) Text description with introductory images: It is used in the wizard for device addition. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 17 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package (5) Command icon: It is used in the command area on the device details page. If no command is involved, the command area is invisible. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 18 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package (6) Small icon of a property: It is used in the secondary area on the device details page. If the property is in the secondary area, a small icon of the property will be used. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 19 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package The properties of a secondary service are shown in the secondary area, and those of a master service in the master area. There must be at least one master service. For details on how to set secondary services and master services, see Huawei IoT Device Capability Profile Development Guide.docx. (7) Large icon of a property: It is used in the master area on the device details page. If the property is in the master area, a large icon of the property will be used. Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 20 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package (8) Mapping between custom property status descriptions in the service presentation profile and text descriptions to be presented on UIs Custom property status description: Location {Resource package path}\service\{serviceType}\profile\servicetype-display.json, as shown in the following figure. {"services": [ { "serviceType":"DoorWindow", "properties": [ { "propertyName": "status", "visible":true, "enumListTag": [ { "key": "OPEN", "value":[ {"language":"en", "desc":"Open"}, {"language":"zh", "desc":"Open"} ] }, { "key": "CLOSED", "value":[ {"language":"en", "desc":"Closed"}, {"language":"zh", "desc":"Closed"} Issue 01 (2016-09-22) Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 21 IoM Solution Huawei IoT Device Resource Package Development Guide 4 Sample Device Resource Package ] } ] } ] } ]} Text descriptions on the device details page (HiHo App will automatically use corresponding text descriptions according to the status of the sensor, and will use text descriptions in the language defined for the system or will use text descriptions in English by default if the system language is not yet set): Issue 01 (2016-09-22) If the value of the property is a number (such as temperature or humidity), the developer does not need to add the property status description in enumListTag. If the property is not a master property, it will be displayed in the secondary area andthe property description will also be automatically displayed in the secondary area. The command description of a command in the command area is similar to the property description of a property in the property area. The command description is displayed below the command icon. For details, see the figure in step …. Ensure that the property status description is not too long, just like the command description of a command in the command area. It is recommended that the property status description should consist of not more than ten characters. Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd. 22
© Copyright 2026 Paperzz