提交 0bcf62f5 编写于 作者: 葛亚芳 提交者: Gitee

Merge branch 'OpenHarmony-3.2-Release' of gitee.com:openharmony/docs into OpenHarmony-3.2-Release

Signed-off-by: N葛亚芳 <geyafang@huawei.com>
# IPC & RPC Development Guidelines
# IPC & RPC Development
## When to Use
......
......@@ -14,6 +14,7 @@ The USB subsystem consists of three parts: USB API, USB Service, and USB HAL. Th
![](figures/en-us_image_0000001237821727.png)
- USB API: provides USB APIs that implement various basic functions, for example, query of the USB device list, bulk data transfer, control transfer, and right management.
- USB Service: receives, parses, and distributes Hardware Abstraction Layer \(HAL\) data, manages and controls foreground and background policies, and manages devices.
- USB HAL: provides driver capability APIs that can be directly called in user mode.
......
......@@ -63,10 +63,10 @@
| ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- |
| mainAbility | string | 是 | 否 | 应用主ability的名称。 |
| apiVersion | [ApiVersion](#apiversion) | 是 | 否 | module的api版本。 |
| deviceType | Array\<string> | 是 | 否 | module的设备类型。 |
| deviceTypes | Array\<string> | 是 | 否 | module的设备类型。 |
| distro | [ModuleDistroInfo](#moduledistroinfo) | 是 | 否 | module发行版信息。 |
| abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | 是 | 否 | module包含的ability组件信息。 |
| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | 是 | 否 | 描述extensionAbilities的配置信息。 |
| extensionAbilities | Array\<[ExtensionAbility](#extensionability)> | 是 | 否 | 描述extensionAbilities的配置信息。 |
## ModuleDistroInfo
......
......@@ -1098,7 +1098,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb
| 错误码ID | 错误信息 |
| -------- | ------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700003 | The specified extensionAbility is not found. |
| 17700003 | The specified ability is not found. |
| 17700004 | The specified userId is invalid. |
| 17700026 | The specified bundle is disabled. |
| 17700029 | The specified ability is disabled. |
......
......@@ -349,6 +349,10 @@ inDevices(devices: Array&lt;string&gt;): RdbPredicates
同步分布式数据库时连接到组网内指定的远程设备。
> **说明:**
>
> 其中devices通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
**参数:**
......@@ -366,8 +370,24 @@ inDevices(devices: Array&lt;string&gt;): RdbPredicates
**示例:**
```js
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.inDevices(['12345678abcde'])
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new data_rdb.RdbPredicates("EMPLOYEE");
predicates.inDevices(deviceIds);
```
### inAllDevices<sup>8+</sup>
......@@ -1808,7 +1828,11 @@ promise.then(() => {
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback&lt;string&gt;): void
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。
根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
......@@ -1818,14 +1842,28 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| device | string | 是 | 远程设备|
| table | string | 是 | 本地表名。 |
| device | string | 是 | 远程设备ID 。 |
| table | string | 是 | 远程设备的本地表名 |
| callback | AsyncCallback&lt;string&gt; | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 |
**示例:**
```js
rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) {
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
if (err) {
console.info('ObtainDistributedTableName failed, err: ' + err)
return
......@@ -1838,7 +1876,11 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err,
obtainDistributedTableName(device: string, table: string): Promise&lt;string&gt;
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。
根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
......@@ -1848,8 +1890,8 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err,
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| device | string | 是 | 远程设备。 |
| table | string | 是 | 本地表名。 |
| device | string | 是 | 远程设备ID。 |
| table | string | 是 | 远程设备的本地表名。 |
**返回值**
......@@ -1860,7 +1902,20 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err,
**示例:**
```js
let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE")
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE")
promise.then((tableName) => {
console.info('ObtainDistributedTableName successfully, tableName= ' + tableName)
}).catch((err) => {
......@@ -1889,8 +1944,24 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback&lt;Array
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new data_rdb.RdbPredicates('EMPLOYEE')
predicates.inDevices(['12345678abcde'])
predicates.inDevices(deviceIds)
rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
if (err) {
console.log('Sync failed, err: ' + err)
......@@ -1929,8 +2000,24 @@ rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, resul
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new data_rdb.RdbPredicates('EMPLOYEE')
predicates.inDevices(['12345678abcde'])
predicates.inDevices(deviceIds)
let promise = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates)
promise.then((result) =>{
console.log('Sync done.')
......
......@@ -399,9 +399,12 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
inDevices(devices: Array&lt;string&gt;): RdbPredicates
同步分布式数据库时连接到组网内指定的远程设备。
> **说明:**
>
> 其中devices通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
**参数:**
......@@ -419,8 +422,24 @@ inDevices(devices: Array&lt;string&gt;): RdbPredicates
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.inDevices(['12345678abcde']);
predicates.inDevices(deviceIds);
```
### inAllDevices
......@@ -1828,24 +1847,41 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
根据指定条件查询远程设备数据库中的数据。使用callback异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
| device | string | 是 | 指定的远程设备的networkId。 |
| table | string | 是 | 指定的目标表名。 |
| predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 |
| columns | Array&lt;string&gt; | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 |
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | -------------------------------------------- | ---- | --------------------------------------------------------- |
| device | string | 是 | 指定的远程设备ID。 |
| table | string | 是 | 指定的目标表名。 |
| predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 |
| columns | Array&lt;string&gt; | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 |
| callback | AsyncCallback&lt;[ResultSet](#resultset)&gt; | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 |
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0);
store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
function(err, resultSet) {
if (err) {
console.error(`Failed to remoteQuery, err: ${err}`);
......@@ -1863,13 +1899,17 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
根据指定条件查询远程设备数据库中的数据。使用Promise异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------------------ | ---- | ------------------------------------------------ |
| device | string | 是 | 指定的远程设备的networkId。 |
| device | string | 是 | 指定的远程设备ID。 |
| table | string | 是 | 指定的目标表名。 |
| predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 |
| columns | Array&lt;string&gt; | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 |
......@@ -1883,6 +1923,19 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0);
let promise = store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
......@@ -2308,7 +2361,11 @@ promise.then(() => {
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback&lt;string&gt;): void
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。
根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
......@@ -2318,14 +2375,27 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| device | string | 是 | 远程设备 |
| table | string | 是 | 本地表名。 |
| device | string | 是 | 远程设备ID 。 |
| table | string | 是 | 远程设备的本地表名。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 |
**示例:**
```js
store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) {
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
if (err) {
console.error(`ObtainDistributedTableName failed, err: ${err}`);
return;
......@@ -2338,7 +2408,11 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab
obtainDistributedTableName(device: string, table: string): Promise&lt;string&gt;
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。
根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
......@@ -2346,10 +2420,10 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| device | string | 是 | 远程设备 |
| table | string | 是 | 本地表名。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------- |
| device | string | 是 | 远程设备ID。 |
| table | string | 是 | 远程设备的本地表名。 |
**返回值**
......@@ -2360,7 +2434,20 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab
**示例:**
```js
let promise = store.obtainDistributedTableName("12345678abcde", "EMPLOYEE");
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceId = devices[0].deviceId;
})
let promise = store.obtainDistributedTableName(deviceId, "EMPLOYEE");
promise.then((tableName) => {
console.info(`ObtainDistributedTableName successfully, tableName= ${tableName}`);
}).catch((err) => {
......@@ -2389,8 +2476,24 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback&lt;Array
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.inDevices(['12345678abcde']);
predicates.inDevices(deviceIds);
store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
if (err) {
console.error(`Sync failed, err: ${err}`);
......@@ -2429,8 +2532,24 @@ store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, r
**示例:**
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let dmInstance = null;
deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
if (err) {
console.log("create device manager failed, err=" + err);
return;
}
dmInstance = manager;
let devices = dmInstance.getTrustedDeviceListSync();
let deviceIds = [];
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
})
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.inDevices(['12345678abcde']);
predicates.inDevices(deviceIds);
let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates);
promise.then((result) =>{
console.info(`Sync done.`);
......
......@@ -282,8 +282,8 @@ try {
| 名称 | 类型 | 必填 | 说明 |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | 是 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId)获取当前进程所在用户。 |
| installFlag | number | 是 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 |
| isKeepData | boolean | 是 | 卸载时是否保留数据目录。 |
| hashParams | Array<[HashParam](#hashparam)> | 是 | 哈希值参数。 |
| crowdtestDeadline| number | 是 |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 |
\ No newline at end of file
| userId | number | 否 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId)获取当前进程所在用户。 |
| installFlag | number | 否 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 |
| isKeepData | boolean | 否 | 卸载时是否保留数据目录。 |
| hashParams | Array<[HashParam](#hashparam)> | 否 | 哈希值参数。 |
| crowdtestDeadline| number | 否 |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 |
\ No newline at end of file
......@@ -2674,4 +2674,4 @@ TLS通信的协议版本。
| 类型 | 说明 |
| --------------------------------------------------------------------- | --------------------- |
|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | 存储证书的数据和编码格式 |
|[cert.EncodingBlob](js-apis-cert.md#datablob) | 存储证书的数据和编码格式 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册