未验证 提交 d03da866 编写于 作者: O openharmony_ci 提交者: Gitee

!2770 Done! 2413:自动化测试修改1

Merge pull request !2770 from wusongqing/TR2413
......@@ -15,17 +15,17 @@ SystemCapability.BundleManager.BundleFramework
## Required Permissions
| Required Permissions| Permission Level| Description|
|-------| --------- | ---- |
| Required Permissions | Permission Level | Description |
| ---------------------------------------- | ------------ | --------- |
| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current application.|
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications.|
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications. |
## bundle.getApplicationInfo
getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo>
Obtains the application information based on a given bundle name. This method uses a promise to return the result.
Obtains the application information based on a given bundle name. This API uses a promise to return the result.
**Required permissions**
......@@ -37,16 +37,16 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
| Type | Description|
| ----------- | -------- |
| Type | Description |
| ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise used to return the application information.|
**Example**
......@@ -69,7 +69,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId)
getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void
Obtains the application information based on a given bundle name. This method uses an asynchronous callback to return the result.
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -81,8 +81,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
......@@ -108,7 +108,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void
Obtains the application information based on a given bundle name. This method uses an asynchronous callback to return the result.
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -120,8 +120,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name of the application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information. |
......@@ -145,7 +145,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
Obtains the information of all available bundles of a specified user in the system. This method uses a promise to return the result.
Obtains the information of all available bundles of a specified user in the system. This API uses a promise to return the result.
**Required permissions**
......@@ -157,15 +157,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ---------- | ---- | ----------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ---------- | ---------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
| Type | Description |
| --------------------------- | ----------------------------------- |
| --------------------------- | -------------------------- |
| Promise<Array\<BundleInfo>> | Promise used to return the information of all available bundles.|
**Example**
......@@ -187,7 +187,7 @@ bundle.getAllBundleInfo(bundleFlag, userId)
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
Obtains the information of all available bundles in the system. This method uses an asynchronous callback to return the result.
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -199,8 +199,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<BundleInfo>> | Yes | Callback used to return the information of all available bundles. |
......@@ -222,7 +222,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => {
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
Obtains the information of all available bundles in the system. This method uses an asynchronous callback to return the result.
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -234,8 +234,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ---------- | --------------------------------- | ---- | --------------------------------------- |
| bundleFlag | BundleFlag | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<BundleInfo>> | Yes | Callback used to return the information of all available bundles. |
......@@ -260,7 +260,7 @@ bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>
Obtains the bundle information based on a given bundle name. This method uses a promise to return the result.
Obtains the bundle information based on a given bundle name. This API uses a promise to return the result.
**Required permissions**
......@@ -272,8 +272,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | BundleOptions | No | Includes **userId**. |
......@@ -281,7 +281,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| -------------------- | ------------------------------------------ |
| -------------------- | ---------------------------- |
| Promise\<BundleInfo> | Promise used to return the bundle information.|
**Example**
......@@ -306,7 +306,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, options)
getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void
Obtains the bundle information based on a given bundle name. This method uses an asynchronous callback to return the result.
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -318,8 +318,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<BundleInfo> | Yes | Callback used to return the bundle information. |
......@@ -343,7 +343,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void
Obtains the bundle information based on a given bundle name. This method uses an asynchronous callback to return the result.
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -355,8 +355,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- |
| bundleName | string | Yes | Bundle name. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | BundleOptions | Yes | Includes **userId**. |
......@@ -384,7 +384,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
Obtains the information about all applications of the specified user. This method uses a promise to return the result.
Obtains the information about all applications of the specified user. This API uses a promise to return the result.
**Required permissions**
......@@ -396,15 +396,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | --------------------------------------- |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
| Type | Description |
| -------------------------------- | ------------------------------------------------ |
| -------------------------------- | ------------------------------- |
| Promise<Array\<ApplicationInfo>> | Promise used to return the application information.|
**Example**
......@@ -426,7 +426,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId)
getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void
Obtains the information about all applications of the specified user. This method uses an asynchronous callback to return the result.
Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -438,8 +438,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<ApplicationInfo>> | Yes | Callback used to return the application information. |
......@@ -461,9 +461,9 @@ bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
## bundle.getAllApplicationInfo
function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void;
getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void;
Obtains the information about all applications. This method uses an asynchronous callback to return the result.
Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -475,8 +475,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<ApplicationInfo>> | Yes | Callback used to return the application information. |
......@@ -497,7 +497,7 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>
Obtains the ability information based on a given want. This method uses a promise to return the result.
Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result.
**Required permissions**
......@@ -509,15 +509,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
| bundleName | string | Yes | Bundle name of the application. |
| abilityName | string | Yes | Name of the ability.|
| abilityName | string | Yes | Ability name.|
**Return value**
| Type | Description |
| ---------------------------- | ---------------------------- |
| --------------------- | --------------------- |
| Promise\<AbilityInfo> | Promise used to return the ability information.|
**Example**
......@@ -535,10 +535,9 @@ bundle.getAbilityInfo(bundleName, abilityName)
## bundle.getAbilityInfo
getAbilityInfo(bundleName: string, abilityName: string): callback :
AsyncCallback\<AbilityInfo>: void
getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;
Obtains the ability information based on a given want. This method uses an asynchronous callback to return the result.
Obtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -550,11 +549,11 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ----------- | ------------ | ---- | ---------------- |
| bundleName | string | Yes | Bundle name of the application. |
| abilityName | string | Yes | Name of the ability.|
| callback | AsyncCallback\<AbilityInfo> | Yes| Callback used to return the ability information.|
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\<AbilityInfo> | Yes | Callback used to return the ability information.|
**Example**
......@@ -574,7 +573,7 @@ bundle.getAbilityInfo(bundleName, abilityName, (err, data) => {
getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>
Obtains the application name based on a given want. This method uses a promise to return the result.
Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result.
**Required permissions**
......@@ -586,15 +585,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
| bundleName | string | Yes | Bundle name of the application. |
| abilityName | string | Yes | Name of the ability.|
| abilityName | string | Yes | Ability name.|
**Return value**
| Type | Description |
| ---------------------------- | ---------------------------- |
| ---------------- | ------------------ |
| Promise\<string> | Promise used to return the application name.|
**Example**
......@@ -614,7 +613,7 @@ bundle.getAbilityLabel(bundleName, abilityName)
getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void
Obtains the application name based on a given want. This method uses an asynchronous callback to return the result.
Obtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -626,11 +625,11 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------- | ---- | ---------------- |
| bundleName | string | Yes | Bundle name of the application. |
| abilityName | string | Yes | Name of the ability.|
| callback | AsyncCallback\<string> | Yes| Callback used to return the application name.|
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the application name. |
**Example**
......@@ -650,7 +649,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
isAbilityEnabled(info: AbilityInfo): Promise\<boolean>
Checks whether an ability is enabled based on a given want. This method uses a promise to return the result.
Checks whether an ability is enabled based on a given want. This API uses a promise to return the result.
**Required permissions**
......@@ -662,14 +661,14 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------ |
| info | AbilityInfo | Yes | Ability information. |
| Name | Type | Mandatory | Description |
| ---- | ----------- | ---- | ------------ |
| info | AbilityInfo | Yes | Ability information.|
**Return value**
| Type | Description |
| ---------------------------- | ------------------------|
| ----------------- | ------------------------- |
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example**
......@@ -691,7 +690,7 @@ bundle.isAbilityEnabled(Info)
isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void
Checks whether an ability is enabled based on a given want. This method uses an asynchronous callback to return the result.
Checks whether an ability is enabled based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -703,10 +702,10 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| -------- | ----------------------- | ---- | --------------- |
| info | AbilityInfo | Yes | Ability information. |
| callback | AsyncCallback\<boolean> | Yes| Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example**
......@@ -728,7 +727,7 @@ bundle.isAbilityEnabled(Info, (err, data) => {
isApplicationEnabled(bundleName: string): Promise\<boolean>
Checks whether an application is enabled based on a given want. This method uses a promise to return the result.
Checks whether an application is enabled based on a given want. This API uses a promise to return the result.
**Required permissions**
......@@ -740,15 +739,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| bundleName | string | Yes | Bundle name of the application. |
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | Yes | Bundle name of the application.|
**Return value**
| Type | Description |
| ---------------------------- | ------------------------|
| Promise\<boolean> | Promise used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.|
| ----------------- | ------------------------- |
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example**
......@@ -766,7 +765,7 @@ bundle.isApplicationEnabled(bundleName)
isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void
Checks whether an application is enabled based on a given want. This method uses an asynchronous callback to return the result.
Checks whether an application is enabled based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -778,15 +777,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | --------------- |
| bundleName | string | Yes | Bundle name of the application. |
| callback | AsyncCallback\<boolean> | Yes| Callback used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example**
```js
let bundleName : "com.example.myapplication";
let bundleName = "com.example.myapplication";
bundle.isApplicationEnabled(bundleName, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
......@@ -800,7 +799,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => {
queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>
Obtains the ability information based on a given want. This method uses a promise to return the result.
Obtains the ability information based on a given want. This API uses a promise to return the result.
**Required permissions**
......@@ -812,8 +811,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
......@@ -821,7 +820,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| ---------------------------- | ---------------------------- |
| ---------------------------- | --------------------- |
| Promise\<Array\<AbilityInfo>>| Promise used to return the ability information.|
**Example**
......@@ -847,7 +846,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId)
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void
Obtains the ability information based on a given want. This method uses an asynchronous callback to return the result.
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
**System capability**
......@@ -855,8 +854,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
......@@ -882,9 +881,9 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
## bundle.queryAbilityByWant
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
Obtains the ability information based on a given want. This method uses an asynchronous callback to return the result.
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
**System capability**
......@@ -892,8 +891,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<AbilityInfo>> | Yes | Callback used to return the ability information. |
......@@ -915,98 +914,13 @@ bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
})
```
## bundle.getBundleInstaller
getBundleInstaller(): Promise\<BundleInstaller>
Obtains the bundle installer. This method uses a promise to return the result.
**Required permissions**
ohos.permission.INSTALL_BUNDLE
**System capability**
SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| ------------------------ | --------------------------------------------------- |
| Promise\<BundleInstaller> | Promise used to return the bundle installer.|
**Example**
```js
let bundleFilePaths = ['/data/test.hap'];
let param = {
userId : 100,
installFlag : 1,
isKeepData : false
};
bundle.getBundleInstaller()
.then((installerObject) => {
console.info('Operation successful. ');
installerObject.install(bundleFilePaths, param)
.then((data) => {
console.info('Operation successful. Data:' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
## bundle.getBundleInstaller
getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;
Obtains the bundle installer. This method uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.INSTALL_BUNDLE
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ------------------------------------------------- |
| callback | AsyncCallback\<BundleInstaller> | Yes | Callback used to return the bundle installer.|
**Example**
```js
let bundleFilePaths = ['/data/test.hap'];
let param = {
userId : 100,
installFlag : 1,
isKeepData : false
};
bundle.getBundleInstaller((err, installerObject) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
}
console.info('Operation successful. Data:' + JSON.stringify(installerObject));
installerObject.install(bundleFilePaths, param, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
})
```
## bundle.getLaunchWantForBundle
getLaunchWantForBundle(bundleName: string): Promise\<Want>
Obtains the **Want** object that launches the specified application. This method uses a promise to return the result.
Obtains the **Want** object that launches the specified application. This API uses a promise to return the result.
**Required permissions**
......@@ -1018,13 +932,13 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | Yes | Bundle name of the application.|
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| -------------- | -------------------------------------- |
| Promise\<Want> | Promise used to return the **Want** object.|
**Example**
......@@ -1043,7 +957,7 @@ bundle.getLaunchWantForBundle(bundleName)
getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;
Obtains the **Want** object that launches the specified application. This method uses an asynchronous callback to return the result.
Obtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -1055,9 +969,9 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| bundleName | string | Yes | Bundle name of the application.|
| Name | Type | Mandatory | Description |
| ---------- | -------------------- | ---- | ------------------------------ |
| bundleName | string | Yes | Bundle name of the application. |
| callback | AsyncCallback\<Want> | Yes | Callback used to return the **Want** object.|
**Example**
......@@ -1078,7 +992,7 @@ bundle.getLaunchWantForBundle(bundleName, (err, data) => {
getNameForUid(uid: number): Promise\<string>
Obtains the bundle name based on a UID. This method uses a promise to return the result.
Obtains the bundle name based on a UID. This API uses a promise to return the result.
**System capability**
......@@ -1086,13 +1000,13 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | -------- |
| uid | number | Yes | UID based on which the bundle name is to obtain.|
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| ---------------- | --------------------------------- |
| Promise\<string> | Promise used to return the bundle name.|
**Example**
......@@ -1109,9 +1023,9 @@ bundle.getNameForUid(uid)
## bundle.getNameForUid<sup>8+</sup>
getNameForUid(uid: number, callback: AsyncCallback\<string>): void;
getNameForUid(uid: number, callback: AsyncCallback\<string>) : void
Obtains the bundle name based on a UID. This method uses an asynchronous callback to return the result.
Obtains the bundle name based on a UID. This API uses an asynchronous callback to return the result.
**System capability**
......@@ -1119,9 +1033,9 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| uid | number | Yes | UID based on which the bundle name is to obtain.|
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ------------------------- |
| uid | number | Yes | UID based on which the bundle name is to obtain. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.|
**Example**
......@@ -1140,9 +1054,9 @@ bundle.getNameForUid(uid, (err, data) => {
## bundle.getAbilityIcon<sup>8+</sup>
getAbilityIcon(bundleName: string, abilityName: string): Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>;
getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This method uses a promise to return the result.
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This API uses a promise to return the result.
**Required permissions**
......@@ -1154,15 +1068,15 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain.|
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain.|
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)> | Promise used to return the <[PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
**Example**
......@@ -1179,9 +1093,9 @@ bundle.getAbilityIcon(bundleName, abilityName)
## bundle.getAbilityIcon<sup>8+</sup>
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>): void;
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This method uses an asynchronous callback to return the result.
Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -1193,11 +1107,11 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain.|
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain.|
| callback | AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)> | Yes | Callback used to return the <[PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
**Example**
......@@ -1218,7 +1132,7 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
Obtains the extension ability information based on a given want. This method uses a promise to return the result.
Obtains the Extension ability information based on a given want. This API uses a promise to return the result.
**Required permissions**
......@@ -1230,8 +1144,8 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
......@@ -1239,8 +1153,8 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| ---------------------------- | ---------------------------- |
| Promise<Array\<ExtensionAbilityInfo>> | Promise used to return the extension ability information.|
| ------------------------------------- | ------------------------------ |
| Promise<Array\<ExtensionAbilityInfo>> | Promise used to return the Extension ability information.|
**Example**
......@@ -1265,7 +1179,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId)
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
Obtains the extension ability information based on a given want. This method uses an asynchronous callback to return the result.
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -1277,12 +1191,12 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<ExtensionAbilityInfo>> | Yes | Callback used to return the extension ability information. |
| callback | AsyncCallback<Array\<ExtensionAbilityInfo>> | Yes | Callback used to return the Extension ability information. |
**Example**
......@@ -1306,7 +1220,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId, (err, data
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
Obtains the extension ability information based on a given want. This method uses an asynchronous callback to return the result.
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
**Required permissions**
......@@ -1318,11 +1232,11 @@ SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | Want | Yes | Want that contains the bundle name. |
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback<Array\<ExtensionAbilityInfo>> | Yes | Callback used to return the extension ability information. |
| callback | AsyncCallback<Array\<ExtensionAbilityInfo>> | Yes | Callback used to return the Extension ability information. |
**Example**
......@@ -1345,40 +1259,40 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ |
| Name | Readable/Writable| Type | Mandatory | Description |
| ----------- | ---- | ------ | ---- | ---------------------------------------- |
| deviceId | Read-only | string | No | ID of the device that runs the ability. |
| bundleName | Read-only | string | Yes | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| abilityName | Read-only | string | Yes | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| uri | Read-only | string | No | Resource ID.|
| shortName | Read-only | string | No | Short name of the **ElementName**.|
| uri | Read-only | string | No | Resource ID. |
| shortName | Read-only | string | No | Short name of the **ElementName**. |
## InstallErrorCode
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Default Value| Description |
| ------ | ------ | ------ |
| SUCCESS | 0 | Installation succeeded.|
| STATUS_INSTALL_FAILURE | 1 | Installation failed. (The application to be installed does not exist.)|
| STATUS_INSTALL_FAILURE_ABORTED | 2 | Installation aborted.|
| STATUS_INSTALL_FAILURE_INVALID | 3 | Invalid installation parameter.|
| STATUS_INSTALL_FAILURE_CONFLICT | 4 | Installation conflict. (The basic information about the application to upgrade is inconsistent with that of the existing application.)|
| STATUS_INSTALL_FAILURE_STORAGE | 5 | Failed to store the bundle information.|
| STATUS_INSTALL_FAILURE_INCOMPATIBLE | 6 | Installation incompatible. (A downgrade occurs or the signature information is incorrect.)|
| STATUS_UNINSTALL_FAILURE | 7 | Uninstallation failed. (The application to be uninstalled does not exist.)|
| STATUS_UNINSTALL_FAILURE_BLOCKED | 8 | Uninstallation aborted. (This error code is not in use.)|
| STATUS_UNINSTALL_FAILURE_ABORTED | 9 | Uninstallation aborted. (Invalid parameters.)|
| Name | Default Value | Description |
| ---------------------------------------- | ---- | ------------------------- |
| SUCCESS | 0 | Installation succeeded. |
| STATUS_INSTALL_FAILURE | 1 | Installation failed. (The application to be installed does not exist.) |
| STATUS_INSTALL_FAILURE_ABORTED | 2 | Installation aborted. |
| STATUS_INSTALL_FAILURE_INVALID | 3 | Invalid installation parameter. |
| STATUS_INSTALL_FAILURE_CONFLICT | 4 | Installation conflict. (The basic information about the application to upgrade is inconsistent with that of the existing application.) |
| STATUS_INSTALL_FAILURE_STORAGE | 5 | Failed to store the bundle information. |
| STATUS_INSTALL_FAILURE_INCOMPATIBLE | 6 | Installation incompatible. (A downgrade occurs or the signature information is incorrect.) |
| STATUS_UNINSTALL_FAILURE | 7 | Uninstallation failed. (The application to be uninstalled does not exist.) |
| STATUS_UNINSTALL_FAILURE_BLOCKED | 8 | Uninstallation aborted. (This error code is not in use.) |
| STATUS_UNINSTALL_FAILURE_ABORTED | 9 | Uninstallation aborted. (Invalid parameters.) |
| STATUS_UNINSTALL_FAILURE_CONFLICT | 10 | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)|
| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT | 0x0B | Installation failed. (Download timed out.)|
| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED | 0x0C | Installation failed. (Download failed.)|
| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application.|
| STATUS_ABILITY_NOT_FOUND | 0x40 | Ability not found.|
| STATUS_BMS_SERVICE_ERROR | 0x41 | BMS service error.|
| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space.|
| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed.|
| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | Installation permission denied.|
| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | Uninstallation permission denied.|
| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT | 0x0B | Installation failed. (Download timed out.) |
| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED | 0x0C | Installation failed. (Download failed.) |
| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application. |
| STATUS_ABILITY_NOT_FOUND | 0x40 | Ability not found. |
| STATUS_BMS_SERVICE_ERROR | 0x41 | BMS service error. |
| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space. |
| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed. |
| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | Installation permission denied. |
| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | Uninstallation permission denied. |
## BundleFlag
......@@ -1386,21 +1300,21 @@ Enumerates bundle flags.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Default Value| Description |
| ------ | ------ | ------ |
| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information.|
| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information.|
| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information.|
| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information.|
| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information.|
| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions.|
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information.|
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the extension ability information.|
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information.|
| Name | Default Value | Description |
| ---------------------------------------- | ---------- | ------------------- |
| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information. |
| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information. |
| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information. |
| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information. |
| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information. |
| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions. |
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information. |
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the Extension ability information.|
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information. |
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information with information about system applications.|
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities.|
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications.|
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information.|
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. |
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. |
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. |
## BundleOptions
......@@ -1408,9 +1322,9 @@ Describes the bundle options.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| userId | number | Yes| Yes| User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------- |
| userId | number | Yes | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
## BundleInfo
......@@ -1418,8 +1332,8 @@ Describes the application bundle information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------------------------------- | ---------------------------- | ---- | ---- | --------------------- |
| name | string | Yes | No | Bundle name. |
| type | string | Yes | No | Bundle type. |
| appId | string | Yes | No | ID of the application to which the bundle belongs. |
......@@ -1441,9 +1355,9 @@ Describes the application bundle information.
| cpuAbi | string | Yes | No | cpuAbi information of the bundle. |
| isSilentInstallation | string | Yes | No | Whether to install the bundle in silent mode. |
| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
| entryInstallationFree | boolean | Yes| No| Whether installation-free is supported for the entry.|
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes| No| Permission grant state.|
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes| No| Extended information of the ability.|
| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry. |
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes | No | Permission grant state. |
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes | No | Extended information of the ability. |
## ApplicationInfo
......@@ -1451,8 +1365,8 @@ Describes the application information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| -------------------------- | ---------------------------------- | ---- | ---- | --------------------- |
| name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | Application description ID. |
......@@ -1468,14 +1382,13 @@ Describes the application information.
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. |
| moduleInfos | Array\<ModuleInfo> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. |
| customizeData | Map<string, Array\<CustomizeData>> | Yes | Yes | Custom data of the application. |
| codePath<sup>8+</sup> | string | Yes| No| Installation directory of the application.|
| metaData<sup>8+</sup> | Map<string, Array\<CustomizeData>> | Yes| No| Custom metadata of the application.|
| metaData<sup>9+</sup> | Map<string, Array\<Metadata>> | Yes| No| Metadata of the application.|
| removable<sup>8+</sup> | boolean | Yes| No| Whether the application is removable.|
| accessTokenId<sup>8+</sup> | number | Yes| No| Access token ID of the application.|
| uid<sup>8+</sup> | number | Yes| No| UID of the application.|
| entityType<sup>9+</sup> | string | Yes| No| Entity type of the application.|
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. |
| metaData<sup>8+</sup> | Map<string, Array\<CustomizeData>> | Yes | No | Custom metadata of the application. |
| metaData<sup>9+</sup> | Map<string, Array\<Metadata>> | Yes | No | Metadata of the application. |
| removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. |
| accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. |
| entityType<sup>9+</sup> | string | Yes | No | Entity type of the application. |
## ModuleInfo
......@@ -1483,8 +1396,8 @@ Describes the module information of the application.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------------- | ------ | ---- | ---- | ---- |
| moduleName | string | Yes | No | Module name.|
| moduleSourceDir | string | Yes | No | Installation directory.|
......@@ -1494,8 +1407,8 @@ Describes the custom metadata.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| ----- | ------ | ---- | ---- | ---------------- |
| Name | Type | Readable | Writable | Description |
| ------------------ | ------ | ---- | ---- | -------- |
| name | string | Yes | Yes | Custom metadata name.|
| value | string | Yes | Yes | Custom metadata value. |
| extra<sup>8+</sup> | string | Yes | Yes | Custom resources. |
......@@ -1507,8 +1420,8 @@ Describes the HAP module information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------------------------------- | ---------------------------- | ---- | ---- | ------------------ |
| name | string | Yes | No | Module name. |
| description | string | Yes | No | Module description. |
| descriptionId | number | Yes | No | Module description ID. |
......@@ -1518,15 +1431,15 @@ Describes the HAP module information.
| iconId | number | Yes | No | Module icon ID. |
| backgroundImg | string | Yes | No | Module background image. |
| supportedModes | number | Yes | No | Modes supported by the module. |
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running.|
| deviceTypes | Array\<string> | Yes | No | An array of supported device types.|
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running. |
| deviceTypes | Array\<string> | Yes | No | An array of supported device types. |
| abilityInfo | Array\<AbilityInfo> | Yes | No | Ability information. |
| moduleName | string | Yes | No | Module name. |
| mainAbilityName | string | Yes | No | Name of the entry ability. |
| installationFree | boolean | Yes | No | Whether installation-free is supported. |
| mainElementName<sup>8+</sup> | string | Yes| No| Information about the entry ability.|
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes| No| Extension ability information.|
| metadata<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the ability.|
| mainElementName<sup>9+</sup> | string | Yes | No | Information about the entry ability. |
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes | No | Extension ability information.|
| metadata<sup>9+</sup> | Array\<Metadata> | Yes | No | Metadata of the ability. |
## ReqPermissionDetail
......@@ -1534,11 +1447,11 @@ Describes the detailed information of the permissions to request from the system
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------- | --------- | ---- | ---- | ---------- |
| name | string | Yes | Yes | Name of the permission to request. |
| reason | string | Yes | Yes | Reason for requesting the permission. |
| usedScene | UsedScene | Yes| Yes| Application scenario and timing for using the permission.|
| usedScene | UsedScene | Yes | Yes | Application scenario and timing for using the permission.|
## UsedScene
......@@ -1546,8 +1459,8 @@ Describes the application scenario and timing for using the permission.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------- | -------------- | ---- | ---- | ---------------- |
| abilities | Array\<string> | Yes | Yes | Abilities that use the permission.|
| when | string | Yes | Yes | Time when the permission is used. |
......@@ -1558,8 +1471,8 @@ Describes the ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------------------- | --------------------- | ---- | ---- | ------------------------ |
| bundleName | string | Yes | No | Application bundle name. |
| name | string | Yes | No | Ability name. |
| label | string | Yes | No | Ability name visible to users. |
......@@ -1585,9 +1498,9 @@ Describes the ability information.
| uri | string | Yes | No | URI of the ability. |
| labelId | number | Yes | No | Ability label ID. |
| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability. |
| metaData<sup>8+</sup> | Array\<CustomizeData> | Yes| No| Custom information of the ability.|
| metaData<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the ability.|
| enabled<sup>8+</sup> | boolean | Yes| No| Whether the ability is enabled.|
| metaData<sup>8+</sup> | Array\<CustomizeData> | Yes | No | Custom information of the ability. |
| metaData<sup>9+</sup> | Array\<Metadata> | Yes | No | Metadata of the ability. |
| enabled<sup>8+</sup> | boolean | Yes | No | Whether the ability is enabled. |
## AbilityType
......@@ -1595,8 +1508,8 @@ Enumerates ability types.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ------- | ---- | --------------------------- |
| Name | Type | Description |
| ------- | ---- | ----------------- |
| UNKNOWN | None | Unknown ability type. |
| PAGE | None | Ability that has a UI. |
| SERVICE | None | Ability that does not have a UI. |
......@@ -1608,8 +1521,8 @@ Enumerates display orientations.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ------------- | ---- | ------------------------ |
| Name | Type | Description |
| ------------- | ---- | ------------- |
| UNSPECIFIED | None | The system automatically determines the display orientation. |
| LANDSCAPE | None | Landscape orientation. |
| PORTRAIT | None | Portrait orientation. |
......@@ -1621,8 +1534,8 @@ Enumerates launch modes.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ----------- | ---- | ------------------- |
| Name | Type | Description |
| --------- | ---- | ------------- |
| SINGLETON | 0 | The ability has only one instance.|
| STANDARD | 1 | The ability can have multiple instances. |
......@@ -1632,20 +1545,20 @@ Enumerates ability subtypes.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ----------- | ---- | ----------------------------- |
| Name | Type | Description |
| ----------- | ---- | -------------------- |
| UNSPECIFIED | 0 | Undefined ability subtype. |
| CA | 1 | Ability that has a UI.|
## ExtensionAbilityType<sup>9+</sup>
Enumerates extension ability types.
Enumerates Extension ability types.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| -------------------- | ---- | ----------------------------- |
| Name | Type | Description |
| ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup> | 0 | Form included. |
| WORK_SCHEDULER<sup>9+</sup> | 1 | Work scheduler included.|
| INPUT_METHOD<sup>9+</sup> | 2 | Input method included. |
......@@ -1659,16 +1572,16 @@ Enumerates extension ability types.
## ExtensionFlag<sup>9+</sup>
Enumerates extension flags.
Enumerates Extension flags.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Default Value| Description |
| ------ | ------ | ------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup> | 0x00000000 | Obtains the default extension ability information.|
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the extension ability information that carries permission information.|
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the extension ability information that carries application information.|
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the extension ability information that carries metadata information.|
| Name | Default Value | Description |
| ---------------------------------------- | ---------- | ------------------------------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup> | 0x00000000 | Obtains the default Extension ability information. |
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the Extension ability information that carries permission information. |
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the Extension ability information that carries application information. |
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
## ColorMode
......@@ -1677,11 +1590,11 @@ Enumerates color modes.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ----------- | ---- | ------------------- |
| Name | Type | Description |
| ---------- | ---- | ---- |
| AUTO_MODE | -1 | Automatic mode.|
| DARK_MODE | 0 | Dark mode. |
| LIGHT_MODE | 1 | Light mode. |
| DARK_MODE | 0 | Dark mode.|
| LIGHT_MODE | 1 | Light mode.|
## GrantStatus
......@@ -1690,34 +1603,34 @@ Enumerates permission grant statuses.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Description |
| ----------- | ---- | ------------------- |
| Name | Type | Description |
| ------------------ | ---- | ---- |
| PERMISSION_DENIED | -1 | Permission denied.|
| PERMISSION_GRANTED | 0 | Permission granted. |
## ExtensionAbilityInfo<sup>9+</sup>
Describes the extension ability information.
Describes the Extension ability information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| Name | Type | Readable | Writable | Description |
| --------------------------------- | --------------------------- | ---- | ---- | --------------------------------- |
| bundleName<sup>9+</sup> | string | Yes | No | Application bundle name. |
| moduleName<sup>9+</sup> | string | Yes | No | Name of the HAP file to which the extension ability belongs. |
| name<sup>9+</sup> | string | Yes | No | Name of the extension ability. |
| labelId<sup>9+</sup> | number | Yes | No | Label ID of the extension ability. |
| descriptionId<sup>9+</sup> | number | Yes | No | Description ID of the extension ability. |
| iconId<sup>9+</sup> | number | Yes | No | Icon ID of the extension ability. |
| isVisible<sup>9+</sup> | boolean | Yes | No | Whether the extension ability can be called by other applications. |
| extensionAbilityType<sup>9+</sup> | bundle.ExtensionAbilityType | Yes | No | Type of the extension ability. |
| permissions<sup>9+</sup> | Array\<string> | Yes | No | Permissions required for other applications to call the extension ability.|
| moduleName<sup>9+</sup> | string | Yes | No | Name of the HAP file to which the Extension ability belongs. |
| name<sup>9+</sup> | string | Yes | No | Name of the Extension ability. |
| labelId<sup>9+</sup> | number | Yes | No | Label ID of the Extension ability. |
| descriptionId<sup>9+</sup> | number | Yes | No | Description ID of the Extension ability. |
| iconId<sup>9+</sup> | number | Yes | No | Icon ID of the Extension ability. |
| isVisible<sup>9+</sup> | boolean | Yes | No | Whether the Extension ability can be called by other applications. |
| extensionAbilityType<sup>9+</sup> | bundle.ExtensionAbilityType | Yes | No | Type of the Extension ability. |
| permissions<sup>9+</sup> | Array\<string> | Yes | No | Permissions required for other applications to call the Extension ability.|
| applicationInfo<sup>9+</sup> | ApplicationInfo | Yes | No | Application configuration information. |
| metaData<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the extension ability.|
| enabled<sup>9+</sup> | boolean | Yes| No| Whether the extension ability is enabled.|
| readPermission<sup>9+</sup> | string | Yes | No | Permission required for reading the extension ability data. |
| writePermission<sup>9+</sup> | string | Yes | No | Permission required for writing data to the extension ability. |
| metaData<sup>9+</sup> | Array\<Metadata> | Yes | No | Metadata of the Extension ability. |
| enabled<sup>9+</sup> | boolean | Yes | No | Whether the Extension ability is enabled. |
| readPermission<sup>9+</sup> | string | Yes | No | Permission required for reading the Extension ability data. |
| writePermission<sup>9+</sup> | string | Yes | No | Permission required for writing data to the Extension ability. |
## Metadata<sup>9+</sup>
......@@ -1726,8 +1639,8 @@ Describes the metadata information.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| ----- | ------ | ---- | ---- | ---------------- |
| Name | Type | Readable | Writable | Description |
| --------------------- | ------ | ---- | ---- | ----- |
| name<sup>9+</sup> | string | Yes | Yes | Metadata name.|
| value<sup>9+</sup> | string | Yes | Yes | Metadata value. |
| resource<sup>9+</sup> | string | Yes | Yes | Metadata resource. |
| resource<sup>9+</sup> | string | Yes | Yes | Metadata resource.|
......@@ -22,14 +22,14 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER**.|
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | Yes| Callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER**.|
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -51,14 +51,14 @@ Subscribes to data changes of the linear acceleration sensor. If this API is cal
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.|
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | Yes| Callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.|
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | Yes | Callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -80,14 +80,14 @@ Subscribes to data changes of the uncalibrated acceleration sensor. If this API
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.|
| callback | Callback&lt;[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)&gt; | Yes| Callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.|
| callback | Callback&lt;[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -110,14 +110,14 @@ Subscribes to data changes of the gravity sensor. If this API is called multiple
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GRAVITY**.|
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | Yes| Callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GRAVITY**. |
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | Yes | Callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -139,14 +139,14 @@ Subscribes to data changes of the gyroscope sensor. If this API is called multip
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE**.|
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | Yes| Callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE**. |
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | Yes | Callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -168,14 +168,14 @@ Subscribes to data changes of the uncalibrated gyroscope sensor. If this API is
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.|
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | Yes| Callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.|
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -198,14 +198,14 @@ Subscribes to data changes of the significant motion sensor. If this API is call
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.|
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | Yes| Callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.|
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | Yes | Callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(data){
console.info('Scalar data: ' + data.scalar);
......@@ -225,14 +225,14 @@ Subscribes to data changes of the pedometer detection sensor. If this API is cal
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.|
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | Yes| Callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.|
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | Yes | Callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(data){
console.info('Scalar data: ' + data.scalar);
......@@ -252,14 +252,14 @@ Subscribes to data changes of the pedometer sensor. If this API is called multip
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER**.|
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | Yes| Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER**. |
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | Yes | Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER,function(data){
console.info('Steps: ' + data.steps);
......@@ -277,14 +277,14 @@ Subscribes to data changes of the ambient temperature sensor. If this API is cal
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.|
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | Yes| Callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.|
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | Yes | Callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,function(data){
console.info('Temperature: ' + data.temperature);
......@@ -302,14 +302,14 @@ Subscribes to data changes of the magnetic field sensor. If this API is called m
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**.|
| callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | Yes| Callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**.|
| callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | Yes | Callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -323,20 +323,20 @@ Subscribes to data changes of the magnetic field sensor. If this API is called m
## sensor.on(SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED)
on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callback&lt;MagneticFieldUncalibratedResponse&gt;, options: Options): void
on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callback&lt;MagneticFieldUncalibratedResponse&gt;, options?: Options): void
Subscribes to data changes of the uncalibrated magnetic field sensor. If this API is called multiple times for the same application, the last call takes effect.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | Yes| Callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -359,14 +359,14 @@ Subscribes to data changes of the proximity sensor. If this API is called multip
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PROXIMITY**.|
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | Yes| Callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PROXIMITY**. |
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | Yes | Callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY,function(data){
console.info('Distance: ' + data.distance);
......@@ -384,14 +384,14 @@ Subscribes to data changes of the humidity sensor. If this API is called multipl
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HUMIDITY**.|
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | Yes| Callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | -------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HUMIDITY**. |
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | Yes | Callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY,function(data){
console.info('Humidity: ' + data.humidity);
......@@ -409,14 +409,14 @@ Subscribes to data changes of the barometer sensor. If this API is called multip
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_BAROMETER**.|
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | Yes| Callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_BAROMETER**. |
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | Yes | Callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,function(data){
console.info('Atmospheric pressure: ' + data.pressure);
......@@ -434,14 +434,14 @@ Subscribes to data changes of the Hall effect sensor. If this API is called mult
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HALL**.|
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | Yes| Callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HALL**. |
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | Yes | Callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL,function(data){
console.info('Status: ' + data.status);
......@@ -459,14 +459,14 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes| Callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes | Callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**. |
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,function(data){
console.info(' Illumination: ' + data.intensity);
......@@ -484,14 +484,14 @@ Subscribes to data changes of the orientation sensor. If this API is called mult
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ORIENTATION**.|
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | Yes| Callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ORIENTATION**. |
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | Yes | Callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,function(data){
console.info('The device rotates at an angle around the X axis: ' + data.beta);
......@@ -512,14 +512,14 @@ Subscribes to only one data change of the heart rate sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. |
| callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.|
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE,function(data){
......@@ -537,14 +537,14 @@ Subscribes to data changes of the rotation vector sensor. If this API is called
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.|
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | Yes| Callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.|
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | Yes | Callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -565,14 +565,14 @@ Subscribes to data changes of the wear detection sensor. If this API is called m
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.|
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | Yes| Callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
| options | [Options](#options) | No| Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.|
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | Yes | Callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
- Example
**Example**
```
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(data){
console.info('Wear status: ' + data.value);
......@@ -592,13 +592,13 @@ Subscribes to only one data change of the acceleration sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER**.|
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | Yes| One-shot callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER**. |
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | Yes | One-shot callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){
console.info('X-coordinate component: ' + data.x);
......@@ -619,13 +619,13 @@ Subscribes to only one data change of the linear acceleration sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.|
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | Yes| One-shot callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.|
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | Yes | One-shot callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -646,13 +646,13 @@ Subscribes to only one data change of the uncalibrated acceleration sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.|
| callback | Callback&lt;[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)&gt; | Yes| One-shot callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.|
| callback | Callback&lt;[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)&gt; | Yes | One-shot callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -674,13 +674,13 @@ Subscribes to only one data change of the gravity sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GRAVITY**.|
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | Yes| One-shot callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GRAVITY**. |
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | Yes | One-shot callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -701,13 +701,13 @@ Subscribes to only one data change of the gyroscope sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE**.|
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | Yes| One-shot callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE**. |
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | Yes | One-shot callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -728,13 +728,13 @@ Subscribes to only one data change of the uncalibrated gyroscope sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.|
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | Yes| One-shot callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.|
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | Yes | One-shot callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -756,13 +756,13 @@ Subscribes to only one data change of the significant motion sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.|
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | Yes| One-shot callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.|
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | Yes | One-shot callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(data) {
console.info('Scalar data: ' + data.scalar);
......@@ -781,13 +781,13 @@ Subscribes to only one data change of the pedometer detection sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.|
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | Yes| One-shot callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.|
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | Yes | One-shot callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(data) {
console.info('Scalar data: ' + data.scalar);
......@@ -806,13 +806,13 @@ Subscribes to only one data change of the pedometer sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER**.|
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | Yes| One-shot callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PEDOMETER**. |
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | Yes | One-shot callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, function(data) {
console.info('Steps: ' + data.steps);
......@@ -829,13 +829,13 @@ Subscribes to only one data change of the ambient temperature sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.|
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | Yes| One-shot callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.|
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | Yes | One-shot callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(data) {
console.info('Temperature: ' + data.temperature);
......@@ -852,13 +852,13 @@ Subscribes to only one data change of the magnetic field sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**.|
| callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | Yes| One-shot callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**. |
| callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | Yes | One-shot callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -877,13 +877,13 @@ Subscribes to only one data change of the uncalibrated magnetic field sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | Yes| One-shot callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | Yes | One-shot callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -905,13 +905,13 @@ Subscribes to only one data change of the proximity sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PROXIMITY**.|
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | Yes| One-shot callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_PROXIMITY**. |
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | Yes | One-shot callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, function(error, data) {
if (error) {
......@@ -932,13 +932,13 @@ Subscribes to only one data change of the humidity sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HUMIDITY**.|
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | Yes| One-shot callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HUMIDITY**. |
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | Yes | One-shot callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, function(data) {
console.info('Humidity: ' + data.humidity);
......@@ -955,13 +955,13 @@ Subscribes to only one data change of the barometer sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_BAROMETER**.|
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | Yes| One-shot callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_BAROMETER**. |
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | Yes | One-shot callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, function(data) {
console.info('Atmospheric pressure: ' + data.pressure);
......@@ -978,13 +978,13 @@ Subscribes to only one data change of the Hall effect sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HALL**.|
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | Yes| One-shot callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HALL**. |
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | Yes | One-shot callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL, function(data) {
console.info('Status: ' + data.status);
......@@ -1001,13 +1001,13 @@ Subscribes to only one data change of the ambient light sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes| One-shot callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | -------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes | One-shot callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, function(data) {
console.info(' Illumination: ' + data.intensity);
......@@ -1024,13 +1024,13 @@ Subscribes to only one data change of the orientation sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ORIENTATION**.|
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | Yes| One-shot callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ORIENTATION**. |
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | Yes | One-shot callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, function(data) {
console.info('The device rotates at an angle around the X axis: ' + data.beta);
......@@ -1049,13 +1049,13 @@ Subscribes to only one data change of the rotation vector sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.|
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | Yes| One-shot callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.|
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | Yes | One-shot callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(data) {
console.info('X-coordinate component: ' + data.x);
......@@ -1077,13 +1077,13 @@ Subscribes to only one data change of the heart rate sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**.|
| callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | Yes| One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. |
| callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, function(data) {
console.info("Heart rate: " + data.heartRate);
......@@ -1100,13 +1100,13 @@ Subscribes to only one data change of the wear detection sensor.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [SensorType](#sensortype) | Yes| Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.|
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | Yes| One-shot callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.|
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | Yes | One-shot callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
- Example
**Example**
```
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(data) {
console.info("Wear status: "+ data.value);
......@@ -1124,14 +1124,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER**.|
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1152,14 +1152,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.|
| callback | Callback&lt;[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1181,14 +1181,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes | Callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.|
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | Yes | Callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**. |
- Example
**Example**
```
function callback(data) {
......@@ -1205,14 +1205,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.|
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | Yes | Callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1229,14 +1229,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_BAROMETER**. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_BAROMETER**.|
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | Yes | Callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1253,14 +1253,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GRAVITY**. |
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | Yes | Callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1281,14 +1281,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE**. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE**.|
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | Yes | Callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1301,7 +1301,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback);
## sensor.off(SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback&lt;GyroscopeResponse&gt;): void
off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback&lt;GyroscopeUncalibratedResponse&gt;): void
Unsubscribes from sensor data changes.
......@@ -1309,14 +1309,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.|
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1335,14 +1335,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HALL**. |
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | Yes | Callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1361,14 +1361,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype)[SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HEART_RATE**. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype)[SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HEART_RATE**.|
| callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1387,14 +1387,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HUMIDITY**. |
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | Yes | Callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1413,14 +1413,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.|
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1441,14 +1441,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**. |
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**.|
| callbackcallback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | Yes | Callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1467,14 +1467,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.|
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | Yes | Callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1496,14 +1496,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ORIENTATION**. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ORIENTATION**.|
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | Yes | Callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1522,14 +1522,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER**. |
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | Yes | Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
- Example
**Return value**
```
function callback(data) {
......@@ -1548,14 +1548,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.|
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | Yes | Callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1572,14 +1572,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PROXIMITY**. |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PROXIMITY**.|
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | Yes | Callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1596,14 +1596,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.|
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | Yes | Callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1623,14 +1623,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.|
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | Yes | Callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
- Example
**Example**
```
function callback(data) {
......@@ -1647,14 +1647,14 @@ Unsubscribes from sensor data changes.
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.|
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | Yes | Callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
- Example
**Example**
```
function accCallback(data) {
......@@ -1671,18 +1671,18 @@ Rotates a rotation vector so that it can represent the coordinate system in diff
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ---------------- | ----------------------------------------- | ---- | ---------------------- |
| inRotationVector | Array&lt;number&gt; | Yes | Rotation vector to rotate. |
| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation vector after being rotated.|
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------------- | ---- | ----------- |
| inRotationVector | Array&lt;number&gt; | Yes | Rotation vector to rotate. |
| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation vector after being rotated.|
- Example
**Example**
```
sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3}, function(err, data) {
```
sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3}, function(err, data) {
if (err) {
console.error("Operation failed. Error code: " + err.code + ", message: " + err.message);
return;
......@@ -1692,8 +1692,7 @@ Rotates a rotation vector so that it can represent the coordinate system in diff
console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]);
}
})
```
```
## sensor.transformCoordinateSystem
transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: CoordinatesOptions): Promise&lt;Array&lt;number&gt;&gt;
......@@ -1702,23 +1701,23 @@ Rotates a rotation vector so that it can represent the coordinate system in diff
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ---------------- | ----------------------------------------- | ---- | ---------------- |
| inRotationVector | Array&lt;number&gt; | Yes | Rotation vector to rotate. |
| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system.|
| Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------------- | ---- | -------- |
| inRotationVector | Array&lt;number&gt; | Yes | Rotation vector to rotate. |
| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system.|
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | ---------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation vector after being converted.|
| Type | Description |
| ---------------------------------- | ----------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation vector after being rotated.|
- Example
**Example**
```
const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3});
```
const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3});
promise.then((data) => {
console.info("Operation successed.");
for (var i=0; i < data.length; i++) {
......@@ -1726,11 +1725,8 @@ Rotates a rotation vector so that it can represent the coordinate system in diff
}
}).catch((err) => {
console.info("Operation failed");
})
```
})
```
## sensor.getGeomagneticField
......@@ -1740,16 +1736,16 @@ Obtains the geomagnetic field of a geographic location. This API uses a callback
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| locationOptions | [LocationOptions](#locationoptions) | Yes| Geographic location.|
| timeMillis | number | Yes| Time for obtaining the magnetic declination, in milliseconds.|
| callback | AsyncCallback&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | Yes| Callback used to return the geomagnetic field.|
**Parameters**
| Name | Type | Mandatory | Description |
| --------------- | ---------------------------------------- | ---- | ----------------- |
| locationOptions | [LocationOptions](#locationoptions) | Yes | Geographic location. |
| timeMillis | number | Yes | Time for obtaining the magnetic declination, in milliseconds.|
| callback | AsyncCallback&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | Yes | Callback used to return the geomagnetic field. |
- Example
```
sensor.getGeomagneticField([80, 0, 0], {'timeMillis':1580486400000}, function(err, data) {
**Example**
```
sensor.getGeomagneticField([80, 0, 0], 1580486400000, function(err, data) {
if (err) {
console.error('Operation failed. Error code: ' + err.code + '; message: ' + err.message);
return;
......@@ -1757,10 +1753,8 @@ Obtains the geomagnetic field of a geographic location. This API uses a callback
console.info('sensor_getGeomagneticField_promise x: ' + data.x + ',y: ' + data.y + ',z: ' +
data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle +
',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity);
});
```
});
```
## sensor.getGeomagneticField
getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise&lt;GeomagneticResponse&gt;
......@@ -1769,20 +1763,20 @@ Obtains the geomagnetic field of a geographic location. This API uses a promise
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| locationOptions | [LocationOptions](#locationoptions) | Yes| Geographic location.|
| timeMillis | number | Yes| Time for obtaining the magnetic declination, in milliseconds.|
**Parameters**
| Name | Type | Mandatory | Description |
| --------------- | ----------------------------------- | ---- | ----------------- |
| locationOptions | [LocationOptions](#locationoptions) | Yes | Geographic location. |
| timeMillis | number | Yes | Time for obtaining the magnetic declination, in milliseconds.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | Promise used to return the geomagnetic field.|
**Return value**
| Type | Description |
| ---------------------------------------- | ------- |
| Promise&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | Promise used to return the geomagnetic field.|
- Example
**Return value**
```
const promise = sensor.getGeomagneticField([80, 0, 0], {'timeMillis':1580486400000});
const promise = sensor.getGeomagneticField([80, 0, 0], 1580486400000);
promise.then((data) => {
console.info('sensor_getGeomagneticField_promise x: ' + data.x + ',y: ' + data.y + ',z: ' +
data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle +
......@@ -1800,15 +1794,15 @@ Obtains the altitude at which the device is located based on the sea-level atmos
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| --------------- | --------------------------- | ---- | ------------------------------------- |
| seaPressure | number | Yes | Sea-level atmospheric pressure, in hPa. |
| currentPressure | number | Yes | Current atmospheric pressure at the altitude where the device is located, in hPa.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the altitude, in meters. |
| Name | Type | Mandatory | Description |
| --------------- | --------------------------- | ---- | -------------------- |
| seaPressure | number | Yes | Sea-level atmospheric pressure, in hPa. |
| currentPressure | number | Yes | Atmospheric pressure at the altitude where the device is located, in hPa.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the altitude, in meters. |
- Example
**Return value**
```
sensor.getAltitude(0, 200, function(err, data) {
......@@ -1829,20 +1823,20 @@ Obtains the altitude at which the device is located based on the sea-level atmos
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| --------------- | ------ | ---- | ------------------------------------- |
| seaPressure | number | Yes | Sea-level atmospheric pressure, in hPa. |
| currentPressure | number | Yes | Atmospheric pressure at the altitude where the device is located, in hPa.|
| Name | Type | Mandatory | Description |
| --------------- | ------ | ---- | -------------------- |
| seaPressure | number | Yes | Sea-level atmospheric pressure, in hPa. |
| currentPressure | number | Yes | Atmospheric pressure at the altitude where the device is located, in hPa.|
- Return value
**Return value**
| Type | Description |
| --------------------- | ------------------------------------ |
| Promise&lt;number&gt; | Promise used to return the altitude, in meters.|
| Type | Description |
| --------------------- | ------------------ |
| Promise&lt;number&gt; | Promise used to return the altitude, in meters.|
- Example
**Return value**
```
const promise = sensor.getAltitude(0, 200);
......@@ -1862,14 +1856,14 @@ Obtains the magnetic dip based on the inclination matrix. This API uses a callba
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------------- | --------------------------- | ---- | ---------------------------- |
| inclinationMatrix | Array&lt;number&gt; | Yes | Inclination matrix. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the magnetic dip, in radians.|
| Name | Type | Mandatory | Description |
| ----------------- | --------------------------- | ---- | -------------- |
| inclinationMatrix | Array&lt;number&gt; | Yes | Inclination matrix. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the magnetic dip, in radians.|
- Example
**Return value**
```
sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) {
......@@ -1878,7 +1872,7 @@ Obtains the magnetic dip based on the inclination matrix. This API uses a callba
err.message);
return;
}
console.info(Successed to get getGeomagneticDip interface get data: " + data);
console.info("Successed to get getGeomagneticDip interface get data: " + data);
})
```
......@@ -1890,19 +1884,19 @@ Obtains the magnetic dip based on the inclination matrix. This API uses a promis
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------------- | ------------------- | ---- | -------------- |
| inclinationMatrix | Array&lt;number&gt; | Yes | Inclination matrix.|
| Name | Type | Mandatory | Description |
| ----------------- | ------------------- | ---- | ------- |
| inclinationMatrix | Array&lt;number&gt; | Yes | Inclination matrix.|
- Return value
**Return value**
| Type | Description |
| --------------------- | ---------------------------- |
| Promise&lt;number&gt; | Promise used to return the magnetic dip, in radians.|
| Type | Description |
| --------------------- | -------------- |
| Promise&lt;number&gt; | Promise used to return the magnetic dip, in radians.|
- Example
**Return value**
```
const promise = sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1]);
......@@ -1921,15 +1915,15 @@ Obtains the angle change between two rotation matrices. This API uses a callback
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| --------------------- | ---------------------------------------- | ---- | --------------------------------- |
| currentRotationMatrix | Array&lt;number&gt; | Yes | Current rotation matrix. |
| preRotationMatrix | Array&lt;number&gt; | Yes | The other rotation matrix. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the angle change around the z, x, and y axes.|
| Name | Type | Mandatory | Description |
| --------------------- | ---------------------------------------- | ---- | ------------------ |
| currentRotationMatrix | Array&lt;number&gt; | Yes | Current rotation matrix. |
| preRotationMatrix | Array&lt;number&gt; | Yes | The other rotation matrix. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the angle change around the z, x, and y axes.|
- Example
**Return value**
```
sensor. getAngleModify([1,0,0,0,1,0,0,0,1], [1, 0, 0, 0, 0.87, -0.50, 0, 0.50, 0.87], function(err, data) {
......@@ -1954,20 +1948,20 @@ Obtains the angle change between two rotation matrices. This API uses a promise
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| --------------------- | ------------------- | ---- | ------------------ |
| currentRotationMatrix | Array&lt;number&gt; | Yes | Current rotation matrix.|
| preRotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix.|
| Name | Type | Mandatory | Description |
| --------------------- | ------------------- | ---- | --------- |
| currentRotationMatrix | Array&lt;number&gt; | Yes | Current rotation matrix.|
| preRotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix. |
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | --------------------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the angle change around the z, x, and y axes.|
| Type | Description |
| ---------------------------------- | ------------------ |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the angle change around the z, x, and y axes.|
- Example
**Return value**
```
const promise = sensor.getAngleModify([1,0,0,0,1,0,0,0,1], [1,0,0,0,0.87,-0.50,0,0.50,0.87]);
......@@ -1990,14 +1984,14 @@ Converts a rotation vector into a rotation matrix. This API uses a callback to r
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------- | ---- | -------------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation matrix.|
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation matrix.|
- Example
**Return value**
```
sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) {
......@@ -2022,19 +2016,19 @@ Converts a rotation vector into a rotation matrix. This API uses a promise to re
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------- | ---- | -------------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| Name | Type | Mandatory | Description |
| -------------- | ------------------- | ---- | ------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | -------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation matrix.|
| Type | Description |
| ---------------------------------- | ------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation matrix.|
- Example
**Return value**
```
const promise = sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877]);
......@@ -2057,14 +2051,14 @@ Converts a rotation vector into a quaternion. This API uses a callback to return
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------- | ---- | -------------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the quaternion. |
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the quaternion. |
- Example
**Return value**
```
sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) {
......@@ -2089,19 +2083,19 @@ Converts a rotation vector into a quaternion. This API uses a promise to return
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------- | ---- | -------------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
| Name | Type | Mandatory | Description |
| -------------- | ------------------- | ---- | ------- |
| rotationVector | Array&lt;number&gt; | Yes | Rotation vector to convert.|
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | ------------ |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the quaternion.|
| Type | Description |
| ---------------------------------- | ------ |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the quaternion.|
- Example
**Return value**
```
const promise = sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877]);
......@@ -2124,14 +2118,14 @@ Obtains the device direction based on the rotation matrix. This API uses a callb
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------- | ---- | --------------------------------- |
| rotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation angle around the z, x, and y axes.|
| Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------- | ---- | ------------------ |
| rotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix. |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the rotation angle around the z, x, and y axes.|
- Example
**Return value**
```
sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) {
......@@ -2156,19 +2150,19 @@ Obtains the device direction based on the rotation matrix. This API uses a promi
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------- | ---- | -------------- |
| rotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix.|
| Name | Type | Mandatory | Description |
| -------------- | ------------------- | ---- | ------- |
| rotationMatrix | Array&lt;number&gt; | Yes | Rotation matrix.|
- Return value
**Return value**
| Type | Description |
| ---------------------------------- | --------------------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation angle around the z, x, and y axes.|
| Type | Description |
| ---------------------------------- | ------------------ |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the rotation angle around the z, x, and y axes.|
- Example
**Return value**
```
const promise = sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1]);
......@@ -2191,15 +2185,15 @@ Creates a rotation matrix based on the gravity vector and geomagnetic vector. Th
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------------------------------------------ | ---- | -------------- |
| gravity | Array&lt;number&gt; | Yes | Gravity vector.|
| geomagnetic | Array&lt;number&gt; | Yes | Geomagnetic vector.|
| callback | AsyncCallback&lt;[RotationMatrixResponse](#rotationmatrixresponse)&gt; | Yes | Callback used to return the rotation matrix.|
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------------------- | ---- | ------- |
| gravity | Array&lt;number&gt; | Yes | Gravity vector.|
| geomagnetic | Array&lt;number&gt; | Yes | Geomagnetic vector.|
| callback | AsyncCallback&lt;[RotationMatrixResponse](#rotationmatrixresponse)&gt; | Yes | Callback used to return the rotation matrix.|
- Example
**Return value**
```
sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444], function(err, data) {
......@@ -2224,20 +2218,20 @@ Creates a rotation matrix based on the gravity vector and geomagnetic vector. Th
**System capability**: SystemCapability.Sensors.Sensor
- Parameters
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------- | ---- | -------------- |
| gravity | Array&lt;number&gt; | Yes | Gravity vector.|
| geomagnetic | Array&lt;number&gt; | Yes | Geomagnetic vector.|
| Name | Type | Mandatory | Description |
| ----------- | ------------------- | ---- | ------- |
| gravity | Array&lt;number&gt; | Yes | Gravity vector.|
| geomagnetic | Array&lt;number&gt; | Yes | Geomagnetic vector.|
- Return value
**Return value**
| Type | Description |
| ------------------------------------------------------------ | -------------- |
| Promise&lt;[RotationMatrixResponse](#rotationmatrixresponse)&gt; | Promise used to return the rotation matrix.|
| Type | Description |
| ---------------------------------------- | ------- |
| Promise&lt;[RotationMatrixResponse](#rotationmatrixresponse)&gt; | Promise used to return the rotation matrix.|
- Example
**Return value**
```
const promise = sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444]);
......@@ -2259,28 +2253,28 @@ Enumerates the sensor types.
**System capability**: SystemCapability.Sensors.Sensor
| Name| Default Value| Description|
| -------- | -------- | -------- |
| SENSOR_TYPE_ID_ACCELEROMETER | 1 | Acceleration sensor.|
| SENSOR_TYPE_ID_GYROSCOPE | 2 | Gyroscope sensor.|
| SENSOR_TYPE_ID_AMBIENT_LIGHT | 5 | Ambient light sensor.|
| SENSOR_TYPE_ID_MAGNETIC_FIELD | 6 | Magnetic field sensor.|
| SENSOR_TYPE_ID_BAROMETER | 8 | Barometer sensor.|
| SENSOR_TYPE_ID_HALL | 10 | Hall effect sensor.|
| SENSOR_TYPE_ID_PROXIMITY | 12 | Proximity sensor.|
| SENSOR_TYPE_ID_HUMIDITY | 13 | Humidity sensor.|
| SENSOR_TYPE_ID_ORIENTATION | 256 | Orientation sensor.|
| SENSOR_TYPE_ID_GRAVITY | 257 | Gravity sensor.|
| SENSOR_TYPE_ID_LINEAR_ACCELERATION | 258 | Linear acceleration sensor.|
| SENSOR_TYPE_ID_ROTATION_VECTOR | 259 | Rotation vector sensor.|
| SENSOR_TYPE_ID_AMBIENT_TEMPERATURE | 260 | Ambient temperature sensor.|
| SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED | 261 | Uncalibrated magnetic field sensor.|
| SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED | 263 | Uncalibrated gyroscope sensor.|
| SENSOR_TYPE_ID_SIGNIFICANT_MOTION | 264 | Significant motion sensor.|
| SENSOR_TYPE_ID_PEDOMETER_DETECTION | 265 | Pedometer detection sensor.|
| SENSOR_TYPE_ID_PEDOMETER | 266 | Pedometer sensor.|
| SENSOR_TYPE_ID_HEART_RATE | 278 | Heart rate sensor.|
| SENSOR_TYPE_ID_WEAR_DETECTION | 280 | Wear detection sensor.|
| Name | Default Value | Description |
| ---------------------------------------- | ---- | ----------- |
| SENSOR_TYPE_ID_ACCELEROMETER | 1 | Acceleration sensor. |
| SENSOR_TYPE_ID_GYROSCOPE | 2 | Gyroscope sensor. |
| SENSOR_TYPE_ID_AMBIENT_LIGHT | 5 | Ambient light sensor. |
| SENSOR_TYPE_ID_MAGNETIC_FIELD | 6 | Magnetic field sensor. |
| SENSOR_TYPE_ID_BAROMETER | 8 | Barometer sensor. |
| SENSOR_TYPE_ID_HALL | 10 | Hall effect sensor. |
| SENSOR_TYPE_ID_PROXIMITY | 12 | Proximity sensor. |
| SENSOR_TYPE_ID_HUMIDITY | 13 | Humidity sensor. |
| SENSOR_TYPE_ID_ORIENTATION | 256 | Orientation sensor. |
| SENSOR_TYPE_ID_GRAVITY | 257 | Gravity sensor. |
| SENSOR_TYPE_ID_LINEAR_ACCELERATION | 258 | Linear acceleration sensor. |
| SENSOR_TYPE_ID_ROTATION_VECTOR | 259 | Rotation vector sensor. |
| SENSOR_TYPE_ID_AMBIENT_TEMPERATURE | 260 | Ambient temperature sensor. |
| SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED | 261 | Uncalibrated magnetic field sensor. |
| SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED | 263 | Uncalibrated gyroscope sensor. |
| SENSOR_TYPE_ID_SIGNIFICANT_MOTION | 264 | Significant motion sensor. |
| SENSOR_TYPE_ID_PEDOMETER_DETECTION | 265 | Pedometer detection sensor. |
| SENSOR_TYPE_ID_PEDOMETER | 266 | Pedometer sensor. |
| SENSOR_TYPE_ID_HEART_RATE | 278 | Heart rate sensor. |
| SENSOR_TYPE_ID_WEAR_DETECTION | 280 | Wear detection sensor. |
| SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED | 281 | Uncalibrated acceleration sensor.|
......@@ -2290,9 +2284,9 @@ Describes the timestamp of the sensor data.
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| timestamp | number | Yes| Yes| Timestamp when the sensor reports data.|
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------------ |
| timestamp | number | Yes | Yes | Timestamp when the sensor reports data.|
## AccelerometerResponse
......@@ -2302,11 +2296,11 @@ Describes the acceleration sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes| Yes| Acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes| Yes| Acceleration along the z-axis of the device, in m/s2.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ---------------------- |
| x | number | Yes | Yes | Acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes | Yes | Acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes | Yes | Acceleration along the z-axis of the device, in m/s2.|
## LinearAccelerometerResponse
......@@ -2316,11 +2310,11 @@ Describes the linear acceleration sensor data. It extends from [Response](#respo
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Linear acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes| Yes| Linear acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes| Yes| Linear acceleration along the z-axis of the device, in m/s2.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------------------------ |
| x | number | Yes | Yes | Linear acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes | Yes | Linear acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes | Yes | Linear acceleration along the z-axis of the device, in m/s2.|
## AccelerometerUncalibratedResponse
......@@ -2330,14 +2324,14 @@ Describes the uncalibrated acceleration sensor data. It extends from [Response](
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Uncalibrated acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes| Yes| Uncalibrated acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes| Yes| Uncalibrated acceleration along the z-axis of the device, in m/s2.|
| biasX | number | Yes| Yes| Uncalibrated acceleration bias along the x-axis of the device, in m/s2.|
| biasY | number | Yes| Yes| Uncalibrated acceleration bias along the y-axis of the device, in m/s2.|
| biasZ | number | Yes| Yes| Uncalibrated acceleration bias along the z-axis of the device, in m/s2.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | ---------------------------- |
| x | number | Yes | Yes | Uncalibrated acceleration along the x-axis of the device, in m/s2. |
| y | number | Yes | Yes | Uncalibrated acceleration along the y-axis of the device, in m/s2. |
| z | number | Yes | Yes | Uncalibrated acceleration along the z-axis of the device, in m/s2. |
| biasX | number | Yes | Yes | Uncalibrated acceleration bias along the x-axis of the device, in m/s2. |
| biasY | number | Yes | Yes | Uncalibrated acceleration bias along the y-axis of the device, in m/s2.|
| biasZ | number | Yes | Yes | Uncalibrated acceleration bias along the z-axis of the device, in m/s2. |
## GravityResponse
......@@ -2347,11 +2341,11 @@ Describes the gravity sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Gravitational acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes| Yes| Gravitational acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes| Yes| Gravitational acceleration along the z-axis of the device, in m/s2.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------------------------ |
| x | number | Yes | Yes | Gravitational acceleration along the x-axis of the device, in m/s2.|
| y | number | Yes | Yes | Gravitational acceleration along the y-axis of the device, in m/s2.|
| z | number | Yes | Yes | Gravitational acceleration along the z-axis of the device, in m/s2.|
## OrientationResponse
......@@ -2361,11 +2355,11 @@ Describes the orientation sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| alpha | number | Yes| Yes| Rotation angle of the device around the z-axis, in rad.|
| beta | number | Yes| Yes| Rotation angle of the device around the x-axis, in rad.|
| gamma | number | Yes| Yes| Rotation angle of the device around the y-axis, in rad.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | ------------------------ |
| alpha | number | Yes | Yes | Rotation angle of the device around the z-axis, in rad.|
| beta | number | Yes | Yes | Rotation angle of the device around the x-axis, in rad. |
| gamma | number | Yes | Yes | Rotation angle of the device around the y-axis, in rad. |
## RotationVectorResponse
......@@ -2375,12 +2369,12 @@ Describes the rotation vector sensor data. It extends from [Response](#response)
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| X-component of the rotation vector.|
| y | number | Yes| Yes| Y-component of the rotation vector.|
| z | number | Yes| Yes| Z-component of the rotation vector.|
| w | number | Yes| Yes| Scalar.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | --------- |
| x | number | Yes | Yes | X-component of the rotation vector.|
| y | number | Yes | Yes | Y-component of the rotation vector.|
| z | number | Yes | Yes | Z-component of the rotation vector.|
| w | number | Yes | Yes | Scalar. |
## GyroscopeResponse
......@@ -2390,11 +2384,11 @@ Describes the gyroscope sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Angular velocity of rotation around the x-axis of the device, in rad/s.|
| y | number | Yes| Yes| Angular velocity of rotation around the y-axis of the device, in rad/s.|
| z | number | Yes| Yes| Angular velocity of rotation around the z-axis of the device, in rad/s.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------------------- |
| x | number | Yes | Yes | Angular velocity of rotation around the x-axis of the device, in rad/s.|
| y | number | Yes | Yes | Angular velocity of rotation around the y-axis of the device, in rad/s.|
| z | number | Yes | Yes | Angular velocity of rotation around the z-axis of the device, in rad/s.|
## GyroscopeUncalibratedResponse
......@@ -2404,14 +2398,14 @@ Describes the uncalibrated gyroscope sensor data. It extends from [Response](#re
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Uncalibrated angular velocity of rotation around the x-axis of the device, in rad/s.|
| y | number | Yes| Yes| Uncalibrated angular velocity of rotation around the y-axis of the device, in rad/s.|
| z | number | Yes| Yes| Uncalibrated angular velocity of rotation around the z-axis of the device, in rad/s.|
| biasX | number | Yes| Yes| Uncalibrated angular velocity bias of rotation around the x-axis of the device, in rad/s.|
| biasY | number | Yes| Yes| Uncalibrated angular velocity bias of rotation around the y-axis of the device, in rad/s.|
| biasZ | number | Yes| Yes| Uncalibrated angular velocity bias of rotation around the z-axis of the device, in rad/s.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | ------------------------ |
| x | number | Yes | Yes | Uncalibrated angular velocity of rotation around the x-axis of the device, in rad/s. |
| y | number | Yes | Yes | Uncalibrated angular velocity of rotation around the y-axis of the device, in rad/s. |
| z | number | Yes | Yes | Uncalibrated angular velocity of rotation around the z-axis of the device, in rad/s. |
| biasX | number | Yes | Yes | Uncalibrated angular velocity bias of rotation around the x-axis of the device, in rad/s.|
| biasY | number | Yes | Yes | Uncalibrated angular velocity bias of rotation around the y-axis of the device, in rad/s.|
| biasZ | number | Yes | Yes | Uncalibrated angular velocity bias of rotation around the z-axis of the device, in rad/s.|
## SignificantMotionResponse
......@@ -2421,9 +2415,9 @@ Describes the significant motion sensor data. It extends from [Response](#respon
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| scalar | number | Yes| Yes| Intensity of a motion. This parameter specifies 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.|
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------------------- |
| scalar | number | Yes | Yes | Intensity of a motion. This parameter specifies 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.|
## ProximityResponse
......@@ -2433,9 +2427,9 @@ Describes the proximity sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| distance | number | Yes| Yes| Proximity between the visible object and the device monitor. The value **0** means the two are close to each other, and **1** means that they are far away from each other.|
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ---------------------------- |
| distance | number | Yes | Yes | Proximity between the visible object and the device monitor. The value **0** means the two are close to each other, and **1** means that they are far away from each other.|
## LightResponse
......@@ -2445,9 +2439,9 @@ Describes the ambient light sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| intensity | number | Yes| Yes| Illumination, in lux.|
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ----------- |
| intensity | number | Yes | Yes | Illumination, in lux.|
## HallResponse
......@@ -2457,9 +2451,9 @@ Describes the Hall effect sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| status | number | Yes| Yes| Hall effect sensor status. This parameter specifies whether a magnetic field exists around a device. The value **0** means that a magnetic field exists around the device, and **1** means the opposite.|
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | --------------------------------- |
| status | number | Yes | Yes | Hall effect sensor status. This parameter specifies whether a magnetic field exists around a device. The value **0** means that a magnetic field exists around the device, and **1** means the opposite.|
## MagneticFieldResponse
......@@ -2469,11 +2463,11 @@ Describes the magnetic field sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Magnetic field strength on the x-axis, in μT.|
| y | number | Yes| Yes| Magnetic field strength on the y-axis, in μT.|
| z | number | Yes| Yes| Magnetic field strength on the z-axis, in μT.|
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------------------ |
| x | number | Yes | Yes | Magnetic field strength on the x-axis, in μT. |
| y | number | Yes | Yes | Magnetic field strength on the y-axis, in μT. |
| z | number | Yes | Yes | Magnetic field strength on the z-axis, in μT.|
## MagneticFieldUncalibratedResponse
......@@ -2483,14 +2477,14 @@ Describes the uncalibrated magnetic field sensor data. It extends from [Response
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| Uncalibrated magnetic field strength on the x-axis, in μT.|
| y | number | Yes| Yes| Uncalibrated magnetic field strength on the y-axis, in μT.|
| z | number | Yes| Yes| Uncalibrated magnetic field strength on the z-axis, in μT.|
| biasX | number | Yes| Yes| Bias of the uncalibrated magnetic field strength on the x-axis, in μT.|
| biasY | number | Yes| Yes| Bias of the uncalibrated magnetic field strength on the y-axis, in μT.|
| biasZ | number | Yes| Yes| Bias of the uncalibrated magnetic field strength on the z-axis, in μT.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | ---------------------- |
| x | number | Yes | Yes | Uncalibrated magnetic field strength on the x-axis, in μT. |
| y | number | Yes | Yes | Uncalibrated magnetic field strength on the y-axis, in μT. |
| z | number | Yes | Yes | Uncalibrated magnetic field strength on the z-axis, in μT. |
| biasX | number | Yes | Yes | Bias of the uncalibrated magnetic field strength on the x-axis, in μT.|
| biasY | number | Yes | Yes | Bias of the uncalibrated magnetic field strength on the y-axis, in μT.|
| biasZ | number | Yes | Yes | Bias of the uncalibrated magnetic field strength on the z-axis, in μT.|
## PedometerResponse
......@@ -2500,9 +2494,9 @@ Describes the pedometer sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| steps | number | Yes| Yes| Number of steps a user has walked.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | -------- |
| steps | number | Yes | Yes | Number of steps a user has walked.|
## HumidityResponse
......@@ -2512,9 +2506,9 @@ Describes the humidity sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| humidity | number | Yes| Yes| Ambient relative humidity, in a percentage (%).|
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------------------------------------ |
| humidity | number | Yes | Yes | Ambient relative humidity, in a percentage (%).|
## PedometerDetectionResponse
......@@ -2524,9 +2518,9 @@ Describes the pedometer detection sensor data. It extends from [Response](#respo
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| scalar | number | Yes| Yes| Pedometer detection. This parameter specifies whether a user takes a step. The value **0** means that the user does not take a step, and **1** means that the user takes a step.|
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------------------- |
| scalar | number | Yes | Yes | Pedometer detection. This parameter specifies whether a user takes a step. The value **0** means that the user does not take a step, and **1** means that the user takes a step.|
## AmbientTemperatureResponse
......@@ -2536,9 +2530,9 @@ Describes the ambient temperature sensor data. It extends from [Response](#respo
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| temperature | number | Yes| Yes| Ambient temperature, in degree Celsius.|
| Name | Type | Readable | Writable | Description |
| ----------- | ------ | ---- | ---- | ------------- |
| temperature | number | Yes | Yes | Ambient temperature, in degree Celsius.|
## BarometerResponse
......@@ -2548,9 +2542,9 @@ Describes the barometer sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| pressure | number | Yes| Yes| Atmospheric pressure, in pascal.|
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------------ |
| pressure | number | Yes | Yes | Atmospheric pressure, in pascal.|
## HeartRateResponse
......@@ -2560,9 +2554,9 @@ Describes the heart rate sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| heartRate | number | Yes| Yes| Heart rate, in beats per minute (bpm).|
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | --------------------- |
| heartRate | number | Yes | Yes | Heart rate, in beats per minute (bpm).|
## WearDetectionResponse
......@@ -2572,9 +2566,9 @@ Describes the wear detection sensor data. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| value | number | Yes| Yes| Whether the device is being worn. The value **1** means that the device is being worn, and **0** means the opposite.|
| Name | Type | Readable | Writable | Description |
| ----- | ------ | ---- | ---- | ------------------------- |
| value | number | Yes | Yes | Whether the device is being worn. The value **1** means that the device is being worn, and **0** means the opposite.|
## Options
......@@ -2583,8 +2577,8 @@ Describes the sensor data reporting frequency.
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Description|
| -------- | -------- | -------- |
| Name | Type | Description |
| -------- | ------ | --------------------------- |
| interval | number | Frequency at which a sensor reports data. The default value is 200,000,000 ns.|
## RotationMatrixResponse
......@@ -2593,8 +2587,8 @@ Describes the response for setting the rotation matrix.
**System capability**: SystemCapability.Sensors.Sensor
| Name | Type | Readable| Writable| Description |
| ----------- | ------------------- | ---- | ---- | ---------- |
| Name | Type | Readable | Writable | Description |
| ----------- | ------------------- | ---- | ---- | ----- |
| rotation | Array&lt;number&gt; | Yes | Yes | Rotation matrix.|
| inclination | Array&lt;number&gt; | Yes | Yes | Inclination matrix.|
......@@ -2605,8 +2599,8 @@ Describes the coordinate options.
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description |
| ---- | -------- | ---- | ---- | ----------- |
| Name | Type | Readable | Writable | Description |
| ---- | ------ | ---- | ---- | ------ |
| x | number | Yes | Yes | X coordinate direction.|
| y | number | Yes | Yes | Y coordinate direction.|
......@@ -2617,15 +2611,15 @@ Describes a geomagnetic response object. It extends from [Response](#response).
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| x | number | Yes| Yes| North component of the geomagnetic field.|
| y | number | Yes| Yes| East component of the geomagnetic field.|
| z | number | Yes| Yes| Vertical component of the geomagnetic field.|
| geomagneticDip | number | Yes| Yes| Magnetic dip, also called magnetic inclination, which is the angle measured from the horizontal plane to the magnetic field vector.|
| deflectionAngle | number | Yes| Yes| Magnetic declination, which is the angle between true north (geographic north) and the magnetic north (the horizontal component of the field).|
| levelIntensity | number | Yes| Yes| Horizontal intensity of the magnetic field vector field.|
| totalIntensity | number | Yes| Yes| Total intensity of the magnetic field vector.|
| Name | Type | Readable | Writable | Description |
| --------------- | ------ | ---- | ---- | ------------------------- |
| x | number | Yes | Yes | North component of the geomagnetic field. |
| y | number | Yes | Yes | East component of the geomagnetic field. |
| z | number | Yes | Yes | Vertical component of the geomagnetic field. |
| geomagneticDip | number | Yes | Yes | Magnetic dip, also called magnetic inclination, which is the angle measured from the horizontal plane to the magnetic field vector. |
| deflectionAngle | number | Yes | Yes | Magnetic declination, which is the angle between true north (geographic north) and the magnetic north (the horizontal component of the field).|
| levelIntensity | number | Yes | Yes | Horizontal intensity of the magnetic field vector field. |
| totalIntensity | number | Yes | Yes | Total intensity of the magnetic field vector. |
## LocationOptions
......@@ -2633,8 +2627,8 @@ Describes the geographical location.
**System capability**: SystemCapability.Sensors.Sensor
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| latitude | number | Yes| Yes| Latitude.|
| longitude | number | Yes| Yes| Longitude.|
| altitude | number | Yes| Yes| Altitude.|
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ----- |
| latitude | number | Yes | Yes | Latitude. |
| longitude | number | Yes | Yes | Longitude. |
| altitude | number | Yes | Yes | Altitude.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册