diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index 351c3199cdaec9cfb233f29eea1ed1d4f627aa92..7d9144c33955dd35a490e682b6a194705c315810 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -23,6 +23,7 @@ - [Device Management](device/Readme-EN.md) - [Device Usage Statistics](device-usage-statistics/Readme-EN.md) - [DFX](dfx/Readme-EN.md) + - [Internationalization](internationalization/Readme-EN.md) - Tools - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) - Hands-On Tutorials diff --git a/en/application-dev/ability/ability-assistant-guidelines.md b/en/application-dev/ability/ability-assistant-guidelines.md index 94cf4bd493cab791481631f40645ed35e25115f3..09feb5e590a67df877035069f0d80d8765831fd5 100644 --- a/en/application-dev/ability/ability-assistant-guidelines.md +++ b/en/application-dev/ability/ability-assistant-guidelines.md @@ -87,15 +87,15 @@ The ability assistant is pre-installed in the device environment. You can direct ``` aa dump -a ``` - ![aa-dump-a](figures/aa-dump-a.png) + ![aa-dump-a](figures/aa-dump-a.PNG) ``` aa dump -l ``` - ![aa-dump-l](figures/aa-dump-l.png) + ![aa-dump-l](figures/aa-dump-l.PNG) ``` aa dump -i 12 ``` -![aa-dump-i](figures/aa-dump-i.png) + ![aa-dump-i](figures/aa-dump-i.PNG) - **force-stop** Forcibly stops a process based on the bundle name. diff --git a/en/application-dev/ability/fa-formability.md b/en/application-dev/ability/fa-formability.md index 833890df17b8f5747b85b09ea09e2c470419fa67..113dd7d05803334bc40b5d6ad6c7d84a97ad5388 100644 --- a/en/application-dev/ability/fa-formability.md +++ b/en/application-dev/ability/fa-formability.md @@ -325,3 +325,11 @@ You can use HML, CSS, and JSON to develop the UI page for a JavaScript-programme Now you've got a widget shown below. ![fa-form-example](figures/fa-form-example.png) + +## Development Example + +The following sample is provided to help you better understand how to develop a widget on the FA model: + +[eTSFormAbility](https://gitee.com/openharmony/app_samples/tree/master/ability/eTSFormAbility) + +This **eTSFormAbility** sample provides a widget. Users can create, update, and delete widgets on the home screen of their phones or by using their own widget host. This sample also implements widget information persistence by using lightweight data storage. diff --git a/en/application-dev/application-dev-website.md b/en/application-dev/application-dev-website.md index d011e219ca52ebc7014e48458bb01be47dfba7d6..f910c4bacdaa086b525610972f99a3154b232ea0 100644 --- a/en/application-dev/application-dev-website.md +++ b/en/application-dev/application-dev-website.md @@ -496,23 +496,23 @@ - [@ohos.application.uriPermissionManager](reference/apis/js-apis-uripermissionmanager.md) - [@ohos.application.Want](reference/apis/js-apis-application-Want.md) - [@ohos.wantAgent](reference/apis/js-apis-wantAgent.md) - - ability/[dataAbilityHelper](reference/apis/js-apis-dataAbilityHelper.md) - - app/[context](reference/apis/js-apis-Context.md) - - application/[AbilityContext](reference/apis/js-apis-ability-context.md) - - application/[abilityDelegator](reference/apis/js-apis-application-abilityDelegator.md) - - application/[abilityDelegatorArgs](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - application/[abilityMonitor](reference/apis/js-apis-application-abilityMonitor.md) - - application/[AbilityRunningInfo](reference/apis/js-apis-abilityrunninginfo.md) - - application/[AbilityStageContext](reference/apis/js-apis-abilitystagecontext.md) - - application/[Context](reference/apis/js-apis-application-context.md) - - application/[ExtensionContext](reference/apis/js-apis-extension-context.md) - - application/[ExtensionRunningInfo](reference/apis/js-apis-extensionrunninginfo.md) - - application/[FormExtensionContext](reference/apis/js-apis-formextensioncontext.md) - - application/[MissionSnapshot](reference/apis/js-apis-application-MissionSnapshot.md) - - application/[PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) - - application/[ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md) - - application/[ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md) - - application/[shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md) + - [dataAbilityHelper](reference/apis/js-apis-dataAbilityHelper.md) + - [context](reference/apis/js-apis-Context.md) + - [AbilityContext](reference/apis/js-apis-ability-context.md) + - [abilityDelegator](reference/apis/js-apis-application-abilityDelegator.md) + - [abilityDelegatorArgs](reference/apis/js-apis-application-abilityDelegatorArgs.md) + - [abilityMonitor](reference/apis/js-apis-application-abilityMonitor.md) + - [AbilityRunningInfo](reference/apis/js-apis-abilityrunninginfo.md) + - [AbilityStageContext](reference/apis/js-apis-abilitystagecontext.md) + - [Context](reference/apis/js-apis-application-context.md) + - [ExtensionContext](reference/apis/js-apis-extension-context.md) + - [ExtensionRunningInfo](reference/apis/js-apis-extensionrunninginfo.md) + - [FormExtensionContext](reference/apis/js-apis-formextensioncontext.md) + - [MissionSnapshot](reference/apis/js-apis-application-MissionSnapshot.md) + - [PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) + - [ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md) + - [ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md) + - [shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md) - Common Event and Notification @@ -520,7 +520,7 @@ - [@ohos.events.emitter](reference/apis/js-apis-emitter.md) - [@ohos.notification](reference/apis/js-apis-notification.md) - [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md) - - application/[EventHub](reference/apis/js-apis-eventhub.md) + - [EventHub](reference/apis/js-apis-eventhub.md) - Bundle Management @@ -578,7 +578,7 @@ - [@ohos.data.preferences](reference/apis/js-apis-data-preferences.md) - [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md) - [@ohos.settings](reference/apis/js-apis-settings.md) - - data/rdb/[resultSet](reference/apis/js-apis-data-resultset.md) + - [resultSet](reference/apis/js-apis-data-resultset.md) - File Management diff --git a/en/application-dev/background-task-management/background-task-dev-guide.md b/en/application-dev/background-task-management/background-task-dev-guide.md index c504299cc8de51b6a992545fb939154cb5365a82..ac0d55e8ec04c89ca999338f14bd2b1568546adc 100644 --- a/en/application-dev/background-task-management/background-task-dev-guide.md +++ b/en/application-dev/background-task-management/background-task-dev-guide.md @@ -36,12 +36,12 @@ import backgroundTaskManager from '@ohos.backgroundTaskManager'; ```js import backgroundTaskManager from '@ohos.backgroundTaskManager'; - + let myReason = 'test requestSuspendDelay'; let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { console.info("Request suspension delay will time out."); }); - + var id = delayInfo.requestId;console.info("requestId is: " + id); ``` @@ -106,36 +106,53 @@ ohos.permission.KEEP_BACKGROUND_RUNNING | function stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): void;
function stopBackgroundRunning(context: Context): Promise<void>; | Cancels the continuous task.| -For details about **WantAgent**, see [WantAgent](../reference/apis/js-apis-notification.md#WantAgent). - +For details about **wantAgent**, see [WantAgent](../reference/apis/js-apis-wantAgent.md). **Table 4** Background modes -| Name| ID Value| Description| -| -------- | -------- | -------- | -| DATA_TRANSFER | 1 | Data transfer.| -| AUDIO_PLAYBACK | 2 | Audio playback.| -| AUDIO_RECORDING | 3 | Audio recording.| -| LOCATION | 4 | Positioning and navigation.| -| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.| -| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.| -| WIFI_INTERACTION | 7 | WLAN-related task (reserved).| -| VOIP | 8 | Voice and video call (reserved).| -| TASK_KEEPING | 9 | Computing task (for PC only).| + +| Name| ID Value| Description| Item| +| -------- | -------- | -------- | -------- | +| DATA_TRANSFER | 1 | Data transfer.| dataTransfer | +| AUDIO_PLAYBACK | 2 | Audio playback.| audioPlayback | +| AUDIO_RECORDING | 3 | Audio recording.| audioRecording | +| LOCATION | 4 | Positioning and navigation.| location | +| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.| bluetoothInteraction | +| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.| multiDeviceConnection | +| WIFI_INTERACTION | 7 | WLAN-related task (reserved).| wifiInteraction | +| VOIP | 8 | Voice and video call (reserved).| voip | +| TASK_KEEPING | 9 | Computing task (for PC only).| taskKeeping | ## How to Develop -1. Declare the continuous task permission in the **config.json** file. +1. Configure the continuous task permission and background mode type in the **config.json** file, with the ability type set to **service**. ```json "module": { - "package": "com.example.myapplication", - ..., - "reqPermissions": [ - { - "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" - } - ] + "package": "com.example.myapplication", + + "abilities": [ + + { + "backgroundModes": [ + "dataTransfer", + "location", + + ], + + "type": "service" + } + ], + "defPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + } + ] } ``` @@ -174,13 +191,13 @@ For details about **WantAgent**, see [WantAgent](../reference/apis/js-apis-notif ```js import backgroundTaskManager from '@ohos.backgroundTaskManager'; import featureAbility from '@ohos.ability.featureAbility'; - + backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() => { console.info("Operation succeeded"); }).catch((err) => { console.error("Operation failed Cause: " + err); }); - + ``` ## Development Examples diff --git a/en/application-dev/device/Readme-EN.md b/en/application-dev/device/Readme-EN.md index bc0820d7d17b61f8c9c56cc7f7c26448cb4a33d6..f77f56a5cab3c2d3765762fe6790566405e9c119 100644 --- a/en/application-dev/device/Readme-EN.md +++ b/en/application-dev/device/Readme-EN.md @@ -11,5 +11,5 @@ - [Sensor Overview](sensor-overview.md) - [Sensor Development](sensor-guidelines.md) - Vibrator - - [vibrator-Overview.md](vibrator-overview.md) + - [Vibrator Overview](vibrator-overview.md) - [Vibrator Development](vibrator-guidelines.md) diff --git a/en/application-dev/device/figures/0752d302-aeb9-481a-bb8f-e5524eb61eeb.png b/en/application-dev/device/figures/0752d302-aeb9-481a-bb8f-e5524eb61eeb.png new file mode 100644 index 0000000000000000000000000000000000000000..5319d27596ecc0de2dabb1141d6feb855c2819d9 Binary files /dev/null and b/en/application-dev/device/figures/0752d302-aeb9-481a-bb8f-e5524eb61eeb.png differ diff --git a/en/application-dev/device/figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png b/en/application-dev/device/figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png new file mode 100644 index 0000000000000000000000000000000000000000..3179d91ecc9e0ab5d7fbcf40f3378cb53997dff7 Binary files /dev/null and b/en/application-dev/device/figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png differ diff --git a/en/application-dev/device/sensor-guidelines.md b/en/application-dev/device/sensor-guidelines.md index 88d24d59bc4885135b92302c3446c7c81bd33d5d..6d8b040b11db1a0a225b1344b39526dc2493008a 100644 --- a/en/application-dev/device/sensor-guidelines.md +++ b/en/application-dev/device/sensor-guidelines.md @@ -22,16 +22,16 @@ ## Available APIs - | Module | API | Description | +| Module| API| Description| | -------- | -------- | -------- | -| ohos.sensor | sensor.on(sensorType,callback:AsyncCallback<Response>):void | Subscribes to data changes of a type of sensor. | -| ohos.sensor | sensor.once(sensorType,callback:AsyncCallback<Response>):void | Subscribes to only one data change of a type of sensor. | -| ohos.sensor | sensor.off(sensorType,callback:AsyncCallback<void>):void | Unsubscribes from sensor data changes. | +| ohos.sensor | sensor.on(sensorType, callback:AsyncCallback<Response>): void | Subscribes to data changes of a type of sensor.| +| ohos.sensor | sensor.once(sensorType, callback:AsyncCallback<Response>): void | Subscribes to only one data change of a type of sensor.| +| ohos.sensor | sensor.off(sensorType, callback:AsyncCallback<void>): void | Unsubscribes from sensor data changes.| ## How to Develop -1. To obtain data from a type of sensor, configure the request permissions in the **config.json** file. +1. To obtain data from a type of sensor, configure the request permissions in the **config.json** file. ``` "reqPermissions":[ @@ -67,67 +67,47 @@ "when":"inuse" } }, - { - "name":"ohos.permission.VIBRATE", - "reason"":"", - "usedScene":{ - "ability": [".MainAbility"], - "when":"inuse" - } - }, ] ``` - + 2. Subscribe to data changes of a type of sensor. ``` import sensor from "@ohos.sensor" - sensor.on(type:sensorType,function(error,data){ - if (error) {// The call fails, and error.code and error.message are printed. - console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message); - return; - }; + sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){ console.info("Subscription succeeded. data = "+ data);// The call is successful, and the obtained sensor data is printed. } ); ``` - + The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**. - + ![en-us_image_0000001241693881](figures/en-us_image_0000001241693881.png) 3. Unsubscribe from sensor data changes. ``` import sensor from "@ohos.sensor" - sensor.off(type:sensorType,function(error) { - if (error) {// The unsubscription fails, and error.code and error.message are printed. - console.error("Failed to unsubscribe from acceleration sensor data. Error code: " + error.code + "; message: " + error.message); - return; - }; + sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() { console.info("Succeeded in unsubscribing from acceleration sensor data.");// The unsubscription is successful, and the result is printed. } ); ``` - + The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**. - + ![en-us_image_0000001196654004](figures/en-us_image_0000001196654004.png) 4. Subscribe to only one data change of a type of sensor. ``` import sensor from "@ohos.sensor" - sensor.once(tyep:sensorType,function(error, data) { - if (error) {// The call fails, and error.code and error.message are printed. - console.error("Failed to obtain data. Error code: " + error.code + "; message: " + error.message); - return; - }; - console.info("Data obtained successfully. data="+data);// The call is successful, and the obtained sensor data is printed. + sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { + console.info("Data obtained successfully. data=" + data);// The call is successful, and the obtained sensor data is printed. } ); ``` - + The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**. - + ![en-us_image_0000001241733907](figures/en-us_image_0000001241733907.png) diff --git a/en/application-dev/device/sensor-overview.md b/en/application-dev/device/sensor-overview.md index ea75d0b5dfc4a0611d118d5ddb9fbbaac1345bc5..c45dd69eea4372c41a1d5f1dbf93de14e4b40ea5 100644 --- a/en/application-dev/device/sensor-overview.md +++ b/en/application-dev/device/sensor-overview.md @@ -1,88 +1,43 @@ # Sensor Overview -Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via OpenHarmony sensors. Using the APIs provided by OpenHarmony sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications. +Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via the sensors. Using the APIs provided by sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications. -The sensors are classified into the following categories based on their functions: motion, environment, orientation, light, body, and other categories (such as Hall effect sensors). Each category includes different sensor types. A sensor type may be a single physical sensor or a composite of multiple physical sensors. +A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another device (for example, a CPU). Generally, a sensor is composed of sensitive components and conversion components. Sensors are the cornerstone of the IoT. A unified sensor management framework is required to achieve data sensing at a low latency and low power consumption, thereby keeping up with requirements of "1+8+N" products or business in the Seamless AI Life Strategy. The sensor list is as follows: +| Sensor Type | Sensor Name | Description | Usage | +| --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- | +| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Detecting the motion status | +| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor| Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Measuring the acceleration bias estimation | +| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Detecting the linear acceleration in each axis | +| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Measuring the gravity | +| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the rotation angular velocity | +| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor| Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the bias estimation of the rotation angular velocity | +| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value **0** means that the device does not have a significant motion, and **1** means the opposite.| Detecting significant motions of a device | +| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step).| Detecting whether a user takes a step | +| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked | +| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature | +| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Creating a compass | +| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Measuring the magnetic field bias estimation | +| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity | +| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure | +| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad.| Providing the three orientation angles of the screen | +| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor.| Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system | +| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call | +| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top| +| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data | +| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables | +| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device | - **Table1** Motion - ohos.sensor.agent.CategoryMotionAgent -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2. | Detecting the motion status | -| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor | Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2. | Measuring the acceleration bias estimation | -| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2. | Detecting the linear acceleration in each axis | -| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2. | Measuring the gravity | -| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the rotation angular velocity | -| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor | Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the bias estimation of the rotation angular velocity | -| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value can be **0** (having no significant motion) or **1** (having a significant motion). | Detecting significant motions of a device | -| SENSOR_TYPE_DROP_DETECTION | Drop detection sensor | Detects the device drop status. The value can be **0** (the device is not dropped) or **1** (the device is dropped). | Detecting whether a device is dropped | -| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step). | Detecting whether a user takes a step | -| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked | +## Working Principles +The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HDF layer. - **Table2** Environment - ohos.sensor.agent.CategoryOrientationAgent + **Figure 1** How the sensor works -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor. | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature | -| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Creating a compass | -| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Measuring the magnetic field bias estimation | -| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity | -| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure | -| SENSOR_TYPE_SAR | Specific Absorption Rate (SAR) sensor | Measures the SAR, in the unit of W/kg. | Measuring the SAR of electromagnetic waves for a device | - - - **Table3** Orientation - ohos.sensor.agent.CategoryOrientationAgent - -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_6DOF | Degrees of Freedom (DoF) sensor | Measures the forward/backward, up/down, and left/right translational movement of a device on the three axes (X, Y, and Z) in the unit of m or mm as well as the roll, pitch, and yaw rotation angles on the three axes (X, Y, and Z) in the unit of rad. | Positioning an object by detecting its freedom of translational and rotational motions, for example, VR | -| SENSOR_TYPE_SCREEN_ROTATION | Screen rotation sensor | Checks the rotation status of the device screen. | Detecting whether the device screen is rotating | -| SENSOR_TYPE_DEVICE_ORIENTATION | Device orientation sensor | Measures the rotation angles of the device, in the unit of rad. | Measuring the angles that a device has rotated | -| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad. | Providing the three orientation angles of the screen | -| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor. | Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system | -| SENSOR_TYPE_GAME_ROTATION_VECTOR
SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | Game rotation vector sensor
Geomagnetic rotation vector sensor | Measures the game rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and gyroscope sensor.
Measures the geomagnetic rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and magnetic field sensor. | Applied in games
Measuring the geomagnetic rotation vector | - - - **Table4** Light - ohos.sensor.agent.CategoryLightAgent - -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call | -| SENSOR_TYPE_TOF | Time of flight (ToF) sensor | Measures the time required for light to travel a distance in the medium. | Facial recognition | -| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top | -| SENSOR_TYPE_COLOR_TEMPERATURE | Color temperature sensor | Measures the ambient color temperature. | Image processing on the device | -| SENSOR_TYPE_COLOR_RGB | RGB color sensor | Measures the ambient RGB color values. | Color detection implemented by the reflectance of RGB colors | -| SENSOR_TYPE_COLOR_XYZ | XYZ color sensor | Measures the ambient XYZ color values. | Identifying true-color spots to reproduce more natural colors | - - - **Table5** Body - ohos.sensor.agent.CategoryBodyAgent - -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data | -| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables | - - - **Table6** Others - -| Sensor Type | Sensor Name | Description | Usage | -| -------- | -------- | -------- | -------- | -| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device | -| SENSOR_TYPE_GRIP_DETECTOR | Grip detection sensor | Detects grip force applied on a device. | Detecting whether the device is gripped on its sides | -| SENSOR_TYPE_MAGNET_BRACKET | Magnet bracket sensor | Checks whether a device is magnetized. | Detecting an in-vehicle or indoor device | -| SENSOR_TYPE_PRESSURE_DETECTOR | Pressure detection sensor | Detects pressure force applied on a device. | Detecting pressure on the top of the device | - - -## How a Service Is Shared Using Huawei Share - -The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HD_IDL. - - **Figure1** Working principles for OpenHarmony sensors - ![en-us_image_0000001226521897](figures/en-us_image_0000001226521897.png) +![fad1a124-a90e-460f-84fc-e87d6caebb21](figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png) - Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler. @@ -90,22 +45,22 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso - Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions. -- HD_IDL: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices. +- HDF layer: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices. -## Limitations and Constraints +## Constraints -To obtain data of the following sensors, you must claim the required permissions. +1. To obtain data of the following sensors, you must claim the required permissions. + Table 7 Sensor data permissions - **Table7** Sensor data permission + | Sensor | Permission | Sensitivity | Permission Description | + | ------------------------- | -------------------------------- | ------------ | ----------------------- | + | Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category.| + | Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.| + | Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. | + | Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. | -| Sensor | Permission Name | Sensitivity | Permission Description | -| -------- | -------- | -------- | -------- | -| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor | ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category. | -| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows your application to subscribe to data of these gyroscope-related sensors in the motion category. | -| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows your application to subscribe to the motion status. | -| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows your application to read health data. | -The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting. +2. The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting. diff --git a/en/application-dev/device/vibrator-guidelines.md b/en/application-dev/device/vibrator-guidelines.md index 88bdeb6884eee52e1591993ec60099d31eb77e3c..982d6c9b0983684729ea41b1d3b45ab9409a43e5 100644 --- a/en/application-dev/device/vibrator-guidelines.md +++ b/en/application-dev/device/vibrator-guidelines.md @@ -8,20 +8,20 @@ You can set different vibration effects as needed, for example, customizing vibr ## Available APIs - | Module | API | Description | + | Module| API| Description| | -------- | -------- | -------- | -| ohos.vibrator | vibrate(duration: number): Promise<void> | Triggers vibration with the specified duration. This API uses a promise to return the result. | -| ohos.vibrator | vibrate(duration: number, callback?: AsyncCallback<void>): void | Triggers vibration with the specified duration. This API uses a callback to return the result. | -| ohos.vibrator | vibrate(effectId: EffectId): Promise<void> | Triggers vibration with the specified effect. This API uses a promise to return the result. | -| ohos.vibrator | vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void | Triggers vibration with the specified effect. This API uses a callback to return the result. | -| ohos.vibrator | stop(stopMode: VibratorStopMode): Promise<void> | Stops vibration. This API uses a promise to return the result. | -| ohos.vibrator | stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void | Stops vibration. This API uses a callback to return the result. | +| ohos.vibrator | vibrate(duration: number): Promise<void> | Triggers vibration with the specified duration. This API uses a promise to return the result.| +| ohos.vibrator | vibrate(duration: number, callback?: AsyncCallback<void>): void | Triggers vibration with the specified duration. This API uses a callback to return the result.| +| ohos.vibrator | vibrate(effectId: EffectId): Promise<void> | Triggers vibration with the specified effect. This API uses a promise to return the result.| +| ohos.vibrator | vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void | Triggers vibration with the specified effect. This API uses a callback to return the result.| +| ohos.vibrator | stop(stopMode: VibratorStopMode): Promise<void> | Stops vibration. This API uses a promise to return the result.| +| ohos.vibrator | stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void | Stops vibration. This API uses a callback to return the result.| ## How to Develop -1. Declare the permissions required for controlling vibrators on the hardware device in the **config.json** file. - +1. Declare the permissions required for controlling vibrators on the hardware device in the **config.json** file. + ``` "reqPermissions":[ { @@ -58,26 +58,26 @@ You can set different vibration effects as needed, for example, customizing vibr ``` 2. Trigger the device to vibrate. - + ``` import vibrator from "@ohos.vibrator" - vibrator.vibrate(duration: number).then((error)=>{ - if(error){// The call fails, and error.code and error.message are printed. - console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); - }else{// The call succeeded. The device starts to vibrate. - console.log("Promise returned to indicate a successful vibration.") + vibrator.vibrate(1000).then((error)=>{ + if (error) {// The call fails, and error.code and error.message are printed. + Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); + }else{// The call is successful, and the device starts to vibrate. + Console.log("Promise returned to indicate a successful vibration.") }; }) ``` 3. Stop the vibration. - + ``` import vibrator from "@ohos.vibrator" - vibrator.stop(stopMode: VibratorStopMode).then((error)=>{ - if(error){// The call fails, and error.code and error.message are printed. - console.log("Promise return failed. error.code"+error.code+"error.message"+error.message); - }else{// The call succeeded. The device stops vibration. + vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ + if (error) {// The call fails, and error.code and error.message are printed. + Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); + }else{// The call is successful, and the device stops vibration. Console.log("Promise returned to indicate a successful stop."); }; }) diff --git a/en/application-dev/device/vibrator-overview.md b/en/application-dev/device/vibrator-overview.md index 3d8f187054dd1f0da3e3099bd10e3cb28e5a9b15..88460b4fe415d836a687363c10ceda68c1e98390 100644 --- a/en/application-dev/device/vibrator-overview.md +++ b/en/application-dev/device/vibrator-overview.md @@ -6,10 +6,11 @@ The vibrator service opens up the latest capabilities of the vibrator hardware t ## Working Principles -The vibrator is a Misc device that consists of four modules: Vibrator API, Vibrator Framework, Vibrator Service, and HD_IDL. +The vibrator is a Misc device that consists of four modules: Vibrator API, Vibrator Framework, Vibrator Service, and HDF layer. - **Figure1** Vibrator in Misc devices - ![en-us_image_0000001180249428](figures/en-us_image_0000001180249428.png) + **Figure 1** Vibrator in Misc devices + +![0752d302-aeb9-481a-bb8f-e5524eb61eeb](figures/0752d302-aeb9-481a-bb8f-e5524eb61eeb.png) - Vibrator API: provides basic vibrator APIs, including the APIs for querying the vibrator list, querying the vibrator by effect, and triggering and stopping vibration. @@ -17,9 +18,9 @@ The vibrator is a Misc device that consists of four modules: Vibrator API, Vibra - Vibrator Service: manages services of vibrators. -- HD_IDL: adapts to different devices. +- HDF layer: adapts to different devices. ## Constraints -When using a vibrator, you need to declare and obtain the **ohos.permission.VIBRATE** permission first so that you can control the vibration effect. +When using a vibrator, you must declare the **ohos.permission.VIBRATE** permission before you can control the vibration effect. The sensitivity level of this permission is **system_grant**. diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index 05b002296fc52b6931993f1c512e968f3eb9acf8..946e975a2bf13af7c1ce8d159ad144a66baf720c 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -20,9 +20,22 @@ Note: Video playback requires hardware capabilities such as display, audio, and 2. The third-party application transfers the surface ID to the VideoPlayer JS. 3. The media service flushes the frame data to the surface buffer. +## Compatibility + +You are advised to use the mainstream playback formats and resolutions, rather than custom or abnormal streams to avoid playback failure, frame freezing, and artifacts. The system is not affected by incompatibility issues. If such an error occurs, you can exit stream playback mode. + +The table below lists the mainstream playback formats and resolutions. + +| Video Container Specification| Specification Description | Resolution | +| :----------: | :-----------------------------------------------: | :--------------------------------: | +| mp4 | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| +| mkv | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| +| ts | Video format: H.264/MPEG-2/MPEG-4; audio format: AAC/MP3 | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| +| webm | Video format: VP8; audio format: VORBIS | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| + ## How to Develop -For details about the APIs used for video playback, see [js-apis-media.md](../reference/apis/js-apis-media.md). +For details about the APIs, see [VideoPlayer in the Media API](../reference/apis/js-apis-media.md). ### Full-Process Scenario diff --git a/en/application-dev/quick-start/start-overview.md b/en/application-dev/quick-start/start-overview.md index 4d345e40f3dd34961f6fdbb123927bdaf9aa09df..c953f0fee4c71547862cd43f7013060ed110a7be 100644 --- a/en/application-dev/quick-start/start-overview.md +++ b/en/application-dev/quick-start/start-overview.md @@ -39,7 +39,7 @@ This document provides a Page ability instance with two pages. For more informat ## Tool Preparation -1. Install the latest version of [DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta). +1. Install the latest version of [DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony). 2. Install DevEco Studio and configure the development environment. For details, see [Configuring the OpenHarmony SDK](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-setting-up-environment-0000001263160443). diff --git a/en/application-dev/quick-start/start-with-ets.md b/en/application-dev/quick-start/start-with-ets.md index 19c8840d4653f78790cf16eb5f0dcc5d901d643b..81510bef091d24e28c39acca75ab2f701151eaab 100644 --- a/en/application-dev/quick-start/start-with-ets.md +++ b/en/application-dev/quick-start/start-with-ets.md @@ -3,7 +3,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > To use eTS, your DevEco Studio must be V3.0.0.601 Beta1 or later. > -> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) for your development. +> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony) for your development. ## Creating an eTS Project diff --git a/en/application-dev/quick-start/start-with-js-low-code.md b/en/application-dev/quick-start/start-with-js-low-code.md index 14dc7309312950d323c7b0998c416132632f696e..d3903efb997c27c24d7f489068a3dab8d3ccf34d 100644 --- a/en/application-dev/quick-start/start-with-js-low-code.md +++ b/en/application-dev/quick-start/start-with-js-low-code.md @@ -3,7 +3,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > This feature will be available in DevEco Studio V2.2 Beta1 and later versions. > -> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) for your development. +> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony) for your development. On the OpenHarmony low-code development pages, you can design your app UI in an efficient, intuitive manner, with a wide array of UI editing features complying with [JS Development Specifications](../reference/apis). diff --git a/en/application-dev/quick-start/start-with-js.md b/en/application-dev/quick-start/start-with-js.md index 3ca8fd4998d1a3feade174150fc8dde137d23478..b2ad7acd9e16e6e0f667facc4e5608860f0853e2 100644 --- a/en/application-dev/quick-start/start-with-js.md +++ b/en/application-dev/quick-start/start-with-js.md @@ -1,7 +1,7 @@ # Getting Started with JavaScript in the Traditional Coding Approach > ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** -> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta) for your development. +> For best possible results, use [DevEco Studio V3.0.0.900 Beta3](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony) for your development. ## Creating a JavaScript Project diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index 4b2526ce8336f5ae3391f0652cbf17dacb7c6f54..7beee10809e0b7252c65ed514180413bc92f10bb 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -880,9 +880,9 @@ Obtains the context of the application. **Return value** -| Parameters | Type | Description | -| --------------- | ------------------------- |------ | -| Context | Context |Application context.| +| Type | Description | +| --------- |------ | +| Context |Application context.| **Example** @@ -908,7 +908,7 @@ var context = featureAbility.getContext().getApplicationContext(); | ----------- | -------- | -------------- | ---- | ------------------ | | requestCode | Read-only | number | Yes | Request code passed.| | permissions | Read-only | Array\ | Yes | Permissions requested. | -| authResults | Read-only | Array\ | Yes | Permission request result. | +| authResults | Read-only | Array\ | Yes | Permission request result. | ## HapModuleInfo diff --git a/en/application-dev/reference/apis/js-apis-connectedTag.md b/en/application-dev/reference/apis/js-apis-connectedTag.md new file mode 100644 index 0000000000000000000000000000000000000000..5e76a594771be99634ac1cfd7e3b7089b8a58ba3 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-connectedTag.md @@ -0,0 +1,223 @@ +# Active Tag + +> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +``` +import connectedTag from '@ohos.connectedTag'; +``` + + +## connectedTag.init + +init(): boolean + +Initializes the active tag chip. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Return value + | **Type**| **Description**| + | -------- | -------- | + | boolean | Returns **true** if the initialization is successful; returns **false** otherwise.| + + +## connectedTag.uninit + +uninit(): boolean + +Uninitializes the active tag resources. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Return value + | **Type**| **Description**| + | -------- | -------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + + +## connectedTag.readNdefTag + +readNdefTag(): Promise<string> + +Reads the content of this active tag. This method uses a promise to return the result. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Return value + | **Type**| **Description**| + | -------- | -------- | + | Promise<string> | Promise used to return the content of the active tag.| + +- Example + ``` + import connectedTag from '@ohos.connectedTag'; + + connectedTag.readNdefTag().then(result => { + console.log("promise recv ndef response: " + result); + }); + ``` + +## connectedTag.readNdefTag + +readNdefTag(callback: AsyncCallback<string>): void + +Reads the content of this active tag. This method uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Parameters + | **Name**| **Type**| **Mandatory**| **Description**| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<string> | Yes| Callback invoked to return the active tag content obtained.| + +- Example + ``` + import connectedTag from '@ohos.connectedTag'; + + connectedTag.readNdefTag(result => { + console.log("callback recv ndef response: " + result); + }); + ``` + +## connectedTag.writeNdefTag + +writeNdefTag(data: string): Promise<void> + +Writes data to this active tag. This method uses a promise to return the result. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Parameters + | **Name**| **Type**| **Mandatory**| **Description**| + | -------- | -------- | -------- | -------- | + | data | string | Yes| Data to write. The maximum length is 1024 bytes.| + +- Return value + | **Type**| **Description**| + | -------- | -------- | + | Promise<void> | Promise used to return the result. This method returns no value.| + +- Example + ``` + import connectedTag from '@ohos.connectedTag'; + + writeNdefTag.write("010203") + .then((value) => { + // Data is written to the tag. + console.log(`success to write event: ${value}`); + }).catch((err) => { + // Failed to write data to the tag. + console.error(`failed to write event because ${err.code}`); + }); + ``` + +## connectedTag.writeNdefTag + +writeNdefTag(data: string, callback: AsyncCallback<string>): void + +Writes data to this active tag. This method uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Parameters + | **Name**| **Type**| **Mandatory**| **Description**| + | -------- | -------- | -------- | -------- | + | data | string | Yes| Data to write. The maximum length is 1024 bytes.| + | callback | AsyncCallback<string> | Yes| Callback invoked to return the operation result.| + +- Example + ``` + import connectedTag from '@ohos.connectedTag'; + + connectedTag.writeNdefTag("010203", (err, value) => { + if (err) { + // Failed to write data to the tag. + console.error(`failed to write event because ${err.code}`); + return; + } + + // Data is written to the tag. + console.log(`success to write event: ${value}`); + }); + ``` + +## connectedTag.on('notify') + +on(type: "notify", callback: Callback<number>): void + +Registers the NFC field strength state events. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Parameters + | **Name**| **Type**| **Mandatory**| **Description**| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is **notify**.| + | callback | Callback<number> | Yes| Callback invoked to return the field strength state.| + +- Enumerates the field strength states. + | **Value**| **Description**| + | -------- | -------- | + | 0 | Field off. | + | 1 | Field on. | + + +## connectedTag.off('notify') + +off(type: "notify", callback?: Callback<number>): void + +Unregisters the NFC field strength state events. + +**Required permissions**: ohos.permission.NFC_TAG + +**System capability**: SystemCapability.Communication.ConnectedTag + +- Parameters + | **Name**| **Type**| **Mandatory**| **Description**| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is **notify**.| + | callback | Callback<number> | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| + +- Example + ``` + import connectedTag from '@ohos.connectedTag'; + + var NFC_RF_NOTIFY = "notify"; + + var recvNfcRfNotifyFunc = result => { + console.info("nfc rf receive state: " + result); + } + + // Register event + connectedTag.on(NFC_RF_NOTIFY, recvNfcRfNotifyFunc); + + // Unregister event + connectedTag.off(NFC_RF_NOTIFY, recvNfcRfNotifyFunc); + ``` + +## NfcRfType + +Enumerates the NFC states. + +| Name| Default Value| Description| +| -------- | -------- | -------- | +| NFC_RF_LEAVE | 0 | Field off. | +| NFC_RF_ENTER | 1 | Field on. | diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index d0c2ad5562ab851003c8e33828fdeb25f5f68847..84eed70f0bdb41b5f876d92459ef832d6ac82754 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -67,7 +67,7 @@ Obtains the default display object. ``` var displayClass = null; display.getDefaultDisplay((err, data) => { - if (err) { + if (err.code) { console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(err)); return; } @@ -119,7 +119,7 @@ Obtains all the display objects. ``` display.getAllDisplay((err, data) => { - if (err) { + if (err.code) { console.error('Failed to obtain all the display objects. Code: ' + JSON.stringify(err)); return; } diff --git a/en/application-dev/reference/apis/js-apis-formhost.md b/en/application-dev/reference/apis/js-apis-formhost.md index 8e890a787adc0cb6b69cbfed2ecbbfabb1ef370d..0cf54af57b8aacb91bb487e49bf8a74074ecc8da 100644 --- a/en/application-dev/reference/apis/js-apis-formhost.md +++ b/en/application-dev/reference/apis/js-apis-formhost.md @@ -51,17 +51,23 @@ deleteForm(formId: string): Promise<void>; Deletes a widget. This API uses a promise to return the result. After this API is called, the application can no longer use the widget, and the Widget Manager will not retain the widget information. +**System capability**: + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| -**Example** +**Parameters** ```js var formId = "12400633174999288"; @@ -144,6 +150,11 @@ SystemCapability.Ability.Form | formId | string | Yes | ID of a widget. | | isReleaseCache | boolean | No | Whether to release the cache.| +**Return value** + + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -188,15 +199,21 @@ requestForm(formId: string): Promise<void>; Requests a widget update. This API uses a promise to return the result. +**System capability** + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -239,7 +256,11 @@ SystemCapability.Ability.Form castTempForm(formId: string): Promise<void>; -Converts a temporary widget to a normal one. This API uses a promise to return the result. +Converts a temporary widget to a normal one. This API uses a promise to return the result. + +**System capability**: + +SystemCapability.Ability.Form **Parameters** @@ -247,9 +268,11 @@ Converts a temporary widget to a normal one. This API uses a promise to return t | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -294,15 +317,21 @@ notifyVisibleForms(formId: string): Promise<void>; Instructs the widget framework to make a widget visible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider. +**System capability**: + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -347,15 +376,21 @@ notifyInvisibleForms(formId: string): Promise<void>; Instructs the widget framework to make a widget invisible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider. +**System capability**: + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -400,15 +435,21 @@ enableFormsUpdate(formId: string): Promise<void>; Instructs the widget framework to make a widget to be updatable. This API uses a promise to return the result. After this API is called, the widget is in the enabled state and can receive updates from the widget provider. +**System capability**: + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -453,15 +494,21 @@ disableFormsUpdate(formId: string): Promise<void>; Instructs the widget framework to make a widget not to be updatable. This API uses a promise to return the result. After this API is called, the widget is in the disabled state and cannot receive updates from the widget provider. +**System capability**: + +SystemCapability.Ability.Form + **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | formId | string | Yes | ID of a widget.| -**System capability**: +**Return value** -SystemCapability.Ability.Form + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -509,6 +556,12 @@ Checks whether the system is ready. This API uses a promise to return the result SystemCapability.Ability.Form +**Return value** + + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + **Example** ```js @@ -686,7 +739,11 @@ SystemCapability.Ability.Form function deleteInvalidForms(formIds: Array<string>): Promise<number>; -Deletes invalid widgets from the list. This API uses a promise to return the result. +Deletes invalid widgets from the list. This API uses a promise to return the result. + +**System capability**: + +SystemCapability.Ability.Form **Parameters** @@ -700,10 +757,6 @@ Deletes invalid widgets from the list. This API uses a promise to return the res | :------------ | :---------------------------------- | | Promise<number> | Promise used to return the number of widgets deleted.| -**System capability**: - -SystemCapability.Ability.Form - **Example** ```js @@ -747,7 +800,7 @@ SystemCapability.Ability.Form ## acquireFormState -function acquireFormState(formIds: Array<string>): Promise<formInfo.FormStateInfo>; +function acquireFormState(want: Want): Promise<FormStateInfo>; Obtains the widget state. This API uses a promise to return the result. @@ -784,7 +837,7 @@ SystemCapability.Ability.Form on(type: "formUninstall", callback: Callback<string>): void; -Subscribes to the widget state changes. This API uses a callback to return the result. +Subscribes to widget uninstall events. **System capability**: @@ -811,7 +864,7 @@ SystemCapability.Ability.Form off(type: "formUninstall", callback: Callback<string>): void; -Unsubscribes from the widget state changes. This API uses a callback to return the result. +Unsubscribes from widget uninstall events. **System capability**: @@ -880,6 +933,12 @@ SystemCapability.Ability.Form | formIds | Array<string> | Yes | List of widget IDs.| | isVisible | boolean | Yes | Whether to be visible.| +**Return value** + + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + **Example** ```js @@ -935,6 +994,12 @@ SystemCapability.Ability.Form | formIds | Array<string> | Yes | List of widget IDs.| | isEnableUpdate | boolean | Yes | Whether to enable update.| +**Return value** + + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-medialibrary.md b/en/application-dev/reference/apis/js-apis-medialibrary.md index ceb96f2481af2d1b8285eb9c4cab71bb87b4e7b9..3df228505ee8923458185f3da35ab6dd1ab92695 100644 --- a/en/application-dev/reference/apis/js-apis-medialibrary.md +++ b/en/application-dev/reference/apis/js-apis-medialibrary.md @@ -968,7 +968,7 @@ close(fd: number, callback: AsyncCallback<void>): void Closes this file asset. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.READ_MEDIA ('r' enabled) and ohos.permission.WRITE_MEDIA ('w' enabled) +**Required permissions**: ohos.permission.READ_MEDIA (when **mode** is set to **r**) and ohos.permission.WRITE_MEDIA (when **mode** is set to **w**) **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -1009,7 +1009,7 @@ close(fd: number): Promise<void> Closes this file asset. This API uses a promise to return the result. -**Required permissions**: ohos.permission.READ_MEDIA ('r' enabled) and ohos.permission.WRITE_MEDIA ('w' enabled) +**Required permissions**: ohos.permission.READ_MEDIA (when **mode** is set to **r**) and ohos.permission.WRITE_MEDIA (when **mode** is set to **w**) **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2128,7 +2128,7 @@ Enumerates media types. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core -| Name | Default Value | Description| +| Name | Default Value| Description| | ----- | ------ | ---- | | FILE | 1 | File.| | IMAGE | 3 | Image.| @@ -2141,7 +2141,7 @@ Enumerates key file information. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core -| Name | Default Value | Description | +| Name | Default Value | Description | | ------------- | ------------------- | ---------------------------------------------------------- | | ID | file_id | File ID. | | RELATIVE_PATH | relative_path | Relative public directory of the file. | @@ -2169,7 +2169,7 @@ Enumerates directory types. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core -| Name | Default Value | Description | +| Name | Default Value| Description | | ------------- | ------ | ------------------ | | DIR_CAMERA | 0 | Directory of camera files.| | DIR_VIDEO | 1 | Directory of video files. | @@ -2184,7 +2184,7 @@ Enumerates device types. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core -| Name | Default Value | Description | +| Name | Default Value| Description | | ------------ | ------ | ---------- | | TYPE_UNKNOWN | 0 | Unknown.| | TYPE_LAPTOP | 1 | Laptop.| diff --git a/en/application-dev/reference/apis/js-apis-mediaquery.md b/en/application-dev/reference/apis/js-apis-mediaquery.md new file mode 100644 index 0000000000000000000000000000000000000000..7cb3263efc4800810a185bf908ae98fef33808ec --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-mediaquery.md @@ -0,0 +1,145 @@ +# Media Query + +> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE** +> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +``` +import mediaquery from '@ohos.mediaquery' +``` + + +## Required Permissions + +None. + + +## mediaquery.matchMediaSync + +matchMediaSync(condition: string): MediaQueryListener + +Sets the media query criteria and returns the corresponding listening handle. + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | condition | string | Yes| Matching condition of a media event.| + +- Return value + | Type| Description| + | -------- | -------- | + | MediaQueryListener | Listening handle to a media event, which is used to register or unregister the listening callback.| + +- Example + ``` + listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events. + ``` + + +## MediaQueryListener + +Media query handle, including the first query result when the handle is applied for. + + +### Attributes + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| matches | boolean | Yes| No| Whether the match condition is met.| +| media | string | Yes| No| Matching condition of a media event.| + + +### on + +on(type: 'change', callback: Callback<MediaQueryResult>): void + +Registers a callback with the corresponding query condition by using the handle. This callback is triggered when the media attributes change. + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Must enter the string **change**.| + | callback | Callback<MediaQueryResult> | Yes| Callback registered with media query.| + +- Example + For details, see [off Example](#off). + + +### off + +off(type: 'change', callback?: Callback<MediaQueryResult>): void + +Unregisters a callback with the corresponding query condition by using the handle, so that no callback is triggered when the media attributes change. +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | boolean | Yes| Must enter the string **change**.| + | callback | Callback<MediaQueryResult> | No| Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.| + +- Example + ``` + import mediaquery from '@ohos.mediaquery' + + listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events. + function onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + // do something here + } else { + // do something here + } + } + this.listener.on('change', this.onPortrait) // Registration callback. + this.listener.off('change', this.onPortrait) // Deregistration callback. + ``` + + +## MediaQueryResult + + +### Attributes + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| matches | boolean | Yes| No| Whether the match condition is met.| +| media | string | Yes| No| Matching condition of a media event.| + + +### Example + +``` +import mediaquery from '@ohos.mediaquery' + +let portraitFunc = null + +@Entry +@Component +struct MediaQueryExample { + @State color: string = '#DB7093' + @State text: string = 'Portrait' + listener = mediaquery.matchMediaSync('(orientation: landscape)') + + onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + this.color = '#FFD700' + this.text = 'Landscape' + } else { + this.color = '#DB7093' + this.text = 'Portrait' + } + } + + aboutToAppear() { + portraitFunc = this.onPortrait.bind(this) //bind current js instance + this.listener.on('change', portraitFunc) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(this.text).fontSize(24).fontColor(this.color) + } + .width('100%').height('100%') + } +} +``` diff --git a/en/application-dev/reference/apis/js-apis-particleAbility.md b/en/application-dev/reference/apis/js-apis-particleAbility.md index 01984d0b1f6b4963885945d635685a30d04b3248..7955a810d33f3b6e9cfe23d6c939c1a83bae92c4 100644 --- a/en/application-dev/reference/apis/js-apis-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-particleAbility.md @@ -384,7 +384,7 @@ Connects this ability to a specific Service ability. This API uses a callback to | Name | Type | Mandatory| Description | | ------- | -------------- | ---- | ---------------------------- | -| request | [Want](js-apis-featureAbility.md#want) | Yes | Service ability to connect.| +| request | [Want](js-apis-featureAbility.md#want) | Yes | Service ability to connect.| | options | ConnectOptions | Yes | Callback used to return the result. | diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index 5b51de9baa01f675421059ab5acdeddd563208e5..d3d17810360c3ffa6074118413daddcb67fce31f 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -141,7 +141,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous | Name | Readable| Writable | Type | Mandatory| Description | | -------- | --- | ---- | ----------------------- | ---- | --------------------------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose bundle name is to be obtained. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the bundle name.| **Example** @@ -213,7 +213,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re | Name | Readable| Writable| Type | Mandatory| Description | | ----- | --- | ---- | --------- | ---- | ------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose bundle name is to be obtained.| +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.| **Return value** @@ -282,7 +282,7 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal | Name | Readable| Writable| Type | Mandatory| Description | | -------- | --- | ---- | ----------------------- | ---- | ----------------------------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose user ID is to be obtained. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the user ID.| **Example** @@ -354,7 +354,7 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return | Name | Readable| Writable| Type | Mandatory| Description | | ----- | --- | ---- | --------- | ---- | ------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose user ID is to be obtained.| +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.| **Return value** @@ -423,7 +423,7 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba | Name | Readable| Writable| Type | Mandatory| Description | | -------- | --- | ---- | --------------------- | ---- | ------------------------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose want is to be obtained. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the want.| **Example** @@ -495,7 +495,7 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th | Name | Readable| Writable| Type | Mandatory| Description | | ----- | --- | ---- | --------- | ---- | ------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose want is to be obtained.| +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.| **Return value** @@ -564,7 +564,7 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return | Name | Readable| Writable| Type | Mandatory| Description | | -------- | --- | ---- | --------------------- | ---- | --------------------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object to cancel. | +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -636,7 +636,13 @@ Cancels a **WantAgent** object. This API uses a promise to return the result. | Name | Readable| Writable| Type | Mandatory| Description | | ----- | --- | ---- | --------- | ---- | ------------- | -| agent | Yes | No | WantAgent | Yes | **WantAgent** object to cancel.| +| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.| + +**Return value** + +| Type | Description | +| --------------- | ------------------------------- | +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-zlib.md b/en/application-dev/reference/apis/js-apis-zlib.md index ea8fbb952b7d1e60150c2659efc25ceb4a8eb674..f1435417e60cc03f23ec9ef79166256000a1c0d8 100644 --- a/en/application-dev/reference/apis/js-apis-zlib.md +++ b/en/application-dev/reference/apis/js-apis-zlib.md @@ -7,6 +7,7 @@ None ```javascript import zlib from '@ohos.zlib'; ``` + ## zlib.zipFile zipFile(inFile:string, outFile:string, options: Options): Promise; Zips a file. This API uses a promise to return the result. @@ -124,7 +125,7 @@ zlib.unzipFile(inFile, outFile, options).then((data) => { ## options -| Name | | +| Name | Description | | --------------------------- | ------------------------------------------------------------ | | level?: CompressLeve | See [zip.CompressLevel](#zip.CompressLevel).| | memLevel?: MemLevel | See [zip.MemLevel](#zip.MemLevel) | @@ -132,12 +133,13 @@ zlib.unzipFile(inFile, outFile, options).then((data) => { ## zip.MemLevel -| MEM_LEVEL_MIN | Minimum memory used by the **zip** API during compression.| +| Name | Description | | ----------------- | -------------------------------- | +| MEM_LEVEL_MIN | Minimum memory used by the **zip** API during compression.| | MEM_LEVEL_MAX | Maximum memory used by the **zip** API during compression.| | MEM_LEVEL_DEFAULT | Default memory used by the **zip** API during compression.| -## zip.CompressLevel +## Zip.CompressLevel | Name | Description | | --------------------------------------- | ----------------- | @@ -146,14 +148,14 @@ zlib.unzipFile(inFile, outFile, options).then((data) => { | COMPRESS_LEVEL_BEST_COMPRESSION :9 | Compression level 9 that gives the best compression. | | COMPRESS_LEVEL_DEFAULT_COMPRESSION : -1| Default compression level. | -## zip.CompressStrategy +## Zip.CompressStrategy | Name | Description | | -------------------------------------- | ------------------------ | | COMPRESS_STRATEGY_DEFAULT_STRATEGY : 0 | Default compression strategy. | | COMPRESS_STRATEGY_FILTERED : 1 | Filtered compression strategy.| | COMPRESS_STRATEGY_HUFFMAN_ONLY : 2 | Huffman coding compression strategy. | -| OMPRESS_STRATEGY_RLE : 3 | RLE compression strategy. | +| COMPRESS_STRATEGY_RLE : 3 | RLE compression strategy. | | COMPRESS_STRATEGY_FIXED : 4 | Fixed compression strategy. | ## zip.ErrorCode diff --git a/en/application-dev/ui/Readme-CN.md b/en/application-dev/ui/Readme-EN.md similarity index 89% rename from en/application-dev/ui/Readme-CN.md rename to en/application-dev/ui/Readme-EN.md index d398aa74d8d44f8da390c879c4a9e83b094b17c4..1e5ecfa6d0b5132a76afe6000b87bcca2a054ab8 100644 --- a/en/application-dev/ui/Readme-CN.md +++ b/en/application-dev/ui/Readme-EN.md @@ -1,4 +1,4 @@ -# UI +# UI Development - [ArkUI Overview](arkui-overview.md) - JavaScript-based Web-like Development Paradigm @@ -27,16 +27,19 @@ - [Defining Events](ui-js-building-ui-event.md) - [Defining Page Routes](ui-js-building-ui-routes.md) - Common Component Development Guidelines - - [<text> Development](ui-js-components-text.md) - - [<input> Development](ui-js-components-input.md) - - [<button> Development](ui-js-components-button.md) - - [<list> Development](ui-js-components-list.md) - - [<picker> Development](ui-js-components-picker.md) - - [<dialog> Development](ui-js-components-dialog.md) - - [<form> Development](ui-js-components-form.md) - - [<stepper> Development](ui-js-components-stepper.md) - - [<tabs> Development](ui-js-component-tabs.md) - - [<image> Development](ui-js-components-images.md) + - Container Components + - [<list> Development](ui-js-components-list.md) + - [<dialog> Development](ui-js-components-dialog.md) + - [<form> Development](ui-js-components-form.md) + - [<stepper> Development](ui-js-components-stepper.md) + - [<tabs> Development](ui-js-component-tabs.md) + + - Basic Components + - [<text> Development](ui-js-components-text.md) + - [<input> Development](ui-js-components-input.md) + - [<button> Development](ui-js-components-button.md) + - [<picker> Development](ui-js-components-picker.md) + - [<image> Development](ui-js-components-images.md) - Animation Development Guidelines - CSS Animation - [Defining Attribute Style Animations](ui-js-animate-attribute-style.md) diff --git a/en/application-dev/website.md b/en/application-dev/website.md index d011e219ca52ebc7014e48458bb01be47dfba7d6..f910c4bacdaa086b525610972f99a3154b232ea0 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -496,23 +496,23 @@ - [@ohos.application.uriPermissionManager](reference/apis/js-apis-uripermissionmanager.md) - [@ohos.application.Want](reference/apis/js-apis-application-Want.md) - [@ohos.wantAgent](reference/apis/js-apis-wantAgent.md) - - ability/[dataAbilityHelper](reference/apis/js-apis-dataAbilityHelper.md) - - app/[context](reference/apis/js-apis-Context.md) - - application/[AbilityContext](reference/apis/js-apis-ability-context.md) - - application/[abilityDelegator](reference/apis/js-apis-application-abilityDelegator.md) - - application/[abilityDelegatorArgs](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - application/[abilityMonitor](reference/apis/js-apis-application-abilityMonitor.md) - - application/[AbilityRunningInfo](reference/apis/js-apis-abilityrunninginfo.md) - - application/[AbilityStageContext](reference/apis/js-apis-abilitystagecontext.md) - - application/[Context](reference/apis/js-apis-application-context.md) - - application/[ExtensionContext](reference/apis/js-apis-extension-context.md) - - application/[ExtensionRunningInfo](reference/apis/js-apis-extensionrunninginfo.md) - - application/[FormExtensionContext](reference/apis/js-apis-formextensioncontext.md) - - application/[MissionSnapshot](reference/apis/js-apis-application-MissionSnapshot.md) - - application/[PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) - - application/[ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md) - - application/[ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md) - - application/[shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md) + - [dataAbilityHelper](reference/apis/js-apis-dataAbilityHelper.md) + - [context](reference/apis/js-apis-Context.md) + - [AbilityContext](reference/apis/js-apis-ability-context.md) + - [abilityDelegator](reference/apis/js-apis-application-abilityDelegator.md) + - [abilityDelegatorArgs](reference/apis/js-apis-application-abilityDelegatorArgs.md) + - [abilityMonitor](reference/apis/js-apis-application-abilityMonitor.md) + - [AbilityRunningInfo](reference/apis/js-apis-abilityrunninginfo.md) + - [AbilityStageContext](reference/apis/js-apis-abilitystagecontext.md) + - [Context](reference/apis/js-apis-application-context.md) + - [ExtensionContext](reference/apis/js-apis-extension-context.md) + - [ExtensionRunningInfo](reference/apis/js-apis-extensionrunninginfo.md) + - [FormExtensionContext](reference/apis/js-apis-formextensioncontext.md) + - [MissionSnapshot](reference/apis/js-apis-application-MissionSnapshot.md) + - [PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) + - [ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md) + - [ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md) + - [shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md) - Common Event and Notification @@ -520,7 +520,7 @@ - [@ohos.events.emitter](reference/apis/js-apis-emitter.md) - [@ohos.notification](reference/apis/js-apis-notification.md) - [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md) - - application/[EventHub](reference/apis/js-apis-eventhub.md) + - [EventHub](reference/apis/js-apis-eventhub.md) - Bundle Management @@ -578,7 +578,7 @@ - [@ohos.data.preferences](reference/apis/js-apis-data-preferences.md) - [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md) - [@ohos.settings](reference/apis/js-apis-settings.md) - - data/rdb/[resultSet](reference/apis/js-apis-data-resultset.md) + - [resultSet](reference/apis/js-apis-data-resultset.md) - File Management diff --git a/en/application-dev/windowmanager/display-guidelines.md b/en/application-dev/windowmanager/display-guidelines.md index 818d6dc3fa769d894c37754840ec7711f141c40c..10895f9f6a6e9f59c7d7e446eaceb491503bd268 100644 --- a/en/application-dev/windowmanager/display-guidelines.md +++ b/en/application-dev/windowmanager/display-guidelines.md @@ -8,7 +8,7 @@ An application can obtain the default display object or all display objects by c For details about the APIs, see [Display](../reference/apis/js-apis-display.md). -### How to Develop +## How to Develop Call **getDefaultDisplay(): Promise** to obtain the default display object. An example code snippet is as follows: diff --git a/en/device-dev/driver/Readme-EN.md b/en/device-dev/driver/Readme-EN.md index 19d359bc3a8282d77731b3f80d6d33f17f0f5667..0d447a1e2b57dc260b367b061f7b908a36133b7e 100644 --- a/en/device-dev/driver/Readme-EN.md +++ b/en/device-dev/driver/Readme-EN.md @@ -9,6 +9,7 @@ - [HDF Development Example](driver-hdf-sample.md) - [Platform Driver Development](driver-develop.md) - [ADC](driver-platform-adc-develop.md) + - [DAC](driver-platform-dac-develop.md) - [GPIO](driver-platform-gpio-develop.md) - [HDMI](driver-platform-hdmi-develop.md) - [I2C](driver-platform-i2c-develop.md) @@ -26,6 +27,7 @@ - [Watchdog](driver-platform-watchdog-develop.md) - [Platform Driver Usage](driver-platform.md) - [ADC](driver-platform-adc-des.md) + - [DAC](driver-platform-dac-des.md) - [GPIO](driver-platform-gpio-des.md) - [HDMI](driver-platform-hdmi-des.md) - [I2C](driver-platform-i2c-des.md) diff --git a/en/device-dev/driver/driver-develop.md b/en/device-dev/driver/driver-develop.md index e3effaeb8ea3bdfc1dd4276c188de0127ad20a83..b35b64a64ffb11c51d1ce56d98942de8d032b5a3 100644 --- a/en/device-dev/driver/driver-develop.md +++ b/en/device-dev/driver/driver-develop.md @@ -2,6 +2,8 @@ - **[ADC](driver-platform-adc-develop.md)** +- **[DAC](driver-platform-dac-develop.md)** + - **[GPIO](driver-platform-gpio-develop.md)** - **[HDMI](driver-platform-hdmi-develop.md)** diff --git a/en/device-dev/driver/driver-platform-dac-des.md b/en/device-dev/driver/driver-platform-dac-des.md new file mode 100644 index 0000000000000000000000000000000000000000..9088d3b689710fa711c014d07bb00a11d8779f11 --- /dev/null +++ b/en/device-dev/driver/driver-platform-dac-des.md @@ -0,0 +1,211 @@ +# DAC + + +## Overview + +### DAC + +A digit-to-analog converter (DAC) is a device that converts a digital signal into an analog signal in electronics. + +The DAC APIs provide a set of methods for DAC data transfer, including: + +- Opening or closing a DAC device +- Setting the target digital-to-analog (DA) value + + +### Basic Concepts + +The DAC module provides the output channel for the process control computer system. It connects to the executor to implement automatic control of the production process. It is also an important module in the analog-to-digital converter using feedback technologies. + +- Resolution + + The number of binary bits that can be converted by a DAC. A greater number of bits indicates a higher resolution. + +- Conversion precision + + Difference between the actual output value of the DAC and the theoretical value when the maximum value is added to the input end. The conversion precision of a DAC converter varies depending on the structure of the chip integrated on the DAC and the interface circuit configuration. The ideal conversion precision value should be as small as possible. To achieve optimal DAC conversion precision, the DAC must have high resolution. In addition, errors in the devices or power supply of the interface circuits will affect the conversion precision. When the error exceeds a certain degree, a DAC conversion error will be caused. + +- Conversion speed + + The conversion speed is determined by the setup time. The setup time is the period from the time the input suddenly changes from all 0s to all 1s to the time the output voltage remains within the FSR ± ½LSB (or FSR ± x%FSR). It is the maximum response time of the DAC, and hence used to measure the conversion speed. + + The full scale range (FSR) is the maximum range of the output signal amplitude of a DAC. Different DACs have different FSRs, which can be limited by positive and negative currents or voltages. + + The least significant byte (LSB) refers to bit 0 (the least significant bit) in a binary number. + +### Working Principles + +In the Hardware Driver Foundation (HDF), the DAC module uses the unified service mode for API adaptation. In this mode, a device service is used as the DAC manager to handle access requests from the devices of the same type in a unified manner. The unified service mode applies to the scenario where there are many device objects of the same type. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services. The figure below shows the unified service mode. + +The DAC module is divided into the following layers: +- The interface layer provides APIs for opening or closing a device and writing data. +- The core layer provides the capabilities of binding, initializing, and releasing devices. +- The adaptation layer implements other functions. + +![](../public_sys-resources/icon-note.gif)NOTE
The core layer can call the functions of the interface layer and uses the hook to call functions of the adaptation layer. In this way, the adaptation layer can indirectly call the functions of the interface layer, but the interface layer cannot call the functions of the adaptation layer. + +**Figure 1** Unified service mode + +![](figures/unified-service-mode.png "DAC-unified-service-mode") + +### Constraints + + Currently, the DAC module supports only the kernels (LiteOS) of mini and small systems. + +## Development Guidelines + +### When to Use + + The DAC module converts digital signals into analog signals in the form of current, voltage, or charge. It is mainly used in audio devices. Audio players and headsets use the DAC module as the digital-to-analog conversion channels. + +### Available APIs + +The table below describes the APIs of the DAC module. For more details, see API Reference. + +**Table 1** DAC driver APIs + +| API | Description | +| :------------------------------------------------------------| :------------ | +| DevHandle DacOpen(uint32_t number) | Opens a DAC device. | +| void DacClose(DevHandle handle) | Closes a DAC device. | +| int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val) | Sets the target DA value. | + +### How to Develop + +The figure below illustrates the process of using a DAC device. + +**Figure 2** Process of using a DAC device + +![](figures/process-of-using-DAC.png "Process of using a DAC") + +#### Opening a DAC Device + +Call **DacOpen()** to open a DAC device before performing the DA conversion. + +``` +DevHandle DacOpen(uint32_t number); +``` + +**Table 2** Description of DacOpen + +| **Parameter** | Description | +| ---------- | ----------------- | +| number | DAC device number. | +| **Return Value**| **Description** | +| NULL | Failed to open the DAC device. | +| Device handle | Handle of the DAC device opened.| + + + +Open device 1 of the two ADC devices (numbered 0 and 1) in the system. + +``` +DevHandle dacHandle = NULL; /* DAC device handle / + +/* Open the DAC device. */ +dacHandle = DacOpen(1); +if (dacHandle == NULL) { + HDF_LOGE("DacOpen: failed\n"); + return; +} +``` + +#### Setting the Target DA Value + +``` +int32_t DacWrite(DevHandle handle, uint32_t channel, uint32_t val); +``` + +**Table 3** Description of DacWrite + + +| **Parameter** | Description | +| ---------- | -------------- | +| handle | DAC device handle. | +| channel | DAC channel number. | +| val | DA value to set. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | + +``` +/* Write the target DA value through the DAC_CHANNEL_NUM channel. */ + ret = DacWrite(dacHandle, DAC_CHANNEL_NUM, val); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp DAC write reg fail!:%d", __func__, ret); + DacClose(dacHandle); + return -1; + } +``` + +#### Closing a DAC Device + +After the DAC communication is complete, call **DacClose()** to close the DAC device. +``` +void DacClose(DevHandle handle); +``` + +**Table 4** Description of DacClose + + +| **Parameter** | Description | +| ---------- | -------------- | +| handle | DAC device handle. | +| **Return Value**| **Description**| +| void | - | + + + +Example: + +``` +DacClose(dacHandle); /* Close the DAC device. */ +``` + +## Development Example + +The procedure is as follows: + +1. Open the DAC device based on the device number and obtain the device handle. +2. Set the DA value. If the operation fails, close the device handle. +3. Close the DAC device handle if the access to the DAC is complete. + +You can obtain the operation result by printing the log information based on the **val**. + +``` +#include "hdmi_if.h" /* Header file for DAC APIs */ +#include "hdf_log.h" /* Header file for log APIs */ + +/* Define device 0, channel 1. */ +#define DAC_DEVICE_NUM 0 +#define DAC_CHANNEL_NUM 1 + +/* Main entry of DAC routines. */ +static int32_t TestCaseDac(void) +{ + // Set the target DA value. + uint32_t val = 2; + int32_t ret; + DevHandle dacHandle; + + /* Open the DAC device. */ + dacHandle = DacOpen(DAC_DEVICE_NUM); + if (dacHandle == NULL) { + HDF_LOGE("%s: Open DAC%u fail!", __func__, DAC_DEVICE_NUM); + return -1; + } + + /* Write data. */ + ret = DacWrite(dacHandle, DAC_CHANNEL_NUM, val); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp DAC write reg fail!:%d", __func__, ret); + DacClose(dacHandle); + return -1; + } + + /* Close the DAC device. */ + DacClose(dacHandle); + + return 0; +} +``` diff --git a/en/device-dev/driver/driver-platform-dac-develop.md b/en/device-dev/driver/driver-platform-dac-develop.md new file mode 100644 index 0000000000000000000000000000000000000000..11585ba1168c289a2963112996f36391b97eec5e --- /dev/null +++ b/en/device-dev/driver/driver-platform-dac-develop.md @@ -0,0 +1,470 @@ +# DAC + + +## Overview + +### DAC + +A digit-to-analog converter (DAC) is a device that converts a digital signal into an analog signal in electronics. + +### Basic Concepts + +The DAC module supports development of digital-to-analog conversion. The DAC module provides the output channel for the process control computer system. It connects to the executor to implement automatic control of the production process. It is also an important module in the analog-to-digital converter using feedback technologies. + +- Resolution + + The number of binary bits that can be converted by a DAC. A greater number of bits indicates a higher resolution. + +- Conversion precision + + Difference between the actual output value of the DAC and the theoretical value when the maximum value is added to the input end. The conversion precision of a DAC converter varies depending on the structure of the chip integrated on the DAC and the interface circuit configuration. The ideal conversion precision value should be as small as possible. To achieve optimal DAC conversion precision, the DAC must have high resolution. In addition, errors in the devices or power supply of the interface circuits will affect the conversion precision. When the error exceeds a certain degree, a DAC conversion error will be caused. + +- Conversion speed + + The conversion speed is determined by the setup time. The setup time is the period from the time the input suddenly changes from all 0s to all 1s to the time the output voltage remains within the FSR ± ½LSB (or FSR ± x%FSR). It is the maximum response time of the DAC, and hence used to measure the conversion speed. + + The full scale range (FSR) is the maximum range of the output signal amplitude of a DAC. Different DACs have different FSRs, which can be limited by positive and negative currents or voltages. + + The least significant byte (LSB) refers to bit 0 (the least significant bit) in a binary number. + +### Working Principles + +In the Hardware Driver Foundation (HDF), the DAC module uses the unified service mode for API adaptation. In this mode, a device service is used as the DAC manager to handle access requests from the devices of the same type in a unified manner. The unified service mode applies to the scenario where there are many device objects of the same type. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services. The figure below shows the unified service mode. + +The DAC module is divided into the following layers: +- The interface layer provides APIs for opening or closing a device and writing data. +- The core layer provides the capabilities of binding, initializing, and releasing devices. +- The adaptation layer implements other functions. + +![](../public_sys-resources/icon-note.gif)NOTE
The core layer can call the functions of the interface layer and uses the hook to call functions of the adaptation layer. In this way, the adaptation layer can indirectly call the functions of the interface layer, but the interface layer cannot call the functions of the adaptation layer. + +**Figure 1** Unified service mode + +![](figures/unified-service-mode.png "DAC unified service mode") + + + + + +### Constraints + + Currently, the DAC module supports only the kernels (LiteOS) of mini and small systems. + +## Development Guidelines + +### When to Use + +The DAC module is used for digital-to-analog conversion, audio output, and motor control. The DAC driver is used when the digital signals input by the DAC module are converted into analog signals to output. + +### Available APIs + +The **DacMethod** is used to call the DAC driver functions. + +**DacMethod** definition: + +``` +struct DacMethod { + // Hook used to write data. + int32_t (*write)(struct DacDevice *device, uint32_t channel, uint32_t val); + // Hook used to start a DAC device. + int32_t (*start)(struct DacDevice *device); + // Hook used to stop a DAC device + int32_t (*stop)(struct DacDevice *device); +}; +``` + +**Table 1** Description of the DacMethod structure + + + +| Function| Input Parameter | Output Parameter| Return Value | Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------ | -------------- | +| write | **device**: pointer to the DAC controller at the core layer.
**channel**: channel ID, which is of the uint32_t type.
val: data to write, which is of the uint32_t type.| - | HDF_STATUS| Writes the target digit-to-analog (DA) value.| +| start | **device**: pointer to the DAC controller at the core layer. | - | HDF_STATUS| Starts a DAC device. | +| stop | **device**: pointer to the DAC controller at the core layer. | - | HDF_STATUS| Stops a device. | + + + +### How to Develop + +The DAC module adaptation procedure is as follows: + +- Instantiate the driver entry. +- Configure attribute files. +- Instantiate the APIs of the core layer. +- Debug the driver. + +1. Instantiate the driver entry. + + Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type (defined in **hdf_device_desc.h**), and the value of **moduleName** must be the same as that in **device_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers are collected to form a segment address space similar to an array for the upper layer to invoke. + + Generally, the HDF calls the **Init()** function to load the driver. If **Init()** fails to be called, the HDF calls **Release()** to release driver resources and exit. + + ``` + static struct HdfDriverEntry g_dacDriverEntry = { + .moduleVersion = 1, + .Init = VirtualDacInit, + .Release = VirtualDacRelease, + .moduleName = "virtual_dac_driver",// (Mandatory) The value must be the same as that in the .hcs file. + }; + HDF_INIT(g_dacDriverEntry); // Call HDF_INIT to register the driver entry with the HDF. + ``` + +2. Configure attribute files. + + - Add the device node description to the **vendor/hisilicon/hispark_taurus/hdf_config/device_info/device_info.hcs** file. + + The device attribute values are closely related to the driver implementation and the default values or restriction ranges of the **DacDevice** members at the core layer, for example, the number of device channels and the maximum transmission speed. + + In the unified service mode, the first device node in the **device_info.hcs** file must be the DAC manager. The parameters must be set as follows: + + | Member | Value | + | --------------- | ------------------------------------------------------------ | + | policy | **0**, which indicates that no service is published.| + | priority | Driver startup priority. The value range is 0 to 200. A larger value indicates a lower priority. If the priorities are the same, the device loading sequence is not ensured.| + | permission | Driver permission.| + | moduleName | The value is **HDF_PLATFORM_DAC_MANAGER**.| + | serviceName | The value is **HDF_PLATFORM_DAC_MANAGER**.| + | deviceMatchAttr | Reserved.| + + Configure DAC controller information from the second node. This node specifies a type of DAC controllers rather than a specific DAC controller. In this example, there is only one DAC device. If there are multiple DAC devices, you need to add the **deviceNode** information to the **device_info** file and add the corresponding device attributes to the **dac_config** file. + + **device_info.hcs** configuration reference + + ``` + root { + device_dac :: device { + // device0 is the DAC manager. + device0 :: deviceNode { + policy = 0; + priority = 52; + permission = 0644; + serviceName = "HDF_PLATFORM_DAC_MANAGER"; + moduleName = "HDF_PLATFORM_DAC_MANAGER"; + } + } + // dac_virtual is the DAC controller. + dac_virtual :: deviceNode { + policy = 0; + priority = 56; + permission = 0644; + moduleName = "virtual_dac_driver"; // (Mandatory) Driver name, which must be the same as moduleName in the driver entry. + serviceName = "VIRTUAL_DAC_DRIVER"; // (Mandatory) Unique name of the service published by the driver. + deviceMatchAttr = "virtual_dac"; // (Mandatory) Controller private data, which must be same as that of the corresponding controller in dac_config.hcs. + } + } + ``` + + - Configure the **dac_test_config.hcs** file. + Add a file, for example, **vendor/vendor_hisilicon/hispark_taurus/hdf_config/hdf_test/dac_test_config.hcs** and configure driver parameters. + + ``` + root { + platform { + dac_config { + match_attr = "virtual_dac"; // (Mandatory) The value must be the same as that of deviceMatchAttr in device_info.hcs. + template dac_device { + deviceNum = 0; // Device number. + validChannel = 0x1; // Valid channel 1. + rate = 20000; // Transmission speed. + } + device_0 :: dac_device { + deviceNum = 0; // Device number. + validChannel = 0x2; // Valid channel 2. + } + } + } + } + ``` + +3. Instantiate the APIs of the core layer. + + - Initialize the **DacDevice** object. + + Initialize the **DacDevice** member in the **VirtualDacParseAndInit** function. + + ``` + // Custom structure of the virtual driver + struct VirtualDacDevice { + // DAC device structure + struct DacDevice device; + // DAC device number + uint32_t deviceNum; + // Valid channel + uint32_t validChannel; + // DAC rate + uint32_t rate; + }; + // Parse and initialize the **DacDevice** object of the core layer. + static int32_t VirtualDacParseAndInit(struct HdfDeviceObject *device, const struct DeviceResourceNode *node) + { + // Define the return values. + int32_t ret; + // Virtual pointer to the DAC device + struct VirtualDacDevice *virtual = NULL; + (void)device; + // Allocate space for the virtual pointer. + virtual = (struct VirtualDacDevice *)OsalMemCalloc(sizeof(*virtual)); + if (virtual == NULL) { + // If the value is null, return an error code. + HDF_LOGE("%s: Malloc virtual fail!", __func__); + return HDF_ERR_MALLOC_FAIL; + } + // Read the configuration of the attribute file. + ret = VirtualDacReadDrs(virtual, node); + if (ret != HDF_SUCCESS) { + // Failed to read the file. + HDF_LOGE("%s: Read drs fail! ret:%d", __func__, ret); + // Release the virtual space. + OsalMemFree(virtual); + // Set the pointer to 0. + virtual = NULL; + return ret; + } + // Initialize the virtual pointer. + VirtualDacDeviceInit(virtual); + // Initialize the priv object in DacDevice. + virtual->device.priv = (void *)node; + // Initialize the devNum object in DacDevice. + virtual->device.devNum = virtual->deviceNum; + // Initialize the ops object in DacDevice. + virtual->device.ops = &g_method; + // Add a DAC device. + ret = DacDeviceAdd(&virtual->device); + if (ret != HDF_SUCCESS) { + // Failed to add the device. + HDF_LOGE("%s: add Dac controller failed! ret = %d", __func__, ret); + // Release the virtual space. + OsalMemFree(virtual); + // Set the virtual pointer to null. + virtual = NULL; + return ret; + } + + return HDF_SUCCESS; + } + ``` + + + + - Custom structure reference + + The custom structure holds parameters and data for the driver. Define the custom structure based on the function parameters of the device. The HDF reads the values in the **dac_config.hcs** file using the **DacTestReadConfig()** function and initializes the structure members using **DeviceResourceIface()**. Some important values, such as the device number and bus number, are also passed to the **DacDevice** object at the core layer. + + ``` + struct VirtualDacDevice { + struct DacDevice device;// (Mandatory) Control object at the core layer. For details, see the description below. + uint32_t deviceNum; // (Mandatory) Device number. + uint32_t validChannel; // (Mandatory) Valid channel. + uint32_t rate; // (Mandatory) Sampling rate. + }; + + // DacDevice is the core layer controller structure. Its members are assigned with values in the Init() function. + struct DacDevice { + const struct DacMethod *ops; + OsalSpinlock spin; // Spinlock. + uint32_t devNum; // Device number. + uint32_t chanNum; // Device channel number. + const struct DacLockMethod *lockOps; + void *priv; + }; + ``` + + - Instantiate the **DacDevice** in **DacMethod**. + + + The **VirtualDacWrite**, **VirtualDacStop**, and **VirtualDacStart** functions are instantiated in **dac_virtual.c**. + + ``` + static const struct DacMethod g_method = { + .write = VirtualDacWrite, // Write data to a DAC device. + .stop = VirtualDacStop, // Stop a DAC device. + .start = VirtualDacStart, // Start a DAC device. + }; + ``` + + ![](../public_sys-resources/icon-note.gif) **NOTE**
+ For details about **DacMethod**, see [Available APIs](#section752964871810). + + + - **Init** function + + Input parameters: + + **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information. + + Return value: + + HDF_STATUS (The table below lists some status. For details about other status, see HDF_STATUS in the /drivers/framework/include/utils/hdf_base.h file.) + + | State | Description | + | ---------------------- | -------------- | + | HDF_ERR_INVALID_OBJECT | Invalid controller object.| + | HDF_ERR_INVALID_PARAM | Invalid parameter. | + | HDF_ERR_MALLOC_FAIL | Failed to allocate memory. | + | HDF_ERR_IO | I/O error. | + | HDF_SUCCESS | Transmission successful. | + | HDF_FAILURE | Transmission failed. | + + Function description: + + Initializes the custom structure object and **DacDevice**, and calls the **AdcDeviceAdd** function at the core layer. + + ``` + static int32_t VirtualDacParseAndInit(struct HdfDeviceObject *device, const struct DeviceResourceNode *node) + { + // Define return value parameters. + int32_t ret; + // Pointer to the DAC device. + struct VirtualDacDevice *virtual = NULL; + (void)device; + // Allocate memory of the specified size. + virtual = (struct VirtualDacDevice *)OsalMemCalloc(sizeof(*virtual)); + if (virtual == NULL) { + // Failed to allocate memory. + HDF_LOGE("%s: Malloc virtual fail!", __func__); + return HDF_ERR_MALLOC_FAIL; + } + // Read the node parameters in the .hcs file. + ret = VirtualDacReadDrs(virtual, node); + if (ret != HDF_SUCCESS) { + // Failed to read the node data. + HDF_LOGE("%s: Read drs fail! ret:%d", __func__, ret); + goto __ERR__; + } + // Initialize the DAC device pointer. + VirtualDacDeviceInit(virtual); + // Pass private node data. + virtual->device.priv = (void *)node; + // Pass the device number. + virtual->device.devNum = virtual->deviceNum; + // Pass the method. + virtual->device.ops = &g_method; + // Add a DAC device. + ret = DacDeviceAdd(&virtual->device); + if (ret != HDF_SUCCESS) { + // Failed to add the DAC device. + HDF_LOGE("%s: add Dac controller failed! ret = %d", __func__, ret); + goto __ERR__; + } + // The DAC device is added. + return HDF_SUCCESS; + __ERR__: + // If the pointer is null + if (virtual != NULL) { + // Release the memory. + OsalMemFree(virtual); + // Set the pointer to null. + virtual = NULL; + } + + return ret; + } + + static int32_t VirtualDacInit(struct HdfDeviceObject *device) + { + // Define return value parameters. + int32_t ret; + // Child node of the device structure + const struct DeviceResourceNode *childNode = NULL; + // Check the input parameter pointer. + if (device == NULL || device->property == NULL) { + // The input parameter pointer is null. + HDF_LOGE("%s: device or property is NULL", __func__); + return HDF_ERR_INVALID_OBJECT; + } + // The input parameter pointer is not null. + ret = HDF_SUCCESS; + DEV_RES_NODE_FOR_EACH_CHILD_NODE(device->property, childNode) { + // Parse the child node. + ret = VirtualDacParseAndInit(device, childNode); + if (ret != HDF_SUCCESS) { + // Failed to parse the child node. + break; + } + } + // The child node is parsed. + return ret; + } + ``` + + - **Release** function + + Input parameters: + + **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information. + + Return value + + This function returns no value. + + Function description: + + Releases memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. If the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Init** function has the corresponding value assignment operations. + + ``` + static void VirtualDacRemoveByNode(const struct DeviceResourceNode *node) + { + // Define return value parameters. + int32_t ret; + // Define the DAC device number. + int16_t devNum; + // Pointer of the DacDevice structure. + struct DacDevice *device = NULL; + // Pointer of the VirtualDacDevice structure. + struct VirtualDacDevice *virtual = NULL; + // Pointer of the DeviceResourceIface structure. + struct DeviceResourceIface *drsOps = NULL; + // Obtain device resources through the instance entry. + drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); + // Check the input parameter pointer. + if (drsOps == NULL || drsOps->GetUint32 == NULL) { + // The pointer is null. + HDF_LOGE("%s: invalid drs ops fail!", __func__); + return; + } + // Obtain data of the devNum node. + ret = drsOps->GetUint16(node, "devNum", (uint16_t *)&devNum, 0); + if (ret != HDF_SUCCESS) { + // Failed to obtain node data. + HDF_LOGE("%s: read devNum fail!", __func__); + return; + } + // Obtain the DAC device number. + device = DacDeviceGet(devNum); + // Check whether the DAC device number and data are null. + if (device != NULL && device->priv == node) { + // Release the DAC device number if the device data is null. + DacDevicePut(device); + // Remove the DAC device number. + DacDeviceRemove(device); + virtual = (struct VirtualDacDevice *)device; + // Release the virtual pointer. + OsalMemFree(virtual); + } + return; + } + + static void VirtualDacRelease(struct HdfDeviceObject *device) + { + // Define the child node structure pointer of the DeviceResourceNode. + const struct DeviceResourceNode *childNode = NULL; + // Check whether the input parameter pointer is null. + if (device == NULL || device->property == NULL) { + // The input parameter pointer is null. + HDF_LOGE("%s: device or property is NULL", __func__); + return; + } + + DEV_RES_NODE_FOR_EACH_CHILD_NODE(device->property, childNode) { + // Remove the DAC through the node. + VirtualDacRemoveByNode(childNode); + } + } + ``` + +4. Debug the driver. + + (Optional) Verify the basic functions of the new driver, for example, whether the test cases are successful after the driver is loaded. + + diff --git a/en/device-dev/driver/driver-platform.md b/en/device-dev/driver/driver-platform.md index 6001bec2a5a8ba9ece5ec83141b85987e9ccd543..3278dc0e5d8e3810adfc854f50ffc311b642c699 100644 --- a/en/device-dev/driver/driver-platform.md +++ b/en/device-dev/driver/driver-platform.md @@ -2,6 +2,8 @@ - **[ADC](driver-platform-adc-des.md)** +- **[DAC](driver-platform-dac-des.md)** + - **[GPIO](driver-platform-gpio-des.md)** - **[HDMI](driver-platform-hdmi-des.md)** diff --git a/en/device-dev/driver/figures/process-of-using-DAC.png b/en/device-dev/driver/figures/process-of-using-DAC.png new file mode 100644 index 0000000000000000000000000000000000000000..7a62db53a3683922d4033ae4cde5e29d3d50fa22 Binary files /dev/null and b/en/device-dev/driver/figures/process-of-using-DAC.png differ diff --git a/en/device-dev/driver/figures/unified-service-mode.png b/en/device-dev/driver/figures/unified-service-mode.png index 6e922299f648f02da320ed101119f1a1698bc609..bf82bb74a0f93399fe273d29fc38a791a95110ed 100644 Binary files a/en/device-dev/driver/figures/unified-service-mode.png and b/en/device-dev/driver/figures/unified-service-mode.png differ diff --git a/en/device-dev/get-code/Readme-EN.md b/en/device-dev/get-code/Readme-EN.md index 5f5dacc4a6cefdf06912a3046c6350a95ff40c5c..c9774a3987b5b7db5cb445dad70bb8ca742a5729 100644 --- a/en/device-dev/get-code/Readme-EN.md +++ b/en/device-dev/get-code/Readme-EN.md @@ -1,7 +1,7 @@ # Source Code Acquisition -- [Source Code Acquisition](sourcecode-acquire.md) -- [Tool Acquisition](gettools.md) - - [Docker Environment](gettools-acquire.md) - - [IDE](gettools-ide.md) - +- [Obtaining Source Code](sourcecode-acquire.md) +- Obtaining Tools + - [Overview](gettools-overview.md) + - [Docker Environments](gettools-acquire.md) + - [IDE](gettools-ide.md) diff --git a/en/device-dev/get-code/gettools-overview.md b/en/device-dev/get-code/gettools-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0e63ba4face13990aaefa6b4e512825fd5c7a0 --- /dev/null +++ b/en/device-dev/get-code/gettools-overview.md @@ -0,0 +1,10 @@ +# Overview + +To streamline your device development process, OpenHarmony provides the useful tools listed below. + +**Table 1** Tools for device development + +| Tool | Description | Related Resources| +| ---- | ------ | ------ | +| DevEco Device Tool | A one-stop integrated development environment (IDE) provided for developers of OpenHarmony-powered smart devices. It allows on-demand component customization, as well as code editing, compilation, burning, and debugging. The tool supports C and C++ languages and can be installed in Visual Studio Code as a plug-in.| [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/documentation/guide/service_introduction-0000001050166905)| +| Docker | A containerization platform used to build and containerize applications. The Docker environments in OpenHarmony encapsulate compilation toolchains for different OpenHarmony variants, so you can start your building straightaway without having to install the compilation toolchain on your own.| [Docker Environment](gettools-acquire.md)| diff --git a/en/device-dev/get-code/sourcecode-acquire.md b/en/device-dev/get-code/sourcecode-acquire.md index 4561cc2511ddf645fb2b4e5a533d85ef6bf93f83..619c8837ac8b430a21a3aa5692945a329db37e7c 100644 --- a/en/device-dev/get-code/sourcecode-acquire.md +++ b/en/device-dev/get-code/sourcecode-acquire.md @@ -4,16 +4,16 @@ OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system \(OS\) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era. -The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com). +The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com). ## Overview of Source Code Acquisition You can use any of the following methods to acquire the OpenHarmony source code: -- **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository. -- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use **hpm-cli** to download and install the bundles and compilation toolchain on your local PC. +- **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository. +- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC. - **Method 3**: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version. -- **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository. +- **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository. ## Method 1: Acquiring Source Code from the Gitee Code Repository @@ -34,7 +34,7 @@ You can use any of the following methods to acquire the OpenHarmony source code: 1. Register your account with Gitee. 2. Register an SSH public key for access to Gitee. -3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information. +3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information. ``` git config --global user.name "yourname" @@ -42,7 +42,7 @@ You can use any of the following methods to acquire the OpenHarmony source code: git config --global credential.helper store ``` -4. Run the following commands to install the **repo** tool: +4. Run the following commands to install the **repo** tool: ``` curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable. @@ -53,14 +53,13 @@ You can use any of the following methods to acquire the OpenHarmony source code: ### How to Use -**Obtaining the Source Code for Mini/Small/Standard Systems** ->![](../public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE** >Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities. - **Obtaining OpenHarmony master code** - Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\) + Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\) ``` repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify @@ -68,7 +67,7 @@ You can use any of the following methods to acquire the OpenHarmony source code: repo forall -c 'git lfs pull' ``` - Method 2: Use the **repo** tool to download the source code over HTTPS. + Method 2: Use the **repo** tool to download the source code over HTTPS. ``` repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify @@ -78,26 +77,26 @@ You can use any of the following methods to acquire the OpenHarmony source code: - **Obtaining OpenHarmony release code** - For details about how to obtain the source code of an OpenHarmony release, see the [Release-Notes](../../release-notes/Readme.md). + For details about how to obtain the source code of an OpenHarmony release, see the [Release-Notes](../../release-notes/Readme.md). ## Method 2: Acquiring Source Code from DevEco Marketplace ### When to Use -If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting bundles of an open-source distribution. Then use **hpm-cli** to download and install the bundles and compilation toolchain on your local PC. +If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting bundles of an open-source distribution. Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC. ### Prerequisites -You must install **Node.js** and HPM on your local PC. The installation procedure is as follows: +You must install **Node.js** and HPM on your local PC. The installation procedure is as follows: -1. Install **Node.js**. +1. Install **Node.js**. - Download **Node.js** from its official website and install it on your local PC. + Download **Node.js** from its official website and install it on your local PC. - The [Node.js](https://nodejs.org/) version must be 12.x \(including npm 6.14.4\) or later. An LTS version is recommended. + The [Node.js](https://nodejs.org/) version must be 12.x \(including npm 6.14.4\) or later. An LTS version is recommended. -2. Install the hpm-cli tool using **npm** delivered with **Node.js**. +2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**. Open the CMD window and run the following command: @@ -121,54 +120,54 @@ You must install **Node.js** and HPM on your local PC. The installation proced ### How to Use 1. Search for distributions. - 1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Equipment Bundle**. - 2. Enter a keyword, for example, **camera**, in the search box, and click the search icon. All matched distributions will be displayed on the **Open Source Distribution** page. - 3. Specify filter criteria, such as the category, OS, kernel, and board, to further filter the distributions. + 1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Equipment Bundle**. Then go to the **Open Source Distribution** page. + 2. Enter a keyword \(for example: **camera**\) in the search box. All matched distributions are found. + 3. Specify filter criteria, such as the bundle type \(for example: **Board support** or **Kernel support**\), to further filter the distributions. 4. Find your desired distribution and click it to view details. - **Figure 1** HPM page + **Figure 1** HPM page ![](figure/hpm-page.png "hpm-page") 2. Learn more about the distribution. - 1. Read the information about the distribution to learn its application scenarios, features, bundles, usage, and customization methods, as shown in the following figure. - 2. Click **Download** to download the distribution to your local PC. - 3. Click **Custom** to add or delete bundles of the distribution. + 1. Read carefully the information about the distribution to learn its application scenarios, features, bundles, usage, and customization methods, as shown in the following figure. + 2. Click **Download** if you want to download the distribution to your local PC. + 3. Click **Custom** if you want to add or delete bundles of the distribution. - **Figure 2** Example distribution - ![](figure/example-distribution.png "example-distribution") + **Figure 2** Example distribution + ![](figure/example-distribution.png "example-distribution") 3. Customize bundles. - 1. Access the **Custom solution** page, as shown in the following figure. - 2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles. + 1. Access the **Custom solution** page, as shown in the following figure. + 2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles. 3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane. - 4. Click **Download**. The system then generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. + 4. Click **Download**. The system generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. - **Figure 3** Customizing bundles + **Figure 3** Customizing bundles ![](figure/customizing-bundles.png "customizing-bundles") 4. Install bundles. - 1. Decompress the downloaded code structure file using CMD on Windows \(or shell in Linux\). - 2. In the generated directory, run the **hpm install** command to download and install bundles. If the **Install successful** message is displayed, the command has been executed successfully. - 3. The downloaded bundles will be stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\) + 1. Decompress the downloaded code structure file using CMD on Windows (or shell in Linux). + 2. In the generated directory, run the **hpm install** command to download and install bundles. If the **Install successful** message is displayed, the command has been executed successfully. + 3. Obtain the bundles. The downloaded bundles are stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\) ## Method 3: Acquiring Source Code from a Mirror Site To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below. -The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release-Notes](../../release-notes/Readme.md). +The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release-Notes](../../release-notes/Readme.md). -**Table 1** Sites for acquiring source code +**Table 1** Sites for acquiring source code - - diff --git a/zh-cn/glossary.md b/zh-cn/glossary.md index 38b57a37c0a144c6ab8cafcd7becc6d4b2110d6f..f8b40ebe00f26305776a9a38427404c083cb791d 100644 --- a/zh-cn/glossary.md +++ b/zh-cn/glossary.md @@ -4,7 +4,7 @@ - ### Ability - 应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。 Ability框架模型结构具有两种形态:[FA模型](#fa模型)和[Stage模型](#stage模型)。 + 应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。 - ### AMS

LTS Code

+ - - - @@ -235,85 +234,85 @@ The table below provides only the sites for downloading the latest OpenHarmony m - - - - - - - - - - - - - - - - - - - - - - - - - - - -

LTS Code

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

-

Master Code

+

Master Code

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Full code base (for mini, small, and standard systems)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

Hi3516 standard system solution (binary)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

RK3568 standard system solution (binary)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

Hi3861 solution (binary)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

Hi3516 solution-LiteOS (binary)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

Hi3516 solution-Linux (binary)

3.1 Beta

+

3.1 Release

Download

+

Download

Download

+

Download

RELEASE-NOTES

3.1 Beta

+

3.1 Release

Download

+

Download

-

Compiler Toolchain

+

Compiler Toolchain

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Compiler toolchain

@@ -328,9 +327,12 @@ The table below provides only the sites for downloading the latest OpenHarmony m
-## Method 4: Acquiring Source Code from the GitHub Image Repository \(at 23:00 UTC Every Day\) +## Method 4: Acquiring Source Code from the GitHub Image Repository -Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\) +>![](../public_sys-resources/icon-note.gif) **NOTE** +> The image repository is synchronized at 23:00 (UTC +8:00) every day. + +Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\) ``` repo init -u git@github.com:openharmony/manifest.git -b master --no-repo-verify @@ -338,7 +340,7 @@ repo sync -c repo forall -c 'git lfs pull' ``` -Method 2: Use the **repo** tool to download the source code over HTTPS. +Method 2: Use the **repo** tool to download the source code over HTTPS. ``` repo init -u https://github.com/openharmony/manifest.git -b master --no-repo-verify @@ -350,7 +352,7 @@ repo forall -c 'git lfs pull' The following table describes the OpenHarmony source code directories. -**Table 2** Source code directories +**Table 2** Source code directories - -

Name

@@ -371,7 +373,7 @@ The following table describes the OpenHarmony source code directories.

build

Bundle-based compilation, building, and configuration scripts

+

Bundle-based compilation, build, and configuration scripts

docs

@@ -401,7 +403,7 @@ The following table describes the OpenHarmony source code directories.

prebuilts

Compiler and tool chain subsystem

+

Compiler and toolchain subsystem

test

@@ -431,4 +433,3 @@ The following table describes the OpenHarmony source code directories.
- diff --git a/en/device-dev/hpm-part/hpm-part-reference.md b/en/device-dev/hpm-part/hpm-part-reference.md index 758dc8cea9eb0196c5cd90a4a63c5b0ec1441e24..1df7f05079cae2c7eb05efb377bec8e88d722de7 100644 --- a/en/device-dev/hpm-part/hpm-part-reference.md +++ b/en/device-dev/hpm-part/hpm-part-reference.md @@ -157,22 +157,22 @@ You can use the hpm-cli tool to manage the lifecycle of an HPM Part. The followi | -------- | -------- | -------- | | Querying version information| **hpm -V** or **hpm --version**| Displays the version of the hpm-cli tool.| | Querying help information| **hpm -h** or **hpm --version**| Displays the command list and help information.| -| hpm -h | Displays command help information.| +|| hpm -h | Displays command help information.| | Creating a project| hpm init bundle | Creates an HPM Part project.| -| hpm init -t template | Creates a scaffolding project from a template.| +|| hpm init -t template | Creates a scaffolding project from a template.| | Installing HPM Parts| **hpm install** or **hpm i**| Installs dependent HPM Parts in the bundle.json file.| -| hpm install bundle\@version | Installs HPM Parts of a specified version.| +|| hpm install bundle\@version | Installs HPM Parts of a specified version.| | Uninstalling HPM Parts| hpm uninstall bundle | Uninstalls dependent HPM Parts.| -| **hpm remove** or **hpm rm bundlename**| Uninstalls dependent HPM Parts.| +|| **hpm remove** or **hpm rm bundlename**| Uninstalls dependent HPM Parts.| | Viewing information| **hpm list** or **hpm ls**| Displays the dependency tree of the HPM part.| -| hpm dependencies | Generates the dependency relationship data of the HPM Part. (This command is also integrated in the **hpm ui** command. After you run the hpm ui command, a hpm UI is displayed with the dependencies.)| +|| hpm dependencies | Generates the dependency relationship data of the HPM Part. (This command is also integrated in the **hpm ui** command. After you run the hpm ui command, a hpm UI is displayed with the dependencies.)| | Searching for HPM Parts| hpm search name | Searches for HPM Parts. **--json** is used to specify the search result in JSON format, and **-type** is used to set the target type, which can be **part**, **distribution**, or **code-segment**.| | Setting HPM configuration items| hpm config set key value | Sets configuration items, such as the server address and network proxy.| -| hpm config delete key | Deletes configurations.| +|| hpm config delete key | Deletes configurations.| | Updating HPM Part versions| hpm update | Updates the versions of dependent HPM Parts.| -| hpm check-update | Checks whether version updates are available to dependent HPM Parts.| +|| hpm check-update | Checks whether version updates are available to dependent HPM Parts.| | Building| hpm build | Builds an HPM Part.| -| hpm dist | Builds a distribution. The build depends on the **dist** script in **scripts** of **bundle.json**.| +|| hpm dist | Builds a distribution. The build depends on the **dist** script in **scripts** of **bundle.json**.| | Packing | hpm pack | Packs dependencies of local HPM Parts.| | Burning| hpm run flash | Burns the firmware. The firmware burning depends on the **flash** script in **scripts** of **bundle.json**.| | Publishing| hpm publish | Publishes an HPM Part, which must be unique in the repository and has a unique version. (An account is required for login.)| @@ -242,7 +242,7 @@ HPM Part dependencies (including indirect dependencies) can be displayed by runn ``` $ hpm list +--demo@1.0.0 -| +--@huawei/media@1.0.2 +| +--@example/media@1.0.2 | +--@demo/sport_hi3518ev300_liteos_a@1.0.0 | | +--@demo/app@4.0.1 | | | +--@demo/build@4.0.1 diff --git a/en/device-dev/kernel/Readme-EN.md b/en/device-dev/kernel/Readme-EN.md index 40cede3bc70bf0b95ba4ce033c95e0d9c31e35be..00a0dd4ac5ed09a68308d226920db376deed97a5 100644 --- a/en/device-dev/kernel/Readme-EN.md +++ b/en/device-dev/kernel/Readme-EN.md @@ -177,4 +177,6 @@ - [Enhanced Kernel Features](kernel-standard-enhanced-features.md) - [Memory Management](kernel-standard-mm.md) - [Enhanced SWAP](kernel-standard-mm-eswap.md) - \ No newline at end of file + - [Task Scheduling](kernel-standard-sched.md) + - [Related Thread Group](kernel-standard-sched-rtg.md) + - [Lightweight CPU Isolation](kernel-standard-sched-cpuisolation.md) \ No newline at end of file diff --git a/en/device-dev/kernel/kernel-standard-sched-cpuisolation.md b/en/device-dev/kernel/kernel-standard-sched-cpuisolation.md new file mode 100644 index 0000000000000000000000000000000000000000..57546a8fb965afd962f0a8f56fcf13a2049b2377 --- /dev/null +++ b/en/device-dev/kernel/kernel-standard-sched-cpuisolation.md @@ -0,0 +1,38 @@ +# Lightweight CPU Isolation + + +## Basic Concepts + +Lightweight CPU isolation enables dynamic CPU isolation based on the system load and user configuration. The kernel migrates the tasks and interrupts from the isolated CPU to other CPUs for execution. The isolated CPU enters the idle state, which reduces the power consumption. In addition, user-mode configuration and query APIs are provided for better system optimization. + + +## Configuration + +### Enabling Lightweight CPU Isolation +Enable related configuration items and dependencies. + +To enable lightweight CPU isolation, you need to enable the corresponding configuration items and dependencies during kernel compilation. The related configuration items are as follows: + +``` +CONFIG_CPU_ISOLATION_OPT=y +CONFIG_SCHED_CORE_CTRL=y +``` + +Enable the following dependencies: + +``` +CONFIG_SMP=y +CONFIG_SCHED_WALT=y +``` +## Available APIs + +APIs are provided to set the number of isolated CPU cores and record the current status. Configurations can be performed based on CPU clusters. These APIs are located in the first CPU device directory of each CPU cluster, for example, `/sys/devices/system/cpu/cpu0/core_ctl`. + +| Category| API | Description | +| ---- | ------------ | ---------------------------------------- | +| Control API| enable | Enables or disables the lightweight CPU isolation. The value **1** means enable, and **0** means disable. | +| | min_cpus | Sets the minimum number of active (not isolated) CPUs. | +| | max_cpus | Sets the maximum number of active (not isolated) CPUs. The maximum value is the number of CPUs in a CPU cluster.| +| Status API| active_cpus | Obtains the number of active (not isolated) CPUs. | +| | need_cpus | Obtains the number of CPUs to de-isolate. | +| | global_state | Records the status of all CPU clusters in the system, including the CPU isolation status, online status, and load information.| diff --git a/en/device-dev/kernel/kernel-standard-sched-rtg.md b/en/device-dev/kernel/kernel-standard-sched-rtg.md new file mode 100644 index 0000000000000000000000000000000000000000..534cdcdab06c04c6f3abce5e29766411e4c819cc --- /dev/null +++ b/en/device-dev/kernel/kernel-standard-sched-rtg.md @@ -0,0 +1,61 @@ +# Related Thread Group + + +## Basic Concepts + +The Related Thread Group (RTG) provides optimized scheduling of a group of important threads. The load of an RTG can be collected and predicted separately and the preferred CPU cluster can be set to allow the important threads to run on the optimal CPU and the kernel to select a proper CPU frequency based on the group loads. + + +## Configuration + +### Enabling RTG +To enable RTG, you need to enable the related configuration items and dependencies during kernel compilation. The related configuration items are as follows: + +``` +CONFIG_SCHED_RTG=y +CONFIG_SCHED_RTG_DEBUG=y +CONFIG_SCHED_RTG_FRAME=y +CONFIG_SCHED_RTG_RT_THREAD_LIMIT=y +``` + +Enable the following dependencies: + +``` +CONFIG_SCHED_WALT=y +``` +### Adding a Process or Thread to an RTG + +By default, 20 RTGs are created in the kernel. The group with ID of 1 is reserved and cannot be added with any process or thread. + +```Bash +// Add a process to an RTG. +echo 2 > /proc//sched_group_id +// Remove a process from an RTG. The group with ID of 0 is not an RTG. +echo 0 > /proc//sched_group_id +``` +### Obtaining RTG Information + +The RTG information includes group ID, preferred CPU cluster ID, and thread information. + + ```Bash +cat /proc/sched_rtg_debug +// The following information is displayed: +RTG_ID : 2 // RTG ID. +RTG_INTERVAL : UPDATE:8ms\#INVALID:4294ms // CPU frequency modulation interval and valid load duration. +RTG_CLUSTER : -1 // CPU cluster ID. The value **-1** means that the preferred cluster is not set. +RTG_THREADS: 0/1 // Total number of threads in the group. +STATE COMM PID PRIO CPU // Thread information, including the status, name, PID, priority, and CPU ID. +--------------------------------------------------------- + S bash 436 120 1(0-3) + ``` + +## Available APIs + +The RTG provides the device node and ioctl APIs for querying and configuring group information. The device node is in `/dev/sched_rtg_ctrl`. + +| Device Node | request | Description | +| ------------------- | ------------------- | ------------------- | +| /dev/sched_rtg_ctrl | CMD_ID_SET_RTG | Creates an RTG, and adds, updates, or deletes threads in the group. | +| | CMD_ID_SET_CONFIG | Configures global group attributes, for example, the maximum number of real-time RTGs.| +| | CMD_ID_SET_RTG_ATTR | Configures specified group attributes, for example, the thread priority. | +| | CMD_ID_SET_MIN_UTIL | Sets the minimum utilization of an RTG. | diff --git a/en/device-dev/kernel/kernel-standard-sched.md b/en/device-dev/kernel/kernel-standard-sched.md new file mode 100644 index 0000000000000000000000000000000000000000..cfaca68261652d3af810a293d353b871e87d8a1f --- /dev/null +++ b/en/device-dev/kernel/kernel-standard-sched.md @@ -0,0 +1,4 @@ +# Task Scheduling + +- **[Related Thread Group](kernel-standard-sched-rtg.md)** +- **[Lightweight CPU Isolation](kernel-standard-sched-cpuisolation.md)** diff --git a/zh-cn/application-dev/application-dev-website.md b/zh-cn/application-dev/application-dev-website.md index a4505230e31b59b043a1adc99e8617d10816c40f..65b00d9df316d634d0f07a219fc11bc28411c096 100644 --- a/zh-cn/application-dev/application-dev-website.md +++ b/zh-cn/application-dev/application-dev-website.md @@ -552,23 +552,23 @@ - [@ohos.application.uriPermissionManager (uriPermissionManager)](reference/apis/js-apis-uripermissionmanager.md) - [@ohos.application.Want (Want)](reference/apis/js-apis-application-Want.md) - [@ohos.wantAgent (WantAgent模块)](reference/apis/js-apis-wantAgent.md) - - ability/[dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md) - - app/[context (Context模块)](reference/apis/js-apis-Context.md) - - application/[AbilityContext (AbilityContext)](reference/apis/js-apis-ability-context.md) - - application/[abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md) - - application/[abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - application/[abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md) - - application/[AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md) - - application/[AbilityStageContext (AbilityStageContext)](reference/apis/js-apis-abilitystagecontext.md) - - application/[Context (Context)](reference/apis/js-apis-application-context.md) - - application/[ExtensionContext (ExtensionContext)](reference/apis/js-apis-extension-context.md) - - application/[ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md) - - application/[FormExtensionContext (FormExtensionContext)](reference/apis/js-apis-formextensioncontext.md) - - application/[MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) - - application/[PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) - - application/[ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) - - application/[ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) - - application/[shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) + - [dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md) + - [context (Context模块)](reference/apis/js-apis-Context.md) + - [AbilityContext (AbilityContext)](reference/apis/js-apis-ability-context.md) + - [abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md) + - [abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md) + - [abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md) + - [AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md) + - [AbilityStageContext (AbilityStageContext)](reference/apis/js-apis-abilitystagecontext.md) + - [Context (Context)](reference/apis/js-apis-application-context.md) + - [ExtensionContext (ExtensionContext)](reference/apis/js-apis-extension-context.md) + - [ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md) + - [FormExtensionContext (FormExtensionContext)](reference/apis/js-apis-formextensioncontext.md) + - [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) + - [PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) + - [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) + - [ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) + - [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) - 公共事件与通知 @@ -576,7 +576,7 @@ - [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md) - [@ohos.notification (Notification模块)](reference/apis/js-apis-notification.md) - [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md) - - application/[EventHub (EventHub)](reference/apis/js-apis-eventhub.md) + - [EventHub (EventHub)](reference/apis/js-apis-eventhub.md) - 应用程序包管理 @@ -638,7 +638,7 @@ - [@ohos.data.preferences (轻量级存储)](reference/apis/js-apis-data-preferences.md) - [@ohos.data.rdb (关系型数据库)](reference/apis/js-apis-data-rdb.md) - [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md) - - data/rdb/[resultSet (结果集)](reference/apis/js-apis-data-resultset.md) + - [resultSet (结果集)](reference/apis/js-apis-data-resultset.md) - 文件管理 @@ -755,7 +755,7 @@ - [@system.bluetooth (蓝牙)](reference/apis/js-apis-system-bluetooth.md) - [@system.brightness (屏幕亮度)](reference/apis/js-apis-system-brightness.md) - [@system.configuration (应用配置)](reference/apis/js-apis-system-configuration.md) - - [@system.device (设备信息)](reference/apis/js-apis-system-deviceinfo.md) + - [@system.device (设备信息)](reference/apis/js-apis-system-device.md) - [@system.fetch (数据请求)](reference/apis/js-apis-system-fetch.md) - [@system.file (文件存储)](reference/apis/js-apis-system-file.md) - [@system.geolocation (地理位置)](reference/apis/js-apis-system-location.md) diff --git a/zh-cn/application-dev/quick-start/start-overview.md b/zh-cn/application-dev/quick-start/start-overview.md index a5997fff869e3a7fcdb9471e2816bd829d95c96f..41c86a4d2cece1460bd7e09addd535050ec7c5cf 100644 --- a/zh-cn/application-dev/quick-start/start-overview.md +++ b/zh-cn/application-dev/quick-start/start-overview.md @@ -39,7 +39,7 @@ Ability可以分为[FA(Feature Ability)](../../glossary.md#f)和[PA(Partic ## 工具准备 -1. 安装最新版[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)。 +1. 安装最新版[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)。 2. 请参考[配置OpenHarmony SDK](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-setting-up-environment-0000001263160443),完成**DevEco Studio**的安装和开发环境配置。 diff --git a/zh-cn/application-dev/quick-start/start-with-ets.md b/zh-cn/application-dev/quick-start/start-with-ets.md index fb0c62b87315dda11b89b70704f557f4b8ad4f55..ca131a97b5f3cfac5df9045575b246e4b3b2d942 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets.md +++ b/zh-cn/application-dev/quick-start/start-with-ets.md @@ -4,7 +4,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 请使用**DevEco Studio V3.0.0.601 Beta1**及更高版本。 > -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 ## 创建eTS工程 diff --git a/zh-cn/application-dev/quick-start/start-with-js-low-code.md b/zh-cn/application-dev/quick-start/start-with-js-low-code.md index bddfd37b55ae8512a80c304e0aae7ff355101d8b..dca9abe3ef5aee030c253d2a30f3e9047338ad99 100644 --- a/zh-cn/application-dev/quick-start/start-with-js-low-code.md +++ b/zh-cn/application-dev/quick-start/start-with-js-low-code.md @@ -4,7 +4,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该特性在**DevEco Studio V2.2 Beta1**及更高版本中支持。 > -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,遵循[JS开发规范](../reference/apis),通过可视化界面开发方式快速构建布局,可有效降低用户的上手成本并提升用户构建UI界面的效率。 diff --git a/zh-cn/application-dev/quick-start/start-with-js.md b/zh-cn/application-dev/quick-start/start-with-js.md index 33e2ab8fa9b0137f4b3246d8dca304ace5cd33f5..f97c7892294f6a3abefde03c4fb5e730d4acd58b 100644 --- a/zh-cn/application-dev/quick-start/start-with-js.md +++ b/zh-cn/application-dev/quick-start/start-with-js.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 ## 创建JS工程 @@ -38,7 +38,7 @@ ## 构建第一个页面 1. **使用文本组件。** - 工程同步完成后,在“**Project**”窗口,点击“**entry > src >main > js > MainAbility > pages> index**”,打开“**index.hml**”文件,设置Text组件内容。“**index.hml**”文件的示例如下: + 工程同步完成后,在“**Project**”窗口,点击“**entry > src > main > js > MainAbility > pages> index**”,打开“**index.hml**”文件,设置Text组件内容。“**index.hml**”文件的示例如下: ``` diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index 752a0dc609f47cadbd92b1034bba79a03c777a4a..ba64727c42ae62aaacbff33193ac6339c1e3c196 100644 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -231,7 +231,7 @@ - [@system.bluetooth (蓝牙)](js-apis-system-bluetooth.md) - [@system.brightness (屏幕亮度)](js-apis-system-brightness.md) - [@system.configuration (应用配置)](js-apis-system-configuration.md) - - [@system.device (设备信息)](js-apis-system-deviceinfo.md) + - [@system.device (设备信息)](js-apis-system-device.md) - [@system.fetch (数据请求)](js-apis-system-fetch.md) - [@system.file (文件存储)](js-apis-system-file.md) - [@system.geolocation (地理位置)](js-apis-system-location.md) diff --git a/zh-cn/application-dev/reference/apis/js-apis-bytrace.md b/zh-cn/application-dev/reference/apis/js-apis-bytrace.md index fb607412758baa1198fe07390914fed0fae16d7f..9133a70b86e343e5a90b2b716f341d409ab8ad68 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bytrace.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bytrace.md @@ -1,7 +1,7 @@ # 性能打点 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 8开始,该接口不再维护,推荐使用新接口[hiTraceMeter](js-apis-hitracemeter.md)。 +> - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.hiTraceMeter`](js-apis-hitracemeter.md)。 > - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-call.md b/zh-cn/application-dev/reference/apis/js-apis-call.md index 30fdfb0abfbb4b5c388ea08ad13f1d4e98f3fe4f..87292d1fb7776837bfaeded57c2a7376bd7c2e9c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-call.md +++ b/zh-cn/application-dev/reference/apis/js-apis-call.md @@ -314,7 +314,7 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | phoneNumber | string | 是 | 电话号码。 | -| options | EmergencyNumberOptions | 是 | 手机参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 | +| options | EmergencyNumberOptions | 是 | 电话号码参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 | | callback | AsyncCallback<boolean> | 是 | 回调函数,返回判断是否是紧急电话号码的结果:
- true:是紧急电话号码。
- false:不是紧急电话号码。 | **示例:** @@ -339,7 +339,7 @@ isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------- | ---- | ------------------------------------------------------------ | | phoneNumber | string | 是 | 电话号码。 | -| options | EmergencyNumberOptions | 是 | 手机参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 | +| options | EmergencyNumberOptions | 是 | 电话号码参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 | **返回值:** @@ -449,7 +449,7 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: Asy 将电话号码格式化为E.164表示形式,使用callback方式作为异步方法。 -需要格式化的电话号码需要与传入国家码相匹配,如中国手机号需要传入国家码CN,否则格式化后的手机号为null。 +需要格式化的电话号码需要与传入国家码相匹配,如中国电话号码需要传入国家码CN,否则格式化后的电话号码为null。 支持所有国家码。 @@ -480,7 +480,7 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
从API Version 9开始,该接口不再维护,推荐使用新接口 [@ohos.data.preferences](js-apis-data-preferences.md) +> +> - 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> - 从API Version 9开始,该接口不再维护,推荐使用新接口[`@ohos.data.preferences`](js-apis-data-preferences.md)。 ## 导入模块 @@ -45,7 +48,7 @@ getStorageSync(path: string): Storage ``` import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' - + var context = featureAbility.getContext() context.getFilesDir((err, path) => { if (err) { @@ -78,7 +81,7 @@ getStorage(path: string, callback: AsyncCallback<Storage>): void ``` import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' - + var context = featureAbility.getContext() context.getFilesDir((err, path) => { if (err) { @@ -120,7 +123,7 @@ getStorage(path: string): Promise<Storage> ``` import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' - + var context = featureAbility.getContext() context.getFilesDir((err, path) => { if (err) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-logs.md b/zh-cn/application-dev/reference/apis/js-apis-logs.md index 0d5d7d765d89621a34c638da9f99f277ed01d8fc..45806efdcf4870a25b48dc53d403c3113fb2f2aa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-logs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-logs.md @@ -1,7 +1,7 @@ # 日志打印 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.hilog](js-apis-hilog.md)'。 +> 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.hilog`](js-apis-hilog.md)。 ## console.debug diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-app.md b/zh-cn/application-dev/reference/apis/js-apis-system-app.md index 51e89b3ca7d9d4fecb8011c2eb560d067c9e7108..a1b7d04658ec0e7a54a68af988da1294bac6b996 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-app.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-app.md @@ -1,7 +1,7 @@ # 应用上下文 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口。具体新接口在接口描述中说明。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -79,7 +79,7 @@ requestFullWindow(options?: RequestFullWindowOptions): void duration: 200}); } } - ``` + ``` ## app.setImageCacheCount7+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md index 0370a7b99e3d4ca3127f3dcaf2583861da416a58..2f9e575a01de78fc69b6371162bb602c0a68db39 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md @@ -1,7 +1,7 @@ # 电量信息 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 6开始,该接口不再维护,推荐使用新接口['@ohos.batteryInfo'](js-apis-battery-info.md)。 +> - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.batteryInfo`](js-apis-battery-info.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md index 495ffd660c805171ebbae2bedb0e4d20bc303755..d5f03b7975526b2eea54a8bead528bf6a3a29340 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md @@ -2,7 +2,10 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.bluetooth`](js-apis-bluetooth.md)。 +> +> - 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md index eadac91a5945fcedb9cd37bf9b17746f32b21438..b8e3a07ba1cfbd0ba2e65854bb2db8acb32c0ff1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @@ -1,7 +1,7 @@ # 屏幕亮度 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.brightness'](js-apis-brightness.md)。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.brightness`](js-apis-brightness.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md index d7543663552ae46b61a584e939b6a426253e5795..43e368c28dfdc243d130baf5ddec151ab3bec5c3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @@ -1,7 +1,7 @@ # 应用配置 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.i18n'](js-apis-i18n.md)和['@ohos.intl'](js-apis-intl.md)。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.i18n`](js-apis-i18n.md)和[`@ohos.intl`](js-apis-intl.md)。 > > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-deviceinfo.md b/zh-cn/application-dev/reference/apis/js-apis-system-device.md similarity index 83% rename from zh-cn/application-dev/reference/apis/js-apis-system-deviceinfo.md rename to zh-cn/application-dev/reference/apis/js-apis-system-device.md index 7deaf91a5aff0bb44547b14ed282159dd7a36697..dec8bf99b4096f9680bdc3027d47dc035d7c4e1c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-deviceinfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-device.md @@ -1,7 +1,7 @@ # 设备信息 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 6开始,该接口不再维护,推荐使用新接口['@ohos.deviceInfo'](js-apis-device-info.md)进行设备信息查询。 +> - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.deviceInfo`](js-apis-device-info.md)进行设备信息查询。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -49,7 +49,7 @@ success返回值: | screenShape4+ | string | 屏幕形状。可取值:
- rect:方形屏;
- circle:圆形屏。 | | apiVersion4+ | number | 系统API版本号。 | | releaseType4+ | string | 版本发布类型,值为类型+版本号,如Beta1。
类型可能值有:
- Canary:同一apiVersion下,canary版本之间保持API兼容,beta版本不对canary版本兼容。
- Beta:同一apiVersion下,beta版本之间保持API兼容,release版本不对beta版本兼容。
- Release:release版本会保持5个API版本兼容。 | -| deviceType4+ | string | 设备类型,可能值有:
- phone:智能手机
- tablet:平板
- tv:智慧屏
- wearable:智能穿戴
- liteWearable:轻量级智能穿戴
- ar:增强现实
- vr:虚拟现实
- earphones:耳机
- pc:个人计算机
- speaker:音箱
- smartVision:智能视觉设备
- linkIoT:联接类模组 | +| deviceType4+ | string | 设备类型。 | fail返回错误代码: diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md index 678ead5ffacc1f0d304197f0256f4ca5e80ff671..ae92b2f606e1295196d6d75b607f89be73f0167a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @@ -1,7 +1,7 @@ # 数据请求 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 6开始,该接口不再维护,推荐使用新接口['@ohos.net.http'](js-apis-http.md)。 +> - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.net.http`](js-apis-http.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-file.md b/zh-cn/application-dev/reference/apis/js-apis-system-file.md index f43e669498d9835069440988fa646b8560a4d7f2..a54f28518195eca0fbe95c243cbb86df74d2b81c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-file.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-file.md @@ -1,7 +1,7 @@ # 文件存储 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 6开始,该接口不再维护,推荐使用新接口['@ohos.fileio'](js-apis-fileio.md)。 +> - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.fileio`](js-apis-fileio.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-location.md b/zh-cn/application-dev/reference/apis/js-apis-system-location.md index 0c5e8bde4c074f0ad3c43eeb86f53b8cb6286521..2443d76ceabbf54ef932fa2b3736b69106824cbe 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-location.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-location.md @@ -1,7 +1,7 @@ # 地理位置 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.geolocation'](js-apis-geolocation.md)。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.geolocation`](js-apis-geolocation.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md index ec7faf77673e02c19a2d68195f20303e91b29aa7..20f90a9b04e1f3fb47c4d1cf70ae2a53433b414d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -3,7 +3,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.mediaquery](js-apis-mediaquery.md)'。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.mediaquery`](js-apis-mediaquery.md)。 > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -126,4 +126,3 @@ mMediaQueryList.removeListener(maxWidthMatch); - diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-network.md b/zh-cn/application-dev/reference/apis/js-apis-system-network.md index fa0b34f7a17543ffc32bbedfb21ac56445a2c113..731bd4d85ff13b25c1f3dcb02717790d4265e6fd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-network.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-network.md @@ -1,7 +1,7 @@ # 网络状态 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.telephony.observer'](js-apis-observer.md)。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.telephony.observer`](js-apis-observer.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md index dd4b4c6c9cde639d8cf66f92d4b77b1deab7f5c9..54fa874345392ddeeedfd19d9921dfe2530a974f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md @@ -1,7 +1,7 @@ # 通知消息 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 7 开始,该接口不再维护,推荐使用新接口['@ohos.notification'](js-apis-notification.md)。 +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.notification`](js-apis-notification.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-package.md b/zh-cn/application-dev/reference/apis/js-apis-system-package.md index 5572556897c3208026f16fc57c2b8175e67c48e4..b8138d9d985f899aa02592ae330f9e195e7008cd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-package.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-package.md @@ -2,7 +2,10 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.bundle`](js-apis-Bundle.md)。 +> +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md b/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md index 381eb32a90cc4cd3b40beea624c1241b5cc8a82f..5c285ac121dd97661bba10eccb37086368a6062a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > -> - 从API Version 8 开始,该接口不再维护,推荐使用新接口['@ohos.prompt](js-apis-prompt.md)'。 +> - 从API Version 8 开始,该接口不再维护,推荐使用新接口[`@ohos.prompt`](js-apis-prompt.md)。 > > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-request.md b/zh-cn/application-dev/reference/apis/js-apis-system-request.md index 685237bb568944f90a50488dd027c33ba951ab24..6763edf39c9be01187a9e921a7bc280b48884525 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-request.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-request.md @@ -1,7 +1,7 @@ # 上传下载 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 从API Version 6开始,该接口不再维护,推荐使用新接口['@ohos.request'](js-apis-request.md)。 +> - 从API Version 6开始,该接口不再维护,推荐使用新接口[`@ohos.request`](js-apis-request.md)。 > > - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-router.md b/zh-cn/application-dev/reference/apis/js-apis-system-router.md index d59e9f76ebeffd4b5c1a54004130d92e3935897b..7085a61e8a100f2d9464e058f8f443b91b3787dc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-router.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > -> - 从API Version 8 开始,该接口不再维护,推荐使用新接口['@ohos.router'](js-apis-router.md)。 +> - 从API Version 8 开始,该接口不再维护,推荐使用新接口[`@ohos.router`](js-apis-router.md)。 > > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md index cfa19710dfbd77dd6840c00902c3543965acdd8e..5a81f3d111af3706c8626265666009c98ab33648 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md @@ -2,8 +2,9 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> +> - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.sensor`](js-apis-sensor.md)。 > - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> - 从API Version 8开始,该接口不再维护,推荐使用新接口[sensor](js-apis-sensor.md)。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md index eed952738cdff3a792fe7a86c5f3f94d4f523832..336eea042ba8c41726ee5e76eff670f85b1b3f58 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > -> - 从API Version 6开始,该接口不再维护,可以使用接口['@ohos.data.storage'](js-apis-data-storage.md)。在API Version 9后,推荐使用新接口 ['@ohos.data.preferences'](js-apis-data-preferences.md)。 +> - 从API Version 6开始,该接口不再维护,可以使用接口[`@ohos.data.storage`](js-apis-data-storage.md)。在API Version 9后,推荐使用新接口 [`@ohos.data.preferences`](js-apis-data-preferences.md)。 > > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md index 67ab27690a460b15d277385af4259e01a86dbd13..156a728a3bdac0712e9859d24b71f13b01243faf 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @@ -3,7 +3,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> - 从API Version 8开始,该接口不再维护,推荐使用新接口[vibrator](js-apis-vibrator.md)。 +> - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.vibrator`](js-apis-vibrator.md)。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index a4505230e31b59b043a1adc99e8617d10816c40f..65b00d9df316d634d0f07a219fc11bc28411c096 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -552,23 +552,23 @@ - [@ohos.application.uriPermissionManager (uriPermissionManager)](reference/apis/js-apis-uripermissionmanager.md) - [@ohos.application.Want (Want)](reference/apis/js-apis-application-Want.md) - [@ohos.wantAgent (WantAgent模块)](reference/apis/js-apis-wantAgent.md) - - ability/[dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md) - - app/[context (Context模块)](reference/apis/js-apis-Context.md) - - application/[AbilityContext (AbilityContext)](reference/apis/js-apis-ability-context.md) - - application/[abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md) - - application/[abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - application/[abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md) - - application/[AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md) - - application/[AbilityStageContext (AbilityStageContext)](reference/apis/js-apis-abilitystagecontext.md) - - application/[Context (Context)](reference/apis/js-apis-application-context.md) - - application/[ExtensionContext (ExtensionContext)](reference/apis/js-apis-extension-context.md) - - application/[ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md) - - application/[FormExtensionContext (FormExtensionContext)](reference/apis/js-apis-formextensioncontext.md) - - application/[MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) - - application/[PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) - - application/[ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) - - application/[ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) - - application/[shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) + - [dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md) + - [context (Context模块)](reference/apis/js-apis-Context.md) + - [AbilityContext (AbilityContext)](reference/apis/js-apis-ability-context.md) + - [abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md) + - [abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md) + - [abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md) + - [AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md) + - [AbilityStageContext (AbilityStageContext)](reference/apis/js-apis-abilitystagecontext.md) + - [Context (Context)](reference/apis/js-apis-application-context.md) + - [ExtensionContext (ExtensionContext)](reference/apis/js-apis-extension-context.md) + - [ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md) + - [FormExtensionContext (FormExtensionContext)](reference/apis/js-apis-formextensioncontext.md) + - [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) + - [PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) + - [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) + - [ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) + - [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) - 公共事件与通知 @@ -576,7 +576,7 @@ - [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md) - [@ohos.notification (Notification模块)](reference/apis/js-apis-notification.md) - [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md) - - application/[EventHub (EventHub)](reference/apis/js-apis-eventhub.md) + - [EventHub (EventHub)](reference/apis/js-apis-eventhub.md) - 应用程序包管理 @@ -638,7 +638,7 @@ - [@ohos.data.preferences (轻量级存储)](reference/apis/js-apis-data-preferences.md) - [@ohos.data.rdb (关系型数据库)](reference/apis/js-apis-data-rdb.md) - [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md) - - data/rdb/[resultSet (结果集)](reference/apis/js-apis-data-resultset.md) + - [resultSet (结果集)](reference/apis/js-apis-data-resultset.md) - 文件管理 @@ -755,7 +755,7 @@ - [@system.bluetooth (蓝牙)](reference/apis/js-apis-system-bluetooth.md) - [@system.brightness (屏幕亮度)](reference/apis/js-apis-system-brightness.md) - [@system.configuration (应用配置)](reference/apis/js-apis-system-configuration.md) - - [@system.device (设备信息)](reference/apis/js-apis-system-deviceinfo.md) + - [@system.device (设备信息)](reference/apis/js-apis-system-device.md) - [@system.fetch (数据请求)](reference/apis/js-apis-system-fetch.md) - [@system.file (文件存储)](reference/apis/js-apis-system-file.md) - [@system.geolocation (地理位置)](reference/apis/js-apis-system-location.md) diff --git a/zh-cn/device-dev/get-code/sourcecode-acquire.md b/zh-cn/device-dev/get-code/sourcecode-acquire.md index a078a9d32df6b8620e709cd235b8240aadeb8153..739814e4d8fcace75178a12d2f8cef1edcfe9c23 100644 --- a/zh-cn/device-dev/get-code/sourcecode-acquire.md +++ b/zh-cn/device-dev/get-code/sourcecode-acquire.md @@ -156,7 +156,7 @@ OpenHarmony当前为开发者提供了以下4种获取源码的方式,开发 为了获得更好的下载性能,您可以选择从以下站点的镜像库获取源码或者对应的解决方案。 -本部分只提供OpenHarmony Master最新版本和LTS最新版本的获取源码方式, 其他版本获取源码方式以及具体版本信息请参考[Release-Notes](../../release-notes/Readme.md)。 +本部分只提供OpenHarmony LTS最新版本和最新发布版本的源码获取方式, 其他版本获取源码方式以及具体版本信息请参考[Release-Notes](../../release-notes/Readme.md)。 **表 1** 获取源码路径 @@ -234,7 +234,7 @@ OpenHarmony当前为开发者提供了以下4种获取源码的方式,开发

-

Master版本源码

+

最新发布版本源码

版本信息