The **WantAgent** class encapsulates want information that specifies a particular action, which can be starting an ability or publishing a common event. You can either call **wantAgent.trigger** to trigger a **WantAgent** directly or add a **WantAgent** to a notification so that it will be triggered when users tap the notification.
The **WantAgent** class encapsulates want information that specifies a particular action, which can be starting an ability or publishing a common event. You can either call **wantAgent.trigger** to trigger a **WantAgent** directly or add a **WantAgent** to a notification so that it will be triggered when users tap the notification.
## Available APIs
| API | Description|
...
...
@@ -21,7 +23,7 @@ The **WantAgent** class encapsulates want information that specifies a particula
```
private wantAgentObj = null // Save the WantAgent object created. It will be used to complete the trigger operations.
//wantAgentInfo
//wantAgentInfo
var wantAgentInfo = {
wants: [
{
...
...
@@ -45,7 +47,7 @@ The **WantAgent** class encapsulates want information that specifies a particula
```
private wantAgentObj = null // Save the WantAgent object created. It will be used to complete the trigger operations.
@@ -16,7 +16,7 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
| ohos.vibrator | vibrate(duration: number, callback?: AsyncCallback<void>): void | Triggers vibration with the specified duration. This API uses a callback to return the result. |
| ohos.vibrator | vibrate(effectId: EffectId): Promise<void> | Triggers vibration with the specified effect. This API uses a promise to return the result. |
| ohos.vibrator | vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void | Triggers vibration with the specified effect. This API uses a callback to return the result.|
| ohos.vibrator | stop(stopMode: VibratorStopMode): Promise<void>| Stops vibration. This API uses a promise to return the result. |
| ohos.vibrator | stop(stopMode: VibratorStopMode): Promise<void>| Stops vibration. This API uses a promise to return the result. |
| ohos.vibrator | stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void | Stops vibration. This API uses a callback to return the result. |
...
...
@@ -55,7 +55,7 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
You can search for common development resources on [DevEco Marketplace](https://repo.harmonyos.com) and import required resources to your projects through dependencies. If you cannot find the desired resources there, develop the resources on your own and publish them in the form of an HPM Part. To develop HPM Parts, install the hpm-cli tool first.
> - For an HPM Part installed in a project, you can reference it using the environment variable **DEP_SCOPE_bundle_name** when running the hpm build command.
> For example, after you run **hpm i \@opensource/gn** to install an HPM Part, edit the build script in the **bundle.json** file as follows:
>
> ```
> "scripts": {
> "build": "${DEP_OPENSOURCE_gn}/gn --version"
> },
> ```
>
> Then, you can run the **hpm build** command to call gn functions.
>
> For example, after you run **hpm i \@opensource/gn** to install an HPM Part, edit the build script in the **bundle.json** file as follows:
>
> ```
> "scripts": {
> "build": "${DEP_OPENSOURCE_gn}/gn --version"
> },
> ```
>
> Then, you can run the **hpm build** command to call gn functions.
>
> - For a globally installed HPM Part, you can directly call the HPM Part using an environment variable or reference the HPM Part using the **${key}/tool_name** parameter in the **hpm config set key value** command. Example:
@@ -77,7 +77,7 @@ On each development board, you need to partition the memory to store the precedi
- Initializes hardware such as the ROM and RAM, and loads the partition table information.
- Loads the **boot.img** file based on the partition table and parses and loads the **ramdisk.img** file to the memory.
- Prepares the partition table information and ramdisk address and enters the kernel, so that the kernel loads the the ramdisk image and starts the init process.
- Prepares the partition table information and ramdisk address and enters the kernel, so that the kernel loads the ramdisk image and starts the init process.
- Waits until the init process prepares the initial file system and mounts **required.fstab** (including **system.img** and **vendor.img**) to the file system.
- Scans the boot scripts in the **etc/init** directory in **system.img** and **vendor.img** and runs each boot command.
...
...
@@ -89,7 +89,7 @@ On each development board, you need to partition the memory to store the precedi
-**boot.img** format
**boot.img** building and loading varies depending on the platform. The implementation on mainstream OpenHarmony platforms is as follows:
**boot.img** building and loading vary depending on the platform. The implementation on mainstream OpenHarmony platforms is as follows:
- Hi3516D V300
...
...
@@ -200,7 +200,7 @@ On each development board, you need to partition the memory to store the precedi
if (access(fstabFile, F_OK) != 0) {
fstabFile = "/system/etc/fstab.required";
}
INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, abort(), "Failed get fstab.required");
INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, abort(), "Failed to get fstab.required");
fstab = ReadFstabFromFile(fstabFile, false);
}
return fstab;
...
...
@@ -313,22 +313,22 @@ On each development board, you need to partition the memory to store the precedi
Therefore, when "Mount required partitions" is displayed, the required partition device is ready for mounting. During the mounting process, the following key information is printed:
```
BEGET_LOGE("Unsupported file system \" %s \"", item->fsType);
The current file system type is not supported.
// The current file system type is not supported.
BEGET_LOGE("Cannot get stat of \" %s \", err = %d", target, errno);
Failed to obtain the mount point directory.
// Failed to obtain the mount point directory.
BEGET_LOGE("Failed to create dir \" %s \", err = %d", target, errno);
Failed to create the mount point directory.
// Failed to create the mount point directory.
BEGET_LOGI("Mount %s to %s successful", item->deviceName, item->mountPoint);
The device is successfully mounted. The output also contains the name of the mounted device and information about the mount point.
// The device is successfully mounted. The output also contains the name of the mounted device and information about the mount point.
```
- Mounting of vendor partitions
After mounting required partitions, the init process scans each script file in the **vendor** partition. The initialization scripts related to the chip or development board is named in the format of **/vendor/etc/init.{ohos.boot.hardware}.cfg**. Wherein, **/vendor/etc/fstab.{ohos.boot.hardware}** represents the extended mount partition file; **hardware** is sourced from **bootargs**, which is passed from the bootloader to the kernel.
After mounting required partitions, the init process scans each script file in the **vendor** partition. The initialization scripts related to the chip or development board are named in the format of **/vendor/etc/init.{ohos.boot.hardware}.cfg**. Wherein, **/vendor/etc/fstab.{ohos.boot.hardware}** represents the extended mount partition file; **hardware** is sourced from **bootargs**, which is passed from the bootloader to the kernel.
OpenHarmony multimedia services help you to develop for audio and video playback and recording.
- The media playback module facilitates the development of audio and video playback, including media file and stream playback, volume control, and playback progress control.
- The media recording module supports the development of audio and video recording and provides functions to set the size of captured video, encoding bit rate, encoder type, video frame rate, audio sampling rate, and output file format.
It is considered good practice that you understand the following concepts before starting development:
...
...
@@ -27,52 +27,17 @@ It is considered good practice that you understand the following concepts before
The sampling rate is the number of samples per second taken from continuous signals to form discrete signals. The unit is hertz \(Hz\).
## Encoding and Decoding<a name="section1582020483111"></a>
## Encoding and Decoding
Available audio and video encoding and decoding capabilities vary depending on device types. The following table lists supported specifications for available development boards.
**Table 1** Encoding and decoding specifications for different development boards
<tbody><trid="row712427195316"><tdclass="cellrowborder"valign="top"width="7.520752075207521%"headers="mcps1.2.5.1.1 "><pid="p19371179459"><aname="p19371179459"></a><aname="p19371179459"></a>Cameras with a screen</p>
<tdclass="cellrowborder"valign="top"width="40.82408240824083%"headers="mcps1.2.5.1.3 "><aname="ul178862023587"></a><aname="ul178862023587"></a><ulid="ul178862023587"><li>Audio: MPEG-4 AAC Profile (AAC LC), MPEG Audio Layer 3 (MP3), mono and dual channels, MPEG-4 (.mp4 and .m4a), and MP3 (.mp3) are supported.</li><li>Video: The H.265 (HEVC) and H.264 (AVC) (for streams encoded using a chip of the same type) and the MPEG-4 (.mp4) container format are supported.</li></ul>
</td>
<tdclass="cellrowborder"valign="top"width="43.41434143414341%"headers="mcps1.2.5.1.4 "><aname="ul5101301882"></a><aname="ul5101301882"></a><ulid="ul5101301882"><li>Audio: AAC-LC encoding, mono and dual channels, and the MPEG-4 (.mp4) container format are supported.</li><li>Video: H.264 and H.265 encoding and the MPEG-4 (.mp4) container format are supported.</li></ul>
</td>
</tr>
<trid="row01212273532"><tdclass="cellrowborder"valign="top"width="7.520752075207521%"headers="mcps1.2.5.1.1 "><pid="p33711914515"><aname="p33711914515"></a><aname="p33711914515"></a>Cameras without a screen</p>
<tdclass="cellrowborder"valign="top"width="40.82408240824083%"headers="mcps1.2.5.1.3 "><aname="ul11786193316820"></a><aname="ul11786193316820"></a><ulid="ul11786193316820"><li>Audio: MPEG-4 AAC Profile (AAC LC), MPEG Audio Layer 3 (MP3), mono and dual channels, MPEG-4 (.mp4 and .m4a), and MP3 (.mp3) are supported.</li><li>Video: none</li></ul>
</td>
<tdclass="cellrowborder"valign="top"width="43.41434143414341%"headers="mcps1.2.5.1.4 "><aname="ul816485812814"></a><aname="ul816485812814"></a><ulid="ul816485812814"><li>Audio: AAC-LC encoding, mono and dual channels, and the MPEG-4 (.mp4) container format are supported.</li><li>Video: H.264 and H.265 encoding and the MPEG-4 (.mp4) container format are supported.</li></ul>
| Cameras with a screen | Hi3516 | - Audio: MPEG-4 AAC Profile (AAC LC), MPEG Audio Layer 3 (MP3), mono and dual channels, MPEG-4 (.mp4 and .m4a), and MP3 (.mp3) are supported.<br>- Video: The H.265 (HEVC) and H.264 (AVC) (for streams encoded using a chip of the same type) and the MPEG-4 (.mp4) container format are supported. | - Audio: AAC-LC encoding, mono and dual channels, and the MPEG-4 (.mp4) container format are supported.<br/>- Video: H.264 and H.265 encoding and the MPEG-4 (.mp4) container format are supported.</li></ul> |
| Cameras without a screen | Hi3518 | - Audio: MPEG-4 AAC Profile (AAC LC), MPEG Audio Layer 3 (MP3), mono and dual channels, MPEG-4 (.mp4 and .m4a), and MP3 (.mp3) are supported.<br/>- Video: none | <ul><li>Audio: AAC-LC encoding, mono and dual channels, and the MPEG-4 (.mp4) container format are supported.<br/>- Video: H.264 and H.265 encoding and the MPEG-4 (.mp4) container format are supported. |
| WLAN connecting devices | Hi3861 | N/A | N/A |
For details about the encoding and decoding specifications of Hi3516 and Hi3518, refer to their documentation.
@@ -26,7 +24,7 @@ The following figure shows the architecture of the pan-sensor service framework.
└── miscdevice_lite # Misc device directory
```
## Usage<a name="section1312121216216"></a>
## Usage
The following modules work cooperatively to implement pan-sensor capabilities: Sensor API, Sensor Framework, and Sensor Service.
...
...
@@ -34,7 +32,7 @@ The following modules work cooperatively to implement pan-sensor capabilities: S
- Sensor Framework: manages sensor data subscription, creates and destroys data channels, subscribes to or unsubscribes from sensor data, and implements communication with the Sensor Service module.
- Sensor Service: interacts with the HDF module to receive, parse, and distribute data, manages sensor services and sensor data reporting, and controls sensor permissions.