Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
fa9e8009
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fa9e8009
编写于
11月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11908 update zh-cn/application-dev/reference/apis/js-apis-rpc.md
Merge pull request !11908 from crazy_hu/master
上级
92c44db3
b3c05690
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
17 deletion
+41
-17
zh-cn/application-dev/reference/apis/js-apis-rpc.md
zh-cn/application-dev/reference/apis/js-apis-rpc.md
+41
-17
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-rpc.md
浏览文件 @
fa9e8009
...
...
@@ -14,6 +14,29 @@ import rpc from '@ohos.rpc';
```
## ErrorCode<sup>9+</sup>
从API version 9起,IPC支持异常返回功能。错误码对应数值及含义如下。
**系统能力**
:SystemCapability.Communication.IPC.Core
| 名称 | 值 | 说明 |
| ------------------------------------- | ------- | --------------------------------------------- |
| OS_MMAP_ERROR | 1900001 | 执行系统调用mmap失败。 |
| OS_IOCTL_ERROR | 1900002 | 在共享内存文件描述符上执行系统调用ioctl失败。 |
| WRITE_TO_ASHMEM_ERROR | 1900003 | 向共享内存写数据失败。 |
| READ_FROM_ASHMEM_ERROR | 1900004 | 从共享内存读数据失败。 |
| ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | 只有proxy对象允许该操作。 |
| ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | 只有remote对象允许该操作。 |
| COMMUNICATION_ERROR | 1900007 | 和远端对象进行进程间通信失败。 |
| PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | 非法的代理对象或者远端对象。 |
| WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | 向MessageSequence写数据失败。 |
| READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | 读取MessageSequence数据失败。 |
| PARCEL_MEMORY_ALLOC_ERROR | 1900011 | 序列化过程中内存分配失败。 |
| CALL_JS_METHOD_ERROR | 1900012 | 执行JS回调方法失败。 |
| OS_DUP_ERROR | 1900013 | 执行系统调用dup失败。 |
## MessageSequence<sup>9+</sup>
在RPC过程中,发送方可以使用MessageSequence提供的写方法,将待发送的数据以特定格式写入该对象。接收方可以使用MessageSequence提供的读方法从该对象中读取特定格式的数据。数据格式包括:基础类型及数组、IPC对象、接口描述符和自定义序列化对象。
...
...
@@ -796,7 +819,7 @@ writeFloat(val: number): void
| 错误码ID | 错误信息 |
| ------- | ------- |
| 19000
10
| write data to message sequence failed |
| 19000
09
| write data to message sequence failed |
**示例:**
...
...
@@ -2543,6 +2566,7 @@ writeRemoteObjectArray(objectArray: IRemoteObject[]): void
**系统能力**
:SystemCapability.Communication.IPC.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | --------------- | ---- | ---------------------------------------------- |
| objectArray | IRemoteObject[] | 是 | 要写入MessageSequence的IRemoteObject对象数组。 |
...
...
@@ -2681,7 +2705,7 @@ readRemoteObjectArray(): IRemoteObject[]
```
### closeFileDescriptor<sup>
8
+</sup>
### closeFileDescriptor<sup>
9
+</sup>
static closeFileDescriptor(fd: number): void
...
...
@@ -2891,7 +2915,7 @@ writeAshmem(ashmem: Ashmem): void
| 错误码ID | 错误信息 |
| ------- | ------- |
| 190000
9
| write data to message sequence failed |
| 190000
3
| write data to message sequence failed |
**示例:**
...
...
@@ -2933,7 +2957,7 @@ readAshmem(): Ashmem
| 错误码ID | 错误信息 |
| ------- | -------- |
| 19000
10
| read data from message sequence failed |
| 19000
04
| read data from message sequence failed |
**示例:**
...
...
@@ -5738,12 +5762,12 @@ onRemoteDied(): void
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。
|
参数名 | 类型 | 必填 | 说明
|
| ------- | --------------- | ---- | ------------------------------------- |
| errCode | number | 是 | 错误码。 |
| code | number | 是 | 消息代码。 |
| data | MessageSequence | 是 | 发送给对端进程的MessageSequence对象。 |
| reply | MessageSequence | 是 | 对端进程返回的MessageSequence对象。 |
|
名称 | 类型 | 可读 | 可写 | 说明
|
| ------- | --------------- | ---- | ----
|-----
--------------------------------- |
| errCode | number | 是 |
否 |
错误码。 |
| code | number | 是 |
否 |
消息代码。 |
| data | MessageSequence | 是 |
否 |
发送给对端进程的MessageSequence对象。 |
| reply | MessageSequence | 是 |
否 |
对端进程返回的MessageSequence对象。 |
## SendRequestResult<sup>8+(deprecated)</sup>
...
...
@@ -5753,12 +5777,12 @@ onRemoteDied(): void
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。
|
参数名 | 类型 | 必填 | 说明
|
| ------- | ------------- | ---- | ----------------------------------- |
| errCode | number | 是 | 错误码。 |
| code | number | 是 | 消息代码。 |
| data | MessageParcel | 是 | 发送给对端进程的MessageParcel对象。 |
| reply | MessageParcel | 是 | 对端进程返回的MessageParcel对象。 |
|
名称 | 类型 | 可读 | 可写 | 说明
|
| ------- | ------------- | ---- | ----
| ----
------------------------------- |
| errCode | number | 是 |
否 |
错误码。 |
| code | number | 是 |
否 |
消息代码。 |
| data | MessageParcel | 是 |
否 |
发送给对端进程的MessageParcel对象。 |
| reply | MessageParcel | 是 |
否 |
对端进程返回的MessageParcel对象。 |
## IRemoteObject
...
...
@@ -5973,7 +5997,7 @@ addDeathRecipient(recipient: DeathRecipient, flags: number): boolean
### unregisterDeathRecipient<sup>9+</sup>
remove
DeathRecipient(recipient: DeathRecipient, flags: number): void
unregister
DeathRecipient(recipient: DeathRecipient, flags: number): void
注销用于接收远程对象死亡通知的回调。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录