diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md index 64459cb19ec7ffbe0ce7d66b1f4ccfa30a4c3ef5..83b61077eeae144c95e92cdad94b35b8f01ccca7 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle.md @@ -15,17 +15,17 @@ SystemCapability.BundleManager.BundleFramework ## Required Permissions -| Required Permissions| Permission Level| Description| -|-------| --------- | ---- | -| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current application.| +| 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\ -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 | -| ----------- | ------ | ---- | ------------------------------------------------------------ | -| 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. | +| 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\ | 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\): 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,12 +81,12 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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. | -| callback | AsyncCallback\ | Yes | Callback used to return the application information. | +| 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. | +| callback | AsyncCallback\ | Yes | Callback used to return the application information. | **Example** @@ -108,7 +108,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => { getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\): 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,11 +120,11 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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\ | Yes | Callback used to return the application information. | +| 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\ | Yes | Callback used to return the application information. | **Example** @@ -145,7 +145,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise> -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 | -| ---------- | ---------- | ---- | ----------------------------------------------------------- | -| 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. | +| 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 | -| --------------------------- | ----------------------------------- | +| Type | Description | +| --------------------------- | -------------------------- | | Promise> | Promise used to return the information of all available bundles.| **Example** @@ -187,7 +187,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): 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,10 +199,10 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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> | Yes | Callback used to return the information of all available bundles. | +| 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> | Yes | Callback used to return the information of all available bundles. | **Example** @@ -222,7 +222,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): 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,11 +234,11 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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> | Yes | Callback used to return the information of all available bundles. | +| 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> | Yes | Callback used to return the information of all available bundles. | **Example** @@ -260,7 +260,7 @@ bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => { getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\ -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,16 +272,16 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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**. | +| 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**. | **Return value** -| Type | Description | -| -------------------- | ------------------------------------------ | +| Type | Description | +| -------------------- | ---------------------------- | | Promise\ | Promise used to return the bundle information.| **Example** @@ -306,7 +306,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, options) getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\): 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,11 +318,11 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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\ | Yes | Callback used to return the bundle information. | +| 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\ | Yes | Callback used to return the bundle information. | **Example** @@ -343,7 +343,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => { getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\): 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,12 +355,12 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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**. | -| callback | AsyncCallback\ | Yes | Callback used to return the bundle information. | +| 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**. | +| callback | AsyncCallback\ | Yes | Callback used to return the bundle information. | **Example** @@ -384,7 +384,7 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { getAllApplicationInfo(bundleFlags: number, userId?: number): Promise> -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 | -| ----------- | ------ | ---- | ------------------------------------------------------ | -| 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. | +| 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 | -| -------------------------------- | ------------------------------------------------ | +| Type | Description | +| -------------------------------- | ------------------------------- | | Promise> | Promise used to return the application information.| **Example** @@ -426,7 +426,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId) getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): 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,11 +438,11 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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> | Yes | Callback used to return the application information. | +| 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> | Yes | Callback used to return the application information. | **Example** @@ -461,9 +461,9 @@ bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => { ## bundle.getAllApplicationInfo -function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; +getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : 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,10 +475,10 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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> | Yes | Callback used to return the application information. | +| 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> | Yes | Callback used to return the application information. | **Example** @@ -497,7 +497,7 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => { getAbilityInfo(bundleName: string, abilityName: string): Promise\ -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 | -| ----------- | ------ | ---- | -------------------------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | -| abilityName | string | Yes | Name of the ability.| +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------------- | +| bundleName | string | Yes | Bundle name of the application. | +| abilityName | string | Yes | Ability name.| **Return value** -| Type | Description | -| ---------------------------- | ---------------------------- | +| Type | Description | +| --------------------- | --------------------- | | Promise\ | 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\: void +getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\): 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 | -| ----------- | ------ | ---- | --------------------------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | -| abilityName | string | Yes | Name of the ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the ability information.| +| Name | Type | Mandatory | Description | +| ----------- | ------------ | ---- | ---------------- | +| bundleName | string | Yes | Bundle name of the application. | +| abilityName | string | Yes | Ability name.| +| callback | AsyncCallback\ | 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\ -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 | -| ----------- | ------ | ---- | -------------------------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | -| abilityName | string | Yes | Name of the ability.| +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------------- | +| bundleName | string | Yes | Bundle name of the application. | +| abilityName | string | Yes | Ability name.| **Return value** -| Type | Description | -| ---------------------------- | ---------------------------- | +| Type | Description | +| ---------------- | ------------------ | | Promise\ | Promise used to return the application name.| **Example** @@ -614,7 +613,7 @@ bundle.getAbilityLabel(bundleName, abilityName) getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\): 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 | -| ----------- | ------ | ---- | --------------------------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | -| abilityName | string | Yes | Name of the ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the application name.| +| Name | Type | Mandatory | Description | +| ----------- | ---------------------- | ---- | ---------------- | +| bundleName | string | Yes | Bundle name of the application. | +| abilityName | string | Yes | Ability name.| +| callback | AsyncCallback\ | Yes | Callback used to return the application name. | **Example** @@ -650,7 +649,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { isAbilityEnabled(info: AbilityInfo): Promise\ -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 | -| ---------------------------- | ------------------------| +| Type | Description | +| ----------------- | ------------------------- | | Promise\ | 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\): 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 | -| ----------- | ------ | ---- | --------------------------------------------------------- | -| info | AbilityInfo | Yes | Ability information. | -| callback | AsyncCallback\ | Yes| Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------- | ---- | --------------- | +| info | AbilityInfo | Yes | Ability information. | +| callback | AsyncCallback\ | 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\ -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\ | Promise used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| +| Type | Description | +| ----------------- | ------------------------- | +| Promise\ | 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\): 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 | -| ----------- | ------ | ---- | --------------------------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | -| callback | AsyncCallback\ | Yes| Callback used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| +| Name | Type | Mandatory | Description | +| ---------- | ----------------------- | ---- | --------------- | +| bundleName | string | Yes | Bundle name of the application. | +| callback | AsyncCallback\ | 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> -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,16 +811,16 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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. | +| 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. | **Return value** -| Type | Description | -| ---------------------------- | ---------------------------- | +| Type | Description | +| ---------------------------- | --------------------- | | Promise\>| 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\>): 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,12 +854,12 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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. | -| callback | AsyncCallback> | Yes | Callback used to return the ability information. | +| 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. | +| callback | AsyncCallback> | Yes | Callback used to return the ability information. | **Example** @@ -882,9 +881,9 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { ## bundle.queryAbilityByWant -queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): 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,11 +891,11 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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> | Yes | Callback used to return the ability information. | +| 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> | Yes | Callback used to return the ability information. | **Example** @@ -915,98 +914,13 @@ bundle.queryAbilityByWant(want, bundleFlags, (err, data) => { }) ``` -## bundle.getBundleInstaller - -getBundleInstaller(): Promise\ - -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\ | 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\): 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\ | 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\ -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 | -| ---------- | ------ | ---- | -------- | -| bundleName | string | Yes | Bundle name of the application.| +| Name | Type | Mandatory | Description | +| ---------- | ------ | ---- | ------------ | +| bundleName | string | Yes | Bundle name of the application.| **Return value** -| Type | Description | -| --------------------- | ------------------------------------------------------------ | +| Type | Description | +| -------------- | -------------------------------------- | | Promise\ | Promise used to return the **Want** object.| **Example** @@ -1043,7 +957,7 @@ bundle.getLaunchWantForBundle(bundleName) getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\): 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,10 +969,10 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------- | -| bundleName | string | Yes | Bundle name of the application.| -| callback | AsyncCallback\ | Yes | Callback used to return the **Want** object.| +| Name | Type | Mandatory | Description | +| ---------- | -------------------- | ---- | ------------------------------ | +| bundleName | string | Yes | Bundle name of the application. | +| callback | AsyncCallback\ | Yes | Callback used to return the **Want** object.| **Example** @@ -1078,7 +992,7 @@ bundle.getLaunchWantForBundle(bundleName, (err, data) => { getNameForUid(uid: number): Promise\ -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 | -| ---------- | ------ | ---- | -------- | -| 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.| **Return value** -| Type | Description | -| --------------------- | ------------------------------------------------------------ | +| Type | Description | +| ---------------- | --------------------------------- | | Promise\ | Promise used to return the bundle name.| **Example** @@ -1109,9 +1023,9 @@ bundle.getNameForUid(uid) ## bundle.getNameForUid8+ -getNameForUid(uid: number, callback: AsyncCallback\): void; +getNameForUid(uid: number, callback: AsyncCallback\) : 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,10 +1033,10 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------- | -| uid | number | Yes | UID based on which the bundle name is to obtain.| -| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ------------------------- | +| uid | number | Yes | UID based on which the bundle name is to obtain. | +| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| **Example** @@ -1140,9 +1054,9 @@ bundle.getNameForUid(uid, (err, data) => { ## bundle.getAbilityIcon8+ -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\; -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\ | 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.getAbilityIcon8+ -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\): 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\ | 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> -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,17 +1144,17 @@ SystemCapability.BundleManager.BundleFramework **Parameters** -| 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. | +| 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. | **Return value** -| Type | Description | -| ---------------------------- | ---------------------------- | -| Promise> | Promise used to return the extension ability information.| +| Type | Description | +| ------------------------------------- | ------------------------------ | +| Promise> | 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>): 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 | -| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| 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> | Yes | Callback used to return the extension ability information. | +| 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> | 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>): 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 | -| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| 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> | Yes | Callback used to return the extension ability information. | +| 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> | 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 | -| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ | -| 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**.| +| 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**. | ## 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.)| -| 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_INVALID8+ | 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_LEFT8+ | 0x42 | Insufficient device space.| -| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED8+ | 0x43 | Application authorization failed.| -| STATUS_INSTALL_PERMISSION_DENIED8+ | 0x44 | Installation permission denied.| -| STATUS_UNINSTALL_PERMISSION_DENIED8+ | 0x45 | Uninstallation permission denied.| +| 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_INVALID8+ | 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_LEFT8+ | 0x42 | Insufficient device space. | +| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED8+ | 0x43 | Application authorization failed. | +| STATUS_INSTALL_PERMISSION_DENIED8+ | 0x44 | Installation permission denied. | +| STATUS_UNINSTALL_PERMISSION_DENIED8+ | 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_METADATA8+ | 0x00000020 | Obtains the ability metadata information.| -| GET_BUNDLE_WITH_EXTENSION_ABILITY9+ | 0x00000020 | Obtains the bundle information with the extension ability information.| -| GET_APPLICATION_INFO_WITH_METADATA8+ | 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_METADATA8+ | 0x00000020 | Obtains the ability metadata information. | +| GET_BUNDLE_WITH_EXTENSION_ABILITY9+ | 0x00000020 | Obtains the bundle information with the Extension ability information.| +| GET_APPLICATION_INFO_WITH_METADATA8+ | 0x00000040 | Obtains the application metadata information. | | GET_ABILITY_INFO_SYSTEMAPP_ONLY8+ | 0x00000080 | Obtains the ability information with information about system applications.| -| GET_ABILITY_INFO_WITH_DISABLE8+ | 0x00000100 | Obtains information about disabled abilities.| -| GET_APPLICATION_INFO_WITH_DISABLE8+ | 0x00000200 | Obtains information about disabled applications.| -| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information.| +| GET_ABILITY_INFO_WITH_DISABLE8+ | 0x00000100 | Obtains information about disabled abilities. | +| GET_APPLICATION_INFO_WITH_DISABLE8+ | 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,32 +1332,32 @@ Describes the application bundle information. **System capability**: SystemCapability.BundleManager.BundleFramework -| 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. | -| uid | number | Yes | No | UID of the application to which the bundle belongs. | -| installTime | number | Yes | No | Time when the HAP file was installed. | -| updateTime | number | Yes | No | Time when the HAP file was updated. | -| appInfo | ApplicationInfo | Yes | No | Application configuration information. | -| abilityInfos | Array\ | Yes | No | Ability configuration information. | -| reqPermissions | Array\ | Yes | No | Array of the permissions to request from the system. | -| reqPermissionDetails | Array\ | Yes | No | Detailed information of the permissions to request from the system.| -| vendor | string | Yes | No | Vendor of the bundle. | -| versionCode | number | Yes | No | Version number of the bundle. | -| versionName | string | Yes | No | Version description of the bundle. | -| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. | -| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. | -| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. | -| hapModuleInfos | Array\ | Yes | No | Module configuration information. | -| entryModuleName | string | Yes | No | Name of the entry module. | -| 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.| -| reqPermissionStates8+ | Array\ | Yes| No| Permission grant state.| -| extensionAbilityInfo9+ | Array\ | Yes| No| Extended information of the ability.| +| 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. | +| uid | number | Yes | No | UID of the application to which the bundle belongs. | +| installTime | number | Yes | No | Time when the HAP file was installed. | +| updateTime | number | Yes | No | Time when the HAP file was updated. | +| appInfo | ApplicationInfo | Yes | No | Application configuration information. | +| abilityInfos | Array\ | Yes | No | Ability configuration information. | +| reqPermissions | Array\ | Yes | No | Array of the permissions to request from the system. | +| reqPermissionDetails | Array\ | Yes | No | Detailed information of the permissions to request from the system.| +| vendor | string | Yes | No | Vendor of the bundle. | +| versionCode | number | Yes | No | Version number of the bundle. | +| versionName | string | Yes | No | Version description of the bundle. | +| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. | +| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. | +| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. | +| hapModuleInfos | Array\ | Yes | No | Module configuration information. | +| entryModuleName | string | Yes | No | Name of the entry module. | +| 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. | +| reqPermissionStates8+ | Array\ | Yes | No | Permission grant state. | +| extensionAbilityInfo9+ | Array\ | Yes | No | Extended information of the ability. | ## ApplicationInfo @@ -1451,31 +1365,30 @@ Describes the application information. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Readable| Writable| Description| -| ------ | ------ | ------ | ------ | ------ | -| name | string | Yes | No | Application name. | -| description | string | Yes | No | Application description. | -| descriptionId | number | Yes | No | Application description ID. | -| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. | -| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | -| label | string | Yes | No | Application label. | -| labelId | string | Yes | No | Application label ID. | -| icon | string | Yes | No | Application icon. | -| iconId | string | Yes | No | Application icon ID. | -| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used by default.| -| supportedModes | number | Yes | No | Running modes supported by the application. | -| moduleSourceDirs | Array\ | Yes | No | Relative paths for storing application resources. | -| permissions | Array\ | Yes | No | Permissions required for accessing the application. | -| moduleInfos | Array\ | Yes | No | Application module information. | -| entryDir | string | Yes | No | Path for storing application files. | -| customizeData | Map> | Yes | Yes | Custom data of the application. | -| codePath8+ | string | Yes| No| Installation directory of the application.| -| metaData8+ | Map> | Yes| No| Custom metadata of the application.| -| metaData9+ | Map> | Yes| No| Metadata of the application.| -| removable8+ | boolean | Yes| No| Whether the application is removable.| -| accessTokenId8+ | number | Yes| No| Access token ID of the application.| -| uid8+ | number | Yes| No| UID of the application.| -| entityType9+ | string | Yes| No| Entity type of the application.| +| Name | Type | Readable | Writable | Description | +| -------------------------- | ---------------------------------- | ---- | ---- | --------------------- | +| name | string | Yes | No | Application name. | +| description | string | Yes | No | Application description. | +| descriptionId | number | Yes | No | Application description ID. | +| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. | +| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | +| label | string | Yes | No | Application label. | +| labelId | string | Yes | No | Application label ID. | +| icon | string | Yes | No | Application icon. | +| iconId | string | Yes | No | Application icon ID. | +| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used by default.| +| supportedModes | number | Yes | No | Running modes supported by the application. | +| moduleSourceDirs | Array\ | Yes | No | Relative paths for storing application resources. | +| permissions | Array\ | Yes | No | Permissions required for accessing the application. | +| moduleInfos | Array\ | Yes | No | Application module information. | +| entryDir | string | Yes | No | Path for storing application files. | +| codePath8+ | string | Yes | No | Installation directory of the application. | +| metaData8+ | Map> | Yes | No | Custom metadata of the application. | +| metaData9+ | Map> | Yes | No | Metadata of the application. | +| removable8+ | boolean | Yes | No | Whether the application is removable. | +| accessTokenId8+ | number | Yes | No | Access token ID of the application. | +| uid8+ | number | Yes | No | UID of the application. | +| entityType9+ | string | Yes | No | Entity type of the application. | ## ModuleInfo @@ -1483,10 +1396,10 @@ Describes the module information of the application. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Readable| Writable| Description| -| ------ | ------ | ------ | ------ | ------ | -| moduleName | string | Yes | No | Module name.| -| moduleSourceDir | string | Yes | No | Installation directory.| +| Name | Type | Readable | Writable | Description | +| --------------- | ------ | ---- | ---- | ---- | +| moduleName | string | Yes | No | Module name.| +| moduleSourceDir | string | Yes | No | Installation directory.| ## CustomizeData @@ -1494,11 +1407,11 @@ Describes the custom metadata. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type | Readable| Writable| Description | -| ----- | ------ | ---- | ---- | ---------------- | -| name | string | Yes | Yes | Custom metadata name.| -| value | string | Yes | Yes | Custom metadata value. | -| extra8+ | string | Yes | Yes | Custom resources. | +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | -------- | +| name | string | Yes | Yes | Custom metadata name.| +| value | string | Yes | Yes | Custom metadata value. | +| extra8+ | string | Yes | Yes | Custom resources. | ## HapModuleInfo @@ -1507,26 +1420,26 @@ Describes the HAP module information. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Readable| Writable| Description| -| ------ | ------ | ------ | ------ | ------ | -| name | string | Yes | No | Module name. | -| description | string | Yes | No | Module description. | -| descriptionId | number | Yes | No | Module description ID. | -| icon | string | Yes | No | Module icon. | -| label | string | Yes | No | Module label. | -| labelId | number | Yes | No | Module label ID. | -| 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\ | Yes | No | Capabilities required for module running.| -| deviceTypes | Array\ | Yes | No | An array of supported device types.| -| abilityInfo | Array\ | 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. | -| mainElementName8+ | string | Yes| No| Information about the entry ability.| -| extensionAbilityInfo9+ | Array\ | Yes| No| Extension ability information.| -| metadata9+ | Array\ | Yes| No| Metadata of the ability.| +| Name | Type | Readable | Writable | Description | +| --------------------------------- | ---------------------------- | ---- | ---- | ------------------ | +| name | string | Yes | No | Module name. | +| description | string | Yes | No | Module description. | +| descriptionId | number | Yes | No | Module description ID. | +| icon | string | Yes | No | Module icon. | +| label | string | Yes | No | Module label. | +| labelId | number | Yes | No | Module label ID. | +| 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\ | Yes | No | Capabilities required for module running. | +| deviceTypes | Array\ | Yes | No | An array of supported device types. | +| abilityInfo | Array\ | 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. | +| mainElementName9+ | string | Yes | No | Information about the entry ability. | +| extensionAbilityInfo9+ | Array\ | Yes | No | Extension ability information.| +| metadata9+ | Array\ | 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 | 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.| +| 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 @@ -1546,10 +1459,10 @@ Describes the application scenario and timing for using the permission. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Readable| Writable| Description| -| ------ | ------ | ------ | ------ | ------ | -| abilities | Array\ | Yes | Yes | Abilities that use the permission.| -| when | string | Yes | Yes | Time when the permission is used. | +| Name | Type | Readable | Writable | Description | +| --------- | -------------- | ---- | ---- | ---------------- | +| abilities | Array\ | Yes | Yes | Abilities that use the permission.| +| when | string | Yes | Yes | Time when the permission is used. | ## AbilityInfo @@ -1558,36 +1471,36 @@ Describes the ability information. **System capability**: SystemCapability.BundleManager.BundleFramework -| 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. | -| description | string | Yes | No | Ability description. | -| icon | string | Yes | No | Index of the ability icon resource file. | -| descriptionId | number | Yes | No | Ability description ID. | -| iconId | number | Yes | No | Ability icon ID. | -| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. | -| process | string | Yes | No | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.| -| targetAbility | string | Yes | No | Target ability that the ability alias points to. | -| backgroundModes | number | Yes | No | Background service mode of the ability. | -| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. | -| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. | -| type | AbilityType | Yes | No | Ability type. | -| orientation | DisplayOrientation | Yes | No | Ability display orientation. | -| launchMode | LaunchMode | Yes | No | Ability launch mode. | -| permissions | Array\ | Yes | No | Permissions required for other applications to call the ability.| -| deviceTypes | Array\ | Yes | No | Device types supported by the ability. | -| deviceCapabilities | Array\ | Yes | No | Device capabilities required for the ability. | -| readPermission | string | Yes | No | Permission required for reading the ability data. | -| writePermission | string | Yes | No | Permission required for writing data to the ability. | -| applicationInfo | ApplicationInfo | Yes | No | Application configuration 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. | -| metaData8+ | Array\ | Yes| No| Custom information of the ability.| -| metaData9+ | Array\ | Yes| No| Metadata of the ability.| -| enabled8+ | boolean | Yes| No| Whether the ability is enabled.| +| 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. | +| description | string | Yes | No | Ability description. | +| icon | string | Yes | No | Index of the ability icon resource file. | +| descriptionId | number | Yes | No | Ability description ID. | +| iconId | number | Yes | No | Ability icon ID. | +| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. | +| process | string | Yes | No | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.| +| targetAbility | string | Yes | No | Target ability that the ability alias points to. | +| backgroundModes | number | Yes | No | Background service mode of the ability. | +| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. | +| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. | +| type | AbilityType | Yes | No | Ability type. | +| orientation | DisplayOrientation | Yes | No | Ability display orientation. | +| launchMode | LaunchMode | Yes | No | Ability launch mode. | +| permissions | Array\ | Yes | No | Permissions required for other applications to call the ability.| +| deviceTypes | Array\ | Yes | No | Device types supported by the ability. | +| deviceCapabilities | Array\ | Yes | No | Device capabilities required for the ability. | +| readPermission | string | Yes | No | Permission required for reading the ability data. | +| writePermission | string | Yes | No | Permission required for writing data to the ability. | +| applicationInfo | ApplicationInfo | Yes | No | Application configuration 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. | +| metaData8+ | Array\ | Yes | No | Custom information of the ability. | +| metaData9+ | Array\ | Yes | No | Metadata of the ability. | +| enabled8+ | boolean | Yes | No | Whether the ability is enabled. | ## AbilityType @@ -1595,12 +1508,12 @@ Enumerates ability types. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Description | -| ------- | ---- | --------------------------- | -| UNKNOWN | None | Unknown ability type. | -| PAGE | None | Ability that has a UI. | -| SERVICE | None | Ability that does not have a UI. | -| DATA | None | Ability that is used to provide data access services.| +| Name | Type | Description | +| ------- | ---- | ----------------- | +| UNKNOWN | None | Unknown ability type. | +| PAGE | None | Ability that has a UI. | +| SERVICE | None | Ability that does not have a UI. | +| DATA | None | Ability that is used to provide data access services.| ## DisplayOrientation @@ -1608,12 +1521,12 @@ Enumerates display orientations. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Description | -| ------------- | ---- | ------------------------ | -| UNSPECIFIED | None | The system automatically determines the display orientation. | -| LANDSCAPE | None | Landscape orientation. | -| PORTRAIT | None | Portrait orientation. | -| FOLLOW_RECENT | None | The page ability orientation is the same as that of the nearest ability in the stack.| +| Name | Type | Description | +| ------------- | ---- | ------------- | +| UNSPECIFIED | None | The system automatically determines the display orientation. | +| LANDSCAPE | None | Landscape orientation. | +| PORTRAIT | None | Portrait orientation. | +| FOLLOW_RECENT | None | The page ability orientation is the same as that of the nearest ability in the stack.| ## LaunchMode @@ -1621,10 +1534,10 @@ Enumerates launch modes. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Description | -| ----------- | ---- | ------------------- | -| SINGLETON | 0 | The ability has only one instance.| -| STANDARD | 1 | The ability can have multiple instances. | +| Name | Type | Description | +| --------- | ---- | ------------- | +| SINGLETON | 0 | The ability has only one instance.| +| STANDARD | 1 | The ability can have multiple instances. | ## AbilitySubType @@ -1632,43 +1545,43 @@ Enumerates ability subtypes. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Description | -| ----------- | ---- | ----------------------------- | -| UNSPECIFIED | 0 | Undefined ability subtype. | +| Name | Type | Description | +| ----------- | ---- | -------------------- | +| UNSPECIFIED | 0 | Undefined ability subtype. | | CA | 1 | Ability that has a UI.| ## ExtensionAbilityType9+ -Enumerates extension ability types. +Enumerates Extension ability types. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Description | -| -------------------- | ---- | ----------------------------- | -| FORM9+ | 0 | Form included. | +| Name | Type | Description | +| ------------------------------ | ---- | ------------------------- | +| FORM9+ | 0 | Form included. | | WORK_SCHEDULER9+ | 1 | Work scheduler included.| -| INPUT_METHOD9+ | 2 | Input method included. | -| SERVICE9+ | 3 | Service included. | -| ACCESSIBILITY9+ | 4 | Accessibility included. | -| DATA_SHARE9+ | 5 | Data sharing included.| -| FILE_SHARE9+ | 6 | File sharing included.| -| STATIC_SUBSCRIBER9+ | 7 | Subscribers included. | -| WALLPAPER9+ | 8 | Wallpaper included. | -| UNSPECIFIED9+ | 9 | Unspecified type. | +| INPUT_METHOD9+ | 2 | Input method included. | +| SERVICE9+ | 3 | Service included. | +| ACCESSIBILITY9+ | 4 | Accessibility included. | +| DATA_SHARE9+ | 5 | Data sharing included.| +| FILE_SHARE9+ | 6 | File sharing included.| +| STATIC_SUBSCRIBER9+ | 7 | Subscribers included. | +| WALLPAPER9+ | 8 | Wallpaper included. | +| UNSPECIFIED9+ | 9 | Unspecified type. | ## ExtensionFlag9+ -Enumerates extension flags. +Enumerates Extension flags. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Default Value| Description | -| ------ | ------ | ------ | -| GET_EXTENSION_INFO_DEFAULT9+ | 0x00000000 | Obtains the default extension ability information.| -| GET_EXTENSION_INFO_WITH_PERMISSION9+ | 0x00000002 | Obtains the extension ability information that carries permission information.| -| GET_EXTENSION_INFO_WITH_APPLICATION9+ | 0x00000004 | Obtains the extension ability information that carries application information.| -| GET_EXTENSION_INFO_WITH_METADATA9+ | 0x00000020 | Obtains the extension ability information that carries metadata information.| +| Name | Default Value | Description | +| ---------------------------------------- | ---------- | ------------------------------ | +| GET_EXTENSION_INFO_DEFAULT9+ | 0x00000000 | Obtains the default Extension ability information. | +| GET_EXTENSION_INFO_WITH_PERMISSION9+ | 0x00000002 | Obtains the Extension ability information that carries permission information. | +| GET_EXTENSION_INFO_WITH_APPLICATION9+ | 0x00000004 | Obtains the Extension ability information that carries application information. | +| GET_EXTENSION_INFO_WITH_METADATA9+ | 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 | -| ----------- | ---- | ------------------- | -| AUTO_MODE | -1 | Automatic mode.| -| DARK_MODE | 0 | Dark mode. | -| LIGHT_MODE | 1 | Light mode. | +| Name | Type | Description | +| ---------- | ---- | ---- | +| AUTO_MODE | -1 | Automatic 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 | -| ----------- | ---- | ------------------- | -| PERMISSION_DENIED | -1 | Permission denied.| -| PERMISSION_GRANTED | 0 | Permission granted. | +| Name | Type | Description | +| ------------------ | ---- | ---- | +| PERMISSION_DENIED | -1 | Permission denied.| +| PERMISSION_GRANTED | 0 | Permission granted. | ## ExtensionAbilityInfo9+ -Describes the extension ability information. +Describes the Extension ability information. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type| Readable| Writable| Description| -| ------ | ------ | ------ | ------ | ------ | -| bundleName9+ | string | Yes | No | Application bundle name. | -| moduleName9+ | string | Yes | No | Name of the HAP file to which the extension ability belongs. | -| name9+ | string | Yes | No | Name of the extension ability. | -| labelId9+ | number | Yes | No | Label ID of the extension ability. | -| descriptionId9+ | number | Yes | No | Description ID of the extension ability. | -| iconId9+ | number | Yes | No | Icon ID of the extension ability. | -| isVisible9+ | boolean | Yes | No | Whether the extension ability can be called by other applications. | -| extensionAbilityType9+ | bundle.ExtensionAbilityType | Yes | No | Type of the extension ability. | -| permissions9+ | Array\ | Yes | No | Permissions required for other applications to call the extension ability.| -| applicationInfo9+ | ApplicationInfo | Yes | No | Application configuration information. | -| metaData9+ | Array\ | Yes| No| Metadata of the extension ability.| -| enabled9+ | boolean | Yes| No| Whether the extension ability is enabled.| -| readPermission9+ | string | Yes | No | Permission required for reading the extension ability data. | -| writePermission9+ | string | Yes | No | Permission required for writing data to the extension ability. | +| Name | Type | Readable | Writable | Description | +| --------------------------------- | --------------------------- | ---- | ---- | --------------------------------- | +| bundleName9+ | string | Yes | No | Application bundle name. | +| moduleName9+ | string | Yes | No | Name of the HAP file to which the Extension ability belongs. | +| name9+ | string | Yes | No | Name of the Extension ability. | +| labelId9+ | number | Yes | No | Label ID of the Extension ability. | +| descriptionId9+ | number | Yes | No | Description ID of the Extension ability. | +| iconId9+ | number | Yes | No | Icon ID of the Extension ability. | +| isVisible9+ | boolean | Yes | No | Whether the Extension ability can be called by other applications. | +| extensionAbilityType9+ | bundle.ExtensionAbilityType | Yes | No | Type of the Extension ability. | +| permissions9+ | Array\ | Yes | No | Permissions required for other applications to call the Extension ability.| +| applicationInfo9+ | ApplicationInfo | Yes | No | Application configuration information. | +| metaData9+ | Array\ | Yes | No | Metadata of the Extension ability. | +| enabled9+ | boolean | Yes | No | Whether the Extension ability is enabled. | +| readPermission9+ | string | Yes | No | Permission required for reading the Extension ability data. | +| writePermission9+ | string | Yes | No | Permission required for writing data to the Extension ability. | ## Metadata9+ @@ -1726,8 +1639,8 @@ Describes the metadata information. **System capability**: SystemCapability.BundleManager.BundleFramework -| Name | Type | Readable| Writable| Description | -| ----- | ------ | ---- | ---- | ---------------- | -| name9+ | string | Yes | Yes | Metadata name.| -| value9+ | string | Yes | Yes | Metadata value. | -| resource9+ | string | Yes | Yes | Metadata resource. | +| Name | Type | Readable | Writable | Description | +| --------------------- | ------ | ---- | ---- | ----- | +| name9+ | string | Yes | Yes | Metadata name.| +| value9+ | string | Yes | Yes | Metadata value. | +| resource9+ | string | Yes | Yes | Metadata resource.| diff --git a/en/application-dev/reference/apis/js-apis-sensor.md b/en/application-dev/reference/apis/js-apis-sensor.md index b163b58eb419404541c7e570ef349579d53729eb..6164de2a46b167097d43da2db6fad4f76f2306dd 100644 --- a/en/application-dev/reference/apis/js-apis-sensor.md +++ b/en/application-dev/reference/apis/js-apis-sensor.md @@ -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<[AccelerometerResponse](#accelerometerresponse)> | 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<[AccelerometerResponse](#accelerometerresponse)> | 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<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 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<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 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<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 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<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 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<[GravityResponse](#gravityresponse)> | 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<[GravityResponse](#gravityresponse)> | 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<[GyroscopeResponse](#gyroscoperesponse)> | 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<[GyroscopeResponse](#gyroscoperesponse)> | 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<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 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<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 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<[SignificantMotionResponse](#significantmotionresponse)> | 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<[SignificantMotionResponse](#significantmotionresponse)> | 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<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 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<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 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<[PedometerResponse](#pedometerresponse)> | 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<[PedometerResponse](#pedometerresponse)> | 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<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 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<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 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<[MagneticFieldResponse](#magneticfieldresponse)> | 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<[MagneticFieldResponse](#magneticfieldresponse)> | 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<MagneticFieldUncalibratedResponse>, options: Options): void +on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callback<MagneticFieldUncalibratedResponse>, 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<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 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<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 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<[ProximityResponse](#proximityresponse)> | 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<[ProximityResponse](#proximityresponse)> | 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<[HumidityResponse](#humidityresponse)> | 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<[HumidityResponse](#humidityresponse)> | 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<[BarometerResponse](#barometerresponse)> | 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<[BarometerResponse](#barometerresponse)> | 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<[HallResponse](#hallresponse)> | 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<[HallResponse](#hallresponse)> | 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<[LightResponse](#lightresponse)> | 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<[LightResponse](#lightresponse)> | 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<[OrientationResponse](#orientationresponse)> | 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<[OrientationResponse](#orientationresponse)> | 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 | -| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. | -| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to subscribe to, which is **SENSOR_TYPE_ID_HEART_RATE**. | +| callback | Callback<[HeartRateResponse](#heartrateresponse)> | 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<[RotationVectorResponse](#rotationvectorresponse)> | 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<[RotationVectorResponse](#rotationvectorresponse)> | 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<[WearDetectionResponse](#weardetectionresponse)> | 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<[WearDetectionResponse](#weardetectionresponse)> | 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<[AccelerometerResponse](#accelerometerresponse)> | 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<[AccelerometerResponse](#accelerometerresponse)> | 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<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 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<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 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<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 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<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 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<[GravityResponse](#gravityresponse)> | 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<[GravityResponse](#gravityresponse)> | 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<[GyroscopeResponse](#gyroscoperesponse)> | 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<[GyroscopeResponse](#gyroscoperesponse)> | 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<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 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<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 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<[SignificantMotionResponse](#significantmotionresponse)> | 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<[SignificantMotionResponse](#significantmotionresponse)> | 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<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 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<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 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<[PedometerResponse](#pedometerresponse)> | 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<[PedometerResponse](#pedometerresponse)> | 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<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 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<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 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<[MagneticFieldResponse](#magneticfieldresponse)> | 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<[MagneticFieldResponse](#magneticfieldresponse)> | 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<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 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<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 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<[ProximityResponse](#proximityresponse)> | 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<[ProximityResponse](#proximityresponse)> | 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<[HumidityResponse](#humidityresponse)> | 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<[HumidityResponse](#humidityresponse)> | 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<[BarometerResponse](#barometerresponse)> | 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<[BarometerResponse](#barometerresponse)> | 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<[HallResponse](#hallresponse)> | 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<[HallResponse](#hallresponse)> | 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<[LightResponse](#lightresponse)> | 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<[LightResponse](#lightresponse)> | 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<[OrientationResponse](#orientationresponse)> | 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<[OrientationResponse](#orientationresponse)> | 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<[RotationVectorResponse](#rotationvectorresponse)> | 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<[RotationVectorResponse](#rotationvectorresponse)> | 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<[HeartRateResponse](#heartrateresponse)> | 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<[HeartRateResponse](#heartrateresponse)> | 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<[WearDetectionResponse](#weardetectionresponse)> | 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<[WearDetectionResponse](#weardetectionresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER**.| -| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER**.| +| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.| -| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | Yes | Callback used to return the uncalibrated acceleration sensor data. The reported data type in the callback is **AccelerometerUncalibratedResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED**.| +| callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 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 | -| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.| -| callback | Callback<[LightResponse](#lightresponse)> | Yes | Callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_LIGHT**.| +| callback | Callback<[LightResponse](#lightresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.| -| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | Callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_AMBIENT_TEMPERATURE**.| +| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 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**. | -| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | Callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_BAROMETER**.| +| callback | Callback<[BarometerResponse](#barometerresponse)> | 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 | -| -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GRAVITY**. | -| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | Callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GRAVITY**. | +| callback | Callback<[GravityResponse](#gravityresponse)> | 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**. | -| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | Callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE**.| +| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | 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<GyroscopeResponse>): void +off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.| -| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | Callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED**.| +| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 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 | -| -------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HALL**. | -| callback | Callback<[HallResponse](#hallresponse)> | Yes | Callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HALL**. | +| callback | Callback<[HallResponse](#hallresponse)> | 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**. | -| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.| +| 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<[HeartRateResponse](#heartrateresponse)> | 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 | -| -------- | ----------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HUMIDITY**. | -| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | Callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_HUMIDITY**. | +| callback | Callback<[HumidityResponse](#humidityresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.| -| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | Callback used to return the acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_LINEAR_ACCELERATION**.| +| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 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**. | -| callbackcallback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | Callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.| +| Name | Type | Mandatory | Description | +| ---------------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD**.| +| callbackcallback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED**.| -| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | Callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.| +| 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<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 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**. | -| callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | Callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ORIENTATION**.| +| callback | Callback<[OrientationResponse](#orientationresponse)> | 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 | -| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER**. | -| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER**. | +| callback | Callback<[PedometerResponse](#pedometerresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.| -| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | Callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER_DETECTION**.| +| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 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**. | -| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | Callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PROXIMITY**.| +| callback | Callback<[ProximityResponse](#proximityresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.| -| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | Callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_ROTATION_VECTOR**.| +| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.| -| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | Callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_SIGNIFICANT_MOTION**.| +| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | 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 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.| -| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | Callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_WEAR_DETECTION**.| +| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | 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,29 +1671,28 @@ 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<number> | Yes | Rotation vector to rotate. | - | coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system. | - | callback | AsyncCallback<Array<number>> | Yes | Callback used to return the rotation vector after being rotated.| +| Name | Type | Mandatory | Description | +| ---------------- | ---------------------------------------- | ---- | ----------- | +| inRotationVector | Array<number> | Yes | Rotation vector to rotate. | +| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system. | +| callback | AsyncCallback<Array<number>> | Yes | Callback used to return the rotation vector after being rotated.| -- Example - - ``` - 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; - } - console.info("Operation successed. Data obtained: " + data.x); - for (var i=0; i < data.length; i++) { - console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); - } - }) - ``` +**Example** +``` +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; + } + console.info("Operation successed. Data obtained: " + data.x); + for (var i=0; i < data.length; i++) { + console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); + } + }) +``` ## sensor.transformCoordinateSystem transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>> @@ -1702,35 +1701,32 @@ Rotates a rotation vector so that it can represent the coordinate system in diff **System capability**: SystemCapability.Sensors.Sensor -- Parameters - - | Name | Type | Mandatory| Description | - | ---------------- | ----------------------------------------- | ---- | ---------------- | - | inRotationVector | Array<number> | Yes | Rotation vector to rotate. | - | coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system.| - -- Return value +**Parameters** - | Type | Description | - | ---------------------------------- | ---------------------- | - | Promise<Array<number>> | Promise used to return the rotation vector after being converted.| +| Name | Type | Mandatory | Description | +| ---------------- | ---------------------------------------- | ---- | -------- | +| inRotationVector | Array<number> | Yes | Rotation vector to rotate. | +| coordinates | [CoordinatesOptions](#coordinatesoptions) | Yes | Direction of the coordinate system.| -- Example +**Return value** - ``` - 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++) { - console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); - } - }).catch((err) => { - console.info("Operation failed"); - }) - ``` +| Type | Description | +| ---------------------------------- | ----------- | +| Promise<Array<number>> | Promise used to return the rotation vector after being rotated.| - +**Example** +``` +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++) { + console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); + } + }).catch((err) => { + console.info("Operation failed"); +}) +``` ## sensor.getGeomagneticField @@ -1740,27 +1736,25 @@ 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<[GeomagneticResponse](#geomagneticresponse)> | Yes| Callback used to return the geomagnetic field.| - -- Example - ``` - sensor.getGeomagneticField([80, 0, 0], {'timeMillis':1580486400000}, function(err, data) { - if (err) { - console.error('Operation failed. Error code: ' + err.code + '; message: ' + err.message); - return; - } - 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); - }); - ``` - +**Parameters** +| Name | Type | Mandatory | Description | +| --------------- | ---------------------------------------- | ---- | ----------------- | +| locationOptions | [LocationOptions](#locationoptions) | Yes | Geographic location. | +| timeMillis | number | Yes | Time for obtaining the magnetic declination, in milliseconds.| +| callback | AsyncCallback<[GeomagneticResponse](#geomagneticresponse)> | Yes | Callback used to return the geomagnetic field. | +**Example** +``` +sensor.getGeomagneticField([80, 0, 0], 1580486400000, function(err, data) { + if (err) { + console.error('Operation failed. Error code: ' + err.code + '; message: ' + err.message); + return; + } + 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<GeomagneticResponse> @@ -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<[GeomagneticResponse](#geomagneticresponse)> | Promise used to return the geomagnetic field.| +**Return value** +| Type | Description | +| ---------------------------------------- | ------- | +| Promise<[GeomagneticResponse](#geomagneticresponse)> | 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<number> | 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<number> | 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<number> | Promise used to return the altitude, in meters.| +| Type | Description | +| --------------------- | ------------------ | +| Promise<number> | 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<number> | Yes | Inclination matrix. | - | callback | AsyncCallback<number> | Yes | Callback used to return the magnetic dip, in radians.| +| Name | Type | Mandatory | Description | +| ----------------- | --------------------------- | ---- | -------------- | +| inclinationMatrix | Array<number> | Yes | Inclination matrix. | +| callback | AsyncCallback<number> | 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<number> | Yes | Inclination matrix.| +| Name | Type | Mandatory | Description | +| ----------------- | ------------------- | ---- | ------- | +| inclinationMatrix | Array<number> | Yes | Inclination matrix.| -- Return value +**Return value** - | Type | Description | - | --------------------- | ---------------------------- | - | Promise<number> | Promise used to return the magnetic dip, in radians.| +| Type | Description | +| --------------------- | -------------- | +| Promise<number> | 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<number> | Yes | Current rotation matrix. | - | preRotationMatrix | Array<number> | Yes | The other rotation matrix. | - | callback | AsyncCallback<Array<number>> | Yes | Callback used to return the angle change around the z, x, and y axes.| +| Name | Type | Mandatory | Description | +| --------------------- | ---------------------------------------- | ---- | ------------------ | +| currentRotationMatrix | Array<number> | Yes | Current rotation matrix. | +| preRotationMatrix | Array<number> | Yes | The other rotation matrix. | +| callback | AsyncCallback<Array<number>> | 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<number> | Yes | Current rotation matrix.| - | preRotationMatrix | Array<number> | Yes | Rotation matrix.| +| Name | Type | Mandatory | Description | +| --------------------- | ------------------- | ---- | --------- | +| currentRotationMatrix | Array<number> | Yes | Current rotation matrix.| +| preRotationMatrix | Array<number> | Yes | Rotation matrix. | -- Return value +**Return value** - | Type | Description | - | ---------------------------------- | --------------------------------- | - | Promise<Array<number>> | Promise used to return the angle change around the z, x, and y axes.| +| Type | Description | +| ---------------------------------- | ------------------ | +| Promise<Array<number>> | 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<number> | Yes | Rotation vector to convert.| - | callback | AsyncCallback<Array<number>> | Yes | Callback used to return the rotation matrix.| +| Name | Type | Mandatory | Description | +| -------------- | ---------------------------------------- | ---- | ------- | +| rotationVector | Array<number> | Yes | Rotation vector to convert.| +| callback | AsyncCallback<Array<number>> | 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<number> | Yes | Rotation vector to convert.| +| Name | Type | Mandatory | Description | +| -------------- | ------------------- | ---- | ------- | +| rotationVector | Array<number> | Yes | Rotation vector to convert.| -- Return value +**Return value** - | Type | Description | - | ---------------------------------- | -------------- | - | Promise<Array<number>> | Promise used to return the rotation matrix.| +| Type | Description | +| ---------------------------------- | ------- | +| Promise<Array<number>> | 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<number> | Yes | Rotation vector to convert.| - | callback | AsyncCallback<Array<number>> | Yes | Callback used to return the quaternion. | +| Name | Type | Mandatory | Description | +| -------------- | ---------------------------------------- | ---- | ------- | +| rotationVector | Array<number> | Yes | Rotation vector to convert.| +| callback | AsyncCallback<Array<number>> | 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<number> | Yes | Rotation vector to convert.| +| Name | Type | Mandatory | Description | +| -------------- | ------------------- | ---- | ------- | +| rotationVector | Array<number> | Yes | Rotation vector to convert.| -- Return value +**Return value** - | Type | Description | - | ---------------------------------- | ------------ | - | Promise<Array<number>> | Promise used to return the quaternion.| +| Type | Description | +| ---------------------------------- | ------ | +| Promise<Array<number>> | 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<number> | Yes | Rotation matrix. | - | callback | AsyncCallback<Array<number>> | Yes | Callback used to return the rotation angle around the z, x, and y axes.| +| Name | Type | Mandatory | Description | +| -------------- | ---------------------------------------- | ---- | ------------------ | +| rotationMatrix | Array<number> | Yes | Rotation matrix. | +| callback | AsyncCallback<Array<number>> | 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<number> | Yes | Rotation matrix.| +| Name | Type | Mandatory | Description | +| -------------- | ------------------- | ---- | ------- | +| rotationMatrix | Array<number> | Yes | Rotation matrix.| -- Return value +**Return value** - | Type | Description | - | ---------------------------------- | --------------------------------- | - | Promise<Array<number>> | Promise used to return the rotation angle around the z, x, and y axes.| +| Type | Description | +| ---------------------------------- | ------------------ | +| Promise<Array<number>> | 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<number> | Yes | Gravity vector.| - | geomagnetic | Array<number> | Yes | Geomagnetic vector.| - | callback | AsyncCallback<[RotationMatrixResponse](#rotationmatrixresponse)> | Yes | Callback used to return the rotation matrix.| +| Name | Type | Mandatory | Description | +| ----------- | ---------------------------------------- | ---- | ------- | +| gravity | Array<number> | Yes | Gravity vector.| +| geomagnetic | Array<number> | Yes | Geomagnetic vector.| +| callback | AsyncCallback<[RotationMatrixResponse](#rotationmatrixresponse)> | 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<number> | Yes | Gravity vector.| - | geomagnetic | Array<number> | Yes | Geomagnetic vector.| +| Name | Type | Mandatory | Description | +| ----------- | ------------------- | ---- | ------- | +| gravity | Array<number> | Yes | Gravity vector.| +| geomagnetic | Array<number> | Yes | Geomagnetic vector.| -- Return value +**Return value** - | Type | Description | - | ------------------------------------------------------------ | -------------- | - | Promise<[RotationMatrixResponse](#rotationmatrixresponse)> | Promise used to return the rotation matrix.| +| Type | Description | +| ---------------------------------------- | ------- | +| Promise<[RotationMatrixResponse](#rotationmatrixresponse)> | 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,29 +2253,29 @@ 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.| -| SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED | 281 | Uncalibrated acceleration 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.| ## Response @@ -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,10 +2587,10 @@ Describes the response for setting the rotation matrix. **System capability**: SystemCapability.Sensors.Sensor -| Name | Type | Readable| Writable| Description | -| ----------- | ------------------- | ---- | ---- | ---------- | -| rotation | Array<number> | Yes | Yes | Rotation matrix.| -| inclination | Array<number> | Yes | Yes | Inclination matrix.| +| Name | Type | Readable | Writable | Description | +| ----------- | ------------------- | ---- | ---- | ----- | +| rotation | Array<number> | Yes | Yes | Rotation matrix.| +| inclination | Array<number> | Yes | Yes | Inclination matrix.| ## CoordinatesOptions @@ -2605,10 +2599,10 @@ Describes the coordinate options. **System capability**: SystemCapability.Sensors.Sensor -| Name| Type| Readable| Writable| Description | -| ---- | -------- | ---- | ---- | ----------- | -| x | number | Yes | Yes | X coordinate direction.| -| y | number | Yes | Yes | Y coordinate direction.| +| Name | Type | Readable | Writable | Description | +| ---- | ------ | ---- | ---- | ------ | +| x | number | Yes | Yes | X coordinate direction.| +| y | number | Yes | Yes | Y coordinate direction.| ## GeomagneticResponse @@ -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.|