提交 23ab3550 编写于 作者: R RayShih

Merge branch 'master' of https://gitee.com/RayShih/docs

......@@ -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
......
......@@ -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.
......
......@@ -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.
......@@ -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
......
......@@ -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&lt;void&gt;): void;<br>function stopBackgroundRunning(context: Context): Promise&lt;void&gt;; | 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
......
......@@ -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)
......@@ -22,16 +22,16 @@
## Available APIs
| Module | API | Description |
| Module| API| Description|
| -------- | -------- | -------- |
| ohos.sensor | sensor.on(sensorType,callback:AsyncCallback&lt;Response&gt;):void | Subscribes to data changes of a type of sensor. |
| ohos.sensor | sensor.once(sensorType,callback:AsyncCallback&lt;Response&gt;):void | Subscribes to only one data change of a type of sensor. |
| ohos.sensor | sensor.off(sensorType,callback:AsyncCallback&lt;void&gt;):void | Unsubscribes from sensor data changes. |
| ohos.sensor | sensor.on(sensorType, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to data changes of a type of sensor.|
| ohos.sensor | sensor.once(sensorType, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to only one data change of a type of sensor.|
| ohos.sensor | sensor.off(sensorType, callback:AsyncCallback&lt;void&gt;): 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)
# 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/s<sup>2</sup>.| 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/s<sup>2</sup>.| 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/s<sup>2</sup>.| 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/s<sup>2</sup>.| 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/s<sup>2</sup>. | 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/s<sup>2</sup>. | 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/s<sup>2</sup>. | 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/s<sup>2</sup>. | 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<br/>SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | Game rotation vector sensor<br/>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.<br/>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<br/>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.
......@@ -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:&nbsp;number):&nbsp;Promise&lt;void&gt; | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;duration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(duration:&nbsp;number,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;duration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId):&nbsp;Promise&lt;void&gt; | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;effect.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;effect.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode):&nbsp;Promise&lt;void&gt; | Stops&nbsp;vibration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Stops&nbsp;vibration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(duration:&nbsp;number):&nbsp;Promise&lt;void&gt; | Triggers vibration with the specified duration. This API uses a promise to return the result.|
| ohos.vibrator | vibrate(duration:&nbsp;number,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers vibration with the specified duration. This API uses a callback to return the result.|
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId):&nbsp;Promise&lt;void&gt; | Triggers vibration with the specified effect. This API uses a promise to return the result.|
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers vibration with the specified effect. This API uses a callback to return the result.|
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode):&nbsp;Promise&lt;void&gt; | Stops vibration. This API uses a promise to return the result.|
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;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.");
};
})
......
......@@ -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**.
......@@ -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
......
......@@ -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).
......
......@@ -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
......
......@@ -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).
......
# 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
......
......@@ -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\<string> | Yes | Permissions requested. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. |
## HapModuleInfo
......
# Active Tag
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE**<br/>
> 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&lt;string&gt;
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&lt;string&gt; | 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&lt;string&gt;): 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&lt;string&gt; | 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&lt;void&gt;
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&lt;void&gt; | 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&lt;string&gt;): 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&lt;string&gt; | 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&lt;number&gt;): 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&lt;number&gt; | 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&lt;number&gt;): 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&lt;number&gt; | 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. |
......@@ -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;
}
......
......@@ -51,17 +51,23 @@ deleteForm(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | 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&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -188,15 +199,21 @@ requestForm(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | 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&lt;void&gt;;
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&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -294,15 +317,21 @@ notifyVisibleForms(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -347,15 +376,21 @@ notifyInvisibleForms(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -400,15 +435,21 @@ enableFormsUpdate(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
......@@ -453,15 +494,21 @@ disableFormsUpdate(formId: string): Promise&lt;void&gt;;
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&lt;void&gt; | 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&lt;void&gt; | 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&ltstring&gt): Promise&lt;number&gt;;
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&lt;number&gt; | 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&ltstring&gt): Promise&lt;formInfo.FormStateInfo&gt;;
function acquireFormState(want: Want): Promise&lt;FormStateInfo&gt;;
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&lt;string&gt;): 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&lt;string&gt;): 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&lt;string&gt; | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
......@@ -935,6 +994,12 @@ SystemCapability.Ability.Form
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isEnableUpdate | boolean | Yes | Whether to enable update.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
......
......@@ -968,7 +968,7 @@ close(fd: number, callback: AsyncCallback&lt;void&gt;): 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&lt;void&gt;
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.|
......
# 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&lt;MediaQueryResult&gt;): 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&lt;MediaQueryResult&gt; | Yes| Callback registered with media query.|
- Example
For details, see [off Example](#off).
### off
off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): 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&lt;MediaQueryResult&gt; | 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%')
}
}
```
......@@ -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. |
......
......@@ -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\<string\> | 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\<number\> | 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\<Want\> | 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\<void\> | 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\<void\> | Promise used to return the result.|
**Example**
......
......@@ -7,6 +7,7 @@ None
```javascript
import zlib from '@ohos.zlib';
```
## zlib.zipFile
zipFile(inFile:string, outFile:string, options: Options): Promise<void>;
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
......
# 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
- [&lt;text&gt; Development](ui-js-components-text.md)
- [&lt;input&gt; Development](ui-js-components-input.md)
- [&lt;button&gt; Development](ui-js-components-button.md)
- [&lt;list&gt; Development](ui-js-components-list.md)
- [&lt;picker&gt; Development](ui-js-components-picker.md)
- [&lt;dialog&gt; Development](ui-js-components-dialog.md)
- [&lt;form&gt; Development](ui-js-components-form.md)
- [&lt;stepper&gt; Development](ui-js-components-stepper.md)
- [&lt;tabs&gt; Development](ui-js-component-tabs.md)
- [&lt;image&gt; Development](ui-js-components-images.md)
- Container Components
- [&lt;list&gt; Development](ui-js-components-list.md)
- [&lt;dialog&gt; Development](ui-js-components-dialog.md)
- [&lt;form&gt; Development](ui-js-components-form.md)
- [&lt;stepper&gt; Development](ui-js-components-stepper.md)
- [&lt;tabs&gt; Development](ui-js-component-tabs.md)
- Basic Components
- [&lt;text&gt; Development](ui-js-components-text.md)
- [&lt;input&gt; Development](ui-js-components-input.md)
- [&lt;button&gt; Development](ui-js-components-button.md)
- [&lt;picker&gt; Development](ui-js-components-picker.md)
- [&lt;image&gt; Development](ui-js-components-images.md)
- Animation Development Guidelines
- CSS Animation
- [Defining Attribute Style Animations](ui-js-animate-attribute-style.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
......
......@@ -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<Display>** to obtain the default display object. An example code snippet is as follows:
......
......@@ -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)
......
......@@ -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)**
......
# 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<br/>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;
}
```
此差异已折叠。
......@@ -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)**
......
# 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)
# 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)|
......@@ -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&nbsp;-h | Displays command help information.|
|| hpm&nbsp;-h | Displays command help information.|
| Creating a project| hpm&nbsp;init&nbsp;bundle | Creates an HPM Part project.|
| hpm&nbsp;init&nbsp;-t&nbsp;template | Creates a scaffolding project from a template.|
|| hpm&nbsp;init&nbsp;-t&nbsp;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&nbsp;install&nbsp;bundle\@version | Installs HPM Parts of a specified version.|
|| hpm&nbsp;install&nbsp;bundle\@version | Installs HPM Parts of a specified version.|
| Uninstalling HPM Parts| hpm&nbsp;uninstall&nbsp;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&nbsp;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&nbsp;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&nbsp;search&nbsp;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&nbsp;config&nbsp;set&nbsp;key&nbsp;value | Sets configuration items, such as the server address and network proxy.|
| hpm&nbsp;config&nbsp;delete&nbsp;key | Deletes configurations.|
|| hpm&nbsp;config&nbsp;delete&nbsp;key | Deletes configurations.|
| Updating HPM Part versions| hpm&nbsp;update | Updates the versions of dependent HPM Parts.|
| hpm&nbsp;check-update | Checks whether version updates are available to dependent HPM Parts.|
|| hpm&nbsp;check-update | Checks whether version updates are available to dependent HPM Parts.|
| Building| hpm&nbsp;build | Builds an HPM Part.|
| hpm&nbsp;dist | Builds a distribution. The build depends on the **dist** script in **scripts** of **bundle.json**.|
|| hpm&nbsp;dist | Builds a distribution. The build depends on the **dist** script in **scripts** of **bundle.json**.|
| Packing | hpm&nbsp;pack | Packs dependencies of local HPM Parts.|
| Burning| hpm&nbsp;run&nbsp;flash | Burns the firmware. The firmware burning depends on the **flash** script in **scripts** of **bundle.json**.|
| Publishing| hpm&nbsp;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
......
......@@ -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
# 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.|
# 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/<pid>/sched_group_id
// Remove a process from an RTG. The group with ID of 0 is not an RTG.
echo 0 > /proc/<pid>/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. |
# Task Scheduling
- **[Related Thread Group](kernel-standard-sched-rtg.md)**
- **[Lightweight CPU Isolation](kernel-standard-sched-cpuisolation.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)
......
......@@ -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**的安装和开发环境配置。
......
......@@ -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工程
......
......@@ -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界面的效率。
......
......@@ -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 &gt; src &gt;main &gt; js &gt; MainAbility &gt; pages&gt; index**”,打开“**index.hml**”文件,设置Text组件内容。“**index.hml**”文件的示例如下:
工程同步完成后,在“**Project**”窗口,点击“**entry &gt; src &gt; main &gt; js &gt; MainAbility &gt; pages&gt; index**”,打开“**index.hml**”文件,设置Text组件内容。“**index.hml**”文件的示例如下:
```
......
......@@ -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)
......
# 性能打点
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -314,7 +314,7 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | 是 | 电话号码。 |
| options | EmergencyNumberOptions | 是 | 手机参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 |
| options | EmergencyNumberOptions | 是 | 电话号码参数,参考[EmergencyNumberOptions](#emergencynumberoptions7)。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调函数,返回判断是否是紧急电话号码的结果:<br/>- true:是紧急电话号码。<br/>- 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<str
将电话号码格式化为E.164表示形式,使用promise方式作为异步方法。
需要格式化的手机号码需要与传入国家码相匹配,如中国手机号需要传入国家码CN,否则格式化后的手机号为null。
需要格式化的电话号码需要与传入国家码相匹配,如中国电话号码需要传入国家码CN,否则格式化后的电话号码为null。
支持所有国家码。
......
......@@ -4,7 +4,10 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。<br/>从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&lt;Storage&gt;): 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&lt;Storage&gt;
```
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
context.getFilesDir((err, path) => {
if (err) {
......
# 日志打印
> ![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
......
# 应用上下文
> ![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.setImageCacheCount<sup>7+</sup>
......
# 电量信息
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
......
# 屏幕亮度
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 应用配置
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 设备信息
> ![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返回值:
| screenShape<sup>4+</sup> | string | 屏幕形状。可取值:<br/>-&nbsp;rect:方形屏;<br/>-&nbsp;circle:圆形屏。 |
| apiVersion<sup>4+</sup> | number | 系统API版本号。 |
| releaseType<sup>4+</sup> | string | 版本发布类型,值为类型+版本号,如Beta1。<br/>类型可能值有:<br/>-&nbsp;Canary:同一apiVersion下,canary版本之间保持API兼容,beta版本不对canary版本兼容。<br/>-&nbsp;Beta:同一apiVersion下,beta版本之间保持API兼容,release版本不对beta版本兼容。<br/>-&nbsp;Release:release版本会保持5个API版本兼容。 |
| deviceType<sup>4+</sup> | string | 设备类型,可能值有:<br/>-&nbsp;phone:智能手机<br/>-&nbsp;tablet:平板<br/>-&nbsp;tv:智慧屏<br/>-&nbsp;wearable:智能穿戴<br/>-&nbsp;liteWearable:轻量级智能穿戴<br/>-&nbsp;ar:增强现实<br/>-&nbsp;vr:虚拟现实<br/>-&nbsp;earphones:耳机<br/>-&nbsp;pc:个人计算机<br/>-&nbsp;speaker:音箱<br/>-&nbsp;smartVision:智能视觉设备<br/>-&nbsp;linkIoT:联接类模组 |
| deviceType<sup>4+</sup> | string | 设备类型 |
fail返回错误代码:
......
# 数据请求
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 文件存储
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 地理位置
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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);
# 网络状态
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 通知消息
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
......
......@@ -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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
# 上传下载
> ![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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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)。
> - 该功能使用需要对应硬件支持,仅支持真机调试。
......
......@@ -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开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......
......@@ -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)。
> - 该功能使用需要对应硬件支持,仅支持真机调试。
......
......@@ -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)
......
......@@ -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种获取源码的方式,开发
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p039662242117"><a name="p039662242117"></a><a name="p039662242117"></a>-</p>
</td>
</tr>
<tr id="row573719239393"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p104146493390"><a name="p104146493390"></a><a name="p104146493390"></a><strong id="b12414104919398"><a name="b12414104919398"></a><a name="b12414104919398"></a>Master版本源码</strong></p>
<tr id="row573719239393"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p104146493390"><a name="p104146493390"></a><a name="p104146493390"></a><strong id="b12414104919398"><a name="b12414104919398"></a><a name="b12414104919398"></a>最新发布版本源码</strong></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p194141849163919"><a name="p194141849163919"></a><a name="p194141849163919"></a><strong id="b441494913918"><a name="b441494913918"></a><a name="b441494913918"></a>版本信息</strong></p>
</td>
......
......@@ -4,7 +4,7 @@
- ### Ability
应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。 Ability框架模型结构具有两种形态:[FA模型](#fa模型)和[Stage模型](#stage模型)。
应用的重要组成部分,是应用所具备能力的抽象。Ability是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。
- ### AMS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册