diff --git a/en/device-dev/guide/Readme-EN.md b/en/device-dev/guide/Readme-EN.md
index ca3d08fed657cfb9f989e587cf3d96a4be437f91..a21f8de99fe4e9973e63e6c08d5d1a5351b82e9e 100644
--- a/en/device-dev/guide/Readme-EN.md
+++ b/en/device-dev/guide/Readme-EN.md
@@ -2,27 +2,6 @@
- [Mini- and Small-System Devices](device-lite.md)
- [WLAN-connected Products](device-wlan.md)
- - [OneHop](device-wlan-touch.md)
- - [Overview](onehop-overview.md)
- - [Preparations](onehop-dev-prerequisites.md)
- - [Developing the Hi3861 Development Board](onehop-dev-hi3861.md)
- - [Developing Atomic Services](onehop-dev-atomic-service.md)
- - [Writing an NFC Tag](onehop-write-nfc-info.md)
- - [Configuring a Service Association Intent](onehop-configuration-device-tag.md)
- - [Tapping to Launch an Atomic Service](onehop-open-atomic-service.md)
- - [References](onehop-reference-info.md)
- - [Development Guidelines on the Network Configuration Atomic Service](guide-atomic-service-netconfig.md)
- - [How to Develop](guide-atomic-service-netconfig-overview.md)
- - [Introduction to the Core Code](guide-atomic-service-netconfig-logic.md)
- - [Calling of Network Configuration APIs](guide-atomic-service-netconfig-api.md)
- - [FAQs](faqs.md)
- - [Development Guidelines on the Device Control Atomic Service](guide-atomic-service-device-ctrl.md)
- - [How to Develop](guide-atomic-service-device-ctrl-overview.md)
- - [Introduction to the Core Code Logic](guide-atomic-service-device-ctrl-logic.md)
- - [JSON Configuration File Description](guide-atomic-service-device-ctrl-json.md)
- - [Overview](guide-atomic-service-device-ctrl-json-intro.md)
- - [Configuration Description of Control Components](guide-atomic-service-device-ctrl-json-control.md)
- - [Configuration Description of Dialog Components](guide-atomic-service-device-ctrl-json-dialog.md)
- [LED Peripheral Control](device-wlan-led.md)
- [LED Peripheral Control](device-wlan-led-outcontrol.md)
- [Third-Party SDK Integration](device-wlan-sdk.md)
diff --git a/en/device-dev/guide/faqs.md b/en/device-dev/guide/faqs.md
deleted file mode 100644
index 9fb5241ff5c773758f6042ed98773d6fe3d6ef33..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/faqs.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# FAQs
-
-1. **Why can't I continue device control after I exit the app and access the control page again?**
-
- Currently, each time you access the app, you must reset the device and configure the network to obtain a new control channel. If the device is not reset, it will maintain the previous network configuration status and the network control fails.
-
-2. **Do I have to use OneHop to access the network configuration feature?**
-
- No. You can also directly open the device configuration page of the **entry** module for network configuration. Taping against an NFC tag is used to start the atomic service and obtain the device information.
-
-3. **After I click the Configure network button, the network configuration progress is stuck at 20% and then a failure message is displayed. What can I do?**
-
- This may occur when the app is killed or exited abnormally last time, as a result of the unstable performance of the network configuration version on the device side.
-
- If the network configuration fails, exit the app, reset the device, and try again.
-
-
diff --git a/en/device-dev/guide/figures/control-more.png b/en/device-dev/guide/figures/control-more.png
deleted file mode 100644
index cbbdb39308126c6bbab31485877701b3fa8e7334..0000000000000000000000000000000000000000
Binary files a/en/device-dev/guide/figures/control-more.png and /dev/null differ
diff --git a/en/device-dev/guide/figures/control.png b/en/device-dev/guide/figures/control.png
deleted file mode 100644
index c0896443de64333eb3c50c8b15daecfd790b0f99..0000000000000000000000000000000000000000
Binary files a/en/device-dev/guide/figures/control.png and /dev/null differ
diff --git a/en/device-dev/guide/figures/link-device.png b/en/device-dev/guide/figures/link-device.png
deleted file mode 100644
index 404a75d2187e374520eadaf3c1e9a105fe44b0c4..0000000000000000000000000000000000000000
Binary files a/en/device-dev/guide/figures/link-device.png and /dev/null differ
diff --git a/en/device-dev/guide/figures/network-configuration-14.png b/en/device-dev/guide/figures/network-configuration-14.png
deleted file mode 100644
index 42a6f643ecb0623d4e208d7ddcb8fd55e92a1f12..0000000000000000000000000000000000000000
Binary files a/en/device-dev/guide/figures/network-configuration-14.png and /dev/null differ
diff --git a/en/device-dev/guide/figures/network-configuration.png b/en/device-dev/guide/figures/network-configuration.png
deleted file mode 100644
index 42a6f643ecb0623d4e208d7ddcb8fd55e92a1f12..0000000000000000000000000000000000000000
Binary files a/en/device-dev/guide/figures/network-configuration.png and /dev/null differ
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md
deleted file mode 100644
index 777ae2f52bf773df613f78ec6a36a76f2efdb296..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md
+++ /dev/null
@@ -1,2350 +0,0 @@
-# Configuration Description of Control Components
-
-- [Control Components](#section7914183213491)
-- [Display Component](#section16681645104918)
-- [Enum Component](#section566910277516)
-- [Reversal Component](#section162211550155113)
-- [Increase\_Decrease Component](#section1092141210525)
-- [Progress Component](#section04131030125215)
-- [Multifunction Component](#section1114919529527)
-
-## Control Components
-
-There are six types of **Control** components: **Display**, **Enum**, **Reversal**, **Progress**, **IncreaseDecrease**, and **Multifunction**.
-
-## Display Component
-
-The **Display** component is used for information presentation. It displays information in two or three areas and supports left-right alignment \(without dividers\) or center alignment \(with dividers\).
-
-Each area can contain the text or the text and image. The image size is fixed at 24 vp x 24 vp. The text color can be customized. The color and image can be selected based on the data range.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "gravity": "default",
- "heightType": "default",
- "name": "Battery level",
- "span": 1,
- "uiList": [
- {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "Disconnected"
- },
- {
- "scope": "1",
- "target": "Connected"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
- },
- "upRight": {}
- }
- },
- {
- "icon": {
- "path": "infoDisplay/battery",
- "value": [
- {
- "defaultTarget ": "/template/pic/battery_10_default.png",
- "disableTarget ": "/template/pic/battery_10_default.png",
- "scope": "-10",
- "target": "/template/pic/battery_10_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_20_default.png",
- "disableTarget ": "/template/pic/battery_20_default.png",
- "scope": "10-20",
- "target": "/template/pic/battery_20_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_30_default.png",
- "disableTarget ": "/template/pic/battery_30_default.png",
- "scope": "20-30",
- "target": "/template/pic/battery_30_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_40_default.png",
- "disableTarget ": "/template/pic/battery_40_default.png",
- "scope": "30-40",
- "target": "/template/pic/battery_40_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_50_default.png",
- "disableTarget ": "/template/pic/battery_50_default.png",
- "scope": "40-50",
- "target": "/template/pic/battery_50_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_60_default.png",
- "disableTarget ": "/template/pic/battery_60_default.png",
- "scope": "50-60",
- "target": "/template/pic/battery_60_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_70_default.png",
- "disableTarget ": "/template/pic/battery_70_default.png",
- "scope": "60-70",
- "target": "/template/pic/battery_70_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_80_default.png",
- "disableTarget ": "/template/pic/battery_80_default.png",
- "scope": "70-80",
- "target": "/template/pic/battery_80_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_90_default.png",
- "disableTarget ": "/template/pic/battery_90_default.png",
- "scope": "80-90",
- "target": "/template/pic/battery_90_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_99_default.png",
- "disableTarget ": "/template/pic/battery_99_default.png",
- "scope": "90-100",
- "target": "/template/pic/battery_99_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_100_default.png",
- "disableTarget ": "/template/pic/battery_100_default.png",
- "scope": "100-",
- "target": "/template/pic/battery_100_default.png"
- }
- ]
- },
- "iconText": {
- "type": "dynamicText",
- "value": "${infoDisplay/battery}%",
- "range": "100-0"
- },
- "subType": "iconTextHorizontal"
- }
- ],
- "uiType": "DISPLAY"
-}
-```
-
-The parameters are described as follows.
-
-
-
Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Battery level.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-gravity
- |
-No
- |
-String (1-128)
- |
-Layout of the child components.
- |
-The value can be default or centerDivider. The default value is default, which means left-right alignment without dividers. centerDivider means center alignment with dividers.
- |
-
-uiList
- |
-Yes
- |
-DisplayItem[]
- |
-List of child components.
- |
-Set the number of child components based on project requirements.
- |
-
-
-
-
-DisplayItem
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-subType
- |
-Yes
- |
-String (1-128)
- |
-Subtype of the component.
- |
-The value can be text, icon, iconTextVertical, or iconTextHorizontal.
- |
-
-icon
- |
-No
- |
-DynamicContent
- |
-Dynamic color, icon, and text. The value is dynamically matched based on the data range in path. When both icon and text are available, the icon is placed above the text.
- |
-The sample code is as follows:
-"icon": {
- "defaultIcon": "",
- "path": "battery/useDay",
- "disableIcon": "",
- "value": [
- {
- "scope": "-50",
- "target": ""
- },
- {
- "scope": "50-100",
- "target": ""
- },
- {
- "scope": "100-",
- "target": ""
- }
- ]
-}
- |
-
-iconText
- |
-No
- |
-NormalText/DynamicText
- |
-Description of the icon.
- |
-"iconText":{
- "color": "",
- "type": "normalText",
- "value": "Battery level"
-}
- |
-
-textDisplay
- |
-No
- |
-DiaplayContent
- |
-Text to display, which can be displayed in the upper left, upper right, and lower part of the component. Set the text based on the project requirements. The text type can be NormalText or DynamicText.
- |
-"textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "Disconnected"
- },
- {
- "scope": "1",
- "target": "Connected"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
- },
- "upRight": {}
- }
- |
-
-
-
-
-DynamicContent
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition, which may need to be set based on the reported device data.
- |
-Example: bluetoothConnectStatus/bluetoothConnectStatus, indicating the current device status.
- |
-
-value
- |
-Yes
- |
-Variation
- |
-Dynamic value range.
- |
-{ "scope": "0", "target": "Disconnected" }.
- |
-
-
-
-
-Variation
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-scope
- |
-Yes
- |
-String (1-128)
- |
-Condition scope.
- |
-Value ranges are separated by hyphens (-). There are five types:
-- -50 (a value less than or equal to 50)
- 50-100 (a value greater than 50 and less than or equal to 100)
- 100- (a value greater than 100)
- - (any value)
- 50 (the specific value 50)
- |
-
-target
- |
-Yes
- |
-String (1-128)
- |
-Value of a condition.
- |
-The value can be a color value or a resource value, for example, 11FCFC or an icon URL.
- |
-
-defaultTarget
- |
-No
- |
-String (1-128)
- |
-URL of the default icon.
- |
--
- |
-
-disableTarget
- |
-No
- |
-String (1-128)
- |
-URL of the icon in the disabled state.
- |
--
- |
-
-
-
-
-NormalText
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-type
- |
-Yes
- |
-String (1-128)
- |
-Type.
- |
-The value is fixed at NormalText.
- |
-
-value
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-The value is fixed, for example, value: Battery level.
- |
-
-color
- |
-No
- |
-String (1-128)
- |
-Display color of the component.
- |
-The value is fixed, for example, 11FCFC.
- |
-
-
-
-
-DynamicText
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-type
- |
-Yes
- |
-String (1-128)
- |
-Type.
- |
-The value is fixed at DynamicText.
- |
-
-value
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: ${bluetoothConnectStatus/bluetoothConnectStatus}. Note: ${} indicates a placeholder, and the value within the braces must be dynamically matched based on the reported device data.
- |
-
-ratio
- |
-No
- |
-float
- |
-Compensation factor.
- |
-For example, if the battery level of the toothbrush is 0.5, the unit displayed on the UI is percent (%), and the displayed content is 50%, then the compensation factor is 0.01. The value displayed on the UI will be divided by the compensation factor before being delivered along the command.
- |
-
-color
- |
-No
- |
-DynamicContent
- |
-Display color of the component, which is a dynamic value.
- |
-"color": {
- "path": "battery/useDay",
- "value": [
- {
- "scope": "-50",
- "target": "11FCFC"
- },
- {
- "scope": "50-100",
- "target": "22FCFC"
- },
- {
- "scope": "100-",
- "target": "33FCFC"
- }
- ]
-}
- |
-
-description
- |
-No
- |
-DynamicContent
- |
-Description of the component, which is a dynamic value.
- |
-"description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "Disconnected"
- },
- {
- "scope": "1",
- "target": "Connected"
- }
- ]
-}
- |
-
-
-
-
-## Enum Component
-
-The **Enum** component is used for type selection. It displays one to four areas, separated by dividers. Each area contains one or two lines to present an image and text, where the image is placed above the text. Each area is clickable. After an area is clicked, a new image \(or the same image with a different color\) is displayed, indicating a status change. As shown in the figure below, after you click the **Read** area, the image is displayed in blue.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "gravity": "centerDivider",
- "heightType": "default",
- "name": "Mode",
- "span": 1,
- "command": [
- {
- "characteristic": "mode",
- "enumInfo": [
- {
- "displayItem":{
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_read_nor.png",
- "scope": "-",
- "target": "/ic_read_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_read_nor_dark.png",
- "scope": "-",
- "target": "/ic_read_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "Read"
- },
- "subType": "iconTextVertical"
- },
- "value": 2
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_write_nor.png",
- "scope": "-",
- "target": "/ic_write_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_write_nor_dark.png",
- "scope": "-",
- "target": "/ic_write_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "Write"
- },
- "subType": "iconTextVertical"
- },
- "value": 3
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_computer_nor.png",
- "scope": "-",
- "target": "/ic_computer_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_computer_nor_dark.png",
- "scope": "-",
- "target": "/ic_computer_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "PC"
- },
- "subType": "iconTextVertical"
- },
- "value": 4
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_favorite_nor.png",
- "scope": "-",
- "target": "/ic_favorite_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_favorite_nor_dark.png",
- "scope": "-",
- "target": "/ic_favorite_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "Favorite"
- },
- "subType": "iconTextVertical"
- },
- "value": 5
- }
- ],
- "sid": "lightMode"
- }
- ],
- "uiType": "ENUM"
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Brightness.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-tag
- |
-No
- |
-String (1-128)
- |
-Tag of the component.
- |
-This is an extended field and is used to tag the component.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-command
- |
-Yes
- |
-Command[]
- |
-Array of commands available for the component.
- |
-ACTION_NORMAL messages are sent prior to ACTION_ENUM messages.
- |
-
-gravity
- |
-No
- |
-String (1-128)
- |
-Layout of the child components.
- |
-The value can be default, center, or centerDivider. The default value is default, which means left-right alignment without dividers. centerDivider means center alignment, and centerDivider means center alignment with dividers.
- |
-
-
-
-
-NormalCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: lightMode.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: mode.
- |
-
-value
- |
-Yes
- |
-int
- |
-Command value to deliver.
- |
-Example: value: 1.
- |
-
-
-
-
-EnumCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: lightMode.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: mode.
- |
-
-value
- |
-Yes
- |
-int
- |
-Command value to deliver.
- |
-Example: value: 1.
- |
-
-
-
-
-EnumInfo
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-displayItem
- |
-No
- |
-DisplayItem
- |
-General child component to display.
- |
--
- |
-
-value
- |
-Yes
- |
-int
- |
-Service property value corresponding to the command.
- |
-Example: 4.
- |
-
-disable
- |
-No
- |
-String[]
- |
-Array of tags disabled after the command is triggered.
- |
-For example, brightness adjustment should be disabled when the lamp is turned off. In this case, set this field to ["Brightness"].
- |
-
-
-
-
-## Reversal Component
-
-The **Reversal** component is used to display a switch in two or three areas. The following table lists the content that can be displayed in each area. The text color can be customized. The color and image can be selected based on the data range. The content in the area on the right can only be used to display the switch image.
-
-**Table 1** Content displayed on the Reversal component
-
-
-Area
- |
-Content
- |
-Mandatory
- |
-
-
-Left area
- |
-Text or text + image (The image size is fixed at 24 vp x 24 vp.)
- |
-Yes
- |
-
-Middle area
- |
-Text or text + image (The image size is fixed at 24 vp x 24 vp.)
- |
-No
- |
-
-Right area
- |
-Image (The image size is fixed at 24 vp x 24 vp.)
- |
-No
- |
-
-
-
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "gravity": "default",
- "heightType": "default",
- "name": "Battery",
- "span": 1,
- "command": [
- {
- "characteristic": "on",
- "reversal": [
- {
- "disableIcon": "/ic_power_nor.png",
- "icon": "/ic_on.png",
- "disableIconNight": "/ic_power_nor_dark.png",
- "iconNight": "/ic_on_dark.png",
- "value": 1
- },
- {
- "disable": {
- "name": [
- "mode",
- "brightness"
- ]
- },
- "disableIcon": "/ic_power_nor.png",
- "icon": "/ic_off.png",
- "disableIconNight": "/ic_power_nor_dark.png",
- "iconNight": "/ic_off_dark.png",
- "value": 0
- }
- ],
- "sid": "switch"
- }
- ],
- "displayItemOne": {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "switch/on",
- "value": [
- {
- "scope": "0",
- "target": "Off"
- },
- {
- "scope": "1",
- "target": "On"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${switch/on}"
- },
- "upRight": {}
- }
- },
- "uiType": "REVERSAL"
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Battery.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width. The value 0.5 means that the component occupies half of the screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-tag
- |
-No
- |
-String (1-128)
- |
-Tag of the component.
- |
-This is an extended field and is used to tag the component.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-displayItemOne
- |
-Yes
- |
-DisplayItem
- |
-General child component to display.
- |
-This field indicates the first component to display.
- |
-
-displayItemTwo
- |
-No
- |
-DisplayItem
- |
-General child component to display.
- |
-This field is used when there are three items in a row. The first two items are general components, and the third item is the reverse switch.
- |
-
-command
- |
-Yes
- |
-ReversalCommand[]
- |
-Array of commands available for the component.
- |
--
- |
-
-gravity
- |
-No
- |
-String (1-128)
- |
-Layout of the child components.
- |
-The value can be default, center, or centerDivider. The default value is default, which means left-right alignment without dividers. centerDivider means center alignment, and centerDivider means center alignment with dividers.
- |
-
-
-
-
-ReversalCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: switch.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: on.
- |
-
-reversal
- |
-Yes
- |
-Reversal[]
- |
-Reverse command property.
- |
-This field provides an array of values corresponding to switch and on. Different values can be selected during control.
- |
-
-
-
-
-Reversal
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-value
- |
-No
- |
-int
- |
-Property value in the command.
- |
-Value of switch.
- |
-
-icon
- |
-Yes
- |
-String (1-128)
- |
-URL of the icon corresponding to the command.
- |
--
- |
-
-disableIcon
- |
-No
- |
-String (1-128)
- |
-URL of the icon in the disabled state.
- |
--
- |
-
-disable
- |
-No
- |
-String[]
- |
-Array of tags disabled after the command is triggered.
- |
-For example, brightness adjustment should be disabled when the lamp is turned off. In this case, set this field to ["Brightness"].
- |
-
-dialogList
- |
-No
- |
-String[]
- |
-Dialog box displayed after the command is triggered.
- |
-The value in dialogList corresponds to the ID of a dialog box.
- |
-
-
-
-
-Property
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-path
- |
-Yes
- |
-String (1-32)
- |
-Property path.
- |
-Example: switch/on, where switch indicates a service and on indicates a property of the service.
- |
-
-value
- |
-Yes
- |
-String (1-32)
- |
-Value of the property.
- |
-Example: 1, indicating that the value of path is 1.
- |
-
-
-
-
-## Increase\_Decrease Component
-
-The **Increase\_Decrease** component is used to increase or decrease data and displays three areas. The left area displays the decrease button, the right area displays the increase button, and the middle area displays the operation data. You can click either button to change the data in the middle area.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Humidity",
- "span": 1,
- "gravity": "default",
- "uiType": "INCREASE_DECREASE",
- "heightType": "low",
- "displayItem": {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "type": "normalText",
- "value": "Target"
- },
- "upRight": {}
- }
- },
- "command": [
- {
- "sid": "temperature",
- "characteristic": "temperature",
- "max": 36,
- "min": 17,
- "ratio": 1,
- "step": 1,
- "defaultValue": 26,
- "disableIconDecrease": "",
- "iconDecrease": "",
- "disableIconIncrease": "",
- "iconIncrease": ""
- }
- ]
-}
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Humidity.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-tag
- |
-No
- |
-String (1-128)
- |
-Tag of the component.
- |
-This is an extended field and is used to tag the component.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-displayItem
- |
-No
- |
-DisplayItem
- |
-General child component to display.
- |
-Component displayed in the middle area.
- |
-
-command
- |
-Yes
- |
-IncreaseDecreaseCommand[]
- |
-Array of commands available for the component.
- |
--
- |
-
-gravity
- |
-No
- |
-String (1-128)
- |
-Layout of the child components.
- |
-The value can be default, center, or centerDivider. The default value is default, which means left-right alignment without dividers. centerDivider means center alignment, and centerDivider means center alignment with dividers.
- |
-
-
-
-
-IncreaseDecreaseCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: humidity.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: humidity.
- |
-
-max
- |
-Yes
- |
-int
- |
-Maximum value.
- |
-For example, the maximum humidity is 100.
- |
-
-min
- |
-Yes
- |
-int
- |
-Minimum value.
- |
-For example, the minimum humidity is 0.
- |
-
-ratio
- |
-No
- |
-float
- |
-Compensation factor.
- |
-For example, if the detected humidity is 0.5 and the displayed humidity is 50, then the compensation factor is 0.01. The value displayed on the UI will be divided by the compensation factor before being delivered along the command.
- |
-
-step
- |
-Yes
- |
-int
- |
-Step value.
- |
-Value that changes at each step.
- |
-
-iconDecrease
- |
-Yes
- |
-String
- |
-URL of the decrease icon.
- |
--
- |
-
-disableIconDecrease
- |
-Yes
- |
-String
- |
-URL of the decrease icon in the disabled state.
- |
--
- |
-
-iconIncrease
- |
-Yes
- |
-String
- |
-URL of the increase icon.
- |
--
- |
-
-disableIconIncrease
- |
-Yes
- |
-String
- |
-URL of the increase icon in the disabled state.
- |
--
- |
-
-defaultValue
- |
-No
- |
-int
- |
-Default value.
- |
--
- |
-
-disable
- |
-No
- |
-String[]
- |
-Array of tags disabled after the command is triggered.
- |
-For example, brightness adjustment should be disabled when the lamp is turned off. In this case, set this field to ["Brightness"].
- |
-
-
-
-
-## Progress Component
-
-The **Progress** component is used to control the progress. It displays two areas. The left area provides the description of the current progress. This area can contain the text or text and image. The image size must be 24 vp x 24 vp. The text color can be customized. The color and image can be selected based on the data range. The right area displays the progress bar.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "gravity": "default",
- "heightType": "low",
- "name": "Brightness",
- "span": 1,
- "command": [
- {
- "characteristic": "brightness",
- "defaultValue": 100,
- "max" : 255,
- "min": 0,
- "radio" : 1,
- "sid": "brightness"
- }
- ],
- "displayItemLeft": {
- "subType": "text",
- "textDisplay": {
- "down": {
- "color": {
- "path" : "brightness/brightness",
- "value" : [{
- "scope": "-",
- "target": "007DFF"
- }]
- },
- "ratio": "0.392156",
- "type": "dynamicText",
- "value": "${brightness/brightness}%"
- },
- "upLeft": {
- "type": "normalText",
- "value": "brightness"
- },
- "upRight": {}
- }
- },
- "uiType": "PROGRESS"
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Brightness.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-displayItem
- |
-No
- |
-DisplayItem
- |
-General child component to display.
- |
-Component displayed in the middle area.
- |
-
-command
- |
-Yes
- |
-ProgressCommand[]
- |
-Array of commands available for the component.
- |
--
- |
-
-
-
-
-ProgressCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: brightness.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: brightness.
- |
-
-max
- |
-Yes
- |
-int
- |
-Maximum value.
- |
-For example, the maximum luminance is 100.
- |
-
-min
- |
-Yes
- |
-int
- |
-Minimum value.
- |
-For example, the minimum luminance is 0.
- |
-
-ratio
- |
-No
- |
-float
- |
-Compensation factor.
- |
-For example, if the brightness of the lamp is 0.5, the unit displayed on the UI is percent (%), and the displayed content is 50%, then the compensation factor is 0.01. The value displayed on the UI will be divided by the compensation factor before being delivered along the command.
- |
-
-step
- |
-Yes
- |
-int
- |
-Step value.
- |
-Value that changes at each step.
- |
-
-defaultValue
- |
-No
- |
-int
- |
-Default value.
- |
--
- |
-
-disable
- |
-No
- |
-String[]
- |
-Array of tags disabled after the command is triggered.
- |
-For example, brightness adjustment should be disabled when the lamp is turned off. In this case, set this field to ["Brightness"].
- |
-
-
-
-
-## Multifunction Component
-
-The **Multifunction** component is used for function control and displays two or three areas. The left area describes the status. The optional middle area is used for timing. The right area displays operation buttons. The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Cooking",
- "span": 1,
- "uiType": "MULTIFUNCTION",
- "displayItemOne": {
- "subType":"text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "workingStatus/status",
- "value": [
- {
- "scope": "1",
- "target": "Standby"
- },
- {
- "scope": "2",
- "target": "Preparing"
- },
- {
- "scope": "3",
- "target": "Cooking"
- },
- {
- "scope": "4",
- "target": "Finished"
- },
- {
- "scope": "5",
- "target": "Reserving"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${workingStatus/status}"
- },
- "upRight": {}
- }
- },
- "displayItemTwo": {
- "subType":"text",
- "textDisplay":{
- "down":{
- "type":"normaltext",
- "value":"Time left"
- },
- "upLeft":{
- "type":"dynamicText",
- "value":"${remainingTime/time}"
- },
- "upRight":{
-
-
- }
- }
- },
- "multifunctionInfo": {
- "path": "workingStatus/action",
- "value": [
- {
- "scope": "1",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_prepare.png",
- "icon": "/ic_prepare.png",
- "disableIconNight": "/ic_prepare.png",
- "iconNight": "/ic_prepare.png",
- "value": 3,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "2",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_prepare.png",
- "icon": "/ic_prepare.png",
- "disableIconNight": "/ic_prepare.png",
- "iconNight": "/ic_prepare.png",
- "value": 3,
- "sid": "workingStatus"
- }
- ],
- "commandTwo": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "3",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "4",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_complete.png",
- "icon": "/ic_complete.png",
- "disableIconNight": "/ic_complete.png",
- "iconNight": "/ic_complete.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "5",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- }
- ]
- }
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the component.
- |
-Example: Battery.
- |
-
-span
- |
-Yes
- |
-float
- |
-Span of the component.
- |
-Set the component span based on the screen width of the mobile phone. The value 1 means that the component occupies the entire screen width.
- |
-
-uiType
- |
-Yes
- |
-String (1-128)
- |
-Type of the component.
- |
-The value can be DISPLAY, REVERSAL, INCREASE_DECREASE, ENUM, or MULTIFUNCTION.
- |
-
-heightType
- |
-No
- |
-String (1-128)
- |
-Height type of the component.
- |
-The value can be default or low. The default value is default.
- |
-
-displayItemOne
- |
-Yes
- |
-DisplayItem
- |
-General child component to display.
- |
-The first component to display.
- |
-
-displayItemTwo
- |
-No
- |
-DisplayItem
- |
-General child component to display.
- |
-This field is used when there are three items in a row. The first two items are general components, and the third item is a multi-function button.
- |
-
-multifunctionInfo
- |
-Yes
- |
-DynamicCommandContent
- |
-Multi-function button.
- |
--
- |
-
-
-
-
-DynamicCommandContent
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition, which may need to be set based on the reported device data.
- |
-Example: workingStatus/status, indicating the current device status.
- |
-
-value
- |
-Yes
- |
-VariationCommand
- |
-Dynamic value range.
- |
-Example: { "scope": "-50", "target": "11FCFC" }.
- |
-
-
-
-
-VariationCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-scope
- |
-Yes
- |
-String (1-128)
- |
-Condition scope.
- |
-Value ranges are separated by hyphens (-). There are five types:
-- -50 (a value less than or equal to 50)
- 50-100 (a value greater than 50 and less than or equal to 100)
- 100- (a value greater than 100)
- - (any value)
- 50 (the specific value 50)
- |
-
-commandOne
- |
-Yes
- |
-MultifunctionCommand
- |
-The first command to execute.
- |
-The sample code is as follows:
-{
- "characteristic": "action",
- "disableIcon": "icon_start_dis.png",
- "icon": "icon_start.png",
- "value": 1,
- "sid": "action"
-}
- |
-
-commandTwo
- |
-No
- |
-MultifunctionCommand
- |
-The second command to execute.
- |
-The sample code is as follows:
-{
- "characteristic": "action",
- "disableIcon": "icon_start_dis.png",
- "icon": "icon_start.png",
- "value": 1,
- "sid": "action"
-}
- |
-
-
-
-
-MultifunctionCommand
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-sid
- |
-Yes
- |
-String (1-32)
- |
-Service corresponding to a command.
- |
-Example: switch.
- |
-
-characteristic
- |
-Yes
- |
-String (1-32)
- |
-Property corresponding to the command.
- |
-Example: on.
- |
-
-value
- |
-No
- |
-int
- |
-Property value in the command.
- |
-Either value or valueString must be specified. For a WLAN device, value is used. For a Bluetooth device, value or valueString is used.
- |
-
-valueString
- |
-No
- |
-String (1-128)
- |
-Property value in the command.
- |
-Either value or valueString must be specified. For a WLAN device, value is used. For a Bluetooth device, value or valueString is used.
- |
-
-icon
- |
-Yes
- |
-String (1-128)
- |
-URL of the icon corresponding to the command.
- |
--
- |
-
-disableIcon
- |
-No
- |
-String (1-128)
- |
-URL of the icon in the disabled state.
- |
--
- |
-
-disable
- |
-No
- |
-String[]
- |
-Array of tags disabled after the command is triggered.
- |
-Example: ["Steaming function"]. For example, the steaming function is disabled when the soy milk maker is shut down.
- |
-
-
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md
deleted file mode 100644
index 08326b32d9809c827a4d17a45bb9f732627fb81c..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md
+++ /dev/null
@@ -1,1264 +0,0 @@
-# Configuration Description of Dialog Components
-
-- [Overview](#section177145394383)
-- [Enum Dialog](#section7797619153917)
-- [Radio Dialog](#section149204321448)
-- [Info Dialog](#section22496134515)
-- [Time Picker](#section13596193716458)
-- [Date Picker](#section11825192184617)
-- [Date and Time Picker](#section69732312462)
-- [Text Picker](#section1179325213461)
-- [Multi-column Picker](#section10946422184712)
-
-## Overview
-
-**Dialog** components are classified into the following types: **Enum**, **Radio**, **Info**, and **Picker** \(time picker, date picker, date and time picker, text picker, and multi-column picker\).
-
-## Enum Dialog
-
-The **Dialog** component of the **Enum** type displays one to eight areas for user selection. Each area is clickable. After an area is clicked, a new image \(or the same image with a different color\) is displayed, indicating a status change. Only one area can be activated at a time.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Drinkings",
- "id": "drinkKind",
- "path": "drinkKind",
- "dialogType": "ENUM",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "Next",
- "type": "submit"
- }
- ],
- "command": [
- {
- "name": "Grain",
- "icon": {
- "value": {
- "defaultTarget": "/ic_grains_nor.png",
- "target": "/ic_grains_on.png"
- },
- "valueNight": {
- "defaultTarget": "/ic_grains_nor.png",
- "target": "/ic_grains_on.png"
- }
- },
- "dialogList": ["duration", "temperature", "capacity", "speed"],
- "value": 1
- },
- {
- "name": "Soy milk",
- "icon": {
- "value": {
- "defaultTarget": "/ic_soy_milk_nor.png",
- "target": "/ic_soy_milk_on.png"
- },
- "valueNight": {
- "defaultTarget": "/ic_soy_milk_nor.png",
- "target": "/ic_soy_milk_on.png"
- }
- },
- "dialogList": ["duration", "temperature", "capacity", "speed"],
- "value": 2
- }
- ]
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Drinkings.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: drinkKind.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: drinkKind.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-command
- |
-Yes
- |
-Command[]
- |
-Array of commands available for the dialog box.
- |
--
- |
-
-
-
-
-ControlItems
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of a control item.
- |
-Example: Cancel.
- |
-
-type
- |
-Yes
- |
-String (1-128)
- |
-Type of the control item.
- |
-The control item type can be submit or cancel.
- |
-
-
-
-
-Command
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of a command.
- |
-Example: Grain.
- |
-
-icon.value.defaultTarget
- |
-Yes
- |
-String (1-128)
- |
-URL of the default icon.
- |
-Example: /ic_soymilk_nor.png.
- |
-
-icon.value.target
- |
-Yes
- |
-String (1-128)
- |
-URL of the icon when being clicked.
- |
-Example: /ic_soymilk_on.png.
- |
-
-icon.valueNight.defaultTarget
- |
-Yes
- |
-String (1-128)
- |
-URL of the default icon in dark mode.
- |
-Example: /ic_soymilk_nor.png.
- |
-
-icon.valueNight.target
- |
-Yes
- |
-String (1-128)
- |
-URL of the icon when being clicked in dark mode.
- |
-Example: /ic_soymilk_on.png.
- |
-
-dialogList
- |
-No
- |
-Array
- |
-Dialog box list to play.
- |
--
- |
-
-value
- |
-Yes
- |
-int
- |
-Property value in the command.
- |
-For example, the value 1 indicates that the first button is clicked.
- |
-
-
-
-
-## Radio Dialog
-
-The **Dialog** component of the **Radio** type provides a dialog box with radio buttons for user selection. The following uses the duration setting as an example.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
-"name": "Duration",
- "id": "drinkTime1",
- "path": "drinkTime1",
- "dialogType": "RADIO",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "Next",
- "type": "submit"
- }
- ],
- "range": ["1 min", "3 min", "5 min", "10 min"],
- "value": [1, 3, 5, 10]
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Duration.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: duration.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: duration.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-range
- |
-Yes
- |
-Array
- |
-Array of options for selection.
- |
-Example: ["1 min", "3 min", "5 min", "10 min"].
- |
-
-value
- |
-Yes
- |
-Array
- |
-Array of the values corresponding to the options.
- |
-Example: [1, 3, 5, 10].
- |
-
-
-
-
-## Info Dialog
-
-The **Dialog** component of the **Info** type is used to display an image and text.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Hand grinding coffee",
- "id": "handGrindingCoffee",
- "dialogType": "INFO",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "OK",
- "type": "submit"
- }
- ],
- "icon": "/ic_grand_coffee.png",
- "headline": "Tips",
- "desc": "Put the coffee powder in the dry-grinding cup into the coffee filter, and then touch Start to pour coffee."
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Hand grinding coffee.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: handGrindingCoffee.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-icon
- |
-Yes
- |
-String (1-128)
- |
-URL of the image to display.
- |
-Example: /ic_handGrindingCoffee.png.
- |
-
-headline
- |
-Yes
- |
-String (1-128)
- |
-Title.
- |
-Example: Tips"
- |
-
-desc
- |
-Yes
- |
-String (1-128)
- |
-Description.
- |
-Example: Put the coffee powder in the dry grinding cup into the coffee filter, and then touch Start to pour coffee.
- |
-
-
-
-
-## Time Picker
-
-The time picker provides time selection in the form of a dialog box. You can set the **hours** parameter to display the time in the 12-hour or 24-hour format.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
-"name": "Time",
- "id": "time",
- "path": "time",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "OK",
- "type": "submit"
- }
- ],
- "pickerType": "time",
- "containSecond": true,
- "hours": 24
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Time.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: time.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: time.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-pickerType
- |
-Yes
- |
-String (1-128)
- |
-Type of the picker.
- |
-The value can be text, time, date, datetime, and multi-text.
- |
-
-containSecond
- |
-No
- |
-boolean
- |
-Whether seconds are contained.
- |
-Example: true.
- |
-
-hours
- |
-No
- |
-int
- |
-Time format used by the time picker.
- |
-The time format can be 12 (12-hour format) or 24 (24-hour format).
- |
-
-
-
-
-## Date Picker
-
-The date picker provides date selection in the form of a dialog box. You can set the **lunar** parameter to display the lunar calendar or Gregorian calendar.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
-"name": "Date",
- "id": "date",
- "path": "date",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "OK",
- "type": "submit"
- }
- ],
- "pickerType": "date",
- "start": "1970-1-1",
- "end": "2100-12-31",
- "lunar": false
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Date.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: date.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: date.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-pickerType
- |
-Yes
- |
-String (1-128)
- |
-Type of the picker.
- |
-The value can be text, time, date, datetime, and multi-text.
- |
-
-start
- |
-No
- |
-time
- |
-Start time of the data picker.
- |
-Format: YYYY-MM-DD.
- |
-
-end
- |
-No
- |
-time
- |
-End time of the data picker.
- |
-Format: YYYY-MM-DD.
- |
-
-lunar
- |
-No
- |
-boolean
- |
-Whether the date picker is displayed in the lunar calendar.
- |
-Example: false.
- |
-
-
-
-
-## Date and Time Picker
-
-The date and time picker provides date and time selection in the form of a dialog box. You can set the **hours** parameter to display the time in the 12-hour or 24-hour format. You can set the **lunar** parameter to display the lunar calendar or Gregorian calendar.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Date & time",
- "id": "datetime",
- "path": "datetime",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "OK",
- "type": "submit"
- }
- ],
- "pickerType": "datetime",
- "lunar": false,
- "hours": 24
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Date & time.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: datetime.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: datetime.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-pickerType
- |
-Yes
- |
-String (1-128)
- |
-Type of the picker.
- |
-The value can be text, time, date, datetime, and multi-text.
- |
-
-lunar
- |
-No
- |
-boolean
- |
-Whether the date and time picker is displayed in the lunar calendar.
- |
-Example: false.
- |
-
-hours
- |
-No
- |
-int
- |
-Time format used by the date and time selector.
- |
-The time format can be 12 (12-hour format) or 24 (24-hour format).
- |
-
-
-
-
-## Text Picker
-
-The text picker is used for text selection in the form of a dialog box. The text content is configurable.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Temperature",
- "id": "temperature",
- "path": "temperature",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "Next",
- "type": "submit"
- }
- ],
- "pickerType": "text",
- "range": ["40", "50", "60", "70", "80", "90", "100"],
- "value": [40, 50, 60, 70, 80, 90, 100],
- "postField": "℃"
-}
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Temperature.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: temperature.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: temperature.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-pickerType
- |
-Yes
- |
-String (1-128)
- |
-Type of the picker.
- |
-The value can be text, time, date, datetime, and multi-text.
- |
-
-range
- |
-Yes
- |
-Array
- |
-Range of the text picker.
- |
-Example: ["40", "50", "60", "70", "80", "90", "100"].
- |
-
-value
- |
-Yes
- |
-Array
- |
-Value range of the text picker.
- |
-Example: [40, 50, 60, 70, 80, 90, 100].
- |
-
-preField
- |
-No
- |
-String (1-128)
- |
-Prefix field added when a value is selected from the text picker.
- |
-Example: 1.
- |
-
-postField
- |
-No
- |
-String (1-128)
- |
-Suffix field added when a value is selected from the text picker.
- |
-Example: ℃
- |
-
-
-
-
-## Multi-column Picker
-
-The multi-column picker is used for multi-column text selection in the form of a dialog box. The text content is configurable.
-
-The following figure shows an example.
-
-
-
-The code for the example is as follows:
-
-```
-{
- "name": "Duration",
- "id": "duration",
- "path": "duration",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "Cancel",
- "type": "cancel"
- },
- {
- "name": "Next",
- "type": "submit"
- }
- ],
- "pickerType": "multi-text",
- "range": [
- ["0 min","1 min","2 min","3 min","4 min","5 min","6 min"],
- ["0s","1s","2s","3s","4s","5s","6s"]
- ]
- }
-```
-
-The parameters are described as follows.
-
-
-Name
- |
-Mandatory
- |
-Type
- |
-Description
- |
-Remarks
- |
-
-
-name
- |
-Yes
- |
-String (1-128)
- |
-Display name of the dialog box.
- |
-Example: Duration.
- |
-
-id
- |
-Yes
- |
-String (1-128)
- |
-Unique ID of the dialog box.
- |
-Example: duration.
- |
-
-path
- |
-Yes
- |
-String (1-128)
- |
-Dynamic content condition.
- |
-Example: duration.
- |
-
-dialogType
- |
-Yes
- |
-String (1-128)
- |
-Type of the dialog box.
- |
-The value can be RADIO, ENUM, PICKER, or INFO.
- |
-
-controlItems
- |
-Yes
- |
-ControlItems[]
- |
-Control items at the bottom of the dialog box.
- |
--
- |
-
-pickerType
- |
-Yes
- |
-String (1-128)
- |
-Type of the picker.
- |
-The value can be text, time, date, datetime, and multi-text.
- |
-
-range
- |
-Yes
- |
-Two-dimensional array.
- |
-Values available for the multi-column text picker.
- |
-The array length indicates the number of columns, and each item in the array indicates the data in a column. Example: [["a","b"], ["c","d"]].
- |
-
-
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md
deleted file mode 100644
index 8d427b5f53a0e180e59ad5429e1d4921e90f2651..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Overview
-
-The JSON configuration file in the template is the basis for the device control UI. The JSON configuration file of the intelligent fan is stored in **control/src/main/resources/rawfile/FAN**. The configuration is as follows:
-
-```
-{
- "devName": "Intelligent fan",
- "devType": "0",
- "prodId": "FAN", -- prodId specifies the product name displayed on the device control UI.
- "templateUIInfo": [ -- Place preset Control components under templateUIInfo, with one component per line.
- {"name": "Power supply"...},
- {"name": "Mode"...},
- {"name": "Speed control"...},
- {"name": "Scheduled shutdown"...}
- ],
- "dialogUIInfo": [ -- Dialog components can be declared under dialogUIInfo. They are displayed only upon click events.
- {"name": "Shutdown time"...}
- ]
-}
-```
-
-Two types of components \(**Control** and **Dialog** components\) are provided in the template. \(The **Control** components are directly displayed on the UI, and the **Dialog** components are displayed only after being triggered.\) You need to declare these components in the JSON configuration file.
-
-**After modifying the JSON configuration file, reinstall and run the atomic service for the modification to take effect.**
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-json.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-json.md
deleted file mode 100644
index 8cf06c8003441dc677c9daad34182aecfb8c73f2..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-json.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# JSON Configuration File Description
-
-- **[Overview](guide-atomic-service-device-ctrl-json-intro.md)**
-
-- **[Configuration Description of Control Components](guide-atomic-service-device-ctrl-json-control.md)**
-
-- **[Configuration Description of Dialog Components](guide-atomic-service-device-ctrl-json-dialog.md)**
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-logic.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-logic.md
deleted file mode 100644
index 9d55d397210900c542fa990738bb752b505e37b1..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-logic.md
+++ /dev/null
@@ -1,180 +0,0 @@
-# Introduction to the Core Code Logic
-
-- [Core Code Description](#section17354153553419)
-
-## Core Code Description
-
-The core logic is described in **DataHandlerAbility.java**. The code process is as follows:
-
-1. After the JS page is started, the JS code requests the template configuration from Java.
-
- JS code:
-
- ```
- async requestTemplate() {
- // This function requests the JSON configuration used for display from Java.
- let action = utils.makeAction(ACTION_MESSAGE_CODE_GET_TEMPLATE, {});
- let result = await FeatureAbility.callAbility(action);
- let resultJson = JSON.parse(result);
- if (resultJson.code == 0) {
- let template = JSON.parse(resultJson.data);
- this.parseJson(template.template);
- }
- }
- ```
-
- Java code:
-
- ```
- private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply) {
- switch (code) {
- case ACTION_MESSAGE_CODE_GET_TEMPLATE: {
- reply.writeString(getWriteTemplateString());
- break;
- }
- default: {
- reply.writeString("service not defined");
- return false;
- }
- }
- return true;
- }
- ```
-
-2. The Java code reads the template configuration file. The configuration file path is specified by **getTemplate** in **DataHandlerAbility**. The path can be a local path or a URL.
-
- ```
- private ZSONObject getTemplate() {
- // source indicates whether the JSON configuration file is from a local file or an online file.
- final String source = "local";
- // configDir indicates the directory.
- final String configDir = SampleDeviceDataHandler.EXAMPLE_TEMPLATE_FILE_DIR + "/" + productName;
- // configPath indicates the URL of the JSON configuration file. You can change it corresponding
- // to your product name or device ID.
- final String configPath = configDir + "/" + productName + "_" + language + ".json";
- ZSONObject result = null;
- if (LOCAL.equals(source)) {
- try {
- Resource resource = abilityContext.getResourceManager().getRawFileEntry(configPath).openRawFile();
- byte[] tmp = new byte[1024 * 1024];
- int reads = resource.read(tmp);
- if (reads != -1) {
- String jsonString = new String(tmp, 0, reads, StandardCharsets.UTF_8);
- result = ZSONObject.stringToZSON(jsonString);
- }
- } catch (IOException e) {
- HiLog.error(LABEL_LOG, "Failed to open the template from the local file.");
- }
- } else {
- try {
- URL url = new URL(configPath);
- URLConnection urlc = url.openConnection();
- urlc.connect();
- try (InputStream is = urlc.getInputStream();
- InputStreamReader isReader = new InputStreamReader(is, StandardCharsets.UTF_8);
- BufferedReader reader = new BufferedReader(isReader)) {
- StringBuilder sb = new StringBuilder();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- result = ZSONObject.stringToZSON(sb.toString());
- }
- } catch (IOException e) {
- HiLog.error(LABEL_LOG, "Failed to open the template from the URL.");
- }
- }
- if (result != null) {
- // iconUrl is the icon's prefix path. Here we use /common/productName in the js module. You can change it into your
- // cloud url. All icon files must be under iconUrl.
- result.put("iconUrl", SampleDeviceDataHandler.EXAMPLE_RESOURCE_DIR + "/" + productName);
- // deviceIcon is the product icon's file name. It must be under iconUrl.
- result.put("deviceIcon", "/" + productName + ".png");
- // logoIcon is the product logo's file name. It must be under iconUrl.
- result.put("logoIcon", "/logo.png");
- }
- return result;
- }
- ```
-
-3. After obtaining the configuration, the JS code requests device data from Java.
-
- JS code:
-
- ```
- async getData() {
- let action = utils.makeAction(ACTION_MESSAGE_CODE_GET_DATA, {});
- await FeatureAbility.callAbility(action);
- }
- ```
-
- Java code:
-
- ```
- private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply) {
- switch (code) {
- case ACTION_MESSAGE_CODE_GET_DATA: {
- deviceDataHandler.getData();
- break;
- }
- default: {
- reply.writeString("service not defined");
- return false;
- }
- }
- return true;
- }
- ```
-
-4. The Java code initializes the device data and calls **BaseDeviceDataHandler\#initProfileData** to return all profile data of the device.
-
- ```
- NetworkDeviceDataHandler(String deviceId, DeviceDataCallback deviceDataCallback) {
- super(deviceId, deviceDataCallback);
- dataModel = fanDataModel;
- mainHandler = new EventHandler(EventRunner.getMainEventRunner());
- mainHandler.postTask(() -> initProfileData(0, "", dataModel.recoverData()));
- }
- ```
-
- For example, the initial data of the intelligent fan in the template is as follows:
-
- ```
- private final DeviceDataModel fanDataModel = new DeviceDataModel() {
- @Override
- public Map recoverData() {
- dataMap.put("switch/on", 0);
- dataMap.put("windMode/mode", 0);
- dataMap.put("windGear/gear", 0);
- dataMap.put("shutdown/mode", 0);
- return dataMap;
- }
- }
- ```
-
-5. When a click event occurs on the JS page that has data loaded, **BaseDeviceDataHandler\#modifyDeviceProperty** is called and sent to the device. In this case, the UI does not change. After the device responds, **BaseDeviceDataHandler\#onDeviceDataChange** is called back to return the changed data to the UI layer. Now the UI is automatically refreshed.
-
- In the template, the logic for the intelligent fan to send messages to the device is as follows:
-
- ```
- private void sendMessage(String message, HashMap tmpMap) {
- CommonInfo commonInfo = new CommonInfo();
- commonInfo.setSessionId(sessionId);
- HiLog.error(LABEL_LOG, "sessionId " + sessionId);
- NetConfigApi.getInstance().sendMessage(commonInfo, message, (code, controlMessage, str) -> {
- if (code == 0) {
- HiLog.info(LABEL_LOG, "Message sent successfully " + message);
- dataMap.putAll(tmpMap);
- mainHandler.postTask(() -> onDeviceDataChange(dataMap));
- } else {
- HiLog.error(LABEL_LOG, "Failed to send message, code = " +
- code + " control message = " + controlMessage);
- }
- });
- }
- ```
-
- > **NOTE:**
- >The template supports only message delivery from the mobile phone to the device. The function of sending messages from the device to the mobile phone will be supported in the future.
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl-overview.md b/en/device-dev/guide/guide-atomic-service-device-ctrl-overview.md
deleted file mode 100644
index 6a38ad9e823328e1c94818fc06b247d8bdc5d9f2..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl-overview.md
+++ /dev/null
@@ -1,259 +0,0 @@
-# How to Develop
-
-- [Overview](#section117101122133917)
-- [Introduction to the Template](#section16117463402)
-- [Sending Messages to Devices \(NAN Channel Available\)](#section536518118361)
-- [Defining the UI of the Device Control Atomic Service](#section737418403116)
-
-## Overview
-
-The **OneHop Device Ability \(JS\)** template helps you implement the complete process of **OneHop, network configuration, and device control**. By default, the template project presents the effect of an intelligent fan. You can customize the device by referring to [Defining the UI of the Device Control Atomic Service](#section737418403116).
-
-The template project consists of two parts:
-
-**Network configuration atomic service \(entry module\)**
-
-**Device control atomic service \(control module\)**
-
-This document provides guidance on developing the device control atomic service \(control module\). For details about how to develop the network configuration atomic service \(entry module\), see [Development Guidelines on the Network Configuration Atomic Service](guide-atomic-service-netconfig-overview.md).
-
-## Introduction to the Template
-
-The directory structure of the **control** module in the **OneHop Device Ability \(JS\)** template project is as follows:
-
-```
-├─control
-│ └─ailife-view // This directory does not need to be modified.
-│ ├─control // Component container
-│ │ ├─display // Component used for information presentation
-│ │ ├─enum // Component used to present enumerations
-│ │ ├─increasedecrease // Component to provide the increase and decrease operations
-│ │ ├─item // Child components
-│ │ ├─multifunction // Multi-function components
-│ │ ├─progress // Component to present a progress bar
-│ │ └─reversal // Component to provide a switch
-│ ├─customdisplay // Custom display area
-│ ├─dialog // Dialog box container
-│ │ ├─dialogbox
-│ │ ├─enumlist // Dialog box used to present enumerations
-│ │ ├─info // Dialog box used for information presentation
-│ │ ├─picker // Picker
-│ │ └─radiolist // Dialog box used to provide radio buttons
-│ ├─observed
-│ └─utils
-└─src
- └─main
- ├─java // For details about the content in this directory, see the class definition below.
- ├─js
- │ └─default
- │ ├─common // Local resource files, which are mainly icon resources
- │ │ └─FAN
- │ │ ic_on.png
- │ │ ic_off.png
- │ │ ...
- │ └─pages
- │ └─index
- │ index.js // Start JS
- └─resources
- └─rawfile
- ├─FAN
- FAN_en.json // Local template configuration file in English
- FAN_zh.json // Local template configuration file in Chinese
-```
-
-The following table describes the classes in the source code directory **src/main/java**.
-
-
-Java
- |
-Description
- |
-
-
-MyApplication
- |
-Application entry class.
- |
-
-ControlMainAbility
- |
-Entry class to start the JS page.
- |
-
-BaseDeviceDataHandler
- |
-Abstract class for device data exchange.
- |
-
-NetworkDeviceDataHandler
- |
-Inherits from the abstract class BaseDeviceDataHandler to implement device data exchange in Neighbor Awareness Networking (NAN) connection mode. You can modify the code based on the device in use.
- |
-
-SampleDeviceDataHandler
- |
-Inherits from the abstract class BaseDeviceDataHandler. This provides sample code, and you do not need to modify the code.
- |
-
-DataHandlerAbility
- |
-Implements a channel for message exchange between a Java-based system and a JS-based one.
- |
-
-
-
-
-
-JS
- |
-Description
- |
-
-
-control/ailife-view
- |
-Home appliance components, which can be referenced in the JSON configuration file.
- |
-
-index.js
- |
-Device control home page. Different components under ailife-view are loaded based on the JSON configuration file.
- |
-
-
-
-
-## Sending Messages to Devices \(NAN Channel Available\)
-
-The **OneHop Device Ability \(JS\)** template implements delivery of messages to devices by calling Java APIs. You can invoke this template in **NetworkDeviceDataHandler**.
-
-**JS API: NetConfig.sendMessage\(commonInfo, message, callbackFunc\)**
-
-- Dependency: The **fa-netconfig.js** file in the template is imported.
-- Note:
- 1. Set **commonInfo** to the configured channel's session ID, which is obtained by the network configuration atomic service.
- 2. Set **message** to the message \(in a string\) to be sent to the device.
- 3. **callbackFunc** specifies whether the message is successfully sent.
-
-
-Example:
-
-```
-sendMessage: function () {
- let callbackFunc = function (value) {
- // sendMessage callback
- };
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).Netconfig.sendMessage(commonInfo, message, callbackFunc).then(
- function (result) {
- let ret = JSON.parse(result);
- // sendMessage message delivery result
- });
-}
-```
-
-**Java API: NetConfigApi._getInstance_\(\).sendMessage\(CommonInfo commonInfo, String message, BaseCallback callback\)**
-
-Dependency: Add **implementation\(group:'com.huawei.hilink',name:'ailifeability',version:'1.0.0.1',ext:'har'\)** to **dependencies** in the **build.gradle** file.
-
-Note:
-
-1. Set **commonInfo** to the configured channel's session ID, which is obtained by the network configuration atomic service.
-2. Set **message** to the message \(in a string\) to be sent to the device.
-3. **callback** specifies whether the message is successfully sent.
-
-Example:
-
-```
-private void sendMessage(String message, HashMap tmpMap) {
- CommonInfo commonInfo = new CommonInfo();
- commonInfo.setSessionId(sessionId);
- HiLog.error(LABEL_LOG, "sessionId " + sessionId);
- NetConfigApi.getInstance().sendMessage(commonInfo, message, (code, controlMessage, str) -> {
- if (code == 0) {
- HiLog.info(LABEL_LOG, "Message sent successfully" + message);
- dataMap.putAll(tmpMap);
- mainHandler.postTask(() -> onDeviceDataChange(dataMap));
- } else {
- HiLog.error(LABEL_LOG, "Failed to send the message. Code =" +
- code + " control message = " + controlMessage);
- }
- });
-}
-```
-
-## Defining the UI of the Device Control Atomic Service
-
-This section describes how to develop the device control UI. There are two methods:
-
-1. Use preset components and configure the JSON configuration file. Using this method, you can quickly create the device control UI. In addition, every component on the UI is bound with a click event and processing logic.
-2. Use native components to develop the device control UI from the scratch. This method provides more flexibility.
-
-This section describes the procedure using the first method. The development procedure using the second method will be provided later.
-
-The template provides a variety of UI components in **control/ailife-view** and defines a set of JSON configuration rules. This set of rules references custom UI components to generate a custom device control UI.
-
-The component reference code in **control/src/main/js/default/pages/index/index.hml** is as follows. \(For details about the component style, see [JSON Configuration File Description](guide-atomic-service-device-ctrl-json-intro.md).\)
-
-
-
-**To build a device control UI by using preset components, perform the following steps:**
-
-1. Declare the JSON configuration file that describes the UI and save the file in the **control/src/main/resources/rawfile/** directory.
-
- For details about the fields in the JSON configuration file, see [JSON Configuration File Description](guide-atomic-service-device-ctrl-json-intro.md). The file name must be \_.json.
-
- > **NOTE:**
- >The template provides four samples: lamp, toothbrush, soy milk maker, and intelligent fan. The configuration files are **LAMP.json**, **TOOTHBRUSH.json**, **SOYMILKMACHINE.json**, and **FAN.json**, respectively.
- >By default, **FAN.json** is used.
-
- 
-
-2. Use UX icon resources, which can be local or online resources.
-
- To use local resources, pack them to the **control/src/main/js/default/common/__** directory. Then you can directly reference them in the JSON configuration file.
-
- 
-
- To use online resources, you must add the resource URL to the code. Specifically, in the **getTemplate** method of **DataHandlerAbility.java**, set **iconUrl** to the resource URL. The resource referenced in the JSON configuration file is the relative path of the resource URL. The following is an example of the part in the **getTemplate** method that needs to be modified:
-
- ```
- if (result != null) {
- // iconUrl is the icon's prefix path. Here we use /common/productName in the JS module. You can change it to your URL. All icon files must be under iconUrl.
- result.put("iconUrl", SampleDeviceDataHandler.EXAMPLE_RESOURCE_DIR + "/" + productName);
- // deviceIcon is the product icon's file name. It must be under iconUrl.
- result.put("deviceIcon", "/" + productName + ".png");
- // logoIcon is the product logo's file name. It must be under iconUrl.
- result.put("logoIcon", "/logo.png");
- }
- ```
-
-3. Set **DEVICE\_DATA\_MODE** in **DataHandlerAbility.java** to **DEVICE\_DATA\_MODE\_NETWORK\_DEVICE**. Then, you can use **NetworkDeviceDataHandler.java** to process data and control devices in seconds.
-
- For details, see **fanDataModel** in **NetworkDeviceDataHandler.java**. The template has implemented the data processing logic of the intelligent fan. This processing logic converts the data passed by the click events into instructions and sends the instructions to the device. You can add your own device processing logic by referring to the fan model.
-
- ```
- public class NetworkDeviceDataHandler extends BaseDeviceDataHandler {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(HiLog.DEBUG, 0, "MessageDataHandler");
- private static String sessionId = null;
- private final DeviceDataModel dataModel;
- private final EventHandler mainHandler;
- private final Map dataMap = new HashMap<>();
- private final DeviceDataModel fanDataModel = new DeviceDataModel() {
- @Override
- public Map recoverData() {
- dataMap.put("switch/on", 0);
- dataMap.put("windMode/mode", 0);
- dataMap.put("windGear/gear", 0);
- dataMap.put("shutdown/mode", 0);
- return dataMap;
- }
- }
- }
- ```
-
- To learn more about the code processing flow, see [Core Code Description](guide-atomic-service-device-ctrl-logic.md#section17354153553419).
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-device-ctrl.md b/en/device-dev/guide/guide-atomic-service-device-ctrl.md
deleted file mode 100644
index cb7925e6134aea1516be16f6d77f442aed9bb4a0..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-device-ctrl.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Development Guidelines on the Device Control Atomic Service
-
-- **[How to Develop](guide-atomic-service-device-ctrl-overview.md)**
-
-- **[Introduction to the Core Code Logic](guide-atomic-service-device-ctrl-logic.md)**
-
-- **[JSON Configuration File Description](guide-atomic-service-device-ctrl-json.md)**
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-netconfig-api.md b/en/device-dev/guide/guide-atomic-service-netconfig-api.md
deleted file mode 100644
index 1002e61bf91fa14938cca2beba9218eafbc4430b..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-netconfig-api.md
+++ /dev/null
@@ -1,907 +0,0 @@
-# Calling of Network Configuration APIs
-
-- [Whether WifiAware Is Supported](#section1488020125510)
-- [Obtaining the Wi-Fi List](#section743413288512)
-- [Discovering Devices Through NAN](#section1504174410511)
-- [Discovering a Device Through SoftAP](#section55681185218)
-- [Connecting a Device](#section4392324115210)
-- [Configuring the Network for a Device](#section772433526)
-- [Releasing the Network Configuration Channel](#section194641109530)
-- [Controlling the Device in Seconds](#section144171232175313)
-- [Registering Message Callbacks](#section7232650195315)
-- [Callback for Device Disconnection](#section176579445411)
-
-All APIs related to the network configuration are in **login/fa-netconfig.js**.
-
-For details about how to reference these APIs, see **import netConfig from'fa-netconfig'** in **app.js**.
-
-## Whether WifiAware Is Supported
-
-
-Function Prototype
- |
-NetConfig.isSupportWifiAware()
- |
-
-Description
- |
-Whether WifiAware is supported.
- |
-
-API Type
- |
-Synchronous API
- |
-
-Return Value
- |
-0 (supported) and -1 (not supported)
- |
-
-
-
-
-- Parameters
-
- None
-
-- Example
-
- ```
- getApp(this).NetConfig.isSupportWifiAware().then(function (result) {
- let ret = JSON.parse(result);
- console.info"isSupportWifiAware message result: code=" + ret.code +", data=" + ret.data)
- if (ret.code == 0) {
- // WifiAware supported.
- } else {
- // WifiAware not supported.
- }
- });
- ```
-
-
-## Obtaining the Wi-Fi List
-
-
-Function Prototype
- |
-NetConfig.getWifiList(callbackFunc)
- |
-
-Description
- |
-Obtains the list of nearby Wi-Fi networks.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback.
- Data returned: List<WifiApInfo>
- WifiApInfo {
- int channel;
- boolean hasDefaultPassword;
- boolean is5G; // Specifies whether 5 GHz Wi-Fi is used.
- String securityType;
- int signalLevel;
- String ssid;
- String wifiApId; // wifiAp ID
- }
- Both 2.4 GHz Wi-Fi and 5 GHz Wi-Fi are returned. The atomic service can filter data based on the value of is5G.
- The value of hasDefaultPassword is true only when the SSID has been connected before and the password can be successfully obtained.
- |
-
-
-
-
-- Example
-
- ```
- getApp(this).NetConfig.getWifiList((result) => {
- if (result.code == 0 && result.data && result.data.length > 0) {
- this.progress = this.progressStatus[3];
- this.desc = this.descStatus[3];
- this.configDevice(result.data[0]);
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[3];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## Discovering Devices Through NAN
-
-
-Function Prototype
- |
-NetConfig.discoveryByNAN(scanNanInfo, callbackFunc)
- |
-
-Description
- |
-Initiates a NAN broadcast, waits for a client connection, establishes the connection, and stops the broadcast.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- scanNanInfo
- |
- Object
- |
- Yes
- |
- scanNanInfo {
- int duration // If a connection is not set up within the specified duration, the broadcast stops. The value range is [0,100], and the unit is seconds. The value 0 indicates an unlimited duration.
- int lockTime // Locking duration of a device in NAN mode after the device receives an NAN mutual trust message. The value range is [0,100], and the unit is seconds. The value 0 indicates an unlimited duration.
- String sessionId // The value is the sessionId value carried by the intent when the service starts the atomic service.
- }
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback. Data returned:
- DeviceInfo{
- String productId,
- String sessionId
- String sn,
- }
- |
-
-
-
-
-- Example
-
- ```
- let scanInfo = {
- duration: 30,
- lockTime: 60,
- sessionId: ''
- };
- getApp(this).NetConfig.discoveryByNAN(scanInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[1];
- this.desc = this.descStatus[1];
- getApp(this).ConfigParams.deviceInfo = result.data;
- this.registerDisconnectCallback(result.data.sessionId);
- this.connectDevice();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[1];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## Discovering a Device Through SoftAP
-
-
-Function Prototype
- |
-NetConfig.discoveryBySoftAP(callbackFunc)
- |
-
-Description
- |
-Scans for access points (APs).
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Input Parameter
- |
-The number of calling times is determined by the atomic service.
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback.
- Data returned: List<SoftAPInfo> SoftAPInfo{
- String ssid,
- boolean usePassword // Specifies whether a password is required.
- }
- |
-
-
-
-
-- Example
-
- ```
- getApp(this).NetConfig.discoveryBySoftAP((result) => {
- if (result.code == 0) {
- for (let index = 0; index < result.data.length; index++) {
- let element = result.data[index];
- console.info("discoveryBySoftAP callback: device element=" + JSON.stringify(element));
- // Compare the Wi-Fi list scanned through SoftAP with the target device's SSID format, category, and MAC address.
- if (element.ssid.indexOf(self.softAPSsidDefault) != -1) {
- this.discoverDeviceBySoftAPResult = JSON.stringify(element);
- this.softAPSsidDefault = element.ssid;
- break;
- }
- }
- }
- });
- ```
-
-
-## Connecting a Device
-
-
-Function Prototype
- |
-NetConfig.connectDevice(connectInfo,callbackFunc)
- |
-
-Description
- |
-Connects a device.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- connectInfo
- |
- Object
- |
- Yes
- |
- connectInfo {
- string targetDeviceId; // Mandatory. ID of the device to connect.
- - number type; // Mandatory. The value can be 0 (NAN) and 1 (SoftAp).
- string pin; // Mandatory. Device PIN.
- string password; //Mandatory. If the device requires a password, set this parameter to the required password. Otherwise, set this parameter to "".
- string sessionId; // Mandatory. If type is set to NAN, set this parameter to the value of sessionId returned by discoverDevByNAN. Otherwise, set this parameter to "".
}
-
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback.
- Data returned: String vendorData // Reserved.
- In SoftAP mode, {
- String productId,
- String sn,
- String vendorData
- } JSON string
- |
-
-
-
-
-- Example of the NAN type
-
- ```
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 0,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- ```
-
-- Example of the SoftAP type
-
- ```
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 1,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## Configuring the Network for a Device
-
-
-Function Prototype
- |
-NetConfig.configDeviceNet(deviceInfo,accountInfo,netConfigInfo,callbackFunc)
- |
-
-Description
- |
-Starts to configure the network for the specified device by sending the SSID, password, device information, and account information.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- deviceInfo
- |
- string
- |
- Yes
- |
- Information allocated by the device cloud to the device, such as the device ID.
- |
-
- accountInfo
- |
- string
- |
- Yes
- |
- Account information.
- |
-
- netConfigInfo
- |
- Object
- |
- Yes
- |
- netConfigInfo {
- string ssid;
- // Mandatory. If the SSID has been configured for the phone, you do not need to enter a password.
- string ssidPassword; // Optional. If the password does not need to be delivered, set this parameter to "".
- boolean isDefaultPassword; // Mandatory.
- int channel; // Mandatory.
- string sessionId; // Mandatory. When type is set to NAN, enter the actual value. Otherwise, set this parameter to "".
- int type; // Mandatory. The value can be 0 (NAN) and 1 (SoftAp).
- String wifiApId; // Enter the corresponding fields in the returned Wi-Fi network list information.
- String vendorData; // Product data, which is encoded using random Base64.
- int timeout; // Network configuration timeout interval, which is set in NAN mode. The value range is [1,90], and the unit is seconds.
- }
- Note: To require the user to enter the password, set isDefaultPassword to false and ssidPassword to the entered password; otherwise, set isDefaultPassword to true and ssidPassword to "".
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. In NAN mode, if the callback is successful, the module reports the network configuration status. The result is converted into two parts: the integer part (stored in data.code) and the string type (stored in data.msg). In SoftAP mode, either 0 or -1 is returned, indicating that the network configuration is successful or fails.
- |
-
-
-
-
-- Example of the NAN type
-
- ```
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 0,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- ```
-
-- Example of the SoftAP type
-
- ```
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 1,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## Releasing the Network Configuration Channel
-
-
-Function Prototype
- |
-NetConfig.disconnectDevice(commonInfo,callbackFunc)
- |
-
-Description
- |
-Releases the network configuration channel. When the atomic service does not use the NAN channel or the atomic service exits, the atomic service needs to proactively call this function.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Input Parameter
- |
-commonInfo
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- commonInfo
- |
- Object
- |
- Yes
- |
- commonInfo{
- String sessionId; // If type is NAN, set this parameter to the value of sessionId returned by discoverDevByNAN. Otherwise, set this parameter to "".
- }
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback.
- Data returned: 0 (success) or -1 (failure)
- |
-
-
-
-
-- Example
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.disconnectDevice(commonInfo, (result) => {
- if (result.code == 0) {
- return;
- }
- });
- ```
-
-
-## Controlling the Device in Seconds
-
-
-Function Prototype
- |
-NetConfig.sendMessage(commonInfo,message,callbackFunc)
- |
-
-Description
- |
-Sends a message to the device for control purposes.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- commonInfo
- |
- Object
- |
- Yes
- |
- commonInfo{
- String sessionId; // If type is NAN, set this parameter to the value of sessionId returned by discoverDevByNAN. Otherwise, set this parameter to "".
- }
- |
-
- message
- |
- String
- |
- Yes
- |
- Message content.
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function, which returns the command sending result.
- Data returned: 0 (success) or -1 (failure)
- |
-
-
-
-
-- Example
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.sendMessage(commonInfo, "111111", (result) => {
- // sendMessage callback
- })
- ```
-
-
-## Registering Message Callbacks
-
-
-Function Prototype
- |
-NetConfig.registerMsgReceive(commonInfo, callbackFunc)
- |
-
-Description
- |
-Obtains messages on the device side. You are advised to call this function before calling the device connection API in NAN mode.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Input Parameter
- |
-See the table below.
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- commonInfo
- |
- Object
- |
- Yes
- |
- commonInfo{
- String sessionId; // If type is NAN, set this parameter to the value of sessionId returned by discoverDevByNAN. Otherwise, set this parameter to "".
- }
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. If the callback is successful, data contains the returned data result. The data result is parsed and used in the callback.
- Data returned: String message
- |
-
-
-
-
-- Example
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.registerMsgReceive(commonInfo, () => {
- // registerMsgReceive callback
- });
- ```
-
-
-## Callback for Device Disconnection
-
-
-Function Prototype
- |
-NetConfig.registerDisconnectCallback(commonInfo, callbackFunc)
- |
-
-Description
- |
-Registers the callback for device disconnection events. You are advised to call this function before calling the device connection API in NAN mode.
-When the device is disconnected from the phone unexpectedly, the callback is triggered.
- |
-
-API Type
- |
-Asynchronous API
- |
-
-Input Parameter
- |
-See the table below.
- |
-
-Return Value
- |
-0 (success) and -1 (failure)
- |
-
-
-
-
-- Parameters
-
-
- Name
- |
- Type
- |
- Mandatory
- |
- Description
- |
-
-
- commonInfo
- |
- Object
- |
- Yes
- |
- commonInfo{
- String sessionId; // If type is NAN, set this parameter to the value of sessionId returned by discoverDevByNAN. Otherwise, set this parameter to "".
- }
- |
-
- callbackFunc
- |
- function
- |
- Yes
- |
- Callback function. This callback is triggered when the device is disconnected from the phone.
- Status code returned: 0
- |
-
-
-
-
-- Example
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.registerDisconnectCallback(commonInfo, () => {
- // registerDisconnectCallback
- });
- ```
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-netconfig-logic.md b/en/device-dev/guide/guide-atomic-service-netconfig-logic.md
deleted file mode 100644
index fe0e182a245359dad27d469f04a87af1207af61d..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-netconfig-logic.md
+++ /dev/null
@@ -1,157 +0,0 @@
-# Introduction to the Core Code
-
-The core code in the project is described as follows:
-
-1. After the **MainAbility** is started, the Java code uses **nanSessionId** read from the **intent** for network configuration and uses **productId** to determine the type of the device to connect. By default, a smart fan is used.
-
- For details about how to read device information, see **onStart** in **MainAbility.java**.
-
- In addition, register **abilityContext** and **sessionId** with the network configuration SDK.
-
- ```
- String sessionId = intent.getStringParam("nanSessionId");
- if ("null".equals(sessionId) || "".equals(sessionId)) {
- NetConfigAbility.register(this, null);
- } else {
- NetConfigAbility.register(this, sessionId);
- }
- ```
-
-2. The Java code passes **productId**, **productName**, and **sessionId** read from the **MainAbility** to JS.
-
- For details on the code, see **MainAbility.java**.
-
- ```
- IntentParams intentParams = intent.getParams();
- if (intentParams != null) {
- intentParams.setParam("productId", productId);
- intentParams.setParam("productName", productName);
- intentParams.setParam("sessionId", sessionId);
- setPageParams(null, intentParams);
- }
- ```
-
-3. The JS code displays the device icon based on **productName**. For details on the code, see **device.js**.
-
- ```
- onInit() {
- this.deviceName = this.$t('strings.device-name');
- this.deviceImg = '/common/img/' + this.productName + ".png";
- getApp(this).Product.productName = this.productName;
- getApp(this).Product.productId = this.productId;
- getApp(this).ConfigParams.sessionId = this.sessionId;
- }
- ```
-
-4. After you click the **Configure network** button, the network configuration logic is executed. For details on the code, see **netconfig.js**.
- 1. Discover the nearest device through Neighbor Awareness Networking \(NAN\) broadcast.
-
- ```
- discoverDevice() {
- let scanInfo = {
- duration: 30,
- lockTime: 60,
- sessionId: getApp(this).ConfigParams.sessionId
- };
- // Step 1 Discover the device through NAN broadcast.
- getApp(this).NetConfig.discoveryByNAN(scanInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[1];
- this.desc = this.descStatus[1];
- getApp(this).ConfigParams.deviceInfo = result.data;
- this.registerDisconnectCallback(result.data.sessionId);
- this.connectDevice();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[1];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 2. Connect to the device.
-
- ```
- connectDevice() {
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 0,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- // Step 2 Connect the device.
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 3. Obtain the Wi-Fi information used by the phone.
-
- ```
- getWifiInfo() {
- // Step 3 Obtain the Wi-Fi information used by the phone for connection.
- getApp(this).NetConfig.getWifiList((result) => {
- if (result.code == 0 && result.data && result.data.length > 0) {
- this.progress = this.progressStatus[3];
- this.desc = this.descStatus[3];
- this.configDevice(result.data[0]);
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[3];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 4. Configure the network for the device. After the configuration is successful, the device control page is displayed.
-
- ```
- async configDevice(wifiApInfo) {
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 0,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- // Step 4 Configure the device network.
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- // Step 5 Display the device control page after a successful network configuration.
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- > **NOTE:**
- >By default, the template project redirects to the device control page configured in the **control** module. You can modify the code for redirection to a custom device control page. Note that **sessionId** must be passed to subsequent pages for sending messages to the device.
- >The JS API for sending messages to devices is **NetConfig.sendMessage\(commonInfo, message, callbackFunc\)**.
- >The Java API for sending messages to devices is **NetConfigApi._getInstance_\(\).sendMessage\(CommonInfo, String, BaseCallback\)**.
-
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-netconfig-overview.md b/en/device-dev/guide/guide-atomic-service-netconfig-overview.md
deleted file mode 100644
index 5393b1d05e2da63a3570176c5d7d0d0d93d373b6..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-netconfig-overview.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# How to Develop
-
-- [Overview](#section117101122133917)
-- [Project Structure](#section163058534218)
-- [Defining the UI of the Network Configuration Atomic Service](#section129531555424)
-
-## Overview
-
-The **OneHop Device Ability \(JS\)** template helps you implement the complete process of **OneHop, network configuration, and device control**. By default, the template project presents the effect of a smart fan. You can customize the device by referring to [Defining the UI of the Network Configuration Atomic Service](#section129531555424).
-
-The template project consists of two parts:
-
-**Network configuration atomic service \(entry module\)**
-
-**Device control atomic service \(control module\)**
-
-This document provides guidance on developing the network configuration atomic service \(entry module\). For details about how to develop the device control atomic service \(control module\), see [Development Guidelines on the Device Control Atomic Service](guide-atomic-service-device-ctrl-overview.md).
-
-## Project Structure
-
-The following figure shows the directory structure of the **entry** module in the **OneHop Device Ability \(JS\)** template project.
-
-
-
-The following table describes the classes in the source code directory.
-
-
-Class
- |
-Description
- |
-
-
-Java
- |
-
-MyApplication
- |
-Application entry class.
- |
-
-MainAbility
- |
-Entry class to start the JS page and process device information read from an NFC tag.
- |
-
-JS
- |
-
-default/pages/device/device.js
- |
-Device introduction page, which is displayed after a OneHop operation.
- |
-
-default/pages/netconfig/netconfig.js
- |
-Network configuration page, which is responsible for the logic related to network configuration. This page is displayed after you click Configure network on the device introduction page.
- |
-
-
-
-
-## Defining the UI of the Network Configuration Atomic Service
-
-1. Process the product ID read from the NFC tag in the **onStart** method of the **MainAbility**. **You can map productId to a different device type and change productName to a specific device name**. By default, a smart fan is used.
-
- ```
- @Override
- public void onStart(Intent intent) {
- intent.setParam("window_modal", 3);
- setInstanceName(JS_MODULE);
-
- Object productInfo = Objects.requireNonNull(intent.getParams()).getParam("productInfo");
- if (productInfo != null) {
- productId = (String) productInfo;
- // Modify your product name according to your product ID in the NFC tag.
- productName = "FAN";
- }
- }
- ```
-
-2. Place the product diagram in the resource directory for UI display. **Note that the file name must be .png and the device name must be the same as the value of productName.**
-
- 
-
- The product diagram is displayed on the device introduction page and network configuration page.
-
-3. Add **deviceType: 1** to the **goToControl** method of **entry\\src\\main\\js\\default\\pages\\netconfig\\netconfig.js** to improve the stability of network configuration.
-
- ```
- goToControl() {
- let target = {
- bundleName: 'com.example.middleplatform.deviceoperate',
- abilityName: 'com.example.middleplatform.ControlMainAbility',
- deviceType: 1,
- data: {
- session_id: getApp(this).ConfigParams.deviceInfo.sessionId,
- product_id: getApp(this).Product.productId,
- product_name: getApp(this).Product.productName
- }
- }
- FeatureAbility.startAbility(target);
- app.terminate();
- }
- ```
-
-
diff --git a/en/device-dev/guide/guide-atomic-service-netconfig.md b/en/device-dev/guide/guide-atomic-service-netconfig.md
deleted file mode 100644
index 3602241f909e749f5f9d5170751272da2fbe4436..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/guide-atomic-service-netconfig.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Development Guidelines on the Network Configuration Atomic Service
-
-- **[How to Develop](guide-atomic-service-netconfig-overview.md)**
-
-- **[Introduction to the Core Code](guide-atomic-service-netconfig-logic.md)**
-
-- **[Calling of Network Configuration APIs](guide-atomic-service-netconfig-api.md)**
-
-- **[FAQs](faqs.md)**
-
-
diff --git a/en/device-dev/guide/onehop-configuration-device-tag.md b/en/device-dev/guide/onehop-configuration-device-tag.md
deleted file mode 100644
index 4c0f123858cd2e8725284bbc4c95189685a9c317..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-configuration-device-tag.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# Configuring a Service Association Intent
-
-Configure the association intent for the atomic service on the HUAWEI Ability Gallery to match the product ID in the NFC tag. This way, users can tap their phone against the NFC tag to obtain the atomic service information and thereby launch the network configuration atomic service.
-
-Let's see how to configure the association intent for an atomic service on the HUAWEI Ability Gallery.
-
-1. Use a Huawei developer account that has completed identity verification to log in to the [HUAWEI Developers](https://developer.huawei.com/consumer/en/). Then, access the console.
-
- 
-
-2. Choose **Ecosystem services** \> **Smart services** and access HUAWEI Ability Gallery. If this is the first time you use HUAWEI Ability Gallery, read and sign the **HUAWEI Ability Gallery Service Agreement**.
-
- 
-
-3. Click the **Create ability** button and then select **HarmonyOS test ability**.
-
- 
-
-4. Set **Ability name**, **Category**, and **Default language**, and then click **Create**.
-
- 
-
-5. Configure the ability information, including the following:
- - Basic information, such as the ability version number, version description, and ability level. When you are done, click **Save**.
- - Display information, such as the brief description, developer brand, and ability icon. Be sure to upload the large icon of the ability. When you are done, click **Save**.
-
-6. Choose **Configure** \> **HarmonyOS tags** and click **Add** to add a device tag. Set **Product model** to the product ID you have obtained in the HUAWEI DevEco Assistant app, and **Product sub-model** to **00**, and then click **Save**.
-
- 
-
-7. Choose **Configure** \> **FA information**, configure the FA basic information and setting mode, and then click **Save**.
-
- - Basic information: Set **Type** to **APK/RPK/FA/H5 link**.
- - Setting mode: Configure **FA Link** fields.
- - **App package**: Enter the value of **bundleName** in the **config.json** file.
- - **Module name**: Enter the value of **moduleName** in the **config.json** file of the entry module \(network configuration module\).
- - **Ability name**: Enter the value of **mainAbility** in the **config.json** file of the entry module \(network configuration module\).
-
- 
-
-8. On the **Test** tab page, click **Prepare test** to start the test. The test is valid for one month. After the validity period expires, click **Prepare again**.
-
- 
-
-
diff --git a/en/device-dev/guide/onehop-dev-atomic-service.md b/en/device-dev/guide/onehop-dev-atomic-service.md
deleted file mode 100644
index 1355c1d1c4a86904a04aa90724a81a4a10ffbc67..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-dev-atomic-service.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# Developing Atomic Services
-
-Use the **OneHop Device Ability\(JS\)** template to implement the process from tapping and network configuration to device control. The HarmonyOS atomic service development for OneHop involves the network configuration atomic service and the device control atomic service. Before you proceed with the following procedure, make sure you have installed [DevEco Studio 3.0 Beta1](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) or later and [built the development environment](https://developer.harmonyos.com/en/docs/documentation/doc-guides/installation_process-0000001071425528).
-
-1. Open the DevEco Studio project wizard using either of the following methods:
- - If no project is open, select **Create Project** on the welcome page.
- - If a project is already open, choose **File** \> **New** \> **New Project** from the menu bar.
-
-2. In the project wizard, click **Template Market** and download the **OneHop Device Ability\(JS\)** template.
-
- 
-
-3. Return to the project creation page. From the template list, select the downloaded **OneHop Device Ability** template and click **Next** to configure the project.
-4. In the project configuration, set **Project Type** to **Service**, select **Show in Service Center**, and click **Finish**.
-
- > **NOTE:**
- >Generally, the device control and network configuration atomic services are started by OneHop. In the debugging phase, to start these atomic services directly by touching the respective app icon on the phone's home screen, you can change the value of the **installationFree** field in the project **config.json** file to **false**. After the debugging is complete, change the value back to **true**.
-
- 
-
-5. In the **entry\\src\\main\\js\\default\\pages\\netconfig\\netconfig.js** file, add **deviceType: 1** to the **goToControl** method, so that the atomic services can be started from the local device.
-
- ```
- goToControl() {
- let target = {
- bundleName: 'com.example.middleplatform.deviceoperate',
- abilityName: 'com.example.middleplatform.ControlMainAbility',
- deviceType: 1,
- data: {
- session_id: getApp(this).ConfigParams.deviceInfo.sessionId,
- product_id: getApp(this).Product.productId,
- product_name: getApp(this).Product.productName
- }
- }
- FeatureAbility.startAbility(target);
- app.terminate();
- }
- ```
-
- > **NOTE:**
- >The **OneHop Device Ability\(JS\)** template has been preconfigured with the network configuration and device control atomic services of an intelligent fan. To modify the UI and functions of these atomic services, refer to the following:
- >- Network configuration atomic service: [Development Guidelines on the Network Configuration Atomic Service](guide-atomic-service-netconfig-overview.md)
- >- Device control atomic service: [Development Guidelines on the Device Control Atomic Service](guide-atomic-service-device-ctrl-overview.md)
-
-6. Sign the atomic services so they can run on Huawei phones. For detailed operations, see [Automatically Signing Your App Using DevEco Studio](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section837891802519).
-7. On the DevEco Studio menu bar, choose **Run** \> **Edit Configurations**. Then, select **Deploy Multi Hap Packages** under the **entry** module, so that the **control** module \(device control atomic service\) is automatically installed on the device when the **entry** module \(network configuration atomic service\) is run.
-
- 
-
-8. On the toolbar, select the **entry** module and click **Run** to install the network configuration and device control atomic services on the device.
-
- In the **entry\\src\\main\\resources\\base\\element\\string.json** file, **entry\_MainAbility** indicates the name of the network configuration atomic service. You can change it to whatever you prefer.
-
- In the **control\\src\\main\\resources\\base\\element\\string.json** file, **control\_ControlMainAbility** indicates the name of the device control atomic service. You can change it to whatever you prefer.
-
- 
-
-9. On the phone's home screen, click the **Net Config** button and check whether the device authentication atomic service is started, as shown below.
-
- 
-
-
diff --git a/en/device-dev/guide/onehop-dev-hi3861.md b/en/device-dev/guide/onehop-dev-hi3861.md
deleted file mode 100644
index 7c26d31ae5aa9b2a8dae1118966d8d69218af39b..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-dev-hi3861.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# Developing the Hi3861 Development Board
-
-- [Writing Source Code](#section103951747175415)
-- [Compiling Source Code](#section188441785558)
-- [Burning Source Code](#section91141823135914)
-
-Use the DevEco Device Tool to develop, compile, and burn the Hi3861 source code in the Ubuntu development environment. For details, see [Ubuntu Development Environment](https://device.harmonyos.com/en/docs/ide/user-guides/install_ubuntu-0000001072959308).
-
-## Writing Source Code
-
-1. Decompress the Hi3861 source code package. In DevEco Device Tool, click **Import Project** to open the source code file.
-
- 
-
-2. When a message is displayed to indicate that the selected directory is not a project directory, click **Import** to continue.
-
- 
-
-3. Set **MCU** to **Hi3861**, **Board** to **Hi3861**, and **Framework** to **Hb**, and then click **Import**.
-
- 
-
-4. Copy the **hals** and **winder** folders in the Hi3861 demo code to the **applications/sample/wifi-iot/app/** directory in the source code project.
-
- 
-
-5. Open the **device/hisilicon/hispark\_pegasus/hi3861\_adapter/hals/communication/wifi\_lite/wifiservice/source/wifi\_device.c** file and comment out the following code:
-
- ```
- if (LockWifiEventLock() != WIFI_SUCCESS) {
- return;
- }
-
- if (UnlockWifiEventLock() != WIFI_SUCCESS) {
- return;
- }
- ```
-
-6. Open the **device/hisilicon/hispark\_pegasus/sdk\_liteos/build/config/usr\_config.mk** file, find **CONFIG\_I2C\_SUPPORT is not set**, uncomment it, and change it to **CONFIG\_I2C\_SUPPORT=y**.
-
- 
-
-7. Open the **applications/sample/wifi-iot/app/BUILD.gn** file, change **startup** in the **features** field to **winder**, and add the index **deps** of the **winder** module. Sample code is as follows:
-
- ```
- import("//build/lite/config/component/lite_component.gni")
-
- lite_component("app") {
- features = [
- "winder",
- ]
- deps = [ "//applications/sample/wifi-iot/app/hals:hi3861_hals" ]
- }
- ```
-
-
-## Compiling Source Code
-
-Use DevEco Device Tool to compile the source code.
-
-1. Download and decompress the tools listed below.
-
-
-
-
-2. In DevEco Device Tool, choose **Tools**, and then click **Add user component** to add Gn, Ninja, and gcc\_riscv32. When adding the tools, note that the tool names cannot be changed.
-
- 
-
-3. Go to  \> **PROJECT TASKS** \> **Build** to start compilation.
-
- 
-
-4. Wait until **SUCCESS** is displayed in the **TERMINAL** window, indicating that the compilation is complete.
-
- 
-
-
-## Burning Source Code
-
-1. Connect the PC and the target development board through the USB port. For details, see [Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324).
-2. Open Device Manager, and then check and record the serial port number corresponding to the development board.
-
- > **NOTE:**
- >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on Hi3861 V100](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433).
-
- 
-
-3. In DevEco Device Tool, choose **QUICK ACCESS** \> **DevEco Home** \> **Projects**, and then click **Settings**.
-
- 
-
-4. On the **Partition Configuration** tab page, modify the settings. Unless otherwise required, you can leave the fields at their default settings.
-
- > **NOTE:**
- >If you obtain the file to be burnt by way of copying, manually change the path of the file to be burnt: Click the tab of the file to be burnt, select **Partition\_bin** from the **New Option** drop-down list box in **Partition Settings**, and set the path of the file to be burnt in **Partition\_bin**.
-
-5. On the **hi3861** tab page, set the burning options.
-
- - **upload\_port**: Select the serial port number obtained in [2](#en-us_topic_0000001056563976_li848662117291).
- - **upload\_protocol**: Select the programming protocol. For Windows, set this parameter to **burn-serial** or **hiburn-serial**. For Linux, set this parameter to **hiburn-serial**.
- - **upload\_partitions**: Select the file to be burned. **hi3861\_app** is selected by default.
-
- 
-
-6. Click **Save** on the top to save your settings.
-7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS** \> **hi3861** \> **Upload** to start burning.
-
- 
-
-8. When the following information is displayed, press the RST button on the development board to restart it.
-
- 
-
-9. Wait until the burning is complete. When the following message is displayed, the burning is successful.
-
- 
-
-
diff --git a/en/device-dev/guide/onehop-dev-prerequisites.md b/en/device-dev/guide/onehop-dev-prerequisites.md
deleted file mode 100644
index 9813130e6ac7ff4b6f0926b2bf52185c9b9fb18e..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-dev-prerequisites.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Preparations
-
-To develop OneHop, you need to develop the HarmonyOS atomic service and Hi3861 development board. Before you start, make the following preparations:
-
-**Preparations for HarmonyOS atomic service development:**
-
-- Prepare a Huawei Mate series or P series phone that has been updated to HarmonyOS 2.0.0.168 or later.
-- Download [DevEco Studio 3.0 Beta1](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) and [build the development environment](https://developer.harmonyos.com/en/docs/documentation/doc-guides/installation_process-0000001071425528).
-- Download and install the HUAWEI DevEco Assistant app from Huawei AppGallery.
-- Prepare an NFC tag. You can tap the NFC tag with your phone to ensure that the NFC function is available.
-- Go to **Settings** \> **Apps & services** \> **Apps**, search for **AI Life Service**, and check whether the version of AI Life is 12.0.2.306 or later. If not, open the AI Life app on your Huawei phone, go to **Me** \> **Settings** \> **Check for updates**, and update AI Life Service.
-
-**Preparations for the development of the Hi3861 development board:**
-
-- Prepare the Hi3861 development board \(HiSpark Wi-Fi IoT Smart Home Development Kit\).
-- Download the [HUAWEI DevEco Device Tool 3.0 Beta1](https://device.harmonyos.com/cn/ide#download_beta) Linux version and [build the Ubuntu development environment](https://device.harmonyos.com/en/docs/documentation/guide/install_ubuntu-0000001072959308).
-- Obtain the OpenHarmony 1.1.0 LTS source code. For details, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/en/release-notes/openharmony-1-1-0-lts.md).
-- [Obtain the Hi3861 demo code](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/team_x/demo_winder) for network configuration and reception of device control instructions.
-
-Now, before you proceed with the development, take a look at the development process below.
-
-
-
diff --git a/en/device-dev/guide/onehop-open-atomic-service.md b/en/device-dev/guide/onehop-open-atomic-service.md
deleted file mode 100644
index 84682fa1abb1e027cb71453071f2957c503dfddd..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-open-atomic-service.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Tapping to Launch an Atomic Service
-
-When the phone is tapped against the NFC tag of the Hi3861 development board, the phone automatically connects to Hi3861 on the same WLAN, and launches the network configuration/device control atomic service.
-
-
-
-Before using OneHop to launch the atomic service, you must log in to your phone with the HUAWEI ID used to request the product ID in the HUAWEI DevEco Assistant app.
-
-1. Enable NFC on your phone and make sure your phone is connected to a WLAN.
-2. Before tapping the NFC tag, press the **RST** button on the Hi3861 development board to reset it.
-3. Tap the NFC tag against the back of your phone. The screen shown below will be displayed on the phone.
-
- > **NOTE:**
- >When tapping the NFC tag, keep the phone within 5 cm away from the development board. If no device is detected, tap the NFC tag again.
-
- 
-
-4. Touch **Net Config** and wait until the device is authenticated.
-
- > **NOTE:**
- >If an error message is displayed to indicate that device scanning fails, perform the following operations to troubleshoot:
- >1. Disconnect your phone from the WLAN, and then connect your phone to the WLAN again.
- >2. Press the **RST** button on the Hi3861 development board to reset it.
- >3. Tap the NFC tag again.
-
- 
-
-5. After the network configuration is complete, the device control page is automatically displayed in half-screen mode. Swipe up on the page and touch **view more** to switch to full-screen mode.
-
- 
-
-6. Perform operations on the device control page. Then, check the LCD of the Hi3861 development board to find out whether your instructions are received properly.
-
- 
-
-
-Congratulations! You have completed the development of the Hop feature.
-
diff --git a/en/device-dev/guide/onehop-overview.md b/en/device-dev/guide/onehop-overview.md
deleted file mode 100644
index a2b1ed4031842bbc9be80fdf502daf8c7d13c049..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-overview.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# Overview
-
-> **NOTE:**
->This guide is prepared for the purpose of helping individual developers to try out the HarmonyOS's OneHop feature. Do not use it to develop or release a commercial solution of OneHop.
-
-The OneHop feature in HarmonyOS is designed for multi-device collaboration. By leveraging the Near Field Communication \(NFC\) protocol, the feature simplifies connections between phones and other devices with a single tap. Combined with the phone's atomic service capabilities, OneHop offers seamless service hopping between devices, complete with lightning-fast device pairing and effortless remote control.
-
-With HarmonyOS's OneHop and atomic service capabilities, your development work is so much easier, thanks to template code and APIs that span the entire process, including atomic service network configuration templates and control templates. You only need to modify the configuration items in the template code to complete the development of atomic services. Then, leverage the OneHop capability to start atomic services for lightning-fast device pairing and convenient device control. The OneHop feature provides the following functions:
-
-- **Fast device connection**
-
- OneHop initiates a device connection process. When the user taps their phone against an unconnected device, the atomic service on the phone is started to quickly complete the pairing between the phone and the device.
-
-- **Quick control**
-
- Most device control functions can be implemented through the service widgets of atomic services.
-
-- **Service expansion**
-
- To enrich the user experience and accommodate more use cases, you can develop interaction features for atomic services and provide these features through the service widget UI.
-
-
-
-
diff --git a/en/device-dev/guide/onehop-reference-info.md b/en/device-dev/guide/onehop-reference-info.md
deleted file mode 100644
index 81efcb80a4b338864902cfa51a360dc5eef202e9..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-reference-info.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# References
-
-- **[Development Guidelines on the Network Configuration Atomic Service](guide-atomic-service-netconfig.md)**
-
-- **[Development Guidelines on the Device Control Atomic Service](guide-atomic-service-device-ctrl.md)**
-
-
diff --git a/en/device-dev/guide/onehop-write-nfc-info.md b/en/device-dev/guide/onehop-write-nfc-info.md
deleted file mode 100644
index 3cf885fd22083dc09089a8e53ff7b8a06d92a881..0000000000000000000000000000000000000000
--- a/en/device-dev/guide/onehop-write-nfc-info.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Writing an NFC Tag
-
-Use the HUAWEI DevEco Assistant app to apply for a product ID and write the product ID to the NFC tag.
-
-1. Enable NFC on your phone.
-2. Open the HUAWEI DevEco Assistant app and click the **NFC** tab at the bottom.
-
- 
-
-3. Touch **Select**. If you have not logged in, log in with your HUAWEI ID first.
-
- 
-
-4. Click **Request** and enter the name of the atomic service package. The name must be the same as the value of **bundleName** in the **config.json** file under **src \> main** of the module. The system will automatically allocate a product ID. You can apply for a maximum of three valid product IDs with one HUAWEI ID. The validity period of each product ID is one month. After a product ID expires, you can request a new one.
-
- 
-
-5. Select a product ID.
-
- 
-
-6. Enter the SN of the Hi3861 development board. The SN is only required when you need to obtain device information through the NFC tag.
-
- 
-
-7. Touch **Write to buffer** to write the data to the buffer.
-
- 
-
-8. Place your phone close to the NFC tag. The data in the buffer starts being written to the NFC tag. After the writing is complete, the status changes to **No data in buffer**.
-
- 
-
-
diff --git a/zh-cn/device-dev/guide/Readme-CN.md b/zh-cn/device-dev/guide/Readme-CN.md
index f08f94270020a8453e55bb85685d719c000abf07..29da041335cb35e904727db70752dcf564d4ad1e 100755
--- a/zh-cn/device-dev/guide/Readme-CN.md
+++ b/zh-cn/device-dev/guide/Readme-CN.md
@@ -2,27 +2,6 @@
- [轻量和小型系统设备](device-lite.md)
- [WLAN连接类产品](device-wlan.md)
- - [碰一碰](device-wlan-touch.md)
- - [碰一碰概述](onehop-overview.md)
- - [准备工作](onehop-dev-prerequisites.md)
- - [开发Hi3861设备侧功能](onehop-dev-hi3861.md)
- - [开发原子化服务](onehop-dev-atomic-service.md)
- - [写入NFC标签信息](onehop-write-nfc-info.md)
- - [配置服务关联意图](onehop-configuration-device-tag.md)
- - [碰一碰拉起原子化服务](onehop-open-atomic-service.md)
- - [参考信息](onehop-reference-info.md)
- - [设备配网原子化服务开发指导](guide-atomic-service-netconfig.md)
- - [开发指导](guide-atomic-service-netconfig-overview.md)
- - [核心代码逻辑介绍](guide-atomic-service-netconfig-logic.md)
- - [配网接口调用](guide-atomic-service-netconfig-api.md)
- - [常见问题](faqs.md)
- - [设备控制原子化服务开发指导](guide-atomic-service-device-ctrl.md)
- - [开发指导](guide-atomic-service-device-ctrl-overview.md)
- - [核心代码逻辑介绍](guide-atomic-service-device-ctrl-logic.md)
- - [JSON文件配置说明](guide-atomic-service-device-ctrl-json.md)
- - [概述](guide-atomic-service-device-ctrl-json-intro.md)
- - [Control类型控件配置说明](guide-atomic-service-device-ctrl-json-control.md)
- - [Dialog类型控件配置说明](guide-atomic-service-device-ctrl-json-dialog.md)
- [LED外设控制](device-wlan-led.md)
- [LED外设控制](oem_wifi_sdk_des.md)
- [集成三方SDK](device-wlan-sdk.md)
diff --git a/zh-cn/device-dev/guide/faqs.md b/zh-cn/device-dev/guide/faqs.md
deleted file mode 100644
index 7d9ccdb13d20fdf8de2909c4e2a5df576ccebd02..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/faqs.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# 常见问题
-
-1. **应用退出后重新进控制页面,不能继续控制设备?**
-
- 目前每次进入应用都要先配网获取新的控制通路,同时配网前需要复位设备,否则设备侧会维持上一次配网状态而无法重新配网。
-
-2. **是否必须碰一碰才能进入配网功能?**
-
- 直接打开entry的设备配网页也可以配网,碰一碰NFC标签只是用于拉起你的原子化服务应用,并且通过NFC信息获取到碰一碰接触的设备信息。
-
-3. **点击配网后,配网进度卡在20%之后突然显示失败 ?**
-
- 由于设备侧配网版本可能不太稳定,这种情况可能会发生在上一次应用页面被杀死或者异常退出的时候。
-
- 如果出现配网失败,可以尝试退出应用,复位设备后再尝试。
-
-
diff --git a/zh-cn/device-dev/guide/figures/control-more.png b/zh-cn/device-dev/guide/figures/control-more.png
deleted file mode 100644
index 9dacf9521484c41505ce1fee730360c018080188..0000000000000000000000000000000000000000
Binary files a/zh-cn/device-dev/guide/figures/control-more.png and /dev/null differ
diff --git a/zh-cn/device-dev/guide/figures/control.png b/zh-cn/device-dev/guide/figures/control.png
deleted file mode 100644
index ef0bd34d39142048ea3b49dcaa6e8e6b8eca8f2d..0000000000000000000000000000000000000000
Binary files a/zh-cn/device-dev/guide/figures/control.png and /dev/null differ
diff --git a/zh-cn/device-dev/guide/figures/link-device.png b/zh-cn/device-dev/guide/figures/link-device.png
deleted file mode 100644
index 7e73346896314746329014564746b5a28e1d152d..0000000000000000000000000000000000000000
Binary files a/zh-cn/device-dev/guide/figures/link-device.png and /dev/null differ
diff --git a/zh-cn/device-dev/guide/figures/network-configuration-8.png b/zh-cn/device-dev/guide/figures/network-configuration-8.png
deleted file mode 100644
index f49a0098c4c6a461c328c91cc861314aa8f18b15..0000000000000000000000000000000000000000
Binary files a/zh-cn/device-dev/guide/figures/network-configuration-8.png and /dev/null differ
diff --git a/zh-cn/device-dev/guide/figures/network-configuration.png b/zh-cn/device-dev/guide/figures/network-configuration.png
deleted file mode 100644
index f49a0098c4c6a461c328c91cc861314aa8f18b15..0000000000000000000000000000000000000000
Binary files a/zh-cn/device-dev/guide/figures/network-configuration.png and /dev/null differ
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md
deleted file mode 100644
index 2a80564ef8cc1945cc0ac9b44d8034e57e46984f..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-control.md
+++ /dev/null
@@ -1,2350 +0,0 @@
-# Control类型控件配置说明
-
-- [Control类型控件配置说明](#section7914183213491)
-- [Display控件](#section16681645104918)
-- [Enum控件](#section566910277516)
-- [Reversal控件](#section162211550155113)
-- [Increase\_Decrease控件](#section1092141210525)
-- [Progress控件](#section04131030125215)
-- [Multifunction控件](#section1114919529527)
-
-## Control类型控件配置说明
-
-Control类型控件一共有六个,分别是Display类型控件、Enum类型控件、Reversal类型控件、Progress类型控件、IncreaseDecrease类型控件和Multifunction类型控件。
-
-## Display控件
-
-Display控件用于信息展示,支持显示两个或者三个区域内容,支持左右对齐(不带分割线)或者居中(带分割线)。
-
-每个区域内容支持文字, 或者文字加图片(图片显示大小为 24vp \*24vp),文字颜色支持自定义,颜色和图片支持根据数据范围来选择。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "gravity": "default",
- "heightType": "default",
- "name": "电量",
- "span": 1,
- "uiList": [
- {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "未连接"
- },
- {
- "scope": "1",
- "target": "已连接"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
- },
- "upRight": {}
- }
- },
- {
- "icon": {
- "path": "infoDisplay/battery",
- "value": [
- {
- "defaultTarget ": "/template/pic/battery_10_default.png",
- "disableTarget ": "/template/pic/battery_10_default.png",
- "scope": "-10",
- "target": "/template/pic/battery_10_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_20_default.png",
- "disableTarget ": "/template/pic/battery_20_default.png",
- "scope": "10-20",
- "target": "/template/pic/battery_20_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_30_default.png",
- "disableTarget ": "/template/pic/battery_30_default.png",
- "scope": "20-30",
- "target": "/template/pic/battery_30_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_40_default.png",
- "disableTarget ": "/template/pic/battery_40_default.png",
- "scope": "30-40",
- "target": "/template/pic/battery_40_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_50_default.png",
- "disableTarget ": "/template/pic/battery_50_default.png",
- "scope": "40-50",
- "target": "/template/pic/battery_50_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_60_default.png",
- "disableTarget ": "/template/pic/battery_60_default.png",
- "scope": "50-60",
- "target": "/template/pic/battery_60_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_70_default.png",
- "disableTarget ": "/template/pic/battery_70_default.png",
- "scope": "60-70",
- "target": "/template/pic/battery_70_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_80_default.png",
- "disableTarget ": "/template/pic/battery_80_default.png",
- "scope": "70-80",
- "target": "/template/pic/battery_80_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_90_default.png",
- "disableTarget ": "/template/pic/battery_90_default.png",
- "scope": "80-90",
- "target": "/template/pic/battery_90_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_99_default.png",
- "disableTarget ": "/template/pic/battery_99_default.png",
- "scope": "90-100",
- "target": "/template/pic/battery_99_default.png"
- },
- {
- "defaultTarget ": "/template/pic/battery_100_default.png",
- "disableTarget ": "/template/pic/battery_100_default.png",
- "scope": "100-",
- "target": "/template/pic/battery_100_default.png"
- }
- ]
- },
- "iconText": {
- "type": "dynamicText",
- "value": "${infoDisplay/battery}%",
- "range": "100-0"
- },
- "subType": "iconTextHorizontal"
- }
- ],
- "uiType": "DISPLAY"
-}
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“电量”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-“default”,“low”;默认为“default”。
- |
-
-gravity
- |
-可选
- |
-String(1-128)
- |
-子视图位置样式
- |
-样式分为:”default”,” “centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” centerDivider”为等分居中且带分隔线。
- |
-
-uiList
- |
-必选
- |
-DisplayItem[]
- |
-子视图列表
- |
-子视图列表,具体根据实际显示需要配置对应个数的显示控件。
- |
-
-
-
-
-子属性DisplayItem
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-subType
- |
-必选
- |
-String(1-128)
- |
-子类型
- |
-纯文本,图标,图标+文本“text”,“icon”,“iconTextVertical”, “iconTextHorizontal”。
- |
-
-icon
- |
-可选
- |
-DynamicContent
- |
-动态颜色、图标,文本,根据path路径下数据的范围动态匹配对应的值。同时写icon和text时,形成icon上,文字下的上下结构
- |
-示例代码如下:
-"icon": {
- "defaultIcon": "",
- "path": "battery/useDay",
- "disableIcon": "",
- "value": [
- {
- "scope": "-50",
- "target": ""
- },
- {
- "scope": "50-100",
- "target": ""
- },
- {
- "scope": "100-",
- "target": ""
- }
- ]
-}
- |
-
-iconText
- |
-可选
- |
-NormalText/DynamicText
- |
-图标描述文本
- |
-"iconText":{
- "color": "",
- "type": "normalText",
- "value": "电量"
-}
- |
-
-textDisplay
- |
-可选
- |
-DiaplayContent
- |
-文字模板,分为上左,上右和下。3处文字根据实际需求填写,分为普通文本类型NormalText和动态文本类型DynamicText
- |
-"textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "未连接"
- },
- {
- "scope": "1",
- "target": "已连接"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${bluetoothConnectStatus/bluetoothConnectStatus}"
- },
- "upRight": {}
- }
- |
-
-
-
-
-子属性DynamicContent
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-path
- |
-必选
- |
-String (1-128)
- |
-动态内容条件值,可能需要动态获取设备数据填充
- |
-例如:“bluetoothConnectStatus/bluetoothConnectStatus” ,表示当前设备状态的值。
- |
-
-value
- |
-必选
- |
-Variation
- |
-动态范围值
- |
-{ "scope": "0", "target": "未连接" }。
- |
-
-
-
-
-子属性Variation
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-scope
- |
-必选
- |
-String (1-128)
- |
-条件范围
- |
-用“-”区分范围,有五种类型: 1,-50:表示小于等于50的值 2,50-100;表示大于50小于等于100; 3,100-:表示大于100的值 4,"scope": "-"时,表示可以匹配任意场景。 5,50:表示等于50。
- |
-
-target
- |
-必选
- |
-String (1-128)
- |
-条件对应的值
- |
-可能是颜色值,资源值等,例如:"11FCFC",图标url。
- |
-
-defaultTarget
- |
-可选
- |
-String (1-128)
- |
-默认图标url
- |
-默认图标url。
- |
-
-disableTarget
- |
-可选
- |
-String (1-128)
- |
-不可用图标url
- |
-不可用图标url。
- |
-
-
-
-
-子属性NormalText
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-type
- |
-必选
- |
-String (1-128)
- |
-类型字段
- |
-固定为NormalText。
- |
-
-value
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-固定值,例如:"value": "电量"。
- |
-
-color
- |
-可选
- |
-String (1-128)
- |
-当前控件显示颜色
- |
-固定值,例如:"11FCFC"。
- |
-
-
-
-
-子属性DynamicText
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-type
- |
-必选
- |
-String (1-128)
- |
-类型字段
- |
-固定为DynamicText。
- |
-
-value
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“${bluetoothConnectStatus/bluetoothConnectStatus}”注意:此处${}表示占位符,内部数据需要根据设备上报结果进行动态匹配。
- |
-
-ratio
- |
-可选
- |
-float
- |
-补偿因子
- |
-例如:牙刷的电量是0.5,实际页面显示为百分数,显示内容为50%,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
- |
-
-color
- |
-可选
- |
-DynamicContent
- |
-当前控件显示颜色,动态值
- |
-"color": {
- "path": "battery/useDay",
- "value": [
- {
- "scope": "-50",
- "target": "11FCFC"
- },
- {
- "scope": "50-100",
- "target": "22FCFC"
- },
- {
- "scope": "100-",
- "target": "33FCFC"
- }
- ]
-}
- |
-
-description
- |
-可选
- |
-DynamicContent
- |
-当前控件描述转换,动态值
- |
-"description": {
- "path": "bluetoothConnectStatus/bluetoothConnectStatus",
- "value": [
- {
- "scope": "0",
- "target": "未连接"
- },
- {
- "scope": "1",
- "target": "已连接"
- }
- ]
-}
- |
-
-
-
-
-## Enum控件
-
-Enum控件用于类型选择,支持显示一行或两行区域内容,每行里面有一到四个区域内容,内容之间带分割线。每个区域内容由图片和文字构成,图片在上方,文字在下方。每个区域内容可以点击,点击后将会根据用户设置切换为对应的图片,表示此区域状态改变。如下方阅读区域,图片切换为蓝色,表示处于激活状态。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "gravity": "centerDivider",
- "heightType": "default",
- "name": "模式",
- "span": 1,
- "command": [
- {
- "characteristic": "mode",
- "enumInfo": [
- {
- "displayItem":{
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_read_nor.png",
- "scope": "-",
- "target": "/ic_read_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_read_nor_dark.png",
- "scope": "-",
- "target": "/ic_read_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "阅读"
- },
- "subType": "iconTextVertical"
- },
- "value": 2
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_write_nor.png",
- "scope": "-",
- "target": "/ic_write_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_write_nor_dark.png",
- "scope": "-",
- "target": "/ic_write_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "书写"
- },
- "subType": "iconTextVertical"
- },
- "value": 3
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_computer_nor.png",
- "scope": "-",
- "target": "/ic_computer_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_computer_nor_dark.png",
- "scope": "-",
- "target": "/ic_computer_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "电脑"
- },
- "subType": "iconTextVertical"
- },
- "value": 4
- },
- {
- "displayItem": {
- "icon": {
- "path": "lightMode/mode",
- "value": [
- {
- "defaultTarget": "/ic_favorite_nor.png",
- "scope": "-",
- "target": "/ic_favorite_on.png"
- }
- ],
- "valueNight": [
- {
- "defaultTarget": "/ic_favorite_nor_dark.png",
- "scope": "-",
- "target": "/ic_favorite_on_dark.png"
- }
- ]
- },
- "iconText": {
- "type": "normalText",
- "value": "最爱"
- },
- "subType": "iconTextVertical"
- },
- "value": 5
- }
- ],
- "sid": "lightMode"
- }
- ],
- "uiType": "ENUM"
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“亮度”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-tag
- |
-可选
- |
-String(1-128)
- |
-标记
- |
-扩展字段,用作标记特殊控件处理。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-“default”,“low”;默认为“default”。
- |
-
-command
- |
-必选
- |
-Command[]
- |
-控件对应的动作数组
- |
-ACTION_NORMAL在前面,ACTION_ENUM在后面,下发命令为串行下发,先发完所有的ACTION_NORMAL再发ACTION_ENUM。
- |
-
-gravity
- |
-可选
- |
-String(1-128)
- |
-子视图位置样式
- |
-样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
- |
-
-
-
-
-NormalCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“lightMode”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“mode”。
- |
-
-value
- |
-必选
- |
-int
- |
-下发命令值
- |
-例如:"value": 1。
- |
-
-
-
-
-EnumCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“lightMode”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“mode”。
- |
-
-value
- |
-必选
- |
-int
- |
-下发命令值
- |
-例如:"value": 1。
- |
-
-
-
-
-EnumInfo
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-displayItem
- |
-可选
- |
-DisplayItem
- |
-通用展示子视图
- |
-通用展示子视图。
- |
-
-value
- |
-必选
- |
-int
- |
-命令对应的服务属性值
- |
-例如:4。
- |
-
-disable
- |
-可选
- |
-String[]
- |
-命令触发后禁用的标签数组
- |
-例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
- |
-
-
-
-
-## Reversal控件
-
-Reversal控件用于开关选择,支持显示两个或三个区域。每个区域可显示内容如下表所示。文字颜色支持自定义,颜色和图片支持需根据数据范围来选择。右边的区域内容只可用于显示开关图片。
-
-**表 1** Reversal控件开关选择内容介绍
-
-
-区域
- |
-可显示内容
- |
-是否必须
- |
-
-
-左边区域
- |
-文字或者文字加图片(图片显示大小固定为 24vp *24vp)
- |
-必选
- |
-
-中间区域
- |
-文字或者文字加图片(图片显示大小固定为 24vp *24vp)
- |
-可选
- |
-
-右边区域
- |
-图片(图片显示大小固定为 24vp *24vp)
- |
-可选
- |
-
-
-
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "gravity": "default",
- "heightType": "default",
- "name": "电源",
- "span": 1,
- "command": [
- {
- "characteristic": "on",
- "reversal": [
- {
- "disableIcon": "/ic_power_nor.png",
- "icon": "/ic_on.png",
- "disableIconNight": "/ic_power_nor_dark.png",
- "iconNight": "/ic_on_dark.png",
- "value": 1
- },
- {
- "disable": {
- "name": [
- "模式",
- "亮度"
- ]
- },
- "disableIcon": "/ic_power_nor.png",
- "icon": "/ic_off.png",
- "disableIconNight": "/ic_power_nor_dark.png",
- "iconNight": "/ic_off_dark.png",
- "value": 0
- }
- ],
- "sid": "switch"
- }
- ],
- "displayItemOne": {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "switch/on",
- "value": [
- {
- "scope": "0",
- "target": "已关闭"
- },
- {
- "scope": "1",
- "target": "已开启"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${switch/on}"
- },
- "upRight": {}
- }
- },
- "uiType": "REVERSAL"
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“Battery”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。0.5表示占普通手机一半的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-tag
- |
-可选
- |
-String(1-128)
- |
-标记
- |
-扩展字段,用作标记特殊控件处理。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-高度类型为:“default”,“low”;默认为“default”。
- |
-
-displayItemOne
- |
-必选
- |
-DisplayItem
- |
-通用展示子视图
- |
-排第一个的展示视图
- |
-
-displayItemTwo
- |
-可选
- |
-DisplayItem
- |
-通用展示子视图
- |
-可选,用于一排显示3个的情况,前俩个显示通用视图,第3个为反转开关。
- |
-
-command
- |
-必选
- |
-ReversalCommand[]
- |
-控件对应的动作数组
- |
--
- |
-
-gravity
- |
-可选
- |
-String(1-128)
- |
-子视图位置样式
- |
-样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
- |
-
-
-
-
-ReversalCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“switch”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“on”。
- |
-
-reversal
- |
-必选
- |
-Reversal[]
- |
-反转命令属性
- |
-数组,对应switch/on的不同属性值,控制的时候,可以相互切换。
- |
-
-
-
-
-Reversal
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-value
- |
-可选
- |
-int
- |
-命令下发对应的属性值
- |
-表示开关值。
- |
-
-icon
- |
-必选
- |
-String (1-128)
- |
-命令对应的图像标签
- |
-命令对应的图标url。
- |
-
-disableIcon
- |
-可选
- |
-String (1-128)
- |
-不可用图标url
- |
-不可用图标url。
- |
-
-disable
- |
-可选
- |
-String[]
- |
-命令触发后禁用的标签数组
- |
-例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
- |
-
-dialogList
- |
-可选
- |
-String[]
- |
-命令触发后会弹出的对话框列表
- |
-dialogList里面的值对应dialog的id值。
- |
-
-
-
-
-Property
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-path
- |
-必选
- |
-String (1-32)
- |
-属性路径
- |
-例如:"switch/on",其中switch表示服务,on表示属性。
- |
-
-value
- |
-必选
- |
-String (1-32)
- |
-属性值
- |
-例如:1,表示path的值为1。
- |
-
-
-
-
-## Increase\_Decrease控件
-
-Increase\_Decrease控件用于增加或减少数据,支持显示三个区域内容。左边区域内容是减少按钮,右边区域内容是增加按钮,中间区域内容用于显示操作的数据,点击增加或减少按钮可以改变中间的数据。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "湿度",
- "span": 1,
- "gravity": "default",
- "uiType": "INCREASE_DECREASE",
- "heightType": "low",
- "displayItem": {
- "subType": "text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "type": "normalText",
- "value": "目标湿度"
- },
- "upRight": {}
- }
- },
- "command": [
- {
- "sid": "temperature",
- "characteristic": "temperature",
- "max": 36,
- "min": 17,
- "ratio": 1,
- "step": 1,
- "defaultValue": 26,
- "disableIconDecrease": "",
- "iconDecrease": "",
- "disableIconIncrease": "",
- "iconIncrease": ""
- }
- ]
-}
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“湿度”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-tag
- |
-可选
- |
-String(1-128)
- |
-标记
- |
-扩展字段,用作标记特殊控件处理。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-“default”,“low”;默认为“default”。
- |
-
-displayItem
- |
-可选
- |
-DisplayItem
- |
-通用展示子视图
- |
-中间的展示视图。
- |
-
-command
- |
-必选
- |
-IncreaseDecreaseCommand[]
- |
-控件对应的动作数组
- |
--
- |
-
-gravity
- |
-可选
- |
-String(1-128)
- |
-子视图位置样式
- |
-样式分为:”default”,” center”,“centerDivider”。默认为“default”,位置样式为俩边靠,无分隔线。” center”为等分居中,” centerDivider”为等分居中且带分隔线。
- |
-
-
-
-
-IncreaseDecreaseCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“humidity”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“humidity”。
- |
-
-max
- |
-必选
- |
-int
- |
-范围最大值
- |
-例如:湿度最大值为100。
- |
-
-min
- |
-必选
- |
-int
- |
-范围最小值
- |
-例如:湿度最小值为0。
- |
-
-ratio
- |
-可选
- |
-float
- |
-补偿因子
- |
-例如:检测到的湿度为0.5,实际显示的湿度为50,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
- |
-
-step
- |
-必选
- |
-int
- |
-步进值
- |
-每次变化的值。
- |
-
-iconDecrease
- |
-必选
- |
-String
- |
-减少的图标
- |
-减少的图标。
- |
-
-disableIconDecrease
- |
-必选
- |
-String
- |
-减少的不可用图标
- |
-减少的不可用图标。
- |
-
-iconIncrease
- |
-必选
- |
-String
- |
-增加的图标
- |
-增加的图标。
- |
-
-disableIconIncrease
- |
-必选
- |
-String
- |
-增加的不可用图标
- |
-增加的不可用图标。
- |
-
-defaultValue
- |
-可选
- |
-int
- |
-默认值
- |
--
- |
-
-disable
- |
-可选
- |
-String[]
- |
-命令触发后禁用的标签数组
- |
-例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
- |
-
-
-
-
-## Progress控件
-
-Progress控件用于控制进度,支持显示两个区域内容,左边区域内容是对当前进度的描述,支持文字,或者文字加图片(图片显示大小为 24vp \*24vp),文字颜色支持自定义,颜色和图片支持根据数据范围来选择。右边的区域用于显示进度条。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "gravity": "default",
- "heightType": "low",
- "name": "亮度",
- "span": 1,
- "command": [
- {
- "characteristic": "brightness",
- "defaultValue": 100,
- "max" : 255,
- "min": 0,
- "radio" : 1,
- "sid": "brightness"
- }
- ],
- "displayItemLeft": {
- "subType": "text",
- "textDisplay": {
- "down": {
- "color": {
- "path" : "brightness/brightness",
- "value" : [{
- "scope": "-",
- "target": "007DFF"
- }]
- },
- "ratio": "0.392156",
- "type": "dynamicText",
- "value": "${brightness/brightness}%"
- },
- "upLeft": {
- "type": "normalText",
- "value": "亮度"
- },
- "upRight": {}
- }
- },
- "uiType": "PROGRESS"
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“亮度”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-高度类型为:“default”,“low”;默认为“default”
- |
-
-displayItem
- |
-可选
- |
-DisplayItem
- |
-通用展示子视图
- |
-中间的展示视图。
- |
-
-command
- |
-必选
- |
-ProgressCommand[]
- |
-控件对应的动作数组
- |
--
- |
-
-
-
-
-ProgressCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“brightness”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“brightness”。
- |
-
-max
- |
-必选
- |
-int
- |
-范围最大值
- |
-例如:亮度最大值为100。
- |
-
-min
- |
-必选
- |
-int
- |
-范围最小值
- |
-例如:亮度最小值为0。
- |
-
-ratio
- |
-可选
- |
-float
- |
-补偿因子
- |
-例如:台灯的亮度是0.5,实际页面显示为百分数,显示内容为50%,那么补偿因子为0.01,再选中页面数值后,控制的过程中,要再次除以补偿因子,进行命令下发。
- |
-
-step
- |
-必选
- |
-int
- |
-步进值
- |
-每次变化的值。
- |
-
-defaultValue
- |
-可选
- |
-int
- |
-默认值
- |
--
- |
-
-disable
- |
-可选
- |
-String[]
- |
-命令触发后禁用的标签数组
- |
-例如:["亮度"],例如:台灯关闭的时候,禁用亮度调节。
- |
-
-
-
-
-## Multifunction控件
-
-Multifunction控件用于功能控制,支持显示两个或三个区域内容。左边的区域内容用于描述当前状态,中间的区域内容可不显示或用于计时,右边的区域内容用于显示操作按钮。示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "制作",
- "span": 1,
- "uiType": "MULTIFUNCTION",
- "displayItemOne": {
- "subType":"text",
- "textDisplay": {
- "down": {},
- "upLeft": {
- "description": {
- "path": "workingStatus/status",
- "value": [
- {
- "scope": "1",
- "target": "待机中"
- },
- {
- "scope": "2",
- "target": "准备中"
- },
- {
- "scope": "3",
- "target": "制作中"
- },
- {
- "scope": "4",
- "target": "制作完成"
- },
- {
- "scope": "5",
- "target": "预约中"
- }
- ]
- },
- "type": "dynamicText",
- "value": "${workingStatus/status}"
- },
- "upRight": {}
- }
- },
- "displayItemTwo": {
- "subType":"text",
- "textDisplay":{
- "down":{
- "type":"normaltext",
- "value":"剩余时间"
- },
- "upLeft":{
- "type":"dynamicText",
- "value":"${remainingTime/time}"
- },
- "upRight":{
-
-
- }
- }
- },
- "multifunctionInfo": {
- "path": "workingStatus/action",
- "value": [
- {
- "scope": "1",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_prepare.png",
- "icon": "/ic_prepare.png",
- "disableIconNight": "/ic_prepare.png",
- "iconNight": "/ic_prepare.png",
- "value": 3,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "2",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_prepare.png",
- "icon": "/ic_prepare.png",
- "disableIconNight": "/ic_prepare.png",
- "iconNight": "/ic_prepare.png",
- "value": 3,
- "sid": "workingStatus"
- }
- ],
- "commandTwo": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "3",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "4",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_complete.png",
- "icon": "/ic_complete.png",
- "disableIconNight": "/ic_complete.png",
- "iconNight": "/ic_complete.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- },
- {
- "scope": "5",
- "commandOne": [
- {
- "characteristic": "action",
- "disableIcon": "/ic_cancel.png",
- "icon": "/ic_cancel.png",
- "disableIconNight": "/ic_cancel.png",
- "iconNight": "/ic_cancel.png",
- "value": 0,
- "sid": "workingStatus"
- }
- ]
- }
- ]
- }
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String (1-128)
- |
-当前控件显示名称
- |
-例如:“Battery”。
- |
-
-span
- |
-必选
- |
-float
- |
-跨度
- |
-根据手机设置控件的宽度占比,为1表示占满普通手机的宽。
- |
-
-uiType
- |
-必选
- |
-String(1-128)
- |
-控件风格
- |
-控件风格为:“DISPLAY” ,“REVERSAL”,“INCREASE_DECREASE”,“ENUM” ,“MULTIFUNCTION”。
- |
-
-heightType
- |
-可选
- |
-String(1-128)
- |
-高度类型
- |
-高度类型为:“default”,“low”;默认为“default”。
- |
-
-displayItemOne
- |
-必选
- |
-DisplayItem
- |
-通用展示子视图
- |
-排第一个的展示视图。
- |
-
-displayItemTwo
- |
-可选
- |
-DisplayItem
- |
-通用展示子视图
- |
-可选,用于一排显示3个的情况,前俩个显示通用视图,第3个为多功能按钮。
- |
-
-multifunctionInfo
- |
-必选
- |
-DynamicCommandContent
- |
-多功能按钮
- |
--
- |
-
-
-
-
-DynamicCommandContent
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-path
- |
-必选
- |
-String (1-128)
- |
-动态内容条件值,可能需要动态获取设备数据填充
- |
-例如:“workingStatus/status” ,表示当前设备状态。
- |
-
-value
- |
-必选
- |
-VariationCommand
- |
-动态范围值
- |
-{ "scope": "-50", "target": "11FCFC" }。
- |
-
-
-
-
-VariationCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-scope
- |
-必选
- |
-String (1-128)
- |
-条件范围
- |
-用“-”区分范围,有五种类型: 1,-50:表示小于等于50的值 2,50-100;表示大于50小于等于100; 3,100-:表示大于100的值 4,"scope": "-"时,表示可以匹配任意场景。 5,50:表示等于50。
- |
-
-commandOne
- |
-必选
- |
-MultifunctionCommand
- |
-执行动作1
- |
-示例代码如下:
-{
- "characteristic": "action",
- "disableIcon": "icon_start_dis.png",
- "icon": "icon_start.png",
- "value": 1,
- "sid": "action"
-}
- |
-
-commandTwo
- |
-可选
- |
-MultifunctionCommand
- |
-执行动作2
- |
-示例代码如下:
-{
- "characteristic": "action",
- "disableIcon": "icon_start_dis.png",
- "icon": "icon_start.png",
- "value": 1,
- "sid": "action"
-}
- |
-
-
-
-
-MultifunctionCommand
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-sid
- |
-必选
- |
-String (1-32)
- |
-命令对应的服务
- |
-例如:“switch”。
- |
-
-characteristic
- |
-必选
- |
-String (1-32)
- |
-命令对应的属性
- |
-例如:“on”。
- |
-
-value
- |
-可选
- |
-int
- |
-命令下发对应的属性值
- |
-value和valueString二者存在其一。其中wifi设备使用value,蓝牙设备使用value或者valueString。
- |
-
-valueString
- |
-可选
- |
-String (1-128)
- |
-命令下发对应的属性值
- |
-value和valueString二者存在其一。其中wifi设备使用value,蓝牙设备使用value或者valueString。
- |
-
-icon
- |
-必选
- |
-String (1-128)
- |
-命令对应的图像标签
- |
-命令对应的图标url。
- |
-
-disableIcon
- |
-可选
- |
-String (1-128)
- |
-不可用图标url
- |
-不可用图标url。
- |
-
-disable
- |
-可选
- |
-String[]
- |
-命令触发后禁用的标签数组
- |
-例如:["蒸功能"],例如:豆浆机关闭的时候,禁用蒸功能。
- |
-
-
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md
deleted file mode 100644
index bd760859adf6cabf82d7220b0b2dcb02e46e4ba8..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-dialog.md
+++ /dev/null
@@ -1,1264 +0,0 @@
-# Dialog类型控件配置说明
-
-- [概述](#section177145394383)
-- [枚举类型Dialog](#section7797619153917)
-- [单选类型Dialog](#section149204321448)
-- [展示类型Dialog](#section22496134515)
-- [时间选择器类型Dialog](#section13596193716458)
-- [日期选择器类型Dialog](#section11825192184617)
-- [日期时间选择器类型Dialog](#section69732312462)
-- [文本选择器类型Dialog](#section1179325213461)
-- [多文本选择器类型Dialog](#section10946422184712)
-
-## 概述
-
-Dialog类型控件一共有七个,分别是枚举类型Dialog、单选类型Dialog、展示类型Dialog、时间选择器类型Dialog、日期选择器类型Dialog、日期时间选择器类型Dialog、多列文本选择器类型Dialog。
-
-## 枚举类型Dialog
-
-枚举类型Dialog用于在Dialog中类型的选择,可以显示一到八个内容区域。每个区域均可以点击,点击后将根据设置切换为对应的图片,表示状态已更改,每次只有一个区域内容处于激活的状态。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "饮功能选择",
- "id": "drinkKind",
- "path": "drinkKind",
- "dialogType": "ENUM",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "下一步",
- "type": "submit"
- }
- ],
- "command": [
- {
- "name": "五谷",
- "icon": {
- "value": {
- "defaultTarget": "/ic_grains_nor.png",
- "target": "/ic_grains_on.png"
- },
- "valueNight": {
- "defaultTarget": "/ic_grains_nor.png",
- "target": "/ic_grains_on.png"
- }
- },
- "dialogList": ["duration", "temperature", "capacity", "speed"],
- "value": 1
- },
- {
- "name": "豆浆",
- "icon": {
- "value": {
- "defaultTarget": "/ic_soy_milk_nor.png",
- "target": "/ic_soy_milk_on.png"
- },
- "valueNight": {
- "defaultTarget": "/ic_soy_milk_nor.png",
- "target": "/ic_soy_milk_on.png"
- }
- },
- "dialogList": ["duration", "temperature", "capacity", "speed"],
- "value": 2
- }
- ]
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“饮功能选择”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“drinkKind”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“drinkKind”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-command
- |
-必选
- |
-Command[]
- |
-弹框对应的动作数组
- |
--
- |
-
-
-
-
-ControlItems
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-控制项显示名称
- |
-例如:“取消”。
- |
-
-type
- |
-必选
- |
-String(1-128)
- |
-控制项类型
- |
-控制项类型为:“submit”,“cancel”。
- |
-
-
-
-
-Command
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-显示名称
- |
-例如:“五谷”。
- |
-
-icon.value.defaultTarget
- |
-必选
- |
-String(1-128)
- |
-默认图标url
- |
-例如:“/ic_soymilk_nor.png”。
- |
-
-icon.value.target
- |
-必选
- |
-String(1-128)
- |
-点击状态图标url
- |
-例如:“/ic_soymilk_on.png”。
- |
-
-icon.valueNight.defaultTarget
- |
-必选
- |
-String(1-128)
- |
-深色模式默认图标url
- |
-例如:“/ic_soymilk_nor.png”。
- |
-
-icon.valueNight.target
- |
-必选
- |
-String(1-128)
- |
-深色模式点击状态图标url
- |
-例如:“/ic_soymilk_on.png”。
- |
-
-dialogList
- |
-可选
- |
-Array
- |
-继续显示的弹框列表
- |
--
- |
-
-value
- |
-必选
- |
-int
- |
-命令下发对应的属性值
- |
-例如:1,表示点了第一个按钮。
- |
-
-
-
-
-## 单选类型Dialog
-
-单选类型Dialog用于在Dialog中进行唯一选择,下方以时间设置为例进行说明。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
-"name": "时间设置",
- "id": "drinkTime1",
- "path": "drinkTime1",
- "dialogType": "RADIO",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "下一步",
- "type": "submit"
- }
- ],
- "range": ["1分钟", "3分钟", "5分钟", "10分钟"],
- "value": [1, 3, 5, 10]
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“时长设置”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“duration”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“duration”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-range
- |
-必选
- |
-Array
- |
-单选项的数组
- |
-例如:["1分钟", "3分钟", "5分钟", "10分钟"]。
- |
-
-value
- |
-必选
- |
-Array
- |
-单选项对应值的数组
- |
-例如:[1, 3, 5, 10]。
- |
-
-
-
-
-## 展示类型Dialog
-
-展示类型Dialog用于显示需要展示的图片和描述文字。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "手磨咖啡功能",
- "id": "handGrindingCoffee",
- "dialogType": "INFO",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "确认",
- "type": "submit"
- }
- ],
- "icon": "/ic_grand_coffee.png",
- "headline": "温馨提示",
- "desc": "请将干磨杯内的咖啡粉装到咖啡滤网中,再点击开始进行冲泡。"
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“手磨咖啡功能”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“handGrindingCoffee”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-icon
- |
-必选
- |
-String(1-128)
- |
-展示图片url
- |
-例如:“/ic_handGrindingCoffee.png”。
- |
-
-headline
- |
-必选
- |
-String(1-128)
- |
-标题
- |
-例如:“温馨提示”。
- |
-
-desc
- |
-必选
- |
-String(1-128)
- |
-描述
- |
-例如:“请将干磨杯内的咖啡粉装到咖啡滤网中,再点击开始进行冲泡。”
- |
-
-
-
-
-## 时间选择器类型Dialog
-
-时间选择器类型Dialog用于在Dialog中选择时间,可以通过设置 "hours"参数,将时间显示为12小时制或者24小时制。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "时间设置",
- "id": "time",
- "path": "time",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "确认",
- "type": "submit"
- }
- ],
- "pickerType": "time",
- "containSecond": true,
- "hours": 24
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“时间设置”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“time”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“time”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-pickerType
- |
-必选
- |
-String(1-128)
- |
-选择器类型
- |
-选择器类型为:“text”,“time”,“date”,“datetime”,“multi-text”。
- |
-
-containSecond
- |
-可选
- |
-boolean
- |
-时间选择器是否包含秒
- |
-例如:true。
- |
-
-hours
- |
-可选
- |
-int
- |
-时间选择器采用的时间格式
- |
-可选值:12:按照12小时制显示,用上午和下午进行区分;24:按照24小时制显示。
- |
-
-
-
-
-## 日期选择器类型Dialog
-
-日期选择器类型Dialog用于在Dialog中选择日期,可以通过设置"lunar"的值,显示为农历时间或者公历时间。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
-"name": "设置日期",
- "id": "date",
- "path": "date",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "确认",
- "type": "submit"
- }
- ],
- "pickerType": "date",
- "start": "1970-1-1",
- "end": "2100-12-31",
- "lunar": false
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“设置日期”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“date”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“date”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-pickerType
- |
-必选
- |
-String(1-128)
- |
-选择器类型
- |
-选择器类型为:“text”,“time”,“date”,“datetime”,“multi-text”。
- |
-
-start
- |
-可选
- |
-time
- |
-日期选择器的起始时间
- |
-格式为 YYYY-MM-DD。
- |
-
-end
- |
-可选
- |
-time
- |
-日期选择器的结束时间
- |
-格式为 YYYY-MM-DD。
- |
-
-lunar
- |
-可选
- |
-boolean
- |
-日期选择器是否为农历展示
- |
-例如:false。
- |
-
-
-
-
-## 日期时间选择器类型Dialog
-
-日期时间选择器类型Dialog用于在Dialog中选择日期和时间,可以通过设置 "hours"参数,将时间显示为12小时制或者24小时制。可以通过设置"lunar"的值,显示为农历时间或者公历时间。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "日期时间设置",
- "id": "datetime",
- "path": "datetime",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "确认",
- "type": "submit"
- }
- ],
- "pickerType": "datetime",
- "lunar": false,
- "hours": 24
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“日期时间设置”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“datetime”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“datetime”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-pickerType
- |
-必选
- |
-String(1-128)
- |
-选择器类型
- |
-选择器类型为:“text”,“time”,“date”,“datetime”,“multi-text”。
- |
-
-lunar
- |
-可选
- |
-boolean
- |
-日期时间选择器是否为农历显示
- |
-例如:false。
- |
-
-hours
- |
-可选
- |
-int
- |
-时间选择器采用的时间格式
- |
-可选值:12:按照12小时制显示,用上午和下午进行区分;24:按照24小时制显示。
- |
-
-
-
-
-## 文本选择器类型Dialog
-
-文本选择器类型Dialog用于在Dialog中选择文本,文本内容可通过配置指定。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "水温设置",
- "id": "temperature",
- "path": "temperature",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "下一步",
- "type": "submit"
- }
- ],
- "pickerType": "text",
- "range": ["40", "50", "60", "70", "80", "90", "100"],
- "value": [40, 50, 60, 70, 80, 90, 100],
- "postField": "℃"
-}
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“水温设置”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“temperature”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“temperature”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-pickerType
- |
-必选
- |
-String(1-128)
- |
-选择器类型
- |
-选择器类型为:“text”,“time”,“date”,“datetime”,“multi-text”。
- |
-
-range
- |
-必选
- |
-Array
- |
-文本选择器的取值范围
- |
-例如:["40", "50", "60", "70", "80", "90", "100"]。
- |
-
-value
- |
-必选
- |
-Array
- |
-文本选择器对应的值的范围
- |
-例如:[40, 50, 60, 70, 80, 90, 100]。
- |
-
-preField
- |
-可选
- |
-String(1-128)
- |
-文本选择器选定值增加的前缀字段
- |
-例如:“1”。
- |
-
-postField
- |
-可选
- |
-String(1-128)
- |
-文本选择器选定值增加的后缀字段
- |
-例如:“℃”。
- |
-
-
-
-
-## 多文本选择器类型Dialog
-
-多列文本选择器类型Dialog用于在Dialog中选择多列文本,文本内容通过配置指定。
-
-示例图:
-
-
-
-对应样例:
-
-```
-{
- "name": "时长设置",
- "id": "duration",
- "path": "duration",
- "dialogType": "PICKER",
- "controlItems": [
- {
- "name": "取消",
- "type": "cancel"
- },
- {
- "name": "下一步",
- "type": "submit"
- }
- ],
- "pickerType": "multi-text",
- "range": [
- ["0分","1分","2分","3分","4分","5分","6分"],
- ["0秒","1秒","2秒","3秒","4秒","5秒","6秒"]
- ]
- }
-```
-
-相关的参数,定义如下:
-
-
-字段名称
- |
-可选/必选
- |
-字段类型
- |
-字段描述
- |
-备注
- |
-
-
-name
- |
-必选
- |
-String(1-128)
- |
-当前弹框显示名称
- |
-例如:“时长设置”。
- |
-
-id
- |
-必选
- |
-String(1-128)
- |
-弹框唯一标识
- |
-例如:“duration”。
- |
-
-path
- |
-必选
- |
-String(1-128)
- |
-动态内容条件值
- |
-例如:“duration”。
- |
-
-dialogType
- |
-必选
- |
-String(1-128)
- |
-弹框类型
- |
-弹框类型为:“RADIO”,“ENUM”,“PICKER”,“INFO”。
- |
-
-controlItems
- |
-必选
- |
-ControlItems[]
- |
-弹框底部控制项
- |
--
- |
-
-pickerType
- |
-必选
- |
-String(1-128)
- |
-选择器类型
- |
-选择器类型为:“text”,“time”,“date”,“datetime”,“multi-text“。
- |
-
-range
- |
-必选
- |
-二维Array
- |
-多列文本选择器的选择值
- |
-长度表示多少列,数组的每项表示每列的数据,如 [["a","b"], ["c","d"]]。
- |
-
-
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md
deleted file mode 100644
index 3ce35bf9b3c64079ab8fec8e45b3c0ff02b84526..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json-intro.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# 概述
-
-模板中json配置文件为设备控制界面的主要依据,智能电风扇页面json文件路径为control/src/main/resources/rawfile/FAN,配置如下:
-
-```
-{
- "devName": "智能电风扇",
- "devType": "0",
- "prodId": "FAN", -- prodId指定了控制界面上的产品图名称
- "templateUIInfo": [ -- templateUIInfo下面可以堆砌模板提供的Control类型控件,以行为单位。
- {"name": "电源"...},
- {"name": "模式"...},
- {"name": "档位"...},
- {"name": "预约关机"...}
- ],
- "dialogUIInfo": [ -- dialogUIInfo下面可以声明Dialog类型控件,默认不显示, 由点击事件触发弹框
- {"name": "关机时间"...}
- ]
-}
-```
-
-目前模板里面提供了两种类型的控件(Control类型控件直接显示在界面上, Dialog类型控件需要触发后以弹窗形式展示),在json配置文件里声明不同控件即可。
-
-**修改json配置文件后重新安装运行原子化服务就能显示修改后的效果。**
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json.md
deleted file mode 100644
index 42bb1a65b3af2c138f8a270aaf0307a750a16ffd..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-json.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# JSON文件配置说明
-
-- **[概述](guide-atomic-service-device-ctrl-json-intro.md)**
-
-- **[Control类型控件配置说明](guide-atomic-service-device-ctrl-json-control.md)**
-
-- **[Dialog类型控件配置说明](guide-atomic-service-device-ctrl-json-dialog.md)**
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-logic.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-logic.md
deleted file mode 100644
index d3bc721517b7557f628b747bcf380d0d6d804953..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-logic.md
+++ /dev/null
@@ -1,180 +0,0 @@
-# 核心代码逻辑介绍
-
-- [核心代码说明](#section17354153553419)
-
-## 核心代码说明
-
-核心逻辑都在DataHandlerAbility.java中, 代码流程如下:
-
-1. JS页面拉起后,会向Java侧请求模板配置数据。
-
- JS代码:
-
- ```
- async requestTemplate() {
- // This function requests the JSON configuration used for display from Java.
- let action = utils.makeAction(ACTION_MESSAGE_CODE_GET_TEMPLATE, {});
- let result = await FeatureAbility.callAbility(action);
- let resultJson = JSON.parse(result);
- if (resultJson.code == 0) {
- let template = JSON.parse(resultJson.data);
- this.parseJson(template.template);
- }
- }
- ```
-
- JAVA代码:
-
- ```
- private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply) {
- switch (code) {
- case ACTION_MESSAGE_CODE_GET_TEMPLATE: {
- reply.writeString(getWriteTemplateString());
- break;
- }
- default: {
- reply.writeString("service not defined");
- return false;
- }
- }
- return true;
- }
- ```
-
-2. Java侧读取模板配置文件:配置文件的路径在DataHandlerAbility的getTemplate中指定,文件来源可以是本地资源,也可以从网络路径读取。
-
- ```
- private ZSONObject getTemplate() {
- // source indicates whether the JSON configuration file is from a local file or an online file.
- final String source = "local";
- // configDir indicates the directory.
- final String configDir = SampleDeviceDataHandler.EXAMPLE_TEMPLATE_FILE_DIR + "/" + productName;
- // configPath indicates the URL of the JSON configuration file. You can change it corresponding
- // to your product name or device ID.
- final String configPath = configDir + "/" + productName + "_" + language + ".json";
- ZSONObject result = null;
- if (LOCAL.equals(source)) {
- try {
- Resource resource = abilityContext.getResourceManager().getRawFileEntry(configPath).openRawFile();
- byte[] tmp = new byte[1024 * 1024];
- int reads = resource.read(tmp);
- if (reads != -1) {
- String jsonString = new String(tmp, 0, reads, StandardCharsets.UTF_8);
- result = ZSONObject.stringToZSON(jsonString);
- }
- } catch (IOException e) {
- HiLog.error(LABEL_LOG, "Failed to open the template from the local file.");
- }
- } else {
- try {
- URL url = new URL(configPath);
- URLConnection urlc = url.openConnection();
- urlc.connect();
- try (InputStream is = urlc.getInputStream();
- InputStreamReader isReader = new InputStreamReader(is, StandardCharsets.UTF_8);
- BufferedReader reader = new BufferedReader(isReader)) {
- StringBuilder sb = new StringBuilder();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- result = ZSONObject.stringToZSON(sb.toString());
- }
- } catch (IOException e) {
- HiLog.error(LABEL_LOG, "Failed to open the template from the URL.");
- }
- }
- if (result != null) {
- // iconUrl is icon's prefix path. Here we use /common/productName in js module. You can change it into your
- // cloud url. All icons file must be under iconUrl.
- result.put("iconUrl", SampleDeviceDataHandler.EXAMPLE_RESOURCE_DIR + "/" + productName);
- // deviceIcon is the product icon's file name. It must be under iconUrl.
- result.put("deviceIcon", "/" + productName + ".png");
- // logoIcon is the product logo's file name. It must exist under iconUrl.
- result.put("logoIcon", "/logo.png");
- }
- return result;
- }
- ```
-
-3. JS读取到页面配置后,会向Java侧请求设备数据。
-
- JS代码:
-
- ```
- async getData() {
- let action = utils.makeAction(ACTION_MESSAGE_CODE_GET_DATA, {});
- await FeatureAbility.callAbility(action);
- }
- ```
-
- JAVA代码:
-
- ```
- private boolean onRemoteRequest(int code, MessageParcel data, MessageParcel reply) {
- switch (code) {
- case ACTION_MESSAGE_CODE_GET_DATA: {
- deviceDataHandler.getData();
- break;
- }
- default: {
- reply.writeString("service not defined");
- return false;
- }
- }
- return true;
- }
- ```
-
-4. Java侧进行初始化设备数据,调用BaseDeviceDataHandler\#initProfileData返回设备所有profile数据。
-
- ```
- NetworkDeviceDataHandler(String deviceId, DeviceDataCallback deviceDataCallback) {
- super(deviceId, deviceDataCallback);
- dataModel = fanDataModel;
- mainHandler = new EventHandler(EventRunner.getMainEventRunner());
- mainHandler.postTask(() -> initProfileData(0, "", dataModel.recoverData()));
- }
- ```
-
- 例如:模板样例智能电风扇的数据初始化如下。
-
- ```
- private final DeviceDataModel fanDataModel = new DeviceDataModel() {
- @Override
- public Map recoverData() {
- dataMap.put("switch/on", 0);
- dataMap.put("windMode/mode", 0);
- dataMap.put("windGear/gear", 0);
- dataMap.put("shutdown/mode", 0);
- return dataMap;
- }
- }
- ```
-
-5. JS界面加载完毕后,事件响应如下:页面点击事件触发后会调用到BaseDeviceDataHandler\#modifyDeviceProperty,发送到设备端,此时UI不会有任何变化。等设备产生响应后,再触发BaseDeviceDataHandler\#onDeviceDataChange回调变化后的数据到UI层,界面会自动刷新。
-
- 例如:模板样例智能电风扇发送消息给设备端的逻辑如下。
-
- ```
- private void sendMessage(String message, HashMap tmpMap) {
- CommonInfo commonInfo = new CommonInfo();
- commonInfo.setSessionId(sessionId);
- HiLog.error(LABEL_LOG, "sessionId " + sessionId);
- NetConfigApi.getInstance().sendMessage(commonInfo, message, (code, controlMessage, str) -> {
- if (code == 0) {
- HiLog.info(LABEL_LOG, "Message sent successfully " + message);
- dataMap.putAll(tmpMap);
- mainHandler.postTask(() -> onDeviceDataChange(dataMap));
- } else {
- HiLog.error(LABEL_LOG, "Failed to send message, code = " +
- code + " control message = " + controlMessage);
- }
- });
- }
- ```
-
- > **说明:**
- >当前模板只提供了从手机发送消息到设备侧的功能,暂不支持从设备侧发送消息到手机,相关能力后续将逐步更新。
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-overview.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-overview.md
deleted file mode 100644
index 07309453562780ab85bda445abca889fe6c83555..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl-overview.md
+++ /dev/null
@@ -1,259 +0,0 @@
-# 开发指导
-
-- [概述](#section117101122133917)
-- [工程模板介绍](#section16117463402)
-- [向设备发送消息(NAN通道建立完成)](#section536518118361)
-- [定义设备控制原子化服务的UI界面](#section737418403116)
-
-## 概述
-
-碰一碰设备控制模板(OneHop Device Ability\(JS\) )用于帮助开发者实现**“碰一碰-设备配网-设备控制”**完整流程。默认工程运行后为智能电风扇的样例效果,开发者可以参考[定义设备控制原子化服务的UI界面](#section737418403116)章节修改成其他自定义设备。
-
-该模板工程主要分为两部分:
-
-**设备配网原子化服务 (entry模块)**
-
-**设备控制原子化服务 (control模块)**
-
-本指导书用于指导开发者如何开发**设备控制原子化服务的(control模块)**,**设备配网原子化服务(entry模块)**开发指导请参考[设备配网原子化服务开发指导书](guide-atomic-service-netconfig-overview.md)。
-
-## 工程模板介绍
-
-OneHop Device Ability\(JS\)碰一碰设备控制模板的工程目录结构如下所示。
-
-```
-├─control
-│ └─ailife-view //该目录无需修改
-│ ├─control //控件容器
-│ │ ├─display //信息展示类控件
-│ │ ├─enum //枚举类控件
-│ │ ├─increasedecrease //加减器控件
-│ │ ├─item //显示子元素
-│ │ ├─multifunction //多功能控件
-│ │ ├─progress //进度条控件
-│ │ └─reversal //开关类控件
-│ ├─customdisplay //自定义展示区
-│ ├─dialog //弹窗容器
-│ │ ├─dialogbox
-│ │ ├─enumlist //枚举弹窗
-│ │ ├─info //信息显示弹窗
-│ │ ├─picker //选择器弹窗
-│ │ └─radiolist //单选弹窗
-│ ├─observed
-│ └─utils
-└─src
- └─main
- ├─java //该目录下内容可见下方类定义
- ├─js
- │ └─default
- │ ├─common //该目录下为本地资源文件,主要都是用于显示的图标资源
- │ │ └─FAN
- │ │ ic_on.png
- │ │ ic_off.png
- │ │ ...
- │ └─pages
- │ └─index
- │ index.js //起始js
- └─resources
- └─rawfile
- ├─FAN
- FAN_en.json //本地英文模板配置文件
- FAN_zh.json //本地中文模板配置文件
-```
-
-源码目录src/main/java中各个类的说明如下表所示。
-
-
-Java
- |
-Description
- |
-
-
-MyApplication
- |
-应用的入口类。
- |
-
-ControlMainAbility
- |
-拉起JS的入口类。
- |
-
-BaseDeviceDataHandler
- |
-与设备数据交互的抽象类。
- |
-
-NetworkDeviceDataHandler
- |
-继承BaseDeviceDataHandler抽象类,实现NAN无感配网通路的设备数据交互,开发者根据自己的设备进行修改。
- |
-
-SampleDeviceDataHandler
- |
-继承BaseDeviceDataHandler抽象类,示例代码,开发者无需修改。
- |
-
-DataHandlerAbility
- |
-Java与JS交互消息的通道。
- |
-
-
-
-
-
-JS
- |
-Description
- |
-
-
-control/ailife-view
- |
-家居控件, 可以在json配置文件声明引用。
- |
-
-index.js
- |
-设备控制主页面,根据json配置文件加载ailife-view下的不同控件。
- |
-
-
-
-
-## 向设备发送消息(NAN通道建立完成)
-
-**本模板是通过JAVA接口向设备发消息,开发者可在NetworkDeviceDataHandler中调用本模板。**
-
-**JS接口:NetConfig.sendMessage\(commonInfo, message, callbackFunc\)**
-
-- 依赖:需要import模板工程里的fa-netconfig.js进行调用。
-- 说明:
- 1. commonInfo里需要填入本次配网通路的sessionId, 由配网原子化服务获取。
- 2. message为发送给设备的字符串消息。
- 3. callbackFunc为消息发送成功与否的回调。
-
-
-示例:
-
-```
-sendMessage: function () {
- let callbackFunc = function (value) {
- //sendMessage 回调
- };
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).Netconfig.sendMessage(commonInfo, message, callbackFunc).then(
- function (result) {
- let ret = JSON.parse(result);
- //sendMessage 消息下发结果
- });
-}
-```
-
-**Java接口:NetConfigApi._getInstance_\(\).sendMessage\(CommonInfo commonInfo, String message, BaseCallback callback\)**
-
-依赖:在build.gradle的dependencies中添加 implementation\(group:'com.huawei.hilink',name:'ailifeability',version:'1.0.0.1',ext:'har'\)
-
-说明:
-
-1. commonInfo里需要填入本次配网通路的sessionId, 由配网原子化服务获取。
-2. message为发送给设备的字符串消息。
-3. callback为消息发送成功与否的回调。
-
-示例:
-
-```
-private void sendMessage(String message, HashMap tmpMap) {
- CommonInfo commonInfo = new CommonInfo();
- commonInfo.setSessionId(sessionId);
- HiLog.error(LABEL_LOG, "sessionId " + sessionId);
- NetConfigApi.getInstance().sendMessage(commonInfo, message, (code, controlMessage, str) -> {
- if (code == 0) {
- HiLog.info(LABEL_LOG, "Message sent successfully" + message);
- dataMap.putAll(tmpMap);
- mainHandler.postTask(() -> onDeviceDataChange(dataMap));
- } else {
- HiLog.error(LABEL_LOG, "Failed to send the message. Code =" +
- code + " control message = " + controlMessage);
- }
- });
-}
-```
-
-## 定义设备控制原子化服务的UI界面
-
-本章节用于指导开发设备控制页面,有两种实现方式:
-
-1. 使用预设的组件构建自定义设备控制页面。此方式通过配置JSON文件,生成设备控制界面。此种方式的优点是可以快速地构建出设备控制界面,并且为界面的各个组件绑定了点击事件和处理逻辑。
-2. 开发者自己开发自定义的设备控制页面。此方式使用系统原生组件开发设备控制页面。此种方式的优点是开发者可灵活地定义UI界面。
-
-本章节主要介绍第一种方式,第二种方式后续将会推出。
-
-该模板工程在control/ailife-view下提供了一系列的UI控件,同时定义了一套json配置规则。这套规则会引用自定义UI控件,来生成自定义的设备控制页面。
-
-在control/src/main/js/default/pages/index/index.hml中相关控件引用代码如下:\( 控件样式请参考下方[JSON文件配置说明](guide-atomic-service-device-ctrl-json-intro.md)章节 \)
-
-
-
-**使用预设的组件构建出自定义设备控制页面需要执行以下几个步骤:**
-
-1. 声明用于描述界面的json文件, 放置到**control/src/main/resources/rawfile/<设备名\>** 的目录下。
-
- json配置文件的详细字段定义见[JSON文件配置说明](guide-atomic-service-device-ctrl-json-intro.md),文件名必须为 <设备名\>\_<语言\>.json。
-
- > **说明:**
- >模板工程默认提供了台灯、牙刷、豆浆机和智能电风扇4个样例,对应的配置文件为LAMP.json、TOOTHBRUSH.json、SOYMILKMACHINE.json、FAN.json。
- >默认运行使用FAN.json。
-
- 
-
-2. 提供UX资源图,可以打包本地资源,也可以使用云端资源。
-
- 使用本地资源需要统一打包到**control/src/main/js/default/common/<设备名\>**的目录下,在json配置文件里可以直接引用。
-
- 
-
- 使用云端资源需要在代码中添加资源的网络路径目录,具体修改到DataHandlerAbility.java中的getTemplate方法,将iconUrl填入您的网络路径, json配置文件中引用的资源是该网络路径下的相对路径。下方为getTemplate方法中需要修改的部分示例:
-
- ```
- if (result != null) {
- //iconUrl 是图标的前缀路径。这里我们在 js 模块中使用 /common/productName 。您可以将其更改为网络地址,所有图标文件必须在 iconUrl 下。
- result.put("iconUrl", SampleDeviceDataHandler.EXAMPLE_RESOURCE_DIR + "/" + productName);
- // deviceIcon 是产品图标的文件名。它必须存在于 iconUrl 下。
- result.put("deviceIcon", "/" + productName + ".png");
- // logoIcon 是产品标志的文件名。它必须存在于 iconUrl 下。
- result.put("logoIcon", "/logo.png");
- }
- ```
-
-3. 将DataHandlerAbility.java中的DEVICE\_DATA\_MODE设为DEVICE\_DATA\_MODE\_NETWORK\_DEVICE,即可使用NetworkDeviceDataHandler.java处理数据,实现秒控控制设备的效果。
-
- 参考NetworkDeviceDataHandler.java中的fanDataModel,模板中已经实现了一个智能电风扇的数据处理逻辑。这个处理逻辑可将页面的点击事件传过来的数据转换成指令发送给设备,您可以参照该电风扇模型添加您的自定义设备处理逻辑。
-
- ```
- public class NetworkDeviceDataHandler extends BaseDeviceDataHandler {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(HiLog.DEBUG, 0, "MessageDataHandler");
- private static String sessionId = null;
- private final DeviceDataModel dataModel;
- private final EventHandler mainHandler;
- private final Map dataMap = new HashMap<>();
- private final DeviceDataModel fanDataModel = new DeviceDataModel() {
- @Override
- public Map recoverData() {
- dataMap.put("switch/on", 0);
- dataMap.put("windMode/mode", 0);
- dataMap.put("windGear/gear", 0);
- dataMap.put("shutdown/mode", 0);
- return dataMap;
- }
- }
- }
- ```
-
- 更多代码处理流程,请参考[核心代码说明](guide-atomic-service-device-ctrl-logic.md#section17354153553419)。
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl.md b/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl.md
deleted file mode 100644
index 3ee1e80114e1888cb62c6018dca567f3dfdd8eb2..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-device-ctrl.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# 设备控制原子化服务开发指导
-
-- **[开发指导](guide-atomic-service-device-ctrl-overview.md)**
-
-- **[核心代码逻辑介绍](guide-atomic-service-device-ctrl-logic.md)**
-
-- **[JSON文件配置说明](guide-atomic-service-device-ctrl-json.md)**
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-api.md b/zh-cn/device-dev/guide/guide-atomic-service-netconfig-api.md
deleted file mode 100644
index 198e70d9442c9ec749005f103fffa0ae28e4ceef..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-api.md
+++ /dev/null
@@ -1,907 +0,0 @@
-# 配网接口调用
-
-- [是否持WifiAware](#section1488020125510)
-- [获取Wifi列表](#section743413288512)
-- [通过NAN发现设备](#section1504174410511)
-- [通过SoftAP发现设备](#section55681185218)
-- [连接设备](#section4392324115210)
-- [对指定设备进行配网](#section772433526)
-- [释放配网通道](#section194641109530)
-- [秒控接口](#section144171232175313)
-- [注册消息回调](#section7232650195315)
-- [设备断链通知回调消息](#section176579445411)
-
-配网相关接口都在login/fa-netconfig.js下。
-
-参考app.js中的import netConfig from 'fa-netconfig'进行引用。
-
-## 是否持WifiAware
-
-
-函数原型
- |
-NetConfig.isSupportWifiAware()
- |
-
-说明
- |
-WifiAware是否支持。
- |
-
-接口类型
- |
-同步接口
- |
-
-返回值
- |
-0(支持)/ -1(不支持)
- |
-
-
-
-
-- 参数
-
- 无
-
-- 示例:
-
- ```
- getApp(this).NetConfig.isSupportWifiAware().then(function (result) {
- let ret = JSON.parse(result);
- console.info("isSupportWifiAware消息结果: code=" + ret.code + ", data=" + ret.data);
- if (ret.code == 0) {
- //支持WifiAware
- } else {
- //不支持WifiAware
- }
- });
- ```
-
-
-## 获取Wifi列表
-
-
-函数原型
- |
-NetConfig.getWifiList(callbackFunc)
- |
-
-说明
- |
-获取周边wifi列表。
- |
-
-接口类型
- |
-异步接口
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。
- 返回:List<WifiApInfo>
- WifiApInfo {
- int channel;
- boolean hasDefaultPassword;
- boolean is5G; // 是否是5G wifi
- String securityType;
- int signalLevel;
- String ssid;
- String wifiApId; // wifiAp ID
- }
- 2.4G和5G都返回,原子化服务只需通过is5G是否支持5G进行筛选过滤;
- 周边范围内的已配置过,并且能够成功获取密码的ssid,hasDefaultPassword才为true;
- |
-
-
-
-
-- 示例
-
- ```
- getApp(this).NetConfig.getWifiList((result) => {
- if (result.code == 0 && result.data && result.data.length > 0) {
- this.progress = this.progressStatus[3];
- this.desc = this.descStatus[3];
- this.configDevice(result.data[0]);
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[3];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## 通过NAN发现设备
-
-
-函数原型
- |
-NetConfig.discoveryByNAN(scanNanInfo, callbackFunc)
- |
-
-说明
- |
-广播NAN服务,等待客户端连接,建立起一条连接,停止广播。
- |
-
-接口类型
- |
-异步接口
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- scanNanInfo
- |
- Object
- |
- 是
- |
- scanNanInfo {
- int duration; 在指定的duration时间内未建立起连接,停止广播,单位为秒,范围[0,100],0表示不限制时长。
- int lockTime; 设备收到NAN互信消息后在NAN模式的锁定时长,单位为秒,范围[0,100],0表示不限制时长。
- String sessionId; 值为service拉起原子化服务时的Intent携带的sessionId值。
- }
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。返回:
- DeviceInfo{
- String productId,
- String sessionId
- String sn,
- }
- |
-
-
-
-
-- 示例:
-
- ```
- let scanInfo = {
- duration: 30,
- lockTime: 60,
- sessionId: ''
- };
- getApp(this).NetConfig.discoveryByNAN(scanInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[1];
- this.desc = this.descStatus[1];
- getApp(this).ConfigParams.deviceInfo = result.data;
- this.registerDisconnectCallback(result.data.sessionId);
- this.connectDevice();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[1];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## 通过SoftAP发现设备
-
-
-函数原型
- |
-NetConfig.discoveryBySoftAP(callbackFunc)
- |
-
-说明
- |
-扫描AP。
- |
-
-接口类型
- |
-异步接口
- |
-
-输入参数
- |
-由原子化服务自行确定调用次数
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。
- 返回:List<SoftAPInfo> SoftAPInfo{
- String ssid,
- boolean usePassword // 是否需要使用密码
- }
- |
-
-
-
-
-- 示例:
-
- ```
- getApp(this).NetConfig.discoveryBySoftAP((result) => {
- if (result.code == 0) {
- for (let index = 0; index < result.data.length; index++) {
- let element = result.data[index];
- console.info("discoveryBySoftAP回调:device element=" + JSON.stringify(element));
- // softAP扫描到的列表中,与既定的设备的ssid格式+品类+mac地址进行比对
- if (element.ssid.indexOf(self.softAPSsidDefault) != -1) {
- this.discoverDeviceBySoftAPResult = JSON.stringify(element);
- this.softAPSsidDefault = element.ssid;
- break;
- }
- }
- }
- });
- ```
-
-
-## 连接设备
-
-
-函数原型
- |
-NetConfig.connectDevice(connectInfo,callbackFunc)
- |
-
-说明
- |
-连接设备。
- |
-
-接口类型
- |
-异步接口
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- connectInfo
- |
- Object
- |
- 是
- |
- connectInfo {
- string targetDeviceId; //必填,待连接设备的标识。
- - number type; //必填,0(NAN)/ 1(SoftAp)。
- string pin; //必填,设备pin。
- string password; //必填,若设备需要密码,则设置为所需密码;否则设置为""。
- string sessionId; //必填,若type为NAN,则设置为discoverDevByNAN 返回的sessionId;否则设置为""。
}
-
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。
- 返回:String vendorData // 后续扩展使用。
- Softap模式下返回{
- String productId,
- String sn,
- String vendorData
- } 的JSON格式字符串
- |
-
-
-
-
-- NAN类型示例
-
- ```
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 0,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- ```
-
-- SoftAP类型示例
-
- ```
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 1,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## 对指定设备进行配网
-
-
-函数原型
- |
-NetConfig.configDeviceNet(deviceInfo,accountInfo,netConfigInfo,callbackFunc)
- |
-
-说明
- |
-开始对指定的设备进行配网,发送SSID和密码,以及设备和账号信息。
- |
-
-接口类型
- |
-异步接口
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- deviceInfo
- |
- string
- |
- 是
- |
- 设备云为设备分配的信息,如deviceID等
- |
-
- accountInfo
- |
- string
- |
- 是
- |
- 账号信息
- |
-
- netConfigInfo
- |
- Object
- |
- 是
- |
- netConfigInfo {
- string ssid;
- //必填,如果是手机已经配置过的ssid,可免输密码。
- string ssidPassword;//非必填,不需要下发密码时,填写“”。
- boolean isDefaultPassword; //必填。
- int channel; //必填。
- string sessionId; //必填,type为NAN时填实际值;type为softAp时填“”。
- int type; //必填,0(NAN)/ 1(softAp)。
- String wifiApId; //填写wifi列表返回信息中的对应字段。
- String vendorData; //产品数据,当前为random Base64编码;
- int timeout; // 配网超时时间,在NAN模式下设置,范围[1,90]s。
- }
- 说明:如果用户输入密码,则isDefaultPassword=false, ssidPassword=“输入的密码”;否则按使用默认密码处理,isDefaultPassword=true, ssidPassword=””
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,NAN配网模式中,回调成功表示模组上报配网状态结果,其结果会转换成整型数值放到data.code,字符串类型会放到data.msg; SoftAp配网模式中,返回0/ -1表示配网成功/失败;
- |
-
-
-
-
-- NAN类型示例
-
- ```
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 0,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- ```
-
-- SoftAP类型示例
-
- ```
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 1,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- ```
-
-
-## 释放配网通道
-
-
-函数原型
- |
-NetConfig.disconnectDevice(commonInfo,callbackFunc)
- |
-
-说明
- |
-释放配网通道,在原子化服务不再使用NAN通道、原子化服务退出等情况需要原子化服务主动调用该接口。
- |
-
-接口类型
- |
-异步接口
- |
-
-输入参数
- |
-commonInfo
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- commonInfo
- |
- Object
- |
- 是
- |
- commonInfo{
- String sessionId; //若type为NAN,则设置为discoverDevByNAN 返回的sessionId;SoftAp设置为””。
- }
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。
- 返回:0(成功)/ -1(失败)
- |
-
-
-
-
-- 示例:
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.disconnectDevice(commonInfo, (result) => {
- if (result.code == 0) {
- return;
- }
- });
- ```
-
-
-## 秒控接口
-
-
-函数原型
- |
-NetConfig.sendMessage(commonInfo,message,callbackFunc)
- |
-
-说明
- |
-秒控接口。
- |
-
-接口类型
- |
-异步接口
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- commonInfo
- |
- Object
- |
- 是
- |
- commonInfo{
- String sessionId; //若type为NAN,则设置为discoverDevByNAN 返回的sessionId;否则设置为””。
- }
- |
-
- message
- |
- String
- |
- 是
- |
- 消息内容
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,返回命令发送结果。
- 返回:0(成功)/ -1(失败)
- |
-
-
-
-
-- 示例:
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.sendMessage(commonInfo, "111111", (result) => {
- // sendMessage 回调
- })
- ```
-
-
-## 注册消息回调
-
-
-函数原型
- |
-NetConfig.registerMsgReceive(commonInfo, callbackFunc)
- |
-
-说明
- |
-获取设备侧消息,建议在NAN配网模式下连接设备接口前调用。
- |
-
-接口类型
- |
-异步接口
- |
-
-输入参数
- |
-详见下方参数表格
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- commonInfo
- |
- Object
- |
- 是
- |
- commonInfo{
- String sessionId; //若type为NAN,则设置为discoverDevByNAN 返回的sessionId;否则设置为””。
- }
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,回调成功的情况下,data为返回数据结果,在该回调函数中解析使用数据结果。
- 返回:String message
- |
-
-
-
-
-- 示例:
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.registerMsgReceive(commonInfo, () => {
- // registerMsgReceive 回调
- });
- ```
-
-
-## 设备断链通知回调消息
-
-
-函数原型
- |
-NetConfig.registerDisconnectCallback(commonInfo, callbackFunc)
- |
-
-说明
- |
-注册连接断开事件回调,建议在NAN配网模式下连接设备接口前调用。
-当因某些原因造成设备主动与手机断开连接时,会通过该回调通知。
- |
-
-接口类型
- |
-异步接口
- |
-
-输入参数
- |
-详见下方参数表格
- |
-
-返回值
- |
-0(成功)/ -1(失败)
- |
-
-
-
-
-- 参数
-
-
- 参数名
- |
- 类型
- |
- 必填
- |
- 说明
- |
-
-
- commonInfo
- |
- Object
- |
- 是
- |
- commonInfo{
- String sessionId; //若type为NAN,则设置为discoverDevByNAN 返回的sessionId ;否则设置为””。
- }
- |
-
- callbackFunc
- |
- function
- |
- 是
- |
- 回调函数,当收到该回调时表示设备与手机连接断开。
- 返回状态码:0。
- |
-
-
-
-
-- 示例
-
- ```
- let commonInfo = {
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- }
- getApp(this).NetConfig.registerDisconnectCallback(commonInfo, () => {
- // registerDisconnectCallback 回调
- });
- ```
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-logic.md b/zh-cn/device-dev/guide/guide-atomic-service-netconfig-logic.md
deleted file mode 100644
index b50f6b30024fefe0d1b4052a2eb0539a62d23f8e..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-logic.md
+++ /dev/null
@@ -1,157 +0,0 @@
-# 核心代码逻辑介绍
-
-关于工程中的核心代码说明如下:
-
-1. 碰一碰拉起MainAbility后, 从intent中读取的nanSessionId用于配网,productId用于确定需要连接的设备类型,默认为智能电风扇。
-
- 参考MainAbility.java的onStart函数中如何读取设备信息。
-
- 同时需要将abilityContext和sessionId注册到配网SDK中。
-
- ```
- String sessionId = intent.getStringParam("nanSessionId");
- if ("null".equals(sessionId) || "".equals(sessionId)) {
- NetConfigAbility.register(this, null);
- } else {
- NetConfigAbility.register(this, sessionId);
- }
- ```
-
-2. MainAbility读取到的productId、productName和sessionId会作为参数会传递到JS。
-
- 代码参考MainAbility.java
-
- ```
- IntentParams intentParams = intent.getParams();
- if (intentParams != null) {
- intentParams.setParam("productId", productId);
- intentParams.setParam("productName", productName);
- intentParams.setParam("sessionId", sessionId);
- setPageParams(null, intentParams);
- }
- ```
-
-3. JS根据productName显示对应的设备图标, 代码参考device.js
-
- ```
- onInit() {
- this.deviceName = this.$t('strings.device-name');
- this.deviceImg = '/common/img/' + this.productName + ".png";
- getApp(this).Product.productName = this.productName;
- getApp(this).Product.productId = this.productId;
- getApp(this).ConfigParams.sessionId = this.sessionId;
- }
- ```
-
-4. 点击配网后会执行配网逻辑,代码参考netconfig.js
- 1. 通过NAN广播发现最近的一个设备。
-
- ```
- discoverDevice() {
- let scanInfo = {
- duration: 30,
- lockTime: 60,
- sessionId: getApp(this).ConfigParams.sessionId
- };
- // Step 1 Discover the device through NAN broadcast.
- getApp(this).NetConfig.discoveryByNAN(scanInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[1];
- this.desc = this.descStatus[1];
- getApp(this).ConfigParams.deviceInfo = result.data;
- this.registerDisconnectCallback(result.data.sessionId);
- this.connectDevice();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[1];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 2. 连接设备。
-
- ```
- connectDevice() {
- let connectInfo = {
- targetDeviceId: getApp(this).ConfigParams.deviceInfo.productId,
- type: 0,
- pin: '0123456789012345',
- password: getApp(this).ConfigParams.deviceInfo.sn,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId
- };
- // Step 2 Connect the device.
- getApp(this).NetConfig.connectDevice(connectInfo, (result) => {
- if (result.code === 0) {
- this.progress = this.progressStatus[2];
- this.desc = this.descStatus[2];
- this.getWifiInfo();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[2];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 3. 获取手机连接的wifi信息。
-
- ```
- getWifiInfo() {
- // Step 3 Obtain the Wi-Fi information used by the phone for connection.
- getApp(this).NetConfig.getWifiList((result) => {
- if (result.code == 0 && result.data && result.data.length > 0) {
- this.progress = this.progressStatus[3];
- this.desc = this.descStatus[3];
- this.configDevice(result.data[0]);
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[3];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- 4. 与设备进行配网, 配网成功后跳转到设备控制页面。
-
- ```
- async configDevice(wifiApInfo) {
- let netConfigInfo = {
- ssid: wifiApInfo.ssid,
- ssidPassword: '',
- isDefaultPassword: true,
- channel: wifiApInfo.channel,
- sessionId: getApp(this).ConfigParams.deviceInfo.sessionId,
- type: 0,
- wifiApId: wifiApInfo.wifiApId,
- vendorData: '',
- timeout: 30,
- paramValid: true
- };
- // Step 4 Configure the device network.
- getApp(this).NetConfig.configDeviceNet('deviceInfo', 'accountInfo', netConfigInfo, (result) => {
- if (result.code == 0) {
- this.progress = this.progressStatus[4];
- this.desc = this.descStatus[4];
- this.registerMsgReceive()
- // Step 5 Display the device control page after a successful network configuration.
- this.goToControl();
- } else {
- this.progress = this.progressStatus[4];
- this.desc = this.failDescStatus[4];
- this.disconnectDevice();
- }
- });
- }
- ```
-
- > **说明:**
- >模板工程默认跳转到control设备控制模块,你也可以修改代码跳转到自定义的设备控制页,注意必须将sessionId传递到后续页面,用于给设备发送消息。
- >给设备发送消息的JS接口为:NetConfig.sendMessage\(commonInfo, message, callbackFunc\)
- >给设备发送消息的JAVA接口为:NetConfigApi._getInstance_\(\).sendMessage\(CommonInfo, String, BaseCallback\)
-
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-overview.md b/zh-cn/device-dev/guide/guide-atomic-service-netconfig-overview.md
deleted file mode 100644
index 0453874499ceb1ba8cd468c297af2fe57c7b0b88..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-netconfig-overview.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# 开发指导
-
-- [概述](#section117101122133917)
-- [工程项目结构](#section163058534218)
-- [定义设备配网原子化服务的UI界面](#section129531555424)
-
-## 概述
-
-碰一碰设备控制模板(OneHop Device Ability\(JS\) )用于帮助开发者实现**“碰一碰-设备配网-设备控制”**完整流程。默认工程运行后为智能电风扇的样例效果,开发者可以参考[定义设备配网原子化服务的UI界面](#section129531555424)章节修改成其他自定义设备。
-
-该模板工程主要分为两部分:
-
-**设备配网原子化服务 (entry模块)**
-
-**设备控制原子化服务 (control模块)**
-
-本指导书用于指导开发者如何开发**设备配网原子化服务 (entry模块)**,关于**设备控制原子化服务(control模块)**的开发指导请参考[设备控制原子化服务开发指导书](guide-atomic-service-device-ctrl-overview.md)。
-
-## 工程项目结构
-
-OneHop Device Ability\(JS\)碰一碰设备配网模板的工程目录结构如下所示。
-
-
-
-源码目录中各个类的说明如下表所示。
-
-
-Class
- |
-Description
- |
-
-
-Java
- |
-
-MyApplication
- |
-应用的入口类
- |
-
-MainAbility
- |
-拉起JS的入口类,处理NFC标签读取到的信息
- |
-
-JS
- |
-
-default/pages/device/device.js
- |
-设备简介页,碰一碰拉起后跳转的页面
- |
-
-default/pages/netconfig/netconfig.js
- |
-设备配网页,负责配网相关逻辑,在设备简介页点击配网后显示
- |
-
-
-
-
-## 定义设备配网原子化服务的UI界面
-
-1. 在MainAbility onStart里处理NFC标签读取到的product id信息, **开发者可以根据自己的productId映射成不同的设备类型,将productName修改成具体的设备名**,默认为智能电风扇。
-
- ```
- @Override
- public void onStart(Intent intent) {
- intent.setParam("window_modal", 3);
- setInstanceName(JS_MODULE);
-
- Object productInfo = Objects.requireNonNull(intent.getParams()).getParam("productInfo");
- if (productInfo != null) {
- productId = (String) productInfo;
- // Modify your product name according to your product ID in the NFC tag.
- productName = "FAN";
- }
- }
- ```
-
-2. 在资源目录下放置您的产品图, 用于界面显示,**注意文件命名为<设备名\>.png, 设备名保持与productName一致**。
-
- 
-
- 设备简介页和设备配网页会显示该产品图。
-
-3. 在项目的entry\\src\\main\\js\\default\\pages\\netconfig\\netconfig.js的goToControl方法中添加deviceType:1,用于提高设备配网的稳定性。
-
- ```
- goToControl() {
- let target = {
- bundleName: 'com.example.middleplatform.deviceoperate',
- abilityName: 'com.example.middleplatform.ControlMainAbility',
- deviceType: 1,
- data: {
- session_id: getApp(this).ConfigParams.deviceInfo.sessionId,
- product_id: getApp(this).Product.productId,
- product_name: getApp(this).Product.productName
- }
- }
- FeatureAbility.startAbility(target);
- app.terminate();
- }
- ```
-
-
diff --git a/zh-cn/device-dev/guide/guide-atomic-service-netconfig.md b/zh-cn/device-dev/guide/guide-atomic-service-netconfig.md
deleted file mode 100644
index 89f13076a339de5a95245290e6953db34e880df9..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/guide-atomic-service-netconfig.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# 设备配网原子化服务开发指导
-
-- **[开发指导](guide-atomic-service-netconfig-overview.md)**
-
-- **[核心代码逻辑介绍](guide-atomic-service-netconfig-logic.md)**
-
-- **[配网接口调用](guide-atomic-service-netconfig-api.md)**
-
-- **[常见问题](faqs.md)**
-
-
diff --git a/zh-cn/device-dev/guide/onehop-configuration-device-tag.md b/zh-cn/device-dev/guide/onehop-configuration-device-tag.md
deleted file mode 100644
index e5d87c0db6d3d1903df462e5d5a5c32fb84f3b9e..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-configuration-device-tag.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# 配置服务关联意图
-
-通过在HAG上配置原子化服务的关联意图,在使用手机碰一碰NFC标签后,即可通过NFC标签中的Product ID信息,与HAG中配置的关联意图进行匹配,获取需要拉取的原子化服务信息,从而拉起设备配网原子化服务。
-
-接下来为大家介绍如何在HAG中配置原子化服务的关联意图。
-
-1. 请使用已经实名认证后的华为开发者帐号登录[华为开发者门户](https://developer.huawei.com/consumer/cn/),登录后进入到管理中心。
-
- 
-
-2. 选择“生态服务 \> 智慧服务”,然后点击进入华为快服务智慧平台。首次使用,请阅读并签署《华为快服义务智慧平台合作协议》。
-
- 
-
-3. 点击**创建快服务**按钮,然后选择**HarmonyOS测试服务**。
-
- 
-
-4. 设置“服务名称”、“服务分类”和“默认语言”,然后点击**创建**。
-
- 
-
-5. 设置服务信息,包括“基本信息”和“服务呈现信息”。
- - 基本信息:如服务版本号、版本描述和服务分级信息,然后点击**保存**按钮。
- - 服务呈现信息:如简要描述、开发者品牌、服务图标等必选项,请注意,**服务大图标**也必须上传,然后点击**保存**。
-
-6. 进入“配置 \> HarmonyOS标签”页面,点击**添加**按钮,添加设备标签。其中“产品型号”输入应用调测助手中申请的Product ID,“产品子型号”固定输入00,然后点击**保存**按钮。
-
- 
-
-7. 进入“配置 \> FA信息”页面,设置FA基本信息和配置方式,设置完成后点击**保存**按钮进行保存。
-
- - 基本信息:其中“实现类型”固定选择“APK/RPK/FA/H5 link”。
- - FA Link:填写“App名称”、“App包名”、“模块名”和“服务名”,其中:
- - “App包名”填写为config.json文件中的bundleName字段取值。
- - “模块名”填写为入口原子化服务(即设备配网模块)config.json文件中的moduleName字段取值。
- - “服务名”填写为入口原子化服务(即设备配网模块)config.json文件中的mainAbility字段取值。
-
- 
-
-8. 进入测试页签,点击**开始测试准备**按钮,启动测试。测试的有效期时间为1个月,到期后请重新点击**重新测试准备**即可。
-
- 
-
- 接下来在“真机测试”中,点击**创建按钮**,添加真机测试名单。此处填写的华为帐号信息需要与手机上登录的华为帐号保持一致。
-
- 
-
-
diff --git a/zh-cn/device-dev/guide/onehop-dev-atomic-service.md b/zh-cn/device-dev/guide/onehop-dev-atomic-service.md
deleted file mode 100644
index 6507d8b7ef896b45459efccde07cafd9b97221f0..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-dev-atomic-service.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# 开发原子化服务
-
-碰一碰设备控制模板OneHop Device Ability\(JS\) 用于帮助开发者实现**“碰一碰-设备配网-设备控制”**完整流程,开发碰一碰拉起HarmonyOS原子化服务包括:开发设备控制原子化服务和设备配网原子化服务。开发设备配网/控制原子化服务使用的工具为[DevEco Studio 3.0 Beta1](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)及以上版本,关于工具配置请查看[DevEco Studio环境搭建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/installation_process-0000001071425528)。
-
-1. 通过如下两种方式,打开工程创建向导界面。
- - 如果当前未打开任何工程,可以在DevEco Studio的欢迎页,选择**Create Project**开始创建一个新工程。
- - 如果已经打开了工程,可以在菜单栏选择**File \> New \> New Project**来创建一个新工程。
-
-2. 在工程向导中,点击**Template Market**按钮,从Marketplace中找到并下载OneHop Device Ability\(JS\) 模板。
-
- 
-
-3. 回到创建工程页面,下载的工程模板出现在模板列表中,然后选择OneHop Device Ability模板,并点击**Next**设置工程配置信息。
-4. 在工程配置中,**Project Type**请选择“Service”,并勾选上“Show in Service Center”,点击**Finish**等待工程同步完成。
-
- > **说明:**
- >设备控制/配网原子化服务一般为通过碰一碰拉起,在调测阶段,为方便开发者在手机桌面应用图标启动设备控制/配网原子化服务,可以在工程创建完成后,将config.json中的“installationFree”字段改为false,待调试完成后,再将该字段取值改回true。
-
- 
-
-5. 在工程的**entry\\src\\main\\js\\default\\pages\\netconfig\\netconfig.js**的goToControl方法中添加deviceType:1,以便从本地设备中拉起原子化服务。
-
- ```
- goToControl() {
- let target = {
- bundleName: 'com.example.middleplatform.deviceoperate',
- abilityName: 'com.example.middleplatform.ControlMainAbility',
- deviceType: 1,
- data: {
- session_id: getApp(this).ConfigParams.deviceInfo.sessionId,
- product_id: getApp(this).Product.productId,
- product_name: getApp(this).Product.productName
- }
- }
- FeatureAbility.startAbility(target);
- app.terminate();
- }
- ```
-
- > **说明:**
- >OneHop Device Ability\(JS\) 模板已预置智能风扇的设备配网和设备控制原子化服务,如果您想修改设备配网和设备控制原子化服务的UI界面和功能,可参考如下内容进行修改。
- >- 开发设备配网原子化服务:请参考[设备配网原子化服务开发指导书](guide-atomic-service-netconfig-overview.md)。
- >- 开发设备控制原子化服务:请参考[设备控制原子化服务开发指导书](guide-atomic-service-device-ctrl-overview.md)。
-
-6. 设备配网和设备控制原子化服务开发完成后,在华为手机上运行,需要对原子化服务进行签名,签名指导请参考[通过DevEco Studio自动化签名方式对应用签名](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section837891802519)。
-7. 打开DevEco Studio菜单栏**Run \> Edit Configurations**, 勾选entry模块下的“Deploy Multi Hap Packages”选项,表示在运行entry模块(设备配网原子化服务)时,同时会在手机中安装control模块(设备控制原子化服务)。
-
- 
-
-8. 在工具栏中选择entry模块,然后点击**Run**按钮,同时在设备上安装设备控制和设备配网原子化服务。
-
- entry\\src\\main\\resources\\base\\element\\string.json中的“entry\_MainAbility”代表设备配网原子化服务的名称,您可以修改为其它名称。
-
- control\\src\\main\\resources\\base\\element\\string.json中的“control\_ControlMainAbility”代表设备控制原子化服务的名称,您可以修改为其它名称。
-
- 
-
-9. 在手机桌面,点击设备配网图标,确认是否启动设备配网原子化服务界面,如下图所示。
-
- 
-
-
diff --git a/zh-cn/device-dev/guide/onehop-dev-hi3861.md b/zh-cn/device-dev/guide/onehop-dev-hi3861.md
deleted file mode 100644
index aae55989dbf37643cead9d96ac3048177e78ed5a..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-dev-hi3861.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# 开发Hi3861设备侧功能
-
-- [源码开发](#section103951747175415)
-- [源码编译](#section188441785558)
-- [源码烧录](#section91141823135914)
-
-使用DevEco Device Tool工具进行Hi3861源码的开发、编译和烧录。开发编译环境必须使用Ubuntu系统,关于DevEco Device Tool的环境搭建请参考[Ubuntu开发环境准备](https://device.harmonyos.com/cn/docs/ide/user-guides/install_ubuntu-0000001072959308)。
-
-## 源码开发
-
-1. 解压Hi3861源码,并在DevEco Device Tool工具中点击**Import Project**打开源码文件。
-
- 
-
-2. 选择源码导入时,提示该工程不是DevEco Device Tool工程,点击**Import**。
-
- 
-
-3. MCU选择Hi3861,Board选择Hi3861,Framework选择Hb,然后点击**Import**完成导入。
-
- 
-
-4. 将Hi3861开发板Demo代码中的**“hals”和“winder”**目录拷贝至源码工程中的**applications/sample/wifi-iot/app**/目录下。
-
- 
-
-5. 修改**device/hisilicon/hispark\_pegasus/hi3861\_adapter/hals/communication/wifi\_lite/wifiservice/source/wifi\_device.c**文件,将如下两处代码进行注释。
-
- ```
- if (LockWifiEventLock() != WIFI_SUCCESS) {
- return;
- }
-
- if (UnlockWifiEventLock() != WIFI_SUCCESS) {
- return;
- }
- ```
-
-6. 打开**device/hisilicon/hispark\_pegasus/sdk\_liteos/build/config/usr\_config.mk**文件,找到**CONFIG\_I2C\_SUPPORT is not set**,取消注释,并将其修改为**CONFIG\_I2C\_SUPPORT=y**。
-
- 
-
-7. 修改**applications/sample/wifi-iot/app/BUILD.gn**文件,将features字段中的startup修改为winder,并添加winder模块的索引deps,配置示例如下所示。
-
- ```
- import("//build/lite/config/component/lite_component.gni")
-
- lite_component("app") {
- features = [
- "winder",
- ]
- deps = [ "//applications/sample/wifi-iot/app/hals:hi3861_hals" ]
- }
- ```
-
-
-## 源码编译
-
-使用DevEco Device Tool对源码进行编译。
-
-1. 下载并解压如下工具,包括:
-
-
-
-
-2. 在DevEco Device Tool的**Tools**中,点击**Add user component**,添加gn、ninja和gcc\_riscv32工具。请注意,添加时,工具名称不能修改为其它名称。
-
- 
-
-3. 点击图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击对应开发板下的**Build**按钮,执行编译。
-
- 
-
-4. 等待编译完成,在**TERMINAL**窗口输出“SUCCESS”,编译完成。
-
- 
-
-
-## 源码烧录
-
-1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3861-0000001105041324)。
-2. 打开电脑的设备管理器,查看并记录对应的串口号。
-
- > **说明:**
- >如果对应的串口异常,请根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。
-
- 
-
-3. 打开DevEco Device Tool,在QUICK ACCESS\>DevEco Home\>Projects中,点击**Settings**打开工程配置界面。
-
- 
-
-4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3861V100开发板进行适配,无需单独修改。
-
- > **说明:**
- >如果待烧录文件是直接通过拷贝的方式获取,需要手动修改待烧录文件的路径。打开待烧录文件的页签,在Partition Settings的New Opiton的下拉列表中,选择Partition\_bin,然后在Partition Opiton的Partition\_bin设置待烧录文件的路径。
-
-5. 在“hi3861”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
-
- - upload\_port:选择步骤2中查询的串口号。
- - upload\_protocol:选择烧录协议,Windows系统可以选择“burn-serial”或“hiburn-serial”,Linux系统只能选择“hiburn-serial”。
- - upload\_partitions:选择待烧录的文件,默认选择hi3861\_app。
-
- 
-
-6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。
-7. 打开工程文件,在DevEco Device Tool界面的“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。
-
- 
-
-8. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。
-
- 
-
-9. 重新上电后,界面提示如下信息时,表示烧录成功。
-
- 
-
-
diff --git a/zh-cn/device-dev/guide/onehop-dev-prerequisites.md b/zh-cn/device-dev/guide/onehop-dev-prerequisites.md
deleted file mode 100644
index c057957ae57d80f85ab82cddbb9a0afc8fba365a..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-dev-prerequisites.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# 准备工作
-
-开发碰一碰特性,需要涉及Hi3861开发板的开发和HarmonyOS原子化服务的开发两部分。因此,在开发前,请做好如下准备工作:
-
-**HarmonyOS原子化服务开发准备工作:**
-
-- 准备已经升级至HarmonyOS 2系统的华为Mate系列或P系列手机,系统版本号为2.0.0.168及以上。
-- 下载[DevEco Studio 3.0 Beta1](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)版本,并配置好[DevEco Studio开发环境](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/installation_process-0000001071425528)。
-- 在华为应用市场,下载并安装“应用调测助手”App,用于写NFC标签。
-- 准备1个NFC标签,可以用手机触碰NFC标签,提前确保NFC功能可用。
-- 打开手机**设置 \> 应用和服务 \> 应用管理**,搜索“智慧生活基础服务”,检测智慧生活基础服务的版本是否为12.0.2.306及以上。如果不是,请打开华为手机的“智慧生活”App,点击“**我的 \> 设置 \> 检查应用更新**”,更新“智慧生活基础服务”。
-
-**Hi3861开发板开发准备工作:**
-
-- 本指导基于Hi3861开发板为例,请准备Hi3861开发板(HiSpark Wi-Fi IoT智能家居套件)。
-- 下载[HUAWEI DevEco Device Tool 3.0 Beta1](https://device.harmonyos.com/cn/ide#download_beta) Linux版本,并搭建好[Ubuntu开发环境](https://device.harmonyos.com/cn/docs/documentation/guide/install_ubuntu-0000001072959308)。
-- 获取OpenHarmony源码,版本为1.1.0 LTS全量代码,获取方式请参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md)。
-- 获取[Hi3861开发板Demo代码](https://gitee.com/openharmony-sig/knowledge_demo_smart_home/tree/master/dev/team_x/demo_winder),用于Hi3861开发板配网和接收设备控制指令。
-
-接下来,熟悉碰一碰特性的主要开发流程,如下图所示。
-
-
-
diff --git a/zh-cn/device-dev/guide/onehop-open-atomic-service.md b/zh-cn/device-dev/guide/onehop-open-atomic-service.md
deleted file mode 100644
index d2acc53123cb3cfa16cdfc91b819df276617c15b..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-open-atomic-service.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# 碰一碰拉起原子化服务
-
-通过手机碰一碰Hi3861开发板的NFC标签,手机会自动为Hi3861开发板连接WLAN,并配置手机与Hi3861开发板之间的通信通道,从而拉起设备配网/控制原子化服务。
-
-
-
-在碰一碰拉起原子化服务前,手机需要登录华为帐号,该帐号需要与在“应用调测助手”中申请Product ID时登录的华为帐号保持一致。
-
-1. 打开手机NFC功能,确认手机已经接入WLAN无线网络。
-2. 在每次触碰NFC标签前,请点击Hi3861开发板的**RST**复位按键,对Hi3861开发板进行复位。
-3. 使用手机背部接触NFC标签,NFC标签会弹出以下页面。
-
- > **说明:**
- >在触碰NFC标签时,请将手机与开发板保持在5cm以内的距离,如果未能发现设备,请重新触碰NFC标签。
-
- 
-
-4. 点击配网,并等待配网完成。
-
- > **说明:**
- >如果出现“扫描设备失败”,可以根据如下操作进行重试。
- >1. 断开手机的WLAN连接,然后再重新连接WLAN。
- >2. 点击Hi3861开发板的**RST**复位按键,对Hi3861开发板进行复位。
- >3. 重新触碰NFC标签进行配网。
-
- 
-
-5. 配网完成后自动跳转到设备控制页面半屏态, 向上滑动后,点击**查看更多**跳转到全屏态。
-
- 
-
-6. 在设备控制页面进行操作,可以在Hi3861开发板的液晶显示屏上,查看是否能够收到相应指令。
-
- 
-
-
-至此,恭喜您已完成碰一碰特性的开发与体验。
-
diff --git a/zh-cn/device-dev/guide/onehop-overview.md b/zh-cn/device-dev/guide/onehop-overview.md
deleted file mode 100644
index f63ba0758697205cea400963891c145c9d48b950..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-overview.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# 碰一碰概述
-
-> **说明:**
->本指导仅用于个人开发者体验HarmonyOS碰一碰特性,并不能作为商用方案进行碰一碰特性的开发和上架。如需开发商用版本的碰一碰特性,请参考[HarmonyOS Connect原子化服务开发](https://developer.huawei.com/consumer/cn/doc/development/SmartDevicePartner-Guides/atomic-service-overview-0000001136377936)指导。
-
-碰一碰特性,是HarmonyOS具备的多终端业务协同技术。其依托NFC短距通信协议,通过碰一碰的交互方式,将手机和全场景设备连接起来。然后通过手机端的原子化服务能力,快速完成配网、远程控制的能力,解决了应用与设备之间接续慢、配网复杂、传输难的问题,为用户带来无缝切换的流畅体验。
-
-华为基于HarmonyOS的碰一碰、原子化服务等能力,为开发者提供全流程的模板代码和API,包括原子化服务配网模板、控制模板等。开发者只需修改模板代码中的配置项,即可完成原子化服务的开发。然后通过碰一碰能力,免安装拉起原子化服务,快速完成设备配网,体验设备控制。碰一碰特性拥有以下体验:
-
-- **设备连接**
-
- “碰一碰”是用户连接设备控制服务的开端。手机“碰一碰”未连接的设备,在手机端拉起设备配网原子化服务,快速完成手机与设备的配网。
-
-- **快捷控制**
-
- 快捷控制是日常使用的核心功能,大多数的设备控制功能可以通过原子化服务的卡片功能即可实现。
-
-- **扩展服务**
-
- 当需要向用户提供更丰富的扩展服务时,可以在原子化服务中开发丰富的交互能力,并通过卡片进入到原子化服务界面,适用于更加复杂的功能使用场景。
-
-
-
-
diff --git a/zh-cn/device-dev/guide/onehop-reference-info.md b/zh-cn/device-dev/guide/onehop-reference-info.md
deleted file mode 100644
index 2241572c474d0845b5bfe229217ad9455b9f6c52..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-reference-info.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# 参考信息
-
-- **[设备配网原子化服务开发指导](guide-atomic-service-netconfig.md)**
-
-- **[设备控制原子化服务开发指导](guide-atomic-service-device-ctrl.md)**
-
-
diff --git a/zh-cn/device-dev/guide/onehop-write-nfc-info.md b/zh-cn/device-dev/guide/onehop-write-nfc-info.md
deleted file mode 100644
index 425dec0872a98bf047607191fc6c5120c54c9ce2..0000000000000000000000000000000000000000
--- a/zh-cn/device-dev/guide/onehop-write-nfc-info.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# 写入NFC标签信息
-
-使用应用调测助手App,申请Product ID,并将Product ID写入到NFC中。
-
-1. 打开手机的NFC功能。
-2. 打开应用调测助手App,选择底部的“NFC”标签页。
-
- 
-
-3. 点击“选择”按钮,若华为帐号未登录,请先登录华为帐号。
-
- 
-
-4. 点击“申请”按钮,输入原子化服务的包名(与模块**src \> main**目录下的config.json中的“bundleName”保持一致),系统会自动分配Product ID。每个帐号最多可申请3个有效的Product ID,每个Product ID的有效期为1个月。Product ID失效后可重新申请。
-
- 
-
-5. 选择已申请的Product ID。
-
- 
-
-6. 输入Hi3861开发板的SN号码。SN号为可选填写,如果开发者需要通过NFC标签获取相关设备信息,可以在这里填写SN号。
-
- 
-
-7. 点击“置入缓存区”按钮,此时数据处于待写入状态。
-
- 
-
-8. 将手机靠近NFC标签,此时开始将缓存区的数据写入到NFC标签中,写入完成后,状态会变为“已成功写入标签”。
-
- 
-
-