diff --git a/api/@ohos.rpc.d.ts b/api/@ohos.rpc.d.ts index 2f2119fc3a54bb9dacae874dfda3f8afc01f8d7e..34f5edc604c6d923cb82257fbde56e65421e2951 100644 --- a/api/@ohos.rpc.d.ts +++ b/api/@ohos.rpc.d.ts @@ -825,6 +825,26 @@ declare namespace rpc { */ queryLocalInterface(descriptor: string): IRemoteBroker; + /** + * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. + * + *

If asynchronous mode is set for {@code option}, a response is returned immediately. + * If synchronous mode is set for {@code option}, the interface will wait for a response from the peer process + * until the request times out. The user must prepare {@code reply} for receiving the execution result + * given by the peer process. + * + * @param code Indicates the message code, which is determined by both sides of the communication. + * If the interface is generated by the IDL tool, the message code is automatically generated by IDL. + * @param data Indicates the {@link MessageParcel} object sent to the peer process. + * @param reply Indicates the {@link MessageParcel} object returned by the peer process. + * @param options Indicates the synchronous or asynchronous mode to send messages. + * @return Returns {@code true} if the method is called successfully; returns {@code false} otherwise. + * @throws RemoteException Throws this exception if the method fails to be called. + * @deprecated since 8 + * @since 7 + */ + sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. * @@ -839,29 +859,28 @@ declare namespace rpc { * param operations Indicates the synchronous or asynchronous mode to send messages. * @returns Promise used to return the {@link SendRequestResult} instance. * @throws Throws an exception if the method fails to be called. + * @deprecated since 9 * @since 8 */ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** - * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. - * - *

If asynchronous mode is set for {@code option}, a response is returned immediately. - * If synchronous mode is set for {@code option}, the interface will wait for a response from the peer process - * until the request times out. The user must prepare {@code reply} for receiving the execution result - * given by the peer process. + * Sends a {@link MessageParcel} message to the peer process asynchronously. * - * @param code Indicates the message code, which is determined by both sides of the communication. - * If the interface is generated by the IDL tool, the message code is automatically generated by IDL. - * @param data Indicates the {@link MessageParcel} object sent to the peer process. - * @param reply Indicates the {@link MessageParcel} object returned by the peer process. - * @param options Indicates the synchronous or asynchronous mode to send messages. - * @return Returns {@code true} if the method is called successfully; returns {@code false} otherwise. - * @throws RemoteException Throws this exception if the method fails to be called. - * @deprecated since 8 - * @since 7 + *

If options indicates the asynchronous mode, a promise will be fulfilled immediately + * and the reply message does not contain any content. If options indicates the synchronous mode, + * a promise will be fulfilled when the response to sendRequest is returned, + * and the reply message contains the returned information. + * param code Message code called by the request, which is determined by the client and server. + * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool. + * param data {@link MessageParcel} object holding the data to send. + * param reply {@link MessageParcel} object that receives the response. + * param operations Indicates the synchronous or asynchronous mode to send messages. + * @returns Promise used to return the {@link SendRequestResult} instance. + * @throws Throws an exception if the method fails to be called. + * @since 9 */ - sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + sendRequestAsync(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. @@ -1070,6 +1089,22 @@ declare namespace rpc { */ onRemoteRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + /** + * Sends a request to the peer object. + * + *

If the peer object and {@code RemoteObject} are on the same device, the request is sent by the IPC driver. + * If they are on different devices, the request is sent by the socket driver. + * + * @param code Indicates the message code of the request. + * @param data Indicates the {@link MessageParcel} object storing the data to be sent. + * @param reply Indicates the {@link MessageParcel} object receiving the response data. + * @param options Indicates a synchronous (default) or asynchronous request. + * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. + * @deprecated since 8 + * @since 7 + */ + sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. * @@ -1084,25 +1119,28 @@ declare namespace rpc { * param operations Indicates the synchronous or asynchronous mode to send messages. * @returns Promise used to return the {@link SendRequestResult} instance. * @throws Throws an exception if the method fails to be called. + * @deprecated since 9 * @since 8 */ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** - * Sends a request to the peer object. - * - *

If the peer object and {@code RemoteObject} are on the same device, the request is sent by the IPC driver. - * If they are on different devices, the request is sent by the socket driver. + * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. * - * @param code Indicates the message code of the request. - * @param data Indicates the {@link MessageParcel} object storing the data to be sent. - * @param reply Indicates the {@link MessageParcel} object receiving the response data. - * @param options Indicates a synchronous (default) or asynchronous request. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. - * @deprecated since 8 - * @since 7 + *

If options indicates the asynchronous mode, a promise will be fulfilled immediately + * and the reply message does not contain any content. If options indicates the synchronous mode, + * a promise will be fulfilled when the response to sendRequest is returned, + * and the reply message contains the returned information. + * param code Message code called by the request, which is determined by the client and server. + * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool. + * param data {@link MessageParcel} object holding the data to send. + * param reply {@link MessageParcel} object that receives the response. + * param operations Indicates the synchronous or asynchronous mode to send messages. + * @returns Promise used to return the {@link SendRequestResult} instance. + * @throws Throws an exception if the method fails to be called. + * @since 9 */ - sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + sendRequestAsync(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. @@ -1226,6 +1264,23 @@ declare namespace rpc { */ getInterfaceDescriptor(): string; + /** + * Sends a request to the peer object. + * + *

If the peer object and {@code RemoteProxy} are on the same device, the request is sent by the IPC driver. + * If they are on different devices, the request is sent by the socket driver. + * + * @param code Indicates the message code of the request. + * @param data Indicates the {@link MessageParcel} object storing the data to be sent. + * @param reply Indicates the {@link MessageParcel} object receiving the response data. + * @param options Indicates a synchronous (default) or asynchronous request. + * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. + * @throws RemoteException Throws this exception if a remote object exception occurs. + * @deprecated since 8 + * @since 7 + */ + sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. * @@ -1240,26 +1295,28 @@ declare namespace rpc { * param operations Indicates the synchronous or asynchronous mode to send messages. * @returns Promise used to return the {@link sendRequestResult} instance. * @throws Throws an exception if the method fails to be called. + * @deprecated since 9 * @since 8 */ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** - * Sends a request to the peer object. - * - *

If the peer object and {@code RemoteProxy} are on the same device, the request is sent by the IPC driver. - * If they are on different devices, the request is sent by the socket driver. + * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode. * - * @param code Indicates the message code of the request. - * @param data Indicates the {@link MessageParcel} object storing the data to be sent. - * @param reply Indicates the {@link MessageParcel} object receiving the response data. - * @param options Indicates a synchronous (default) or asynchronous request. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. - * @throws RemoteException Throws this exception if a remote object exception occurs. - * @deprecated since 8 - * @since 7 + *

If options indicates the asynchronous mode, a promise will be fulfilled immediately + * and the reply message does not contain any content. If options indicates the synchronous mode, + * a promise will be fulfilled when the response to sendRequest is returned, + * and the reply message contains the returned information. + * param code Message code called by the request, which is determined by the client and server. + * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool. + * param data {@link MessageParcel} object holding the data to send. + * param reply {@link MessageParcel} object that receives the response. + * param operations Indicates the synchronous or asynchronous mode to send messages. + * @returns Promise used to return the {@link SendRequestResult} instance. + * @throws Throws an exception if the method fails to be called. + * @since 9 */ - sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; + sendRequestAsync(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise; /** * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.