You need to sign in or sign up before continuing.
提交 2ee9ab2c 编写于 作者: H HelloCrease

update docs

Signed-off-by: NHelloCrease <lian15@huawei.com>
上级 5b39e0a1
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
## 接口说明 ## 接口说明
| 模块 | 接口名 | 描述 | | 模块 | 接口名 | 描述 |
| -------- | -------- | -------- | | ------------- | ---------------------------------------- | --------------------------- |
| ohos.vibrator | vibrate(duration:&nbsp;number):&nbsp;Promise&lt;void&gt; | 触发马达按照时长振动,Promise型。 | | ohos.vibrator | vibrate(duration:&nbsp;number):&nbsp;Promise&lt;void&gt; | 触发马达按照时长振动,Promise型。 |
| ohos.vibrator | vibrate(duration:&nbsp;number,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 触发马达按照时长振动,Callback型。 | | ohos.vibrator | vibrate(duration:&nbsp;number,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 触发马达按照时长振动,Callback型。 |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId):&nbsp;Promise&lt;void&gt; | 触发马达按照指定字符串振动,Promise型。 | | ohos.vibrator | vibrate(effectId:&nbsp;EffectId):&nbsp;Promise&lt;void&gt; | 触发马达按照指定开发者传递效果振动,Promise型。 |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 触发马达按照指定字符串振动,Callback型。 | | ohos.vibrator | vibrate(effectId:&nbsp;EffectId,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 触发马达按照开发者传递效果振动,Callback型。 |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode):&nbsp;Promise&lt;void&gt; | 停止振动。 | | ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode):&nbsp;Promise&lt;void&gt; | 停止振动。 |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 停止振动。 | | ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 停止振动。 |
......
...@@ -24,12 +24,12 @@ createAppAccountManager(): AppAccountManager ...@@ -24,12 +24,12 @@ createAppAccountManager(): AppAccountManager
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | ------------------------ | | ----------------- | ------------ |
| AppAccountManager | 获取应用帐号模块的实例。 | | AppAccountManager | 获取应用帐号模块的实例。 |
**示例:** **示例:**
```js ```js
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account_appAccount.createAppAccountManager();
``` ```
## AppAccountManager ## AppAccountManager
...@@ -47,7 +47,7 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -47,7 +47,7 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------- | | -------- | ------------------------- | ---- | -------------------- |
| name | string | 是 | 要添加的应用帐号名称。 | | name | string | 是 | 要添加的应用帐号名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用的帐号名添加到帐号管理服务回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 将此应用的帐号名添加到帐号管理服务回调。 |
...@@ -71,7 +71,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;) ...@@ -71,7 +71,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------- | ---- | ---------------------------------------- |
| name | string | 是 | 要添加的应用帐号名称。 | | name | string | 是 | 要添加的应用帐号名称。 |
| extraInfo | string | 是 | 要添加的应用帐号的额外信息(能转换string类型的其它信息,如token等),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 | | extraInfo | string | 是 | 要添加的应用帐号的额外信息(能转换string类型的其它信息,如token等),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用程序的帐号名和额外信息添加到帐号管理服务中回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 将此应用程序的帐号名和额外信息添加到帐号管理服务中回调。 |
...@@ -98,14 +98,14 @@ addAccount(name: string, extraInfo: string): Promise&lt;void&gt; ...@@ -98,14 +98,14 @@ addAccount(name: string, extraInfo: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------------------------------------------------ | | --------- | ------ | ---- | ---------------------------------------- |
| name | string | 是 | 要添加的应用帐号名称。 | | name | string | 是 | 要添加的应用帐号名称。 |
| extraInfo | string | 是 | 要添加的应用帐号的额外信息(能转换成string类型的其它信息),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 | | extraInfo | string | 是 | 要添加的应用帐号的额外信息(能转换成string类型的其它信息),额外信息不能是应用帐号的敏感信息(如应用账号密码)。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ----------------------------------- | | ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -130,7 +130,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -130,7 +130,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------------------------- | | -------- | --------------------- | ---- | ----------------------- |
| owner | string | 是 | 要添加的应用帐号所有者包名。 | | owner | string | 是 | 要添加的应用帐号所有者包名。 |
| authType | string | 是 | 要添加的应用帐号鉴权类型。鉴权类型为自定义。 | | authType | string | 是 | 要添加的应用帐号鉴权类型。鉴权类型为自定义。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。可选项可根据自己需要设置。 | | options | {[key: string]: any} | 是 | 鉴权所需要的可选项。可选项可根据自己需要设置。 |
...@@ -171,7 +171,7 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -171,7 +171,7 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------- | | -------- | ------------------------- | ---- | ---------------- |
| name | string | 是 | 要删除的应用帐号名称。 | | name | string | 是 | 要删除的应用帐号名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 帐号管理服务中删除应用帐号回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 帐号管理服务中删除应用帐号回调。 |
...@@ -195,13 +195,13 @@ deleteAccount(name: string): Promise&lt;void&gt; ...@@ -195,13 +195,13 @@ deleteAccount(name: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- | | ---- | ------ | ---- | ----------- |
| name | string | 是 | 要删除的应用帐号名称。 | | name | string | 是 | 要删除的应用帐号名称。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -226,7 +226,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo ...@@ -226,7 +226,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ | | ---------- | ------------------------- | ---- | --------------------------------- |
| name | string | 是 | 要禁用访问的第三方应用帐号名称。 | | name | string | 是 | 要禁用访问的第三方应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 禁止指定第三方应用帐号名称对指定包名称的第三方应用的回调进行访问。 | | callback | AsyncCallback&lt;void&gt; | 是 | 禁止指定第三方应用帐号名称对指定包名称的第三方应用的回调进行访问。 |
...@@ -251,14 +251,14 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt; ...@@ -251,14 +251,14 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------------------------- | | ---------- | ------ | ---- | ---------------- |
| name | string | 是 | 要禁用访问的第三方应用帐号名称。 | | name | string | 是 | 要禁用访问的第三方应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -283,7 +283,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi ...@@ -283,7 +283,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ | | ---------- | ------------------------- | ---- | --------------------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 允许指定第三方应用帐号名称对指定包名称的第三方应用的回调进行访问。 | | callback | AsyncCallback&lt;void&gt; | 是 | 允许指定第三方应用帐号名称对指定包名称的第三方应用的回调进行访问。 |
...@@ -308,14 +308,14 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt; ...@@ -308,14 +308,14 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------ | | ---------- | ------ | ---- | --------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -341,7 +341,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;): ...@@ -341,7 +341,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------------------ | | -------- | ---------------------------- | ---- | --------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 检查指定应用帐号是否允许应用数据同步回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 检查指定应用帐号是否允许应用数据同步回调。 |
...@@ -368,13 +368,13 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt; ...@@ -368,13 +368,13 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- | | ---- | ------ | ---- | ------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------------- | :---------------------------------- | | :--------------------- | :-------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -399,7 +399,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca ...@@ -399,7 +399,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------- | ---- | -------------------------- | | -------------- | ------------------------- | ---- | ------------- |
| name | string | 是 | 应用程序帐号名称。 | | name | string | 是 | 应用程序帐号名称。 |
| credentialType | string | 是 | 要设置的凭据类型。 | | credentialType | string | 是 | 要设置的凭据类型。 |
| credential | string | 是 | 要设置的凭据。 | | credential | string | 是 | 要设置的凭据。 |
...@@ -425,7 +425,7 @@ setAccountCredential(name: string, credentialType: string, credential: string): ...@@ -425,7 +425,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- | | -------------- | ------ | ---- | ---------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 | | credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 | | credential | string | 是 | 要设置的凭据。 |
...@@ -433,7 +433,7 @@ setAccountCredential(name: string, credentialType: string, credential: string): ...@@ -433,7 +433,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -458,7 +458,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt; ...@@ -458,7 +458,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | ------------------------------ | | --------- | ------------------------- | ---- | --------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 | | extraInfo | string | 是 | 要设置的额外信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的额外信息回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的额外信息回调。 |
...@@ -483,14 +483,14 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt; ...@@ -483,14 +483,14 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------ | | --------- | ------ | ---- | --------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 | | extraInfo | string | 是 | 要设置的额外信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -517,7 +517,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback ...@@ -517,7 +517,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------------------------------------- | | -------- | ------------------------- | ---- | ------------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 | | isEnable | boolean | 是 | 是否允许应用数据同步。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置指定的应用帐号是否允许应用程序数据同步的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置指定的应用帐号是否允许应用程序数据同步的回调。 |
...@@ -544,14 +544,14 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt; ...@@ -544,14 +544,14 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------- | ---- | ---------------------- | | -------- | ------- | ---- | ----------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 | | isEnable | boolean | 是 | 是否允许应用数据同步。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -576,7 +576,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb ...@@ -576,7 +576,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------- | | -------- | ------------------------- | ---- | ----------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 | | key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 | | value | string | 是 | 要设置的数据的值。 |
...@@ -601,7 +601,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt; ...@@ -601,7 +601,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------- | | ----- | ------ | ---- | ----------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 | | key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 | | value | string | 是 | 要设置的数据的值。 |
...@@ -609,7 +609,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt; ...@@ -609,7 +609,7 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------------ | :---------------------------------- | | :------------------ | :-------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -634,7 +634,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba ...@@ -634,7 +634,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | --------------------------- | ---- | ---------------------------- | | -------------- | --------------------------- | ---- | -------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 获取此应用帐号的凭据的类型。 | | credentialType | string | 是 | 获取此应用帐号的凭据的类型。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的凭据的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的凭据的回调。 |
...@@ -660,14 +660,14 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt ...@@ -660,14 +660,14 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- | | -------------- | ------ | ---- | ---------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 | | credentialType | string | 是 | 要获取的凭据的类型。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------------- | :---------------------------------- | | :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -692,7 +692,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -692,7 +692,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------ | | -------- | --------------------------- | ---- | --------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的额外信息回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的额外信息回调。 |
...@@ -717,13 +717,13 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt; ...@@ -717,13 +717,13 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- | | ---- | ------ | ---- | ------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------------- | :---------------------------------- | | :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -748,7 +748,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g ...@@ -748,7 +748,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ---------------------------------- | | -------- | --------------------------- | ---- | ----------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的键。 | | key | string | 是 | 要获取的数据的键。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取与此应用帐号关联的数据的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取与此应用帐号关联的数据的回调。 |
...@@ -774,14 +774,14 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt; ...@@ -774,14 +774,14 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------ | | ---- | ------ | ---- | --------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的键。 | | key | string | 是 | 要获取的数据的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------------- | :---------------------------------- | | :-------------------- | :-------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -808,7 +808,7 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;& ...@@ -808,7 +808,7 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ------------------ | | -------- | ---------------------------------------- | ---- | --------- |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表。 | | callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表。 |
**示例:** **示例:**
...@@ -834,7 +834,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -834,7 +834,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- | | ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -861,7 +861,7 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo ...@@ -861,7 +861,7 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ------------------ | | -------- | ---------------------------------------- | ---- | --------- |
| owner | string | 是 | 应用包名称。 | | owner | string | 是 | 应用包名称。 |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表。 | | callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表。 |
...@@ -889,13 +889,13 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -889,13 +889,13 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------ | | ----- | ------ | ---- | ------ |
| owner | string | 是 | 应用包名称。 | | owner | string | 是 | 应用包名称。 |
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- | | ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -921,7 +921,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A ...@@ -921,7 +921,7 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------------------- | ---- | ------------------------------ |
| type | 'change' | 是 | 关于帐号更改事件,当帐号所有者更新帐号时,订阅者将收到通知。 | | type | 'change' | 是 | 关于帐号更改事件,当帐号所有者更新帐号时,订阅者将收到通知。 |
| owners | Array&lt;string&gt; | 是 | 指示帐号的所有者。 | | owners | Array&lt;string&gt; | 是 | 指示帐号的所有者。 |
| callback | Callback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 订阅指定帐号所有者的帐号变更事件的回调。 | | callback | Callback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 订阅指定帐号所有者的帐号变更事件的回调。 |
...@@ -952,7 +952,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void ...@@ -952,7 +952,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------- | ---- | ------------------------ | | -------- | -------------------------------- | ---- | ------------ |
| type | 'change' | 是 | 关于帐号更改事件。 | | type | 'change' | 是 | 关于帐号更改事件。 |
| callback | Callback<Array\<AppAccountInfo>> | 否 | 取消订阅帐号事件的回调。 | | callback | Callback<Array\<AppAccountInfo>> | 否 | 取消订阅帐号事件的回调。 |
...@@ -985,7 +985,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -985,7 +985,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------ | | -------- | --------------------- | ---- | --------------- |
| name | string | 是 | 要鉴权的应用帐号名称。 | | name | string | 是 | 要鉴权的应用帐号名称。 |
| owner | string | 是 | 要鉴权的应用帐号所有者包名。 | | owner | string | 是 | 要鉴权的应用帐号所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
...@@ -1027,11 +1027,11 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall ...@@ -1027,11 +1027,11 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ---------------------- | | -------- | --------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| callback |AsyncCallback&lt;string&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 查询结果的回调。 |
**示例:** **示例:**
...@@ -1054,7 +1054,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string& ...@@ -1054,7 +1054,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- | | -------- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
...@@ -1062,7 +1062,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string& ...@@ -1062,7 +1062,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| --------------------- | ----------------------------------- | | --------------------- | --------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1087,7 +1087,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall ...@@ -1087,7 +1087,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------- | | -------- | ------------------------- | ---- | -------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 | | token | string | 是 | OAuth令牌。 |
...@@ -1113,7 +1113,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt ...@@ -1113,7 +1113,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- | | -------- | ------ | ---- | -------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 | | token | string | 是 | OAuth令牌。 |
...@@ -1121,7 +1121,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt ...@@ -1121,7 +1121,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ----------------------------------- | | ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1146,7 +1146,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c ...@@ -1146,7 +1146,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- | | -------- | ------------------------- | ---- | ------------ |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
...@@ -1173,7 +1173,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): ...@@ -1173,7 +1173,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- | | -------- | ------ | ---- | ------------ |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
...@@ -1182,7 +1182,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): ...@@ -1182,7 +1182,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ----------------------------------- | | ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1207,7 +1207,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1207,7 +1207,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ----------------------------------------- | | ---------- | ------------------------- | ---- | ------------------------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。 | | bundleName | string | 是 | 被设置可见性的应用包名。 |
...@@ -1234,7 +1234,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1234,7 +1234,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------- | ---- | ------------------------ | | ---------- | ------- | ---- | ------------ |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。 | | bundleName | string | 是 | 被设置可见性的应用包名。 |
...@@ -1243,7 +1243,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1243,7 +1243,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------- | ----------------------------------- | | ------------------- | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1268,7 +1268,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca ...@@ -1268,7 +1268,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------- | ---- | ---------------------- | | ---------- | ---------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 检查可见性的应用包名。 | | bundleName | string | 是 | 检查可见性的应用包名。 |
...@@ -1295,7 +1295,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P ...@@ -1295,7 +1295,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------------------- | | ---------- | ------ | ---- | ------------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 | | bundleName | string | 是 | 用于检查可见性的应用包名。 |
...@@ -1303,7 +1303,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P ...@@ -1303,7 +1303,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------- | ----------------------------------- | | ---------------------- | --------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1328,7 +1328,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array& ...@@ -1328,7 +1328,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ---------------------- | | -------- | ---------------------------------------- | ---- | ----------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt; [OAuthTokenInfo](#oauthtokeninfo8)&gt;&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;Array&lt; [OAuthTokenInfo](#oauthtokeninfo8)&gt;&gt; | 是 | 查询结果的回调。 |
...@@ -1354,14 +1354,14 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn ...@@ -1354,14 +1354,14 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- | | ----- | ------ | ---- | ----------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- | | ---------------------------------------- | --------------------- |
| Promise&lt;Array&lt; [OAuthTokenInfo](#oauthtokeninfo8)&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt; [OAuthTokenInfo](#oauthtokeninfo8)&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1386,7 +1386,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt ...@@ -1386,7 +1386,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------------------------------- | | -------- | ---------------------------------------- | ---- | ----------------------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 应用帐号的鉴权类型的OAuth令牌的授权列表。 | | authType | string | 是 | 应用帐号的鉴权类型的OAuth令牌的授权列表。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 查询结果的回调。 |
...@@ -1412,14 +1412,14 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -1412,14 +1412,14 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ----------------------------------------- | | -------- | ------ | ---- | ----------------------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 应用帐号的鉴权类型的OAuth令牌的授权列表。 | | authType | string | 是 | 应用帐号的鉴权类型的OAuth令牌的授权列表。 |
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------------------- | ----------------------------------- | | ---------------------------------- | --------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1444,7 +1444,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic ...@@ -1444,7 +1444,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------ | ---- | ---------------- | | --------- | ---------------------------------------- | ---- | -------- |
| sessionId | string | 是 | 鉴权会话的标识。 | | sessionId | string | 是 | 鉴权会话的标识。 |
| callback | AsyncCallback&lt;AuthenticatorCallback&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;AuthenticatorCallback&gt; | 是 | 查询结果的回调。 |
...@@ -1480,13 +1480,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt ...@@ -1480,13 +1480,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------- | | --------- | ------ | ---- | -------- |
| sessionId | string | 是 | 鉴权会话的标识。 | | sessionId | string | 是 | 鉴权会话的标识。 |
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------ | ----------------------------------- | | ------------------------------------ | --------------------- |
| Promise&lt;AuthenticatorCallback&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;AuthenticatorCallback&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1520,7 +1520,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo ...@@ -1520,7 +1520,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------- | ---- | ----------- |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| callback | AsyncCallback&lt;AuthenticatorInfo&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;AuthenticatorInfo&gt; | 是 | 查询结果的回调。 |
...@@ -1545,13 +1545,13 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1545,13 +1545,13 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- | | ----- | ------ | ---- | ----------- |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
**参数:** **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| -------------------------------- | ----------------------------------- | | -------------------------------- | --------------------- |
| Promise&lt;AuthenticatorInfo&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;AuthenticatorInfo&gt; | Promise实例,用于获取异步返回结果。 |
**示例:** **示例:**
...@@ -1572,7 +1572,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1572,7 +1572,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- | | ----- | ------ | ---- | ----------- |
| owner | string | 是 | 应用帐号的所有者包名。 | | owner | string | 是 | 应用帐号的所有者包名。 |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
...@@ -1583,7 +1583,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1583,7 +1583,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- | | -------- | ------ | ---- | -------- |
| authType | string | 是 | 令牌的鉴权类型。 | | authType | string | 是 | 令牌的鉴权类型。 |
| token | string | 是 | 令牌的取值。 | | token | string | 是 | 令牌的取值。 |
...@@ -1594,7 +1594,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1594,7 +1594,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------- | | ------- | ------ | ---- | ---------- |
| owner | string | 是 | 认证器的所有者包名。 | | owner | string | 是 | 认证器的所有者包名。 |
| iconId | string | 是 | 认证器的图标标识。 | | iconId | string | 是 | 认证器的图标标识。 |
| labelId | string | 是 | 认证器的标签标识。 | | labelId | string | 是 | 认证器的标签标识。 |
...@@ -1606,7 +1606,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1606,7 +1606,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| ----------------------------- | ---------------------- | -------------------------- | | ----------------------------- | ---------------------- | ------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作,隐式添加帐号。 | | ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作,隐式添加帐号。 |
| ACTION_AUTHENTICATE | "authenticate" | 表示操作,鉴权。 | | ACTION_AUTHENTICATE | "authenticate" | 表示操作,鉴权。 |
| KEY_NAME | "name" | 表示键名,应用帐号名称。 | | KEY_NAME | "name" | 表示键名,应用帐号名称。 |
...@@ -1626,7 +1626,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1626,7 +1626,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| ----------------------------------- | ------ | ------------------------ | | ----------------------------------- | ----- | ------------ |
| SUCCESS | 0 | 表示操作成功。 | | SUCCESS | 0 | 表示操作成功。 |
| ERROR_ACCOUNT_NOT_EXIST | 10001 | 表示应用帐号不存在。 | | ERROR_ACCOUNT_NOT_EXIST | 10001 | 表示应用帐号不存在。 |
| ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | 表示应用帐号服务异常。 | | ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | 表示应用帐号服务异常。 |
...@@ -1661,7 +1661,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void ...@@ -1661,7 +1661,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------- | ---- | ------------ | | ------ | -------------------- | ---- | ------ |
| code | number | 是 | 鉴权结果码。 | | code | number | 是 | 鉴权结果码。 |
| result | {[key: string]: any} | 是 | 鉴权结果。 | | result | {[key: string]: any} | 是 | 鉴权结果。 |
...@@ -1691,7 +1691,7 @@ onRequestRedirected: (request: Want) =&gt; void ...@@ -1691,7 +1691,7 @@ onRequestRedirected: (request: Want) =&gt; void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ---- | ---- | -------------------- | | ------- | ---- | ---- | ---------- |
| request | Want | 是 | 用于跳转的请求信息。 | | request | Want | 是 | 用于跳转的请求信息。 |
**示例:** **示例:**
...@@ -1728,7 +1728,7 @@ addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: ...@@ -1728,7 +1728,7 @@ addAccountImplicitly(authType: string, callerBundleName: string, options: {[key:
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | ---- | ------------------------------ | | ---------------- | --------------------- | ---- | --------------- |
| authType | string | 是 | 应用帐号的鉴权类型。 | | authType | string | 是 | 应用帐号的鉴权类型。 |
| callerBundleName | string | 是 | 鉴权请求方的包名。 | | callerBundleName | string | 是 | 鉴权请求方的包名。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 | | options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
...@@ -1744,7 +1744,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options: ...@@ -1744,7 +1744,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options:
**参数:** **参数:**
| 接口名 | 类型 | 必填 | 说明 | | 接口名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | ---- | ------------------------------ | | ---------------- | --------------------- | ---- | --------------- |
| name | string | 是 | 应用帐号的名称。 | | name | string | 是 | 应用帐号的名称。 |
| authType | string | 是 | 应用帐号的鉴权类型。 | | authType | string | 是 | 应用帐号的鉴权类型。 |
| callerBundleName | string | 是 | 鉴权请求方的包名。 | | callerBundleName | string | 是 | 鉴权请求方的包名。 |
......
# 配置策略 # 配置策略
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >
> - 本模块接口均为系统接口,三方应用不支持调用。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> 本模块接口均为系统接口,三方应用不支持调用。
配置策略提供按预先定义的定制配置层级获取对应定制配置目录和文件路径的能力。 配置策略提供按预先定义的定制配置层级获取对应定制配置目录和文件路径的能力。
## 导入模块 ## 导入模块
``` ```js
import configPolicy from '@ohos.configPolicy'; import configPolicy from '@ohos.configPolicy';
``` ```
...@@ -22,18 +24,18 @@ getOneCfgFile(relPath: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -22,18 +24,18 @@ getOneCfgFile(relPath: string, callback: AsyncCallback&lt;string&gt;): void
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | --------------------------- | ---- | --------------------- |
| relPath | string | 是 | 配置文件名 | | relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;string&gt; | 是 | 异步回调,用于返回最高优先级配置文件的路径 | | callback | AsyncCallback&lt;string&gt; | 是 | 异步回调,用于返回最高优先级配置文件的路径 |
**示例:** **示例:**
``` ```js
configPolicy.getOneCfgFile('config.xml', (error, value) => { configPolicy.getOneCfgFile('config.xml', (error, value) => {
if (error == undefined) { if (error == undefined) {
console.log(value); console.log("value is " + value);
} else { } else {
console.log(error); console.log("error occurs "+ error);
} }
}); });
``` ```
...@@ -48,19 +50,19 @@ getOneCfgFile(relPath: string): Promise&lt;string&gt; ...@@ -48,19 +50,19 @@ getOneCfgFile(relPath: string): Promise&lt;string&gt;
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ----- |
| relPath | string | 是 | 配置文件名 | | relPath | string | 是 | 配置文件名 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | --------------------- | ------------ |
| Promise&lt;string&gt; | 最高优先级配置文件的路径 | | Promise&lt;string&gt; | 最高优先级配置文件的路径 |
**示例:** **示例:**
``` ```js
configPolicy.getOneCfgFile('config.xml').then(value => { configPolicy.getOneCfgFile('config.xml').then(value => {
console.log(value); console.log("value is " + value);
}).catch(error => { }).catch(error => {
console.log("getOneCfgFile promise " + error); console.log("getOneCfgFile promise " + error);
}); });
...@@ -77,18 +79,18 @@ getCfgFiles(relPath: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) ...@@ -77,18 +79,18 @@ getCfgFiles(relPath: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;)
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ------------- |
| relPath | string | 是 | 配置文件名 | | relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回文件列表 | | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回文件列表 |
**示例:** **示例:**
``` ```js
configPolicy.getCfgFiles('config.xml', (error, value) => { configPolicy.getCfgFiles('config.xml', (error, value) => {
if (error == undefined) { if (error == undefined) {
console.log(value); console.log("value is " + value);
} else { } else {
console.log(error); console.log("error occurs "+ error);
} }
}); });
``` ```
...@@ -103,19 +105,19 @@ getCfgFiles(relPath: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -103,19 +105,19 @@ getCfgFiles(relPath: string): Promise&lt;Array&lt;string&gt;&gt;
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------- | ------ | ---- | ----- |
| relPath | string | 是 | 配置文件名 | | relPath | string | 是 | 配置文件名 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ---------------------------------- | ---- |
| Promise&lt;Array&lt;string&gt;&gt; | 文件列表 | | Promise&lt;Array&lt;string&gt;&gt; | 文件列表 |
**示例:** **示例:**
``` ```js
configPolicy.getCfgFiles('config.xml').then(value => { configPolicy.getCfgFiles('config.xml').then(value => {
console.log(value); console.log("value is " + value);
}).catch(error => { }).catch(error => {
console.log("getCfgFiles promise " + error); console.log("getCfgFiles promise " + error);
}); });
...@@ -131,17 +133,17 @@ getCfgDirList(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void ...@@ -131,17 +133,17 @@ getCfgDirList(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | ---------------------------------------- | ---- | ----------------- |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回配置层级目录列表 | | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回配置层级目录列表 |
**示例:** **示例:**
``` ```js
configPolicy.getCfgDirList((error, value) => { configPolicy.getCfgDirList((error, value) => {
if (error == undefined) { if (error == undefined) {
console.log(value); console.log("value is " + value);
} else { } else {
console.log(error); console.log("error occurs "+ error);
} }
}); });
``` ```
...@@ -156,14 +158,14 @@ getCfgDirList(): Promise&lt;Array&lt;string&gt;&gt; ...@@ -156,14 +158,14 @@ getCfgDirList(): Promise&lt;Array&lt;string&gt;&gt;
**系统能力**:SystemCapability.Customization.ConfigPolicy **系统能力**:SystemCapability.Customization.ConfigPolicy
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ---------------------------------- | -------- |
| Promise&lt;Array&lt;string&gt;&gt; | 配置层级目录列表 | | Promise&lt;Array&lt;string&gt;&gt; | 配置层级目录列表 |
**示例:** **示例:**
``` ```js
configPolicy.getCfgDirList().then(value => { configPolicy.getCfgDirList().then(value => {
console.log(value); console.log("value is " + value);
}).catch(error => { }).catch(error => {
console.log("getCfgDirList promise " + error); console.log("getCfgDirList promise " + error);
}); });
......
# 企业设备管理 # 企业设备管理
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
``` ```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'; import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager';
``` ```
...@@ -26,7 +27,7 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -26,7 +27,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------------- | ----------------------------------- | ---- | ------------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 | | type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 |
...@@ -34,7 +35,7 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -34,7 +35,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -48,7 +49,7 @@ enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDevice ...@@ -48,7 +49,7 @@ enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDevice
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -67,7 +68,7 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -67,7 +68,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------ | | -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 | | type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 |
...@@ -75,12 +76,12 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -75,12 +76,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 | | Promise\<boolean> | Promise形式返回是否激活成功 |
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -91,7 +92,7 @@ let enterpriseInfo = { ...@@ -91,7 +92,7 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL) enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -112,23 +113,23 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -112,23 +113,23 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ------------------------------ | | -------- | ----------------------------------- | ---- | ------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 | | callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 |
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: elementName.bundleName, bundleName: "bundleName",
abilityName: elementName.abilityName, abilityName: "abilityName",
}; };
enterpriseDeviceManager.deactivateAdmin(wantTemp, (error, result) => { enterpriseDeviceManager.deactivateAdmin(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -149,24 +150,24 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -149,24 +150,24 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | ------------------ | | ----- | ----------------------------------- | ---- | --------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 | | Promise\<boolean> | Promise形式返回是否激活成功 |
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
}; };
enterpriseDeviceManager.deactivateAdmin(wantTemp).then((result) => { enterpriseDeviceManager.deactivateAdmin(wantTemp).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -184,20 +185,20 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -184,20 +185,20 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------- | ---- | ------------------------------ | | ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | 是 | 超级设备管理员应用的包名 | | bundleName | String | 是 | 超级设备管理员应用的包名 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 | | callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 |
**示例** **示例**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.deactivateSuperAdmin(bundleName, (error, result) => { enterpriseDeviceManager.deactivateSuperAdmin(bundleName, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -213,21 +214,21 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -213,21 +214,21 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------------ | | ---------- | ------ | ---- | ------------ |
| bundleName | String | 是 | 超级设备管理员应用的包名 | | bundleName | String | 是 | 超级设备管理员应用的包名 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 | | Promise\<boolean> | Promise形式返回是否激活成功 |
**示例** **示例**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.deactivateSuperAdmin(bundleName).then((result) => { enterpriseDeviceManager.deactivateSuperAdmin(bundleName).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -245,23 +246,23 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -245,23 +246,23 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | -------------------------------- | | -------- | ----------------------------------- | ---- | -------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 | | callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 |
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: elementName.bundleName, bundleName: "bundleName",
abilityName: elementName.abilityName, abilityName: "abilityName",
}; };
enterpriseDeviceManager.isAdminAppActive(wantTemp, (error, result) => { enterpriseDeviceManager.isAdminAppActive(wantTemp, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -279,24 +280,24 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -279,24 +280,24 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | -------------- | | ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | ------------------------------- | | ----------------- | ------------------- |
| Promise\<boolean> | Promise形式返回是否处于激活状态 | | Promise\<boolean> | Promise形式返回是否处于激活状态 |
**示例** **示例**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
}; };
enterpriseDeviceManager.isAdminAppActive(wantTemp).then((result) => { enterpriseDeviceManager.isAdminAppActive(wantTemp).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -314,20 +315,20 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -314,20 +315,20 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------- | ---- | -------------------------------- | | ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | 是 | 设备管理员应用 | | bundleName | String | 是 | 设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 | | callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 |
**示例** **示例**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => { enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -345,21 +346,21 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -345,21 +346,21 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数** **参数**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------ | | ---------- | ------ | ---- | --------- |
| bundleName | String | 是 | 超级设备管理员应用 | | bundleName | String | 是 | 超级设备管理员应用 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------- | ------------------------------- | | ----------------- | ------------------- |
| Promise\<boolean> | Promise形式返回是否处于激活状态 | | Promise\<boolean> | Promise形式返回是否处于激活状态 |
**示例** **示例**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => { enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -377,12 +378,12 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -377,12 +378,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | --------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback<DeviceSettingsManager&gt; | 是 | callback方式返回DeviceSettingsManager对象 | | callback | AsyncCallback<DeviceSettingsManager&gt; | 是 | callback方式返回DeviceSettingsManager对象 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
...@@ -415,12 +416,12 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -415,12 +416,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ------------------------------------ | ---------------------------------- |
| Promise&lt;DeviceSettingsManager&gt; | Promise方式返回DeviceSettingsManager对象 | | Promise&lt;DeviceSettingsManager&gt; | Promise方式返回DeviceSettingsManager对象 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
...@@ -448,14 +449,14 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -448,14 +449,14 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------------------ | | -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| callback | AsyncCallback\<boolean&gt; | 是 | callback方式返回是否设置企业信息成功 | | callback | AsyncCallback\<boolean&gt; | 是 | callback方式返回是否设置企业信息成功 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -466,7 +467,7 @@ let enterpriseInfo = { ...@@ -466,7 +467,7 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo) enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -485,19 +486,19 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -485,19 +486,19 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------ | | -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------ | ----------------------------------- | | ------------------ | --------------------- |
| Promise\<boolean>; | Promise方式返回是否设置企业信息成功 | | Promise\<boolean>; | Promise方式返回是否设置企业信息成功 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -508,7 +509,7 @@ let enterpriseInfo = { ...@@ -508,7 +509,7 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo) enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -526,13 +527,13 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -526,13 +527,13 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------ | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 是 | callback方式返回设备管理员应用的企业信息 | | callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 是 | callback方式返回设备管理员应用的企业信息 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -560,18 +561,18 @@ SystemCapability.Customation.EnterpriseDeviceManager ...@@ -560,18 +561,18 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | -------------- | | ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 | | admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------------ | ------------------------------------------- | | ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise方式返回设备管理员应用的企业信息对象 | | Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise方式返回设备管理员应用的企业信息对象 |
**示例:** **示例:**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -591,7 +592,7 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { ...@@ -591,7 +592,7 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
**系统能力:** **系统能力:**
以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager 以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ----------- | -------- | ------ | ---- | ---------------------------------- | | ----------- | ---- | ------ | ---- | ----------------- |
| name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 | | name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 |
| description | 只读 | string | 是 | 表示设备管理员应用所属企业的描述。 | | description | 只读 | string | 是 | 表示设备管理员应用所属企业的描述。 |
...@@ -603,6 +604,6 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { ...@@ -603,6 +604,6 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
**系统能力:** **系统能力:**
以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager 以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| -------- | -------- | -------- | | ----------------- | ---- | ----- |
| ADMIN_TYPE_NORMAL | 0x00 | 普通管理员 | | ADMIN_TYPE_NORMAL | 0x00 | 普通管理员 |
| ADMIN_TYPE_SUPER | 0x01 | 超级管理员 | | ADMIN_TYPE_SUPER | 0x01 | 超级管理员 |
...@@ -26,7 +26,7 @@ on(type: “change”, listener: Callback&lt;DeviceListener&gt;): void ...@@ -26,7 +26,7 @@ on(type: “change”, listener: Callback&lt;DeviceListener&gt;): void
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- | | -------- | ---------------------------------------- | ---- | ----------- |
| type | string | 是 | 输入设备的事件类型。 | | type | string | 是 | 输入设备的事件类型。 |
| listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 是 | 可上报的输入设备事件。 | | listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 是 | 可上报的输入设备事件。 |
...@@ -61,7 +61,7 @@ off(type: “change”, listener?: Callback&lt;DeviceListener&gt;): void ...@@ -61,7 +61,7 @@ off(type: “change”, listener?: Callback&lt;DeviceListener&gt;): void
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- | | -------- | ---------------------------------------- | ---- | ----------- |
| type | string | 是 | 输入设备的事件类型。 | | type | string | 是 | 输入设备的事件类型。 |
| listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 否 | 可上报的输入设备事件。 | | listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 否 | 可上报的输入设备事件。 |
...@@ -113,7 +113,7 @@ function getDeviceIds(): Promise&lt;&lt;Array&lt;number&gt;&gt; ...@@ -113,7 +113,7 @@ function getDeviceIds(): Promise&lt;&lt;Array&lt;number&gt;&gt;
**返回值** **返回值**
| 参数 | 说明 | | 参数 | 说明 |
| ------------------------- | ----------------------------- | | ---------------------------------- | ------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise实例,用于异步获取结果。 | | Promise&lt;Array&lt;number&gt;&gt; | Promise实例,用于异步获取结果。 |
**示例** **示例**
...@@ -159,13 +159,13 @@ function getDevice(deviceId: number): Promise&lt;InputDeviceData&gt; ...@@ -159,13 +159,13 @@ function getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- | | -------- | ------ | ---- | ------------ |
| deviceId | number | 是 | 需要获取信息的设备id。 | | deviceId | number | 是 | 需要获取信息的设备id。 |
**返回值** **返回值**
| 参数 | 说明 | | 参数 | 说明 |
| -------------------------------------------------- | ----------------------------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[InputDeviceData](#inputdevicedata)&gt; | Promise实例,用于异步获取结果。 | | Promise&lt;[InputDeviceData](#inputdevicedata)&gt; | Promise实例,用于异步获取结果。 |
**示例** **示例**
...@@ -188,7 +188,7 @@ supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt; ...@@ -188,7 +188,7 @@ supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------ | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | | deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 | | keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 |
| callback | Callback&lt;Array&lt;boolean&gt;&gt; | 是 | 回调函数,异步返回查询结果。 | | callback | Callback&lt;Array&lt;boolean&gt;&gt; | 是 | 回调函数,异步返回查询结果。 |
...@@ -213,14 +213,14 @@ supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;b ...@@ -213,14 +213,14 @@ supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;b
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------- | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | | deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 | | keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 |
**返回值** **返回值**
| 参数 | 说明 | | 参数 | 说明 |
| ----------------------------------- | ----------------------------- | | ----------------------------------- | ------------------- |
| Promise&lt;Array&lt;boolean&gt;&gt; | Promise实例,用于异步获取结果。 | | Promise&lt;Array&lt;boolean&gt;&gt; | Promise实例,用于异步获取结果。 |
**示例** **示例**
...@@ -243,7 +243,7 @@ getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): ...@@ -243,7 +243,7 @@ getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;):
**参数** **参数**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------------------- | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | | deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| callback | AsyncCallback&lt;[KeyboardType](#keyboardtype)&gt; | 是 | 回调函数,异步返回查询结果。 | | callback | AsyncCallback&lt;[KeyboardType](#keyboardtype)&gt; | 是 | 回调函数,异步返回查询结果。 |
...@@ -267,14 +267,14 @@ getKeyboardType(deviceId: number,): Promise&lt;KeyboardType&gt;; ...@@ -267,14 +267,14 @@ getKeyboardType(deviceId: number,): Promise&lt;KeyboardType&gt;;
**返回值** **返回值**
| 参数 | 说明 | | 参数 | 说明 |
| -------------------------------------------- | ----------------------------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[KeyboardType](#keyboardtype)&gt; | Promise实例,用于异步获取结果。 | | Promise&lt;[KeyboardType](#keyboardtype)&gt; | Promise实例,用于异步获取结果。 |
**示例** **示例**
```js ```js
// 示例查询设备id为1的设备键盘类型。 // 示例查询设备id为1的设备键盘类型。
inputDevice.getKeyboardType().then((ret)=>{ inputDevice.getKeyboardType(1).then((ret)=>{
console.log("The keyboard type of the device is: " + ret); console.log("The keyboard type of the device is: " + ret);
}) })
``` ```
...@@ -286,7 +286,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -286,7 +286,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| -------- | --------------------------- | ------------------------------------------------------------ | | -------- | ------------------------- | --------------------------------- |
| type | [ChangeType](#changetype) | 表示输入设备插入或者移除。 | | type | [ChangeType](#changetype) | 表示输入设备插入或者移除。 |
| deviceId | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | | deviceId | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
...@@ -297,7 +297,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -297,7 +297,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| -------------------- | -------------------------------------- | ------------------------------------------------------------ | | -------------------- | -------------------------------------- | ---------------------------------------- |
| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 | | id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| name | string | 输入设备的名字。 | | name | string | 输入设备的名字。 |
| sources | Array&lt;[SourceType](#sourcetype)&gt; | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 | | sources | Array&lt;[SourceType](#sourcetype)&gt; | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 |
...@@ -316,7 +316,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -316,7 +316,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| ----------- | -------- | ------------------- | | ----------- | ------ | --------------- |
| touchMajor | string | 表示touchMajor轴。 | | touchMajor | string | 表示touchMajor轴。 |
| touchMinor | string | 表示touchMinor轴。 | | touchMinor | string | 表示touchMinor轴。 |
| toolMinor | string | 表示toolMinor轴。 | | toolMinor | string | 表示toolMinor轴。 |
...@@ -334,7 +334,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -334,7 +334,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**: 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| ----------------------- | ------------------------- | ---------------- | | ----------------------- | ------------------------- | -------- |
| source | [SourceType](#sourcetype) | 轴的输入源类型。 | | source | [SourceType](#sourcetype) | 轴的输入源类型。 |
| axis | [AxisType](axistype) | 轴的类型。 | | axis | [AxisType](axistype) | 轴的类型。 |
| max | number | 轴的最大值。 | | max | number | 轴的最大值。 |
...@@ -365,7 +365,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -365,7 +365,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 | | 名称 | 参数类型 | 说明 |
| ------ | -------- | ------------------ | | ------ | ------ | --------- |
| add | string | 表示输入设备插入。 | | add | string | 表示输入设备插入。 |
| remove | string | 表示输入设备移除。 | | remove | string | 表示输入设备移除。 |
...@@ -376,7 +376,7 @@ inputDevice.getKeyboardType().then((ret)=>{ ...@@ -376,7 +376,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice **系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 值 | 说明 | | 名称 | 参数类型 | 值 | 说明 |
| ------------------- | -------- | ---- | ------------------ | | ------------------- | ------ | ---- | --------- |
| NONE | number | 0 | 表示无按键设备。 | | NONE | number | 0 | 表示无按键设备。 |
| UNKNOWN | number | 1 | 表示未知按键设备。 | | UNKNOWN | number | 1 | 表示未知按键设备。 |
| ALPHABETIC_KEYBOARD | number | 2 | 表示全键盘设备。 | | ALPHABETIC_KEYBOARD | number | 2 | 表示全键盘设备。 |
......
# 注入按键 # 注入按键
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
> >
> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> >
> - 本模块接口均为系统接口,三方应用不支持调用。 > 本模块接口均为系统接口,三方应用不支持调用。
## 导入模块 ## 导入模块
``` ```js
import inputEventClient from '@ohos.multimodalInput.inputEventClient'; import inputEventClient from '@ohos.multimodalInput.inputEventClient';
``` ```
...@@ -27,19 +27,19 @@ injectEvent({KeyEvent: KeyEvent}): void ...@@ -27,19 +27,19 @@ injectEvent({KeyEvent: KeyEvent}): void
**参数:** **参数:**
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | --------------------- | ---- | --------- |
| KeyEvent | [KeyEvent](#keyevent) | 是 | 注入按键的描述信息 | | KeyEvent | [KeyEvent](#keyevent) | 是 | 注入按键的描述信息 |
**示例:** **示例:**
``` ```js
let keyEvent = { let keyEvent = {
isPressed: true, isPressed: true,
keyCode: 2, keyCode: 2,
keyDownDuration: 0, keyDownDuration: 0,
isIntercepted: false isIntercepted: false
} }
res = inputEventClient.injectEvent({KeyEvent: keyEvent}); let res = inputEventClient.injectEvent({KeyEvent: keyEvent});
``` ```
...@@ -50,7 +50,7 @@ res = inputEventClient.injectEvent({KeyEvent: keyEvent}); ...@@ -50,7 +50,7 @@ res = inputEventClient.injectEvent({KeyEvent: keyEvent});
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputSimulator **系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputSimulator
| 参数 | 类型 | 必填 | 说明 | | 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------------- | ------- | ---- | --------- |
| isPressed | boolean | 是 | 按键是否按下 | | isPressed | boolean | 是 | 按键是否按下 |
| keyCode | Number | 是 | 按键键值 | | keyCode | Number | 是 | 按键键值 |
| keyDownDuration | boolean | 是 | 按键按下持续时间 | | keyDownDuration | boolean | 是 | 按键按下持续时间 |
......
# 传感器 # 传感器
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
``` ```js
import sensor from '@ohos.sensor'; import sensor from '@ohos.sensor';
``` ```
...@@ -30,7 +30,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback&lt;Acceler ...@@ -30,7 +30,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback&lt;Acceler
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -59,7 +59,7 @@ on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback&lt;Line ...@@ -59,7 +59,7 @@ on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback&lt;Line
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -88,7 +88,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback ...@@ -88,7 +88,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -118,7 +118,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback&lt;GravityRespons ...@@ -118,7 +118,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback&lt;GravityRespons
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -147,7 +147,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback&lt;GyroscopeRes ...@@ -147,7 +147,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback&lt;GyroscopeRes
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -176,7 +176,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Callback&lt;G ...@@ -176,7 +176,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Callback&lt;G
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -206,7 +206,7 @@ on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback&lt;Sig ...@@ -206,7 +206,7 @@ on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback&lt;Sig
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(data){
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
}, },
...@@ -233,7 +233,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback&lt;Pe ...@@ -233,7 +233,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback&lt;Pe
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(data){
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
}, },
...@@ -260,7 +260,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback&lt;PedometerRes ...@@ -260,7 +260,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback&lt;PedometerRes
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER,function(data){
console.info('Steps: ' + data.steps); console.info('Steps: ' + data.steps);
}, },
...@@ -285,7 +285,7 @@ on(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:Callback&lt;Ambie ...@@ -285,7 +285,7 @@ on(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:Callback&lt;Ambie
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,function(data){
console.info('Temperature: ' + data.temperature); console.info('Temperature: ' + data.temperature);
}, },
...@@ -310,7 +310,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback&lt;Magneti ...@@ -310,7 +310,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback&lt;Magneti
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -337,7 +337,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callbac ...@@ -337,7 +337,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callbac
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -367,7 +367,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback&lt;ProximityRes ...@@ -367,7 +367,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback&lt;ProximityRes
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY,function(data){
console.info('Distance: ' + data.distance); console.info('Distance: ' + data.distance);
}, },
...@@ -392,7 +392,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback&lt;HumidityRespo ...@@ -392,7 +392,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback&lt;HumidityRespo
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY,function(data){
console.info('Humidity: ' + data.humidity); console.info('Humidity: ' + data.humidity);
}, },
...@@ -417,7 +417,7 @@ on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback&lt;BarometerRes ...@@ -417,7 +417,7 @@ on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback&lt;BarometerRes
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,function(data){
console.info('Atmospheric pressure: ' + data.pressure); console.info('Atmospheric pressure: ' + data.pressure);
}, },
...@@ -442,7 +442,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback&lt;HallResponse&gt;, ...@@ -442,7 +442,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback&lt;HallResponse&gt;,
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL,function(data){
console.info('Status: ' + data.status); console.info('Status: ' + data.status);
}, },
...@@ -467,7 +467,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback&lt;LightRes ...@@ -467,7 +467,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback&lt;LightRes
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,function(data){
console.info(' Illumination: ' + data.intensity); console.info(' Illumination: ' + data.intensity);
}, },
...@@ -492,7 +492,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback&lt;Orientatio ...@@ -492,7 +492,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback&lt;Orientatio
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,function(data){
console.info('The device rotates at an angle around the X axis: ' + data.beta); console.info('The device rotates at an angle around the X axis: ' + data.beta);
console.info('The device rotates at an angle around the Y axis: ' + data.gamma); console.info('The device rotates at an angle around the Y axis: ' + data.gamma);
...@@ -521,7 +521,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback&lt;HeartRateRe ...@@ -521,7 +521,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback&lt;HeartRateRe
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE,function(data){
console.info("Heart rate: " + data.heartRate); console.info("Heart rate: " + data.heartRate);
}, },
...@@ -545,7 +545,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback: Callback&lt;Rotatio ...@@ -545,7 +545,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback: Callback&lt;Rotatio
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -573,7 +573,7 @@ on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback&lt;WearDet ...@@ -573,7 +573,7 @@ on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback&lt;WearDet
| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | | options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 |
**示例:** **示例:**
``` ```js
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(data){ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(data){
console.info('Wear status: ' + data.value); console.info('Wear status: ' + data.value);
}, },
...@@ -599,7 +599,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback&lt;Accele ...@@ -599,7 +599,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback&lt;Accele
| callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | 是 | 注册一次加速度传感器的回调函数,上报的数据类型为AccelerometerResponse。 | | callback | Callback&lt;[AccelerometerResponse](#accelerometerresponse)&gt; | 是 | 注册一次加速度传感器的回调函数,上报的数据类型为AccelerometerResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(data){
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -626,7 +626,7 @@ once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback&lt;Li ...@@ -626,7 +626,7 @@ once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback&lt;Li
| callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | 是 | 注册一次线性加速度传感器的回调函数,上报的数据类型为LinearAccelerometerResponse。 | | callback | Callback&lt;[LinearAccelerometerResponse](#linearaccelerometerresponse)&gt; | 是 | 注册一次线性加速度传感器的回调函数,上报的数据类型为LinearAccelerometerResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -681,7 +681,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback&lt;GravityRespo ...@@ -681,7 +681,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback&lt;GravityRespo
| callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | 是 | 注册一次重力传感器的回调函数,上报的数据类型为GravityResponse。 | | callback | Callback&lt;[GravityResponse](#gravityresponse)&gt; | 是 | 注册一次重力传感器的回调函数,上报的数据类型为GravityResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -708,7 +708,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback&lt;GyroscopeR ...@@ -708,7 +708,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback&lt;GyroscopeR
| callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | 是 | 注册一次陀螺仪传感器的回调函数,上报的数据类型为GyroscopeResponse。 | | callback | Callback&lt;[GyroscopeResponse](#gyroscoperesponse)&gt; | 是 | 注册一次陀螺仪传感器的回调函数,上报的数据类型为GyroscopeResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -735,7 +735,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback: Callback&l ...@@ -735,7 +735,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback: Callback&l
| callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | 是 | 注册一次未校准陀螺仪传感器的回调函数,上报的数据类型为GyroscopeUncalibratedResponse。 | | callback | Callback&lt;[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)&gt; | 是 | 注册一次未校准陀螺仪传感器的回调函数,上报的数据类型为GyroscopeUncalibratedResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -763,7 +763,7 @@ once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback: Callback&lt;Si ...@@ -763,7 +763,7 @@ once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback: Callback&lt;Si
| callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | 是 | 注册一次有效运动传感器的回调函数,上报的数据类型为SignificantMotionResponse。 | | callback | Callback&lt;[SignificantMotionResponse](#significantmotionresponse)&gt; | 是 | 注册一次有效运动传感器的回调函数,上报的数据类型为SignificantMotionResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(data) {
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
} }
...@@ -788,7 +788,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback: Callback&lt;P ...@@ -788,7 +788,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback: Callback&lt;P
| callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | 是 | 注册一次计步检测传感器的回调函数,上报的数据类型为PedometerDetectionResponse。 | | callback | Callback&lt;[PedometerDetectionResponse](#pedometerdetectionresponse)&gt; | 是 | 注册一次计步检测传感器的回调函数,上报的数据类型为PedometerDetectionResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(data) {
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
} }
...@@ -813,7 +813,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback&lt;PedometerR ...@@ -813,7 +813,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback&lt;PedometerR
| callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | 是 | 注册一次计步传感器的回调函数,上报的数据类型为PedometerResponse。 | | callback | Callback&lt;[PedometerResponse](#pedometerresponse)&gt; | 是 | 注册一次计步传感器的回调函数,上报的数据类型为PedometerResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, function(data) {
console.info('Steps: ' + data.steps); console.info('Steps: ' + data.steps);
} }
...@@ -836,7 +836,7 @@ once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback: Callback&lt;A ...@@ -836,7 +836,7 @@ once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback: Callback&lt;A
| callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | 是 | 注册一次环境温度传感器的回调函数,上报的数据类型为AmbientTemperatureResponse。 | | callback | Callback&lt;[AmbientTemperatureResponse](#ambienttemperatureresponse)&gt; | 是 | 注册一次环境温度传感器的回调函数,上报的数据类型为AmbientTemperatureResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(data) {
console.info('Temperature: ' + data.temperature); console.info('Temperature: ' + data.temperature);
} }
...@@ -859,7 +859,7 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback&lt;Magne ...@@ -859,7 +859,7 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback&lt;Magne
| callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | 是 | 注册一次磁场传感器的回调函数,上报的数据类型为MagneticFieldResponse。 | | callback | Callback&lt;[MagneticFieldResponse](#magneticfieldresponse)&gt; | 是 | 注册一次磁场传感器的回调函数,上报的数据类型为MagneticFieldResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -884,7 +884,7 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callb ...@@ -884,7 +884,7 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callb
| callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | 是 | 注册一次未校准磁场传感器的回调函数,上报的数据类型为MagneticFieldUncalibratedResponse。 | | callback | Callback&lt;[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)&gt; | 是 | 注册一次未校准磁场传感器的回调函数,上报的数据类型为MagneticFieldUncalibratedResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -912,7 +912,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback&lt;ProximityR ...@@ -912,7 +912,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback&lt;ProximityR
| callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | 是 | 注册一次接近光传感器的回调函数,上报的数据类型为ProximityResponse。 | | callback | Callback&lt;[ProximityResponse](#proximityresponse)&gt; | 是 | 注册一次接近光传感器的回调函数,上报的数据类型为ProximityResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, function(error, data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, function(error, data) {
if (error) { if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message); console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
...@@ -939,7 +939,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback&lt;HumidityRes ...@@ -939,7 +939,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback&lt;HumidityRes
| callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | 是 | 注册一次湿度传感器的回调函数,上报的数据类型为HumidityResponse。 | | callback | Callback&lt;[HumidityResponse](#humidityresponse)&gt; | 是 | 注册一次湿度传感器的回调函数,上报的数据类型为HumidityResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, function(data) {
console.info('Humidity: ' + data.humidity); console.info('Humidity: ' + data.humidity);
} }
...@@ -962,7 +962,7 @@ once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback&lt;BarometerR ...@@ -962,7 +962,7 @@ once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback&lt;BarometerR
| callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | 是 | 注册一次气压计传感器的回调函数,上报的数据类型为BarometerResponse。 | | callback | Callback&lt;[BarometerResponse](#barometerresponse)&gt; | 是 | 注册一次气压计传感器的回调函数,上报的数据类型为BarometerResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, function(data) {
console.info('Atmospheric pressure: ' + data.pressure); console.info('Atmospheric pressure: ' + data.pressure);
} }
...@@ -985,7 +985,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback&lt;HallResponse&gt ...@@ -985,7 +985,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback&lt;HallResponse&gt
| callback | Callback&lt;[HallResponse](#hallresponse)&gt; | 是 | 注册一次霍尔传感器的回调函数,上报的数据类型为HallResponse。 | | callback | Callback&lt;[HallResponse](#hallresponse)&gt; | 是 | 注册一次霍尔传感器的回调函数,上报的数据类型为HallResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL, function(data) {
console.info('Status: ' + data.status); console.info('Status: ' + data.status);
} }
...@@ -1008,7 +1008,7 @@ once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback&lt;LightR ...@@ -1008,7 +1008,7 @@ once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback&lt;LightR
| callback | Callback&lt;[LightResponse](#lightresponse)&gt; | 是 | 注册一次环境光传感器的回调函数,上报的数据类型为LightResponse。 | | callback | Callback&lt;[LightResponse](#lightresponse)&gt; | 是 | 注册一次环境光传感器的回调函数,上报的数据类型为LightResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, function(data) {
console.info(' Illumination: ' + data.intensity); console.info(' Illumination: ' + data.intensity);
} }
...@@ -1031,7 +1031,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback&lt;Orientat ...@@ -1031,7 +1031,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback&lt;Orientat
| callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | 是 | 注册一次方向传感器的回调函数,上报的数据类型为OrientationResponse。 | | callback | Callback&lt;[OrientationResponse](#orientationresponse)&gt; | 是 | 注册一次方向传感器的回调函数,上报的数据类型为OrientationResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, function(data) {
console.info('The device rotates at an angle around the X axis: ' + data.beta); console.info('The device rotates at an angle around the X axis: ' + data.beta);
console.info('The device rotates at an angle around the Y axis: ' + data.gamma); console.info('The device rotates at an angle around the Y axis: ' + data.gamma);
...@@ -1056,7 +1056,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback&lt;Rota ...@@ -1056,7 +1056,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback&lt;Rota
| callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | 是 | 注册一次旋转矢量传感器的回调函数,上报的数据类型为RotationVectorResponse。 | | callback | Callback&lt;[RotationVectorResponse](#rotationvectorresponse)&gt; | 是 | 注册一次旋转矢量传感器的回调函数,上报的数据类型为RotationVectorResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1084,7 +1084,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback&lt;HeartRate ...@@ -1084,7 +1084,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback&lt;HeartRate
| callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | 是 | 注册一次心率传感器的回调函数,上报的数据类型为HeartRateResponse。 | | callback | Callback&lt;[HeartRateResponse](#heartrateresponse)&gt; | 是 | 注册一次心率传感器的回调函数,上报的数据类型为HeartRateResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, function(data) {
console.info("Heart rate: " + data.heartRate); console.info("Heart rate: " + data.heartRate);
} }
...@@ -1107,7 +1107,7 @@ once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback&lt;WearD ...@@ -1107,7 +1107,7 @@ once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback&lt;WearD
| callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | 是 | 注册一次穿戴检测传感器的回调函数,上报的数据类型为WearDetectionResponse。 | | callback | Callback&lt;[WearDetectionResponse](#weardetectionresponse)&gt; | 是 | 注册一次穿戴检测传感器的回调函数,上报的数据类型为WearDetectionResponse。 |
**示例:** **示例:**
``` ```js
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(data) { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(data) {
console.info("Wear status: "+ data.value); console.info("Wear status: "+ data.value);
} }
...@@ -1133,7 +1133,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback&lt;Accele ...@@ -1133,7 +1133,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback&lt;Accele
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('x-coordinate component: ' + data.x); console.info('x-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1161,7 +1161,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback?: Callb ...@@ -1161,7 +1161,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback?: Callb
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1190,7 +1190,7 @@ off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback&lt;LightR ...@@ -1190,7 +1190,7 @@ off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback&lt;LightR
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info(' Illumination: ' + data.intensity); console.info(' Illumination: ' + data.intensity);
} }
...@@ -1214,7 +1214,7 @@ off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback&lt; ...@@ -1214,7 +1214,7 @@ off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback&lt;
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Temperature: ' + data.temperature); console.info('Temperature: ' + data.temperature);
} }
...@@ -1238,7 +1238,7 @@ off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback&lt;BarometerR ...@@ -1238,7 +1238,7 @@ off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback&lt;BarometerR
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Atmospheric pressure: ' + data.pressure); console.info('Atmospheric pressure: ' + data.pressure);
} }
...@@ -1262,7 +1262,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback&lt;GravityRespo ...@@ -1262,7 +1262,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback&lt;GravityRespo
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1290,7 +1290,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback&lt;GyroscopeR ...@@ -1290,7 +1290,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback&lt;GyroscopeR
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1318,7 +1318,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback& ...@@ -1318,7 +1318,7 @@ off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback&
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1344,7 +1344,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback&lt;HallResponse&gt ...@@ -1344,7 +1344,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback&lt;HallResponse&gt
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Status: ' + data.status); console.info('Status: ' + data.status);
} }
...@@ -1370,7 +1370,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback&lt;HeartRate ...@@ -1370,7 +1370,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback&lt;HeartRate
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info("Heart rate: " + data.heartRate); console.info("Heart rate: " + data.heartRate);
} }
...@@ -1396,7 +1396,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback&lt;HumidityRes ...@@ -1396,7 +1396,7 @@ off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback&lt;HumidityRes
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Humidity: ' + data.humidity); console.info('Humidity: ' + data.humidity);
} }
...@@ -1422,7 +1422,7 @@ off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback&lt; ...@@ -1422,7 +1422,7 @@ off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback&lt;
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1450,7 +1450,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback); ...@@ -1450,7 +1450,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback);
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1476,7 +1476,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); ...@@ -1476,7 +1476,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback);
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1505,7 +1505,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callbac ...@@ -1505,7 +1505,7 @@ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callbac
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('The device rotates at an angle around the X axis: ' + data.beta); console.info('The device rotates at an angle around the X axis: ' + data.beta);
console.info('The device rotates at an angle around the Y axis: ' + data.gamma); console.info('The device rotates at an angle around the Y axis: ' + data.gamma);
...@@ -1531,7 +1531,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback&lt;PedometerR ...@@ -1531,7 +1531,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback&lt;PedometerR
**返回值:** ; **返回值:** ;
``` ```js
function callback(data) { function callback(data) {
console.info('Steps: ' + data.steps); console.info('Steps: ' + data.steps);
} }
...@@ -1557,7 +1557,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback&lt; ...@@ -1557,7 +1557,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback&lt;
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
} }
...@@ -1581,7 +1581,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback&lt;ProximityR ...@@ -1581,7 +1581,7 @@ off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback&lt;ProximityR
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Distance: ' + data.distance); console.info('Distance: ' + data.distance);
} }
...@@ -1605,7 +1605,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback&lt;Rota ...@@ -1605,7 +1605,7 @@ off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback&lt;Rota
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('X-coordinate component: ' + data.x); console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y); console.info('Y-coordinate component: ' + data.y);
...@@ -1632,7 +1632,7 @@ off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback&lt;S ...@@ -1632,7 +1632,7 @@ off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback&lt;S
**示例:** **示例:**
``` ```js
function callback(data) { function callback(data) {
console.info('Scalar data: ' + data.scalar); console.info('Scalar data: ' + data.scalar);
} }
...@@ -1656,7 +1656,7 @@ off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback&lt;WearD ...@@ -1656,7 +1656,7 @@ off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback&lt;WearD
**示例:** **示例:**
``` ```js
function accCallback(data) { function accCallback(data) {
console.info('Wear status: ' + data.value); console.info('Wear status: ' + data.value);
} }
...@@ -1681,13 +1681,13 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co ...@@ -1681,13 +1681,13 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co
**示例:** **示例:**
``` ```js
sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3}, function(err, data) { sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}, function(err, data) {
if (err) { if (err) {
console.error("Operation failed. Error code: " + err.code + ", message: " + err.message); console.error("Operation failed. Error code: " + err.code + ", message: " + err.message);
return; return;
} }
console.info("Operation successed. Data obtained: " + data.x); console.info("Operation successed. Data obtained: " + data);
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]);
} }
...@@ -1716,8 +1716,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co ...@@ -1716,8 +1716,8 @@ transformCoordinateSystem(inRotationVector: Array&lt;number&gt;, coordinates: Co
**示例:** **示例:**
``` ```js
const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {'axisX':2, 'axisY':3}); const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3});
promise.then((data) => { promise.then((data) => {
console.info("Operation successed."); console.info("Operation successed.");
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
...@@ -1744,8 +1744,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callba ...@@ -1744,8 +1744,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callba
| callback | AsyncCallback&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | 是 | 返回磁场信息。 | | callback | AsyncCallback&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | 是 | 返回磁场信息。 |
**示例:** **示例:**
``` ```js
sensor.getGeomagneticField([80, 0, 0], 1580486400000, function(err, data) { sensor.getGeomagneticField({latitude:80, longitude:0, altitude:0}, 1580486400000, function(err, data) {
if (err) { if (err) {
console.error('Operation failed. Error code: ' + err.code + '; message: ' + err.message); console.error('Operation failed. Error code: ' + err.code + '; message: ' + err.message);
return; return;
...@@ -1775,8 +1775,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promi ...@@ -1775,8 +1775,8 @@ getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promi
| Promise&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | 返回磁场信息。 | | Promise&lt;[GeomagneticResponse](#geomagneticresponse)&gt; | 返回磁场信息。 |
**返回值:** **返回值:**
``` ```js
const promise = sensor.getGeomagneticField([80, 0, 0], 1580486400000); const promise = sensor.getGeomagneticField({latitude:80, longitude:0, altitude:0}, 1580486400000);
promise.then((data) => { promise.then((data) => {
console.info('sensor_getGeomagneticField_promise x: ' + data.x + ',y: ' + data.y + ',z: ' + console.info('sensor_getGeomagneticField_promise x: ' + data.x + ',y: ' + data.y + ',z: ' +
data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle + data.z + ',geomagneticDip: ' + data.geomagneticDip + ',deflectionAngle: ' + data.deflectionAngle +
...@@ -1804,7 +1804,7 @@ getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallbac ...@@ -1804,7 +1804,7 @@ getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallbac
**返回值:** **返回值:**
``` ```js
sensor.getAltitude(0, 200, function(err, data) { sensor.getAltitude(0, 200, function(err, data) {
if (err) { if (err) {
console.error( console.error(
...@@ -1838,7 +1838,7 @@ getAltitude(seaPressure: number, currentPressure: number): Promise&lt;number&gt; ...@@ -1838,7 +1838,7 @@ getAltitude(seaPressure: number, currentPressure: number): Promise&lt;number&gt;
**返回值:** **返回值:**
``` ```js
const promise = sensor.getAltitude(0, 200); const promise = sensor.getAltitude(0, 200);
promise.then((data) => { promise.then((data) => {
console.info(' sensor_getAltitude_Promise success', data); console.info(' sensor_getAltitude_Promise success', data);
...@@ -1865,10 +1865,10 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;, callback: AsyncCallbac ...@@ -1865,10 +1865,10 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;, callback: AsyncCallbac
**返回值:** **返回值:**
``` ```js
sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) { sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) {
if (err) { if (err) {
console.error(LABEL + 'SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' + console.error('SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
...@@ -1898,7 +1898,7 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;): Promise&lt;number&gt; ...@@ -1898,7 +1898,7 @@ getGeomagneticDip(inclinationMatrix: Array&lt;number&gt;): Promise&lt;number&gt;
**返回值:** **返回值:**
``` ```js
const promise = sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1]); const promise = sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1]);
promise.then((data) => { promise.then((data) => {
console.info(' getGeomagneticDip_promise successed', data); console.info(' getGeomagneticDip_promise successed', data);
...@@ -1925,10 +1925,10 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar ...@@ -1925,10 +1925,10 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar
**返回值:** **返回值:**
``` ```js
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) { 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) {
if (err) { if (err) {
console.error(LABEL + 'Failed to register data, error code is: ' + err.code + ', message: ' + console.error('Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
...@@ -1963,10 +1963,10 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar ...@@ -1963,10 +1963,10 @@ getAngleModify(currentRotationMatrix: Array&lt;number&gt;, preRotationMatrix: Ar
**返回值:** **返回值:**
``` ```js
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]); 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]);
promise.then((data) => { promise.then((data) => {
console.info(LABEL + 'getAngleModifiy_promise success'); console.info('getAngleModifiy_promise success');
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info(LABEL + "data[" + i + "]: " + data[i]); console.info(LABEL + "data[" + i + "]: " + data[i]);
} }
...@@ -1993,10 +1993,10 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;, callback: AsyncCallbac ...@@ -1993,10 +1993,10 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;, callback: AsyncCallbac
**返回值:** **返回值:**
``` ```js
sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) { sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) {
if (err) { if (err) {
console.error(LABEL + 'SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' + console.error('SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
...@@ -2030,10 +2030,10 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;n ...@@ -2030,10 +2030,10 @@ createRotationMatrix(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;n
**返回值:** **返回值:**
``` ```js
const promise = sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877]); const promise = sensor.createRotationMatrix([0.20046076, 0.21907, 0.73978853, 0.60376877]);
promise.then((data) => { promise.then((data) => {
console.info(LABEL + 'createRotationMatrix_promise success'); console.info('createRotationMatrix_promise success');
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info(LABEL + "data[" + i + "]: " + data[i]); console.info(LABEL + "data[" + i + "]: " + data[i]);
} }
...@@ -2060,10 +2060,10 @@ createQuaternion(rotationVector: Array&lt;number&gt;, callback: AsyncCallback&lt ...@@ -2060,10 +2060,10 @@ createQuaternion(rotationVector: Array&lt;number&gt;, callback: AsyncCallback&lt
**返回值:** **返回值:**
``` ```js
sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) { sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877], function(err, data) {
if (err) { if (err) {
console.error(LABEL + 'SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' + console.error('SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
...@@ -2097,12 +2097,12 @@ createQuaternion(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;numbe ...@@ -2097,12 +2097,12 @@ createQuaternion(rotationVector: Array&lt;number&gt;): Promise&lt;Array&lt;numbe
**返回值:** **返回值:**
``` ```js
const promise = sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877]); const promise = sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877]);
promise.then((data) => { promise.then((data) => {
console.info('createQuaternion_promise successed'); console.info('createQuaternion_promise successed');
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info(LABEL + "data[" + i + "]: " + data[i]); console.info("data[" + i + "]: " + data[i]);
} }
}).catch((err) => { }).catch((err) => {
console.info('promise failed'); console.info('promise failed');
...@@ -2127,16 +2127,16 @@ getDirection(rotationMatrix: Array&lt;number&gt;, callback: AsyncCallback&lt;Arr ...@@ -2127,16 +2127,16 @@ getDirection(rotationMatrix: Array&lt;number&gt;, callback: AsyncCallback&lt;Arr
**返回值:** **返回值:**
``` ```js
sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) { sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1], function(err, data) {
if (err) { if (err) {
console.error(LABEL + 'SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' + console.error('SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
console.info(LABEL + "SensorJsAPI--->Successed to get getDirection interface get data: " + data.x); console.info("SensorJsAPI--->Successed to get getDirection interface get data: " + data.x);
for (var i = 1; i < data.length; i++) { for (var i = 1; i < data.length; i++) {
console.info(TAG +"sensor_getDirection_callback" + data[i]); console.info("sensor_getDirection_callback" + data[i]);
} }
}) })
``` ```
...@@ -2164,12 +2164,12 @@ getDirection(rotationMatrix: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt ...@@ -2164,12 +2164,12 @@ getDirection(rotationMatrix: Array&lt;number&gt;): Promise&lt;Array&lt;number&gt
**返回值:** **返回值:**
``` ```js
const promise = sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1]); const promise = sensor.getDirection([1, 0, 0, 0, 1, 0, 0, 0, 1]);
promise.then((data) => { promise.then((data) => {
console.info(' sensor_getAltitude_Promise success', data.x); console.info('sensor_getAltitude_Promise success', data.x);
for (var i = 1; i < data.length; i++) { for (var i = 1; i < data.length; i++) {
console.info(TAG +"sensor_getDirection_promise" + data[i]); console.info("sensor_getDirection_promise" + data[i]);
} }
}).catch((err) => { }).catch((err) => {
console.info('promise failed'); console.info('promise failed');
...@@ -2195,16 +2195,16 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2195,16 +2195,16 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
**返回值:** **返回值:**
``` ```js
sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444], function(err, data) { sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444], function(err, data) {
if (err) { if (err) {
console.error(LABEL + 'SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' + console.error('SensorJsAPI--->Failed to register data, error code is: ' + err.code + ', message: ' +
err.message); err.message);
return; return;
} }
console.info("SensorJsAPI--->Successed to get createRotationMatrix interface get data: " + data.x); console.info("SensorJsAPI--->Successed to get createRotationMatrix interface get data: " + data.x);
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info(LABEL + "data[" + i + "]: " + data[i]) console.info("data[" + i + "]: " + data[i])
} }
}) })
``` ```
...@@ -2233,15 +2233,15 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2233,15 +2233,15 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
**返回值:** **返回值:**
``` ```js
const promise = sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444]); const promise = sensor.createRotationMatrix([-0.27775216, 0.5351276, 9.788099], [210.87253, -78.6096, -111.44444]);
promise.then((data) => { promise.then((data) => {
console.info(LABEL + 'createRotationMatrix_promise successed'); console.info('createRotationMatrix_promise successed');
for (var i=0; i < data.length; i++) { for (var i=0; i < data.length; i++) {
console.info(LABEL + "data[" + i + "]: " + data[i]); console.info(LABEL + "data[" + i + "]: " + data[i]);
} }
}).catch((err) => { }).catch((err) => {
console.info(LABEL + 'promise failed'); console.info('promise failed');
}) })
``` ```
...@@ -2356,7 +2356,7 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number& ...@@ -2356,7 +2356,7 @@ createRotationMatrix(gravity: Array&lt;number&gt;, geomagnetic: Array&lt;number&
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ----- | ------ | ---- | ---- | ------------------------ | | ----- | ------ | ---- | ---- | ----------------- |
| alpha | number | 是 | 是 | 设备围绕Z轴的旋转角度,单位:度。 | | alpha | number | 是 | 是 | 设备围绕Z轴的旋转角度,单位:度。 |
| beta | number | 是 | 是 | 设备围绕X轴的旋转角度,单位:度。 | | beta | number | 是 | 是 | 设备围绕X轴的旋转角度,单位:度。 |
| gamma | number | 是 | 是 | 设备围绕Y轴的旋转角度,单位:度。 | | gamma | number | 是 | 是 | 设备围绕Y轴的旋转角度,单位:度。 |
......
# 振动 # 振动
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
``` ```js
import vibrator from '@ohos.vibrator'; import vibrator from '@ohos.vibrator';
``` ```
...@@ -34,7 +35,7 @@ vibrate(duration: number): Promise&lt;void&gt; ...@@ -34,7 +35,7 @@ vibrate(duration: number): Promise&lt;void&gt;
**示例:** **示例:**
``` ```js
vibrator.vibrate(1000).then(()=>{ vibrator.vibrate(1000).then(()=>{
console.log("Promise returned to indicate a successful vibration."); console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{ }, (error)=>{
...@@ -60,7 +61,7 @@ vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void ...@@ -60,7 +61,7 @@ vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | | callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 |
**示例:** **示例:**
``` ```js
vibrator.vibrate(1000,function(error){ vibrator.vibrate(1000,function(error){
if(error){ if(error){
console.log("error.code"+error.code+"error.message"+error.message); console.log("error.code"+error.code+"error.message"+error.message);
...@@ -92,7 +93,7 @@ vibrate(effectId: EffectId): Promise&lt;void&gt; ...@@ -92,7 +93,7 @@ vibrate(effectId: EffectId): Promise&lt;void&gt;
| Promise&lt;void&gt; | 指示触发振动是否成功。 | | Promise&lt;void&gt; | 指示触发振动是否成功。 |
**示例:** **示例:**
``` ```js
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(()=>{ vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(()=>{
console.log("Promise returned to indicate a successful vibration."); console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{ }, (error)=>{
...@@ -118,7 +119,7 @@ vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void ...@@ -118,7 +119,7 @@ vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 | | callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 |
**示例:** **示例:**
``` ```js
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER, function(error){ vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER, function(error){
if(error){ if(error){
console.log("error.code"+error.code+"error.message"+error.message); console.log("error.code"+error.code+"error.message"+error.message);
...@@ -150,7 +151,7 @@ stop(stopMode: VibratorStopMode): Promise&lt;void&gt; ...@@ -150,7 +151,7 @@ stop(stopMode: VibratorStopMode): Promise&lt;void&gt;
| Promise&lt;void&gt; | 指示停止振动是否成功。 | | Promise&lt;void&gt; | 指示停止振动是否成功。 |
**示例:** **示例:**
``` ```js
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then(()=>{ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then(()=>{
console.log("Promise returned to indicate a successful vibration."); console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{ }, (error)=>{
...@@ -176,7 +177,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void; ...@@ -176,7 +177,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
| callback | AsyncCallback&lt;void&gt; | 否 | 马达停止振动的回调函数,指示停止振动是否成功。 | | callback | AsyncCallback&lt;void&gt; | 否 | 马达停止振动的回调函数,指示停止振动是否成功。 |
**示例:** **示例:**
``` ```js
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, function(error){ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, function(error){
if(error){ if(error){
console.log("error.code"+error.code+"error.message"+error.message); console.log("error.code"+error.code+"error.message"+error.message);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册