提交 2ee9ab2c 编写于 作者: H HelloCrease

update docs

Signed-off-by: NHelloCrease <lian15@huawei.com>
上级 5b39e0a1
......@@ -8,12 +8,12 @@
## 接口说明
| 模块 | 接口名 | 描述 |
| -------- | -------- | -------- |
| 模块 | 接口名 | 描述 |
| ------------- | ---------------------------------------- | --------------------------- |
| 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(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;Promise&lt;void&gt; | 触发马达按照指定开发者传递效果振动,Promise型。 |
| 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;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | 停止振动。 |
......
# 配置策略
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 本模块接口均为系统接口,三方应用不支持调用。
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> 本模块接口均为系统接口,三方应用不支持调用。
配置策略提供按预先定义的定制配置层级获取对应定制配置目录和文件路径的能力。
## 导入模块
```
```js
import configPolicy from '@ohos.configPolicy';
```
......@@ -22,18 +24,18 @@ getOneCfgFile(relPath: string, callback: AsyncCallback&lt;string&gt;): void
**系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;string&gt; | 是 | 异步回调,用于返回最高优先级配置文件的路径 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | --------------------- |
| relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;string&gt; | 是 | 异步回调,用于返回最高优先级配置文件的路径 |
**示例:**
```
```js
configPolicy.getOneCfgFile('config.xml', (error, value) => {
if (error == undefined) {
console.log(value);
console.log("value is " + value);
} else {
console.log(error);
console.log("error occurs "+ error);
}
});
```
......@@ -48,19 +50,19 @@ getOneCfgFile(relPath: string): Promise&lt;string&gt;
**系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| relPath | string | 是 | 配置文件名 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ----- |
| relPath | string | 是 | 配置文件名 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;string&gt; | 最高优先级配置文件的路径 |
| 类型 | 说明 |
| --------------------- | ------------ |
| Promise&lt;string&gt; | 最高优先级配置文件的路径 |
**示例:**
```
```js
configPolicy.getOneCfgFile('config.xml').then(value => {
console.log(value);
console.log("value is " + value);
}).catch(error => {
console.log("getOneCfgFile promise " + error);
});
......@@ -77,18 +79,18 @@ getCfgFiles(relPath: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;)
**系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回文件列表 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------- |
| relPath | string | 是 | 配置文件名 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回文件列表 |
**示例:**
```
```js
configPolicy.getCfgFiles('config.xml', (error, value) => {
if (error == undefined) {
console.log(value);
console.log("value is " + value);
} else {
console.log(error);
console.log("error occurs "+ error);
}
});
```
......@@ -103,19 +105,19 @@ getCfgFiles(relPath: string): Promise&lt;Array&lt;string&gt;&gt;
**系统能力**: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 => {
console.log(value);
console.log("value is " + value);
}).catch(error => {
console.log("getCfgFiles promise " + error);
});
......@@ -131,17 +133,17 @@ getCfgDirList(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
**系统能力**:SystemCapability.Customization.ConfigPolicy
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回配置层级目录列表 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------- |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 异步回调,用于返回配置层级目录列表 |
**示例:**
```
```js
configPolicy.getCfgDirList((error, value) => {
if (error == undefined) {
console.log(value);
console.log("value is " + value);
} else {
console.log(error);
console.log("error occurs "+ error);
}
});
```
......@@ -156,14 +158,14 @@ getCfgDirList(): Promise&lt;Array&lt;string&gt;&gt;
**系统能力**:SystemCapability.Customization.ConfigPolicy
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;Array&lt;string&gt;&gt; | 配置层级目录列表 |
| 类型 | 说明 |
| ---------------------------------- | -------- |
| Promise&lt;Array&lt;string&gt;&gt; | 配置层级目录列表 |
**示例:**
```
```js
configPolicy.getCfgDirList().then(value => {
console.log(value);
console.log("value is " + value);
}).catch(error => {
console.log("getCfgDirList promise " + error);
});
......
# 企业设备管理
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager';
```
......@@ -26,7 +27,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------------- | ----------------------------------- | ---- | ------------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 |
......@@ -34,7 +35,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**示例**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -48,7 +49,7 @@ enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDevice
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -67,7 +68,7 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------ |
| -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| type | [AdminType](#AdminType) | 是 | 激活的设备管理员类型 |
......@@ -75,12 +76,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**返回值:**
| 类型 | 说明 |
| ----------------- | --------------------------- |
| ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 |
**示例**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -91,7 +92,7 @@ let enterpriseInfo = {
}
enterpriseDeviceManager.activateAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL)
.then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -112,23 +113,23 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ------------------------------ |
| -------- | ----------------------------------- | ---- | ------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 |
**示例**
```
```js
let wantTemp = {
bundleName: elementName.bundleName,
abilityName: elementName.abilityName,
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.deactivateAdmin(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -149,24 +150,24 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | ------------------ |
| ----- | ----------------------------------- | ---- | --------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 普通设备管理员应用 |
**返回值:**
| 类型 | 说明 |
| ----------------- | --------------------------- |
| ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 |
**示例**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.deactivateAdmin(wantTemp).then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -184,20 +185,20 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------- | ---- | ------------------------------ |
| ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | 是 | 超级设备管理员应用的包名 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否去激活成功 |
**示例**
```
```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.deactivateSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -213,21 +214,21 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------------ |
| ---------- | ------ | ---- | ------------ |
| bundleName | String | 是 | 超级设备管理员应用的包名 |
**返回值:**
| 类型 | 说明 |
| ----------------- | --------------------------- |
| ----------------- | ----------------- |
| Promise\<boolean> | Promise形式返回是否激活成功 |
**示例**
```
```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.deactivateSuperAdmin(bundleName).then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -245,23 +246,23 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | -------------------------------- |
| -------- | ----------------------------------- | ---- | -------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 |
**示例**
```
```js
let wantTemp = {
bundleName: elementName.bundleName,
abilityName: elementName.abilityName,
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.isAdminAppActive(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -279,24 +280,24 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | -------------- |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------- |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise形式返回是否处于激活状态 |
**示例**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.isAdminAppActive(wantTemp).then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -314,20 +315,20 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------- | ---- | -------------------------------- |
| ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | 是 | 设备管理员应用 |
| callback | AsyncCallback\<boolean> | 是 | callback方式返回是否处于激活状态 |
**示例**
```
```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -345,21 +346,21 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------ |
| ---------- | ------ | ---- | --------- |
| bundleName | String | 是 | 超级设备管理员应用 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------- |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise形式返回是否处于激活状态 |
**示例**
```
```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -377,12 +378,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback<DeviceSettingsManager&gt; | 是 | callback方式返回DeviceSettingsManager对象 |
**示例:**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
......@@ -415,12 +416,12 @@ SystemCapability.Customation.EnterpriseDeviceManager
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| ------------------------------------ | ---------------------------------- |
| Promise&lt;DeviceSettingsManager&gt; | Promise方式返回DeviceSettingsManager对象 |
**示例:**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
......@@ -448,14 +449,14 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------------------ |
| -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
| callback | AsyncCallback\<boolean&gt; | 是 | callback方式返回是否设置企业信息成功 |
**示例:**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -466,7 +467,7 @@ let enterpriseInfo = {
}
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -485,19 +486,19 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ---------------------------------------------- | ---- | ------------------------ |
| -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | 是 | 设备管理员应用的企业信息 |
**返回值:**
| 类型 | 说明 |
| ------------------ | ----------------------------------- |
| ------------------ | --------------------- |
| Promise\<boolean>; | Promise方式返回是否设置企业信息成功 |
**示例:**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -508,7 +509,7 @@ let enterpriseInfo = {
}
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -526,13 +527,13 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------ | ---- | ---------------------------------------- |
| -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
| callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 是 | callback方式返回设备管理员应用的企业信息 |
**示例:**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -560,18 +561,18 @@ SystemCapability.Customation.EnterpriseDeviceManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | -------------- |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | 是 | 设备管理员应用 |
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------ | ------------------------------------------- |
| ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise方式返回设备管理员应用的企业信息对象 |
**示例:**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -591,7 +592,7 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
**系统能力:**
以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ----------- | -------- | ------ | ---- | ---------------------------------- |
| ----------- | ---- | ------ | ---- | ----------------- |
| name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 |
| description | 只读 | string | 是 | 表示设备管理员应用所属企业的描述。 |
......@@ -603,6 +604,6 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
**系统能力:**
以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| ----------------- | ---- | ----- |
| ADMIN_TYPE_NORMAL | 0x00 | 普通管理员 |
| ADMIN_TYPE_SUPER | 0x01 | 超级管理员 |
......@@ -26,7 +26,7 @@ on(type: “change”, listener: Callback&lt;DeviceListener&gt;): void
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- |
| -------- | ---------------------------------------- | ---- | ----------- |
| type | string | 是 | 输入设备的事件类型。 |
| listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 是 | 可上报的输入设备事件。 |
......@@ -61,7 +61,7 @@ off(type: “change”, listener?: Callback&lt;DeviceListener&gt;): void
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------- |
| -------- | ---------------------------------------- | ---- | ----------- |
| type | string | 是 | 输入设备的事件类型。 |
| listener | Callback&lt;[DeviceListener](#devicelistener<sup>9+</sup>)&gt; | 否 | 可上报的输入设备事件。 |
......@@ -113,7 +113,7 @@ function getDeviceIds(): Promise&lt;&lt;Array&lt;number&gt;&gt;
**返回值**
| 参数 | 说明 |
| ------------------------- | ----------------------------- |
| ---------------------------------- | ------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise实例,用于异步获取结果。 |
**示例**
......@@ -159,13 +159,13 @@ function getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| -------- | ------ | ---- | ------------ |
| deviceId | number | 是 | 需要获取信息的设备id。 |
**返回值**
| 参数 | 说明 |
| -------------------------------------------------- | ----------------------------- |
| ---------------------------------------- | ------------------- |
| Promise&lt;[InputDeviceData](#inputdevicedata)&gt; | Promise实例,用于异步获取结果。 |
**示例**
......@@ -188,7 +188,7 @@ supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ |
| -------- | ------------------------------------ | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 |
| 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
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| -------- | -------------------- | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| keys | Array&lt;KeyCode&gt; | 是 | 需要查询的键码值,最多支持5个按键查询。 |
**返回值**
| 参数 | 说明 |
| ----------------------------------- | ----------------------------- |
| ----------------------------------- | ------------------- |
| Promise&lt;Array&lt;boolean&gt;&gt; | Promise实例,用于异步获取结果。 |
**示例**
......@@ -243,7 +243,7 @@ getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;):
**参数**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ |
| -------- | ---------------------------------------- | ---- | --------------------------------- |
| deviceId | number | 是 | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| callback | AsyncCallback&lt;[KeyboardType](#keyboardtype)&gt; | 是 | 回调函数,异步返回查询结果。 |
......@@ -267,14 +267,14 @@ getKeyboardType(deviceId: number,): Promise&lt;KeyboardType&gt;;
**返回值**
| 参数 | 说明 |
| -------------------------------------------- | ----------------------------- |
| ---------------------------------------- | ------------------- |
| Promise&lt;[KeyboardType](#keyboardtype)&gt; | Promise实例,用于异步获取结果。 |
**示例**
```js
// 示例查询设备id为1的设备键盘类型。
inputDevice.getKeyboardType().then((ret)=>{
inputDevice.getKeyboardType(1).then((ret)=>{
console.log("The keyboard type of the device is: " + ret);
})
```
......@@ -286,7 +286,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------- | --------------------------- | ------------------------------------------------------------ |
| -------- | ------------------------- | --------------------------------- |
| type | [ChangeType](#changetype) | 表示输入设备插入或者移除。 |
| deviceId | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
......@@ -297,7 +297,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| -------------------- | -------------------------------------- | ------------------------------------------------------------ |
| -------------------- | -------------------------------------- | ---------------------------------------- |
| id | number | 输入设备的唯一标识,同一个物理设备反复插拔,其设备id会发生变化。 |
| name | string | 输入设备的名字。 |
| sources | Array&lt;[SourceType](#sourcetype)&gt; | 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。 |
......@@ -316,7 +316,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------- | -------- | ------------------- |
| ----------- | ------ | --------------- |
| touchMajor | string | 表示touchMajor轴。 |
| touchMinor | string | 表示touchMinor轴。 |
| toolMinor | string | 表示toolMinor轴。 |
......@@ -334,7 +334,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------------------- | ------------------------- | ---------------- |
| ----------------------- | ------------------------- | -------- |
| source | [SourceType](#sourcetype) | 轴的输入源类型。 |
| axis | [AxisType](axistype) | 轴的类型。 |
| max | number | 轴的最大值。 |
......@@ -365,7 +365,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ------ | -------- | ------------------ |
| ------ | ------ | --------- |
| add | string | 表示输入设备插入。 |
| remove | string | 表示输入设备移除。 |
......@@ -376,7 +376,7 @@ inputDevice.getKeyboardType().then((ret)=>{
**系统能力**:以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 值 | 说明 |
| ------------------- | -------- | ---- | ------------------ |
| ------------------- | ------ | ---- | --------- |
| NONE | number | 0 | 表示无按键设备。 |
| UNKNOWN | number | 1 | 表示未知按键设备。 |
| 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';
```
......@@ -27,19 +27,19 @@ injectEvent({KeyEvent: KeyEvent}): void
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| -------- | --------------------- | ---- | --------- |
| KeyEvent | [KeyEvent](#keyevent) | 是 | 注入按键的描述信息 |
**示例:**
```
```js
let keyEvent = {
isPressed: true,
keyCode: 2,
keyDownDuration: 0,
isIntercepted: false
}
res = inputEventClient.injectEvent({KeyEvent: keyEvent});
let res = inputEventClient.injectEvent({KeyEvent: keyEvent});
```
......@@ -50,7 +50,7 @@ res = inputEventClient.injectEvent({KeyEvent: keyEvent});
**系统能力:** 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputSimulator
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| --------------- | ------- | ---- | --------- |
| isPressed | boolean | 是 | 按键是否按下 |
| keyCode | Number | 是 | 按键键值 |
| keyDownDuration | boolean | 是 | 按键按下持续时间 |
......
# 振动
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
```js
import vibrator from '@ohos.vibrator';
```
......@@ -34,7 +35,7 @@ vibrate(duration: number): Promise&lt;void&gt;
**示例:**
```
```js
vibrator.vibrate(1000).then(()=>{
console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{
......@@ -60,7 +61,7 @@ vibrate(duration: number, callback?: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 |
**示例:**
```
```js
vibrator.vibrate(1000,function(error){
if(error){
console.log("error.code"+error.code+"error.message"+error.message);
......@@ -92,7 +93,7 @@ vibrate(effectId: EffectId): Promise&lt;void&gt;
| Promise&lt;void&gt; | 指示触发振动是否成功。 |
**示例:**
```
```js
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(()=>{
console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{
......@@ -118,7 +119,7 @@ vibrate(effectId: EffectId, callback?: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 否 | 马达执行振动的回调函数,指示触发振动是否成功。 |
**示例:**
```
```js
vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER, function(error){
if(error){
console.log("error.code"+error.code+"error.message"+error.message);
......@@ -150,7 +151,7 @@ stop(stopMode: VibratorStopMode): Promise&lt;void&gt;
| Promise&lt;void&gt; | 指示停止振动是否成功。 |
**示例:**
```
```js
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then(()=>{
console.log("Promise returned to indicate a successful vibration.");
}, (error)=>{
......@@ -176,7 +177,7 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback&lt;void&gt;): void;
| callback | AsyncCallback&lt;void&gt; | 否 | 马达停止振动的回调函数,指示停止振动是否成功。 |
**示例:**
```
```js
vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, function(error){
if(error){
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.
先完成此消息的编辑!
想要评论请 注册