“3d490d030e7c51c760f7da3030a0e8b938050044”上不存在“doc/howto/git@gitcode.net:s920243400/PaddleDetection.git”
提交 211de98a 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 29f6acd4
...@@ -22,6 +22,7 @@ Obtains information about the root album or directory in asynchronous mode. This ...@@ -22,6 +22,7 @@ Obtains information about the root album or directory in asynchronous mode. This
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
...@@ -83,6 +84,7 @@ Obtains information about the second-level album or files in asynchronous mode. ...@@ -83,6 +84,7 @@ Obtains information about the second-level album or files in asynchronous mode.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| path | string | Yes| URI of the directory to query.| | path | string | Yes| URI of the directory to query.|
...@@ -169,6 +171,7 @@ Creates a file in the specified path in asynchronous mode. This API uses a promi ...@@ -169,6 +171,7 @@ Creates a file in the specified path in asynchronous mode. This API uses a promi
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| filename | string | Yes| Name of the file to create.| | filename | string | Yes| Name of the file to create.|
......
...@@ -16,7 +16,7 @@ import rpc from '@ohos.rpc'; ...@@ -16,7 +16,7 @@ import rpc from '@ohos.rpc';
## MessageParcel ## MessageParcel
Provides methods for reading and writing basic data types and arrays, inter-process communication (IPC) objects, interface tokens, and sequenceable objects. Provides APIs for reading and writing data in specific format. During RPC, the sender can use the **write()** method provided **MessageParcel** to write data to a **MessageParcel** object in specific format. The receiver can use the **read()** method provided by **MessageParcel** to read data in specific format from a **MessageParcel** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects.
### create ### create
...@@ -28,7 +28,8 @@ Creates a **MessageParcel** object. This method is a static method. ...@@ -28,7 +28,8 @@ Creates a **MessageParcel** object. This method is a static method.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| MessageParcel | **MessageParcel** object created.| | MessageParcel | **MessageParcel** object created.|
...@@ -65,12 +66,14 @@ writeRemoteObject(object: [IRemoteObject](#iremoteobject)): boolean ...@@ -65,12 +66,14 @@ writeRemoteObject(object: [IRemoteObject](#iremoteobject)): boolean
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | [IRemoteObject](#iremoteobject) | Yes| Remote object to serialize and write to the **MessageParcel** object.| | object | [IRemoteObject](#iremoteobject) | Yes| Remote object to serialize and write to the **MessageParcel** object.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -111,7 +114,8 @@ Reads the remote object from this **MessageParcel** object. You can use this met ...@@ -111,7 +114,8 @@ Reads the remote object from this **MessageParcel** object. You can use this met
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| [IRemoteObject](#iremoteobject) | Remote object obtained.| | [IRemoteObject](#iremoteobject) | Remote object obtained.|
...@@ -148,17 +152,19 @@ Reads the remote object from this **MessageParcel** object. You can use this met ...@@ -148,17 +152,19 @@ Reads the remote object from this **MessageParcel** object. You can use this met
writeInterfaceToken(token: string): boolean writeInterfaceToken(token: string): boolean
Writes an interface token to this **MessageParcel** object. Writes an interface token to this **MessageParcel** object. The remote object can use this interface token to verify the communication.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| token | string | Yes| Interface token to write.| | token | string | Yes| Interface token to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -175,12 +181,13 @@ Writes an interface token to this **MessageParcel** object. ...@@ -175,12 +181,13 @@ Writes an interface token to this **MessageParcel** object.
readInterfaceToken(): string readInterfaceToken(): string
Reads the interface token from this **MessageParcel** object. The interface tokens are read in the order in which they are written into the **MessageParcel** object. Reads the interface token from this **MessageParcel** object. The interface token is read in the sequence in which it is written to the **MessageParcel** object. The local object can use it to verify the communication.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Interface token obtained.| | string | Interface token obtained.|
...@@ -206,7 +213,8 @@ Obtains the data size of this **MessageParcel** object. ...@@ -206,7 +213,8 @@ Obtains the data size of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Size of the **MessageParcel** object obtained, in bytes.| | number | Size of the **MessageParcel** object obtained, in bytes.|
...@@ -228,7 +236,8 @@ Obtains the capacity of this **MessageParcel** object. ...@@ -228,7 +236,8 @@ Obtains the capacity of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | **MessageParcel** capacity obtained, in bytes.| | number | **MessageParcel** capacity obtained, in bytes.|
...@@ -250,12 +259,14 @@ Sets the size of data contained in this **MessageParcel** object. ...@@ -250,12 +259,14 @@ Sets the size of data contained in this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| size | number | Yes| Data size to set, in bytes.| | size | number | Yes| Data size to set, in bytes.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -277,12 +288,14 @@ Sets the storage capacity of this **MessageParcel** object. ...@@ -277,12 +288,14 @@ Sets the storage capacity of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| size | number | Yes| Storage capacity to set, in bytes.| | size | number | Yes| Storage capacity to set, in bytes.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -304,7 +317,8 @@ Obtains the writable capacity of this **MessageParcel** object. ...@@ -304,7 +317,8 @@ Obtains the writable capacity of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | **MessageParcel** writable capacity obtained, in bytes.| | number | **MessageParcel** writable capacity obtained, in bytes.|
...@@ -330,7 +344,8 @@ Obtains the readable capacity of this **MessageParcel** object. ...@@ -330,7 +344,8 @@ Obtains the readable capacity of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | **MessageParcel** object readable capacity, in bytes.| | number | **MessageParcel** object readable capacity, in bytes.|
...@@ -356,7 +371,8 @@ Obtains the read position of this **MessageParcel** object. ...@@ -356,7 +371,8 @@ Obtains the read position of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Current read position of the **MessageParcel** object.| | number | Current read position of the **MessageParcel** object.|
...@@ -378,7 +394,8 @@ Obtains the write position of this **MessageParcel** object. ...@@ -378,7 +394,8 @@ Obtains the write position of this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Current write position of the **MessageParcel** object.| | number | Current write position of the **MessageParcel** object.|
...@@ -401,12 +418,14 @@ Moves the read pointer to the specified position. ...@@ -401,12 +418,14 @@ Moves the read pointer to the specified position.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pos | number | Yes| Position from which data is to read.| | pos | number | Yes| Position from which data is to read.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the read position changes; returns **false** otherwise.| | boolean | Returns **true** if the read position changes; returns **false** otherwise.|
...@@ -433,12 +452,14 @@ Moves the write pointer to the specified position. ...@@ -433,12 +452,14 @@ Moves the write pointer to the specified position.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| pos | number | Yes| Position from which data is to write.| | pos | number | Yes| Position from which data is to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the write position changes; returns **false** otherwise.| | boolean | Returns **true** if the write position changes; returns **false** otherwise.|
...@@ -463,12 +484,14 @@ Writes a Byte value to this **MessageParcel** object. ...@@ -463,12 +484,14 @@ Writes a Byte value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Byte value to write.| | val | number | Yes| Byte value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -490,7 +513,8 @@ Reads the Byte value from this **MessageParcel** object. ...@@ -490,7 +513,8 @@ Reads the Byte value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Byte value read.| | number | Byte value read.|
...@@ -514,12 +538,14 @@ Writes a Short int value to this **MessageParcel** object. ...@@ -514,12 +538,14 @@ Writes a Short int value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Short int value to write.| | val | number | Yes| Short int value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -541,7 +567,8 @@ Reads the Short int value from this **MessageParcel** object. ...@@ -541,7 +567,8 @@ Reads the Short int value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Short int value read.| | number | Short int value read.|
...@@ -565,12 +592,14 @@ Writes an Int value to this **MessageParcel** object. ...@@ -565,12 +592,14 @@ Writes an Int value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Int value to write.| | val | number | Yes| Int value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -592,7 +621,8 @@ Reads the Int value from this **MessageParcel** object. ...@@ -592,7 +621,8 @@ Reads the Int value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Int value read.| | number | Int value read.|
...@@ -616,12 +646,14 @@ Writes a Long int value to this **MessageParcel** object. ...@@ -616,12 +646,14 @@ Writes a Long int value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Long int value to write.| | val | number | Yes| Long int value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -643,7 +675,8 @@ Reads the Long int value from this **MessageParcel** object. ...@@ -643,7 +675,8 @@ Reads the Long int value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Long int value read.| | number | Long int value read.|
...@@ -667,12 +700,14 @@ Writes a Float value to this **MessageParcel** object. ...@@ -667,12 +700,14 @@ Writes a Float value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Float value to write.| | val | number | Yes| Float value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -694,7 +729,8 @@ Reads the Float value from this **MessageParcel** object. ...@@ -694,7 +729,8 @@ Reads the Float value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Float value read.| | number | Float value read.|
...@@ -718,12 +754,14 @@ Writes a Double value to this **MessageParcel** object. ...@@ -718,12 +754,14 @@ Writes a Double value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Double value to write.| | val | number | Yes| Double value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -745,7 +783,8 @@ Reads the Double value from this **MessageParcel** object. ...@@ -745,7 +783,8 @@ Reads the Double value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Double value read.| | number | Double value read.|
...@@ -769,12 +808,14 @@ Writes a Boolean value to this **MessageParcel** object. ...@@ -769,12 +808,14 @@ Writes a Boolean value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | boolean | Yes| Boolean value to write.| | val | boolean | Yes| Boolean value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -796,7 +837,8 @@ Reads the Boolean value from this **MessageParcel** object. ...@@ -796,7 +837,8 @@ Reads the Boolean value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Boolean value read.| | boolean | Boolean value read.|
...@@ -820,12 +862,14 @@ Writes a Char value to this **MessageParcel** object. ...@@ -820,12 +862,14 @@ Writes a Char value to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | number | Yes| Char value to write.| | val | number | Yes| Char value to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -847,7 +891,8 @@ Reads the Char value from this **MessageParcel** object. ...@@ -847,7 +891,8 @@ Reads the Char value from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Char value read.| | number | Char value read.|
...@@ -871,12 +916,14 @@ Writes a string to this **MessageParcel** object. ...@@ -871,12 +916,14 @@ Writes a string to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | string | Yes| String to write. The length of the string must be less than 40960 bytes.| | val | string | Yes| String to write. The length of the string must be less than 40960 bytes.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -898,7 +945,8 @@ Reads a string from this **MessageParcel** object. ...@@ -898,7 +945,8 @@ Reads a string from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String read.| | string | String read.|
...@@ -922,12 +970,14 @@ Writes a sequenceable object to this **MessageParcel** object. ...@@ -922,12 +970,14 @@ Writes a sequenceable object to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| val | [Sequenceable](#sequenceable) | Yes| Sequenceable object to write.| | val | [Sequenceable](#sequenceable) | Yes| Sequenceable object to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -968,12 +1018,14 @@ Reads member variables from this **MessageParcel** object. ...@@ -968,12 +1018,14 @@ Reads member variables from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | [Sequenceable](#sequenceable) | Yes| Object that reads member variables from the **MessageParcel** object.| | dataIn | [Sequenceable](#sequenceable) | Yes| Object that reads member variables from the **MessageParcel** object.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1017,12 +1069,14 @@ Writes a byte array to this **MessageParcel** object. ...@@ -1017,12 +1069,14 @@ Writes a byte array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| byteArray | number[] | Yes| Byte array to write.| | byteArray | number[] | Yes| Byte array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1045,7 +1099,8 @@ Reads a byte array from this **MessageParcel** object. ...@@ -1045,7 +1099,8 @@ Reads a byte array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| Byte array to read.| | dataIn | number[] | Yes| Byte array to read.|
...@@ -1070,7 +1125,8 @@ Reads the byte array from this **MessageParcel** object. ...@@ -1070,7 +1125,8 @@ Reads the byte array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Byte array read.| | number[] | Byte array read.|
...@@ -1095,12 +1151,14 @@ Writes a short array to this **MessageParcel** object. ...@@ -1095,12 +1151,14 @@ Writes a short array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| shortArray | number[] | Yes| Short array to write.| | shortArray | number[] | Yes| Short array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1122,7 +1180,8 @@ Reads a short array from this **MessageParcel** object. ...@@ -1122,7 +1180,8 @@ Reads a short array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| Short array to read.| | dataIn | number[] | Yes| Short array to read.|
...@@ -1146,7 +1205,8 @@ Reads the short array from this **MessageParcel** object. ...@@ -1146,7 +1205,8 @@ Reads the short array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Short array read.| | number[] | Short array read.|
...@@ -1170,12 +1230,14 @@ Writes an integer array to this **MessageParcel** object. ...@@ -1170,12 +1230,14 @@ Writes an integer array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| intArray | number[] | Yes| Integer array to write.| | intArray | number[] | Yes| Integer array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1197,7 +1259,8 @@ Reads an integer array from this **MessageParcel** object. ...@@ -1197,7 +1259,8 @@ Reads an integer array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| Integer array to read.| | dataIn | number[] | Yes| Integer array to read.|
...@@ -1221,7 +1284,8 @@ Reads the integer array from this **MessageParcel** object. ...@@ -1221,7 +1284,8 @@ Reads the integer array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Integer array read.| | number[] | Integer array read.|
...@@ -1245,12 +1309,14 @@ Writes a long array to this **MessageParcel** object. ...@@ -1245,12 +1309,14 @@ Writes a long array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| longArray | number[] | Yes| Long array to write.| | longArray | number[] | Yes| Long array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1272,7 +1338,8 @@ Reads a long array from this **MessageParcel** object. ...@@ -1272,7 +1338,8 @@ Reads a long array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| Long array to read.| | dataIn | number[] | Yes| Long array to read.|
...@@ -1296,7 +1363,8 @@ Reads the long array from this **MessageParcel** object. ...@@ -1296,7 +1363,8 @@ Reads the long array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Long array read.| | number[] | Long array read.|
...@@ -1320,12 +1388,14 @@ Writes a FloatArray to this **MessageParcel** object. ...@@ -1320,12 +1388,14 @@ Writes a FloatArray to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| floatArray | number[] | Yes| FloatArray to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| | floatArray | number[] | Yes| FloatArray to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1347,7 +1417,8 @@ Reads a FloatArray from this **MessageParcel** object. ...@@ -1347,7 +1417,8 @@ Reads a FloatArray from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| FloatArray to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| | dataIn | number[] | Yes| FloatArray to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.|
...@@ -1372,7 +1443,8 @@ Reads the FloatArray from this **MessageParcel** object. ...@@ -1372,7 +1443,8 @@ Reads the FloatArray from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | FloatArray read.| | number[] | FloatArray read.|
...@@ -1396,12 +1468,14 @@ Writes a DoubleArray to this **MessageParcel** object. ...@@ -1396,12 +1468,14 @@ Writes a DoubleArray to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| doubleArray | number[] | Yes| DoubleArray to write.| | doubleArray | number[] | Yes| DoubleArray to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1423,7 +1497,8 @@ Reads a DoubleArray from this **MessageParcel** object. ...@@ -1423,7 +1497,8 @@ Reads a DoubleArray from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| DoubleArray to read.| | dataIn | number[] | Yes| DoubleArray to read.|
...@@ -1447,7 +1522,8 @@ Reads the DoubleArray from this **MessageParcel** object. ...@@ -1447,7 +1522,8 @@ Reads the DoubleArray from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | DoubleArray read.| | number[] | DoubleArray read.|
...@@ -1471,12 +1547,14 @@ Writes a Boolean array to this **MessageParcel** object. ...@@ -1471,12 +1547,14 @@ Writes a Boolean array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| booleanArray | boolean[] | Yes| Boolean array to write.| | booleanArray | boolean[] | Yes| Boolean array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1498,7 +1576,8 @@ Reads a Boolean array from this **MessageParcel** object. ...@@ -1498,7 +1576,8 @@ Reads a Boolean array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | boolean[] | Yes| Boolean array to read.| | dataIn | boolean[] | Yes| Boolean array to read.|
...@@ -1522,7 +1601,8 @@ Reads the Boolean array from this **MessageParcel** object. ...@@ -1522,7 +1601,8 @@ Reads the Boolean array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean[] | Boolean array read.| | boolean[] | Boolean array read.|
...@@ -1545,12 +1625,14 @@ Writes a character array to this **MessageParcel** object. ...@@ -1545,12 +1625,14 @@ Writes a character array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| charArray | number[] | Yes| Character array to write.| | charArray | number[] | Yes| Character array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1572,7 +1654,8 @@ Reads a character array from this **MessageParcel** object. ...@@ -1572,7 +1654,8 @@ Reads a character array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | number[] | Yes| Character array to read.| | dataIn | number[] | Yes| Character array to read.|
...@@ -1596,7 +1679,8 @@ Reads the character array from this **MessageParcel** object. ...@@ -1596,7 +1679,8 @@ Reads the character array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Character array read.| | number[] | Character array read.|
...@@ -1620,12 +1704,14 @@ Writes a string array to this **MessageParcel** object. ...@@ -1620,12 +1704,14 @@ Writes a string array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stringArray | string[] | Yes| String array to write. The length of a single element in the array must be less than 40960 bytes.| | stringArray | string[] | Yes| String array to write. The length of a single element in the array must be less than 40960 bytes.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1647,7 +1733,8 @@ Reads a string array from this **MessageParcel** object. ...@@ -1647,7 +1733,8 @@ Reads a string array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | string[] | Yes| String array to read.| | dataIn | string[] | Yes| String array to read.|
...@@ -1671,7 +1758,8 @@ Reads the string array from this **MessageParcel** object. ...@@ -1671,7 +1758,8 @@ Reads the string array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string[] | String array read.| | string[] | String array read.|
...@@ -1793,12 +1881,14 @@ Writes a sequenceable array to this **MessageParcel** object. ...@@ -1793,12 +1881,14 @@ Writes a sequenceable array to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| sequenceableArray | Sequenceable[] | Yes| Sequenceable array to write.| | sequenceableArray | Sequenceable[] | Yes| Sequenceable array to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -1842,7 +1932,8 @@ Reads a sequenceable array from this **MessageParcel** object. ...@@ -1842,7 +1932,8 @@ Reads a sequenceable array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| sequenceableArray | Sequenceable[] | Yes| Sequenceable array to read.| | sequenceableArray | Sequenceable[] | Yes| Sequenceable array to read.|
...@@ -1888,12 +1979,14 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object. ...@@ -1888,12 +1979,14 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| objectArray | IRemoteObject[] | Yes| Array of **IRemoteObject** objects to write.| | objectArray | IRemoteObject[] | Yes| Array of **IRemoteObject** objects to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** if the operation fails or if the **IRemoteObject** array is null.| | boolean | Returns **true** if the operation is successful; returns **false** if the operation fails or if the **IRemoteObject** array is null.|
...@@ -1939,7 +2032,8 @@ Reads an **IRemoteObject** array from this **MessageParcel** object. ...@@ -1939,7 +2032,8 @@ Reads an **IRemoteObject** array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| objects | IRemoteObject[] | Yes| **IRemoteObject** array to read.| | objects | IRemoteObject[] | Yes| **IRemoteObject** array to read.|
...@@ -1986,7 +2080,8 @@ Reads the **IRemoteObject** array from this **MessageParcel** object. ...@@ -1986,7 +2080,8 @@ Reads the **IRemoteObject** array from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| IRemoteObject[] | **IRemoteObject** object array obtained.| | IRemoteObject[] | **IRemoteObject** object array obtained.|
...@@ -2034,7 +2129,8 @@ Closes a file descriptor. ...@@ -2034,7 +2129,8 @@ Closes a file descriptor.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fd | number | Yes| File descriptor to close.| | fd | number | Yes| File descriptor to close.|
...@@ -2057,12 +2153,14 @@ Duplicates a file descriptor. ...@@ -2057,12 +2153,14 @@ Duplicates a file descriptor.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fd | number | Yes| File descriptor to duplicate.| | fd | number | Yes| File descriptor to duplicate.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | New file descriptor.| | number | New file descriptor.|
...@@ -2085,7 +2183,8 @@ Checks whether this **MessageParcel** object contains a file descriptor. ...@@ -2085,7 +2183,8 @@ Checks whether this **MessageParcel** object contains a file descriptor.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the **MessageParcel** object contains a file descriptor; returns **false** otherwise.| | boolean | Returns **true** if the **MessageParcel** object contains a file descriptor; returns **false** otherwise.|
...@@ -2113,12 +2212,14 @@ Writes a file descriptor to this **MessageParcel** object. ...@@ -2113,12 +2212,14 @@ Writes a file descriptor to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fd | number | Yes| File descriptor to write.| | fd | number | Yes| File descriptor to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2143,7 +2244,8 @@ Reads the file descriptor from this **MessageParcel** object. ...@@ -2143,7 +2244,8 @@ Reads the file descriptor from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | File descriptor read.| | number | File descriptor read.|
...@@ -2169,12 +2271,14 @@ Writes an anonymous shared object to this **MessageParcel** object. ...@@ -2169,12 +2271,14 @@ Writes an anonymous shared object to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ashmem | Ashmem | Yes| Anonymous shared object to write.| | ashmem | Ashmem | Yes| Anonymous shared object to write.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2197,7 +2301,8 @@ Reads the anonymous shared object from this **MessageParcel** object. ...@@ -2197,7 +2301,8 @@ Reads the anonymous shared object from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Ashmem | Anonymous share object obtained.| | Ashmem | Anonymous share object obtained.|
...@@ -2222,7 +2327,8 @@ Obtains the maximum amount of raw data that can be held by this **MessageParcel* ...@@ -2222,7 +2327,8 @@ Obtains the maximum amount of raw data that can be held by this **MessageParcel*
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.| | number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.|
...@@ -2244,13 +2350,15 @@ Writes raw data to this **MessageParcel** object. ...@@ -2244,13 +2350,15 @@ Writes raw data to this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rawData | number[] | Yes| Raw data to write.| | rawData | number[] | Yes| Raw data to write.|
| size | number | Yes| Size of the raw data, in bytes.| | size | number | Yes| Size of the raw data, in bytes.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2273,12 +2381,14 @@ Reads raw data from this **MessageParcel** object. ...@@ -2273,12 +2381,14 @@ Reads raw data from this **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| size | number | Yes| Size of the raw data to read.| | size | number | Yes| Size of the raw data to read.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Raw data obtained, in bytes.| | number[] | Raw data obtained, in bytes.|
...@@ -2307,12 +2417,14 @@ Marshals the sequenceable object into a **MessageParcel** object. ...@@ -2307,12 +2417,14 @@ Marshals the sequenceable object into a **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataOut | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object to which the sequenceable object is to be marshaled.| | dataOut | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object to which the sequenceable object is to be marshaled.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2356,12 +2468,14 @@ Unmarshals this sequenceable object from a **MessageParcel** object. ...@@ -2356,12 +2468,14 @@ Unmarshals this sequenceable object from a **MessageParcel** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| dataIn | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object in which the sequenceable object is to be unmarshaled.| | dataIn | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object in which the sequenceable object is to be unmarshaled.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2405,12 +2519,13 @@ Provides the holder of a remote proxy object. ...@@ -2405,12 +2519,13 @@ Provides the holder of a remote proxy object.
asObject(): IRemoteObject asObject(): IRemoteObject
Obtains a proxy or remote object. This method must be implemented by its derived classes. Obtains a proxy or remote object. This API must be implemented by its derived classes.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| [IRemoteObject](#iremoteobject) | Returns the [RemoteObject](#ashmem8) if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.| | [IRemoteObject](#iremoteobject) | Returns the [RemoteObject](#ashmem8) if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.|
...@@ -2491,29 +2606,32 @@ Obtains the interface. ...@@ -2491,29 +2606,32 @@ Obtains the interface.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| descriptor | string | Yes| Interface descriptor.| | descriptor | string | Yes| Interface descriptor.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| IRemoteBroker | **IRemoteBroker** object bound to the specified interface descriptor.| | IRemoteBroker | **IRemoteBroker** object bound to the specified interface descriptor.|
### sendRequest<sup>(deprecated)</sup> ### sendRequest<sup>(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **NOTE**<br/> > **NOTE**<br/>
> This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9). > This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2521,24 +2639,26 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2521,24 +2639,26 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
### sendRequest<sup>8+(deprecated)</sup> ### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt; sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **NOTE**<br/>
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2546,7 +2666,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2546,7 +2666,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -2559,7 +2680,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2559,7 +2680,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2567,7 +2689,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2567,7 +2689,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -2580,7 +2703,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2580,7 +2703,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2598,13 +2722,15 @@ Adds a callback for receiving death notifications of the remote object. This met ...@@ -2598,13 +2722,15 @@ Adds a callback for receiving death notifications of the remote object. This met
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to add.| | recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to add.|
| flags | number | Yes| Flag of the death notification.| | flags | number | Yes| Flag of the death notification.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.|
...@@ -2618,13 +2744,15 @@ Removes the callback used to receive death notifications of the remote object. ...@@ -2618,13 +2744,15 @@ Removes the callback used to receive death notifications of the remote object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to remove.| | recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to remove.|
| flags | number | Yes| Flag of the death notification.| | flags | number | Yes| Flag of the death notification.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.| | boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.|
...@@ -2638,7 +2766,8 @@ Obtains the interface descriptor of this object. The interface descriptor is a s ...@@ -2638,7 +2766,8 @@ Obtains the interface descriptor of this object. The interface descriptor is a s
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Interface descriptor obtained.| | string | Interface descriptor obtained.|
...@@ -2652,7 +2781,8 @@ Checks whether this object is dead. ...@@ -2652,7 +2781,8 @@ Checks whether this object is dead.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the object is dead; returns **false** otherwise.| | boolean | Returns **true** if the object is dead; returns **false** otherwise.|
...@@ -2676,17 +2806,18 @@ Provides methods to implement **IRemoteObject**. ...@@ -2676,17 +2806,18 @@ Provides methods to implement **IRemoteObject**.
### sendRequest<sup>(deprecated)</sup> ### sendRequest<sup>(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **NOTE**<br/>
> This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2694,7 +2825,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2694,7 +2825,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -2741,17 +2873,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2741,17 +2873,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
### sendRequest<sup>8+(deprecated)</sup> ### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt; sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **NOTE**<br/>
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2759,7 +2892,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2759,7 +2892,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -2818,7 +2952,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2818,7 +2952,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2826,7 +2961,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2826,7 +2961,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -2885,7 +3021,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -2885,7 +3021,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -2946,12 +3083,14 @@ Obtains the **LocalInterface** object of an interface descriptor. ...@@ -2946,12 +3083,14 @@ Obtains the **LocalInterface** object of an interface descriptor.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| interface | string | Yes| Interface descriptor.| | interface | string | Yes| Interface descriptor.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.|
...@@ -2991,13 +3130,15 @@ Adds a callback for receiving the death notifications of the remote object, incl ...@@ -2991,13 +3130,15 @@ Adds a callback for receiving the death notifications of the remote object, incl
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to add.| | recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to add.|
| flags | number | Yes| Flag of the death notification. This parameter is reserved. It is set to **0**.| | flags | number | Yes| Flag of the death notification. This parameter is reserved. It is set to **0**.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.|
...@@ -3042,13 +3183,15 @@ Removes the callback used to receive death notifications of the remote object. ...@@ -3042,13 +3183,15 @@ Removes the callback used to receive death notifications of the remote object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to remove.| | recipient | [DeathRecipient](#deathrecipient) | Yes| Callback to remove.|
| flags | number | Yes| Flag of the death notification. This parameter is reserved. It is set to **0**.| | flags | number | Yes| Flag of the death notification. This parameter is reserved. It is set to **0**.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.| | boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.|
...@@ -3094,7 +3237,8 @@ Obtains the interface descriptor of this proxy object. ...@@ -3094,7 +3237,8 @@ Obtains the interface descriptor of this proxy object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Interface descriptor obtained.| | string | Interface descriptor obtained.|
...@@ -3134,7 +3278,8 @@ Checks whether the **RemoteObject** is dead. ...@@ -3134,7 +3278,8 @@ Checks whether the **RemoteObject** is dead.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.| | boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.|
...@@ -3188,7 +3333,8 @@ A constructor used to create a **MessageOption** object. ...@@ -3188,7 +3333,8 @@ A constructor used to create a **MessageOption** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| syncFlags | number | No| Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| | syncFlags | number | No| Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.|
| waitTime | number | No| Maximum wait time for an RPC call. The default value is **TF_WAIT_TIME**.| | waitTime | number | No| Maximum wait time for an RPC call. The default value is **TF_WAIT_TIME**.|
...@@ -3203,7 +3349,8 @@ Obtains the call flag, which can be synchronous or asynchronous. ...@@ -3203,7 +3349,8 @@ Obtains the call flag, which can be synchronous or asynchronous.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Call mode obtained.| | number | Call mode obtained.|
...@@ -3217,7 +3364,8 @@ Sets the call flag, which can be synchronous or asynchronous. ...@@ -3217,7 +3364,8 @@ Sets the call flag, which can be synchronous or asynchronous.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| flags | number | Yes| Call flag to set.| | flags | number | Yes| Call flag to set.|
...@@ -3231,7 +3379,8 @@ Obtains the maximum wait time for this RPC call. ...@@ -3231,7 +3379,8 @@ Obtains the maximum wait time for this RPC call.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Maximum wait time obtained.| | number | Maximum wait time obtained.|
...@@ -3245,7 +3394,8 @@ Sets the maximum wait time for this RPC call. ...@@ -3245,7 +3394,8 @@ Sets the maximum wait time for this RPC call.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| waitTime | number | Yes| Maximum wait time to set.| | waitTime | number | Yes| Maximum wait time to set.|
...@@ -3264,7 +3414,8 @@ Obtains the system capability manager. ...@@ -3264,7 +3414,8 @@ Obtains the system capability manager.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| [IRemoteObject](#iremoteobject) | System capability manager obtained.| | [IRemoteObject](#iremoteobject) | System capability manager obtained.|
...@@ -3285,7 +3436,8 @@ Obtains the PID of the caller. This method is invoked by the **RemoteObject** ob ...@@ -3285,7 +3436,8 @@ Obtains the PID of the caller. This method is invoked by the **RemoteObject** ob
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | PID of the caller.| | number | PID of the caller.|
...@@ -3311,7 +3463,8 @@ Obtains the UID of the caller. This method is invoked by the **RemoteObject** ob ...@@ -3311,7 +3463,8 @@ Obtains the UID of the caller. This method is invoked by the **RemoteObject** ob
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | UID of the caller.| | number | UID of the caller.|
...@@ -3363,7 +3516,8 @@ Obtains the ID of the device hosting the caller's process. ...@@ -3363,7 +3516,8 @@ Obtains the ID of the device hosting the caller's process.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Device ID obtained.| | string | Device ID obtained.|
...@@ -3389,7 +3543,8 @@ Obtains the local device ID. ...@@ -3389,7 +3543,8 @@ Obtains the local device ID.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Local device ID obtained.| | string | Local device ID obtained.|
...@@ -3415,7 +3570,8 @@ Checks whether the remote process is a process of the local device. ...@@ -3415,7 +3570,8 @@ Checks whether the remote process is a process of the local device.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.| | boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.|
...@@ -3441,13 +3597,15 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp ...@@ -3441,13 +3597,15 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | [IRemoteObject](#iremoteobject) | Yes| **RemoteProxy** specified. | | object | [IRemoteObject](#iremoteobject) | Yes| **RemoteProxy** specified. |
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.| | number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.|
...@@ -3488,7 +3646,8 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. ...@@ -3488,7 +3646,8 @@ Changes the UID and PID of the remote user to the UID and PID of the local user.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String containing the UID and PID of the remote user.| | string | String containing the UID and PID of the remote user.|
...@@ -3514,12 +3673,14 @@ Restores the UID and PID of the remote user. It is usually called when the UID a ...@@ -3514,12 +3673,14 @@ Restores the UID and PID of the remote user. It is usually called when the UID a
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| identity | string | Yes| String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| | identity | string | Yes| String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -3556,24 +3717,26 @@ A constructor used to create a **RemoteObject** object. ...@@ -3556,24 +3717,26 @@ A constructor used to create a **RemoteObject** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| descriptor | string | Yes| Interface descriptor.| | descriptor | string | Yes| Interface descriptor.|
### sendRequest<sup>(deprecated)</sup> ### sendRequest<sup>(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **NOTE**<br/>
> This API is deprecated since API version 8. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -3581,7 +3744,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3581,7 +3744,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -3630,17 +3794,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3630,17 +3794,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
### sendRequest<sup>8+(deprecated)</sup> ### sendRequest<sup>8+(deprecated)</sup>
> **NOTE**<br/>
> This API is deprecated since API Version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt; sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **NOTE**<br/>
> This API is deprecated since API version 9. You are advised to use [sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2).
Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -3648,7 +3813,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3648,7 +3813,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -3709,7 +3875,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3709,7 +3875,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -3717,7 +3884,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3717,7 +3884,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.| | options | [MessageOption](#messageoption) | Yes| Request sending mode, which can be synchronous (default) or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;SendRequestResult&gt; | Promise used to return the **sendRequestResult** object.|
...@@ -3777,7 +3945,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3777,7 +3945,8 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| 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.| | code | number | Yes| 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.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object holding the data to send.|
...@@ -3831,16 +4000,21 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -3831,16 +4000,21 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
``` ```
### onRemoteRequest ### onRemoteRequest<sup>8+(deprecated)</sup>
onRemoteRequest(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean onRemoteRequest(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean
> **NOTE**<br/>
> This API is deprecated since API version 9. You are advised to use [onRemoteRequestEx<sup>9+</sup>](#onremoterequestex9).
Provides a response to **sendRequestAsync()**. The server processes the request and returns a response in this function. Provides a response to **sendRequestAsync()**. The server processes the request and returns a response in this function.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| code | number | Yes| Service request code sent by the remote end.| | code | number | Yes| Service request code sent by the remote end.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object that holds the parameters called by the client.| | data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object that holds the parameters called by the client.|
...@@ -3848,14 +4022,15 @@ Provides a response to **sendRequestAsync()**. The server processes the request ...@@ -3848,14 +4022,15 @@ Provides a response to **sendRequestAsync()**. The server processes the request
| option | [MessageOption](#messageoption) | Yes| Whether the operation is synchronous or asynchronous.| | option | [MessageOption](#messageoption) | Yes| Whether the operation is synchronous or asynchronous.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
``` ```ets
class MyDeathRecipient { class MyDeathRecipient {
onRemoteDied() { onRemoteDied() {
console.log("server died"); console.log("server died");
...@@ -3886,8 +4061,190 @@ Provides a response to **sendRequestAsync()**. The server processes the request ...@@ -3886,8 +4061,190 @@ Provides a response to **sendRequestAsync()**. The server processes the request
} }
} }
``` ```
### onRemoteRequestEx<sup>9+</sup>
onRemoteRequestEx(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean | Promise <boolean>
> **NOTE**<br/>
>- You are advised to overload **onRemoteRequestEx** preferentially, which implements synchronous and asynchronous message processing.
>- If both **onRemoteRequest** and **onRemoteRequestEx** are overloaded, only **onRemoteRequestEx** takes effect.
Provides a response to **sendRequestAsync()**. The server processes the request synchronously or asynchronously and returns the result in this API.
**System capability**: SystemCapability.Communication.IPC.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| code | number | Yes| Service request code sent by the remote end.|
| data | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object that holds the parameters called by the client.|
| reply | [MessageParcel](#messageparcel) | Yes| **MessageParcel** object carrying the result.|
| option | [MessageOption](#messageoption) | Yes| Whether the operation is synchronous or asynchronous.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteRequestEx**. If the operation is successful, **true** is returned. Otherwise, **false** is returned.|
| Promise <boolean> | Returns a promise object if the request is processed asynchronously in **onRemoteRequestEx**.|
**Example**: Overload **onRemoteRequestEx** to process a request synchronously.
```ets
class MyDeathRecipient {
onRemoteDied() {
console.log("server died");
}
}
class TestRemoteObject extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
isObjectDead(): boolean {
return false;
}
onRemoteRequestEx(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: sync onRemoteRequestEx is called");
return true;
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
}
}
```
**Example**: Overload **onRemoteRequestEx** to process a request asynchronously.
```ets
class MyDeathRecipient {
onRemoteDied() {
console.log("server died");
}
}
class TestRemoteObject extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
isObjectDead(): boolean {
return false;
}
async onRemoteRequestEx(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: async onRemoteRequestEx is called");
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
await new Promise((resolve) => {
setTimeout(resolve, 100);
})
return true;
}
}
```
**Example**: Overload **onRemoteRequestEx** and **onRemoteRequest** to process requests synchronously.
```ets
class MyDeathRecipient {
onRemoteDied() {
console.log("server died");
}
}
class TestRemoteObject extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
isObjectDead(): boolean {
return false;
}
onRemoteRequest(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: sync onRemoteRequestEx is called");
return true;
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
}
// Only onRemoteRequestEx is executed when onRemoteRequestEx and onRemoteRequest are called.
onRemoteRequestEx(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: async onRemoteRequestEx is called");
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
return true;
}
}
```
**Example**: Overload **onRemoteRequestEx** and **onRemoteRequest** to process requests asynchronously.
```ets
class MyDeathRecipient {
onRemoteDied() {
console.log("server died");
}
}
class TestRemoteObject extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean {
return true;
}
isObjectDead(): boolean {
return false;
}
onRemoteRequest(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: sync onRemoteRequestEx is called");
return true;
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
}
// Only onRemoteRequestEx is executed when onRemoteRequestEx and onRemoteRequest are called.
async onRemoteRequestEx(code, data, reply, option) {
if (code === 1) {
console.log("RpcServer: async onRemoteRequestEx is called");
} else {
console.log("RpcServer: unknown code: " + code);
return false;
}
await new Promise((resolve) => {
setTimeout(resolve, 100);
})
return true;
}
}
```
### getCallingUid ### getCallingUid
getCallingUid(): number getCallingUid(): number
...@@ -3897,7 +4254,8 @@ Obtains the UID of the remote process. ...@@ -3897,7 +4254,8 @@ Obtains the UID of the remote process.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | UID of the remote process obtained.| | number | UID of the remote process obtained.|
...@@ -3938,7 +4296,8 @@ Obtains the PID of the remote process. ...@@ -3938,7 +4296,8 @@ Obtains the PID of the remote process.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | PID of the remote process obtained.| | number | PID of the remote process obtained.|
...@@ -3979,12 +4338,14 @@ Checks whether the remote object corresponding to the specified interface descri ...@@ -3979,12 +4338,14 @@ Checks whether the remote object corresponding to the specified interface descri
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| descriptor | string | Yes| Interface descriptor.| | descriptor | string | Yes| Interface descriptor.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.| | IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.|
...@@ -4025,7 +4386,8 @@ Obtains the interface descriptor. ...@@ -4025,7 +4386,8 @@ Obtains the interface descriptor.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Interface descriptor obtained.| | string | Interface descriptor obtained.|
...@@ -4067,7 +4429,8 @@ Binds an interface descriptor to an **IRemoteBroker** object. ...@@ -4067,7 +4429,8 @@ Binds an interface descriptor to an **IRemoteBroker** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| localInterface | IRemoteBroker | Yes| **IRemoteBroker** object.| | localInterface | IRemoteBroker | Yes| **IRemoteBroker** object.|
| descriptor | string | Yes| Interface descriptor.| | descriptor | string | Yes| Interface descriptor.|
...@@ -4128,13 +4491,15 @@ Creates an **Ashmem** object with the specified name and size. ...@@ -4128,13 +4491,15 @@ Creates an **Ashmem** object with the specified name and size.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the **Ashmem** object to create.| | name | string | Yes| Name of the **Ashmem** object to create.|
| size | number | Yes| Size (in bytes) of the **Ashmem** object to create.| | size | number | Yes| Size (in bytes) of the **Ashmem** object to create.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.|
...@@ -4157,12 +4522,14 @@ Creates an **Ashmem** object by copying the file descriptor (FD) of an existing ...@@ -4157,12 +4522,14 @@ Creates an **Ashmem** object by copying the file descriptor (FD) of an existing
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ashmem | Ashmem | Yes| Existing **Ashmem** object.| | ashmem | Ashmem | Yes| Existing **Ashmem** object.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| Ashmem | **Ashmem** object created.| | Ashmem | **Ashmem** object created.|
...@@ -4218,7 +4585,8 @@ Obtains the memory size of this **Ashmem** object. ...@@ -4218,7 +4585,8 @@ Obtains the memory size of this **Ashmem** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number | **Ashmem** size obtained.| | number | **Ashmem** size obtained.|
...@@ -4240,12 +4608,14 @@ Creates the shared file mapping on the virtual address space of this process. Th ...@@ -4240,12 +4608,14 @@ Creates the shared file mapping on the virtual address space of this process. Th
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| mapType | number | Yes| Protection level of the memory region to which the shared file is mapped.| | mapType | number | Yes| Protection level of the memory region to which the shared file is mapped.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -4267,7 +4637,8 @@ Maps the shared file to the readable and writable virtual address space of the p ...@@ -4267,7 +4637,8 @@ Maps the shared file to the readable and writable virtual address space of the p
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -4289,7 +4660,8 @@ Maps the shared file to the read-only virtual address space of the process. ...@@ -4289,7 +4660,8 @@ Maps the shared file to the read-only virtual address space of the process.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -4311,12 +4683,14 @@ Sets the protection level of the memory region to which the shared file is mappe ...@@ -4311,12 +4683,14 @@ Sets the protection level of the memory region to which the shared file is mappe
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| protectionType | number | Yes| Protection type to set.| | protectionType | number | Yes| Protection type to set.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
...@@ -4338,14 +4712,16 @@ Writes data to the shared file associated with this **Ashmem** object. ...@@ -4338,14 +4712,16 @@ Writes data to the shared file associated with this **Ashmem** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| buf | number[] | Yes| Data to write.| | buf | number[] | Yes| Data to write.|
| size | number | Yes| Size of the data to write.| | size | number | Yes| Size of the data to write.|
| offset | number | Yes| Start position of the data to write in the memory region associated with this **Ashmem** object.| | offset | number | Yes| Start position of the data to write in the memory region associated with this **Ashmem** object.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** is the data is written successfully; returns **false** otherwise.| | boolean | Returns **true** is the data is written successfully; returns **false** otherwise.|
...@@ -4370,13 +4746,15 @@ Reads data from the shared file associated with this **Ashmem** object. ...@@ -4370,13 +4746,15 @@ Reads data from the shared file associated with this **Ashmem** object.
**System capability**: SystemCapability.Communication.IPC.Core **System capability**: SystemCapability.Communication.IPC.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| size | number | Yes| Size of the data to read.| | size | number | Yes| Size of the data to read.|
| offset | number | Yes| Start position of the data to read in the memory region associated with this **Ashmem** object.| | offset | number | Yes| Start position of the data to read in the memory region associated with this **Ashmem** object.|
**Return value** **Return value**
| Type| Description|
| Type| Description|
| -------- | -------- | | -------- | -------- |
| number[] | Data read.| | number[] | Data read.|
......
...@@ -18,26 +18,26 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -18,26 +18,26 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- **Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------- | | ------ | ------ | ---- | ---------------------------- |
| path | string | Yes | File path of the file system.| | path | string | Yes | File path of the file system.|
- Return value **Return value**
| Type | Description | | Type | Description |
| --------------------- | -------------- | | --------------------- | -------------- |
| Promise&lt;number&gt; | Promise used to return the number of free bytes obtained.| | Promise&lt;number&gt; | Promise used to return the number of free bytes obtained.|
- Example **Example**
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getFreeBytes(path).then(function (number){ statfs.getFreeBytes(path).then(function (number) {
console.info("getFreeBytes promise successfully:"+ number); console.info("getFreeBytes promise successfully:" + number);
}).catch(function(err){ }).catch(function (err) {
console.info("getFreeBytes failed with error:"+ err); console.info("getFreeBytes failed with error:" + err);
}); });
``` ```
...@@ -49,21 +49,21 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -49,21 +49,21 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- **Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------- | | -------- | --------------------------- | ---- | ---------------------------- |
| path | string | Yes | File path of the file system.| | path | string | Yes | File path of the file system.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of free bytes obtained.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of free bytes obtained.|
- Example **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext(); let context = featureAbility.getContext();
context.getFilesDir().then(function (path) { context.getFilesDir().then(function (path) {
statfs.getFreeBytes(path, function(err, number){ statfs.getFreeBytes(path, function (err, number) {
console.info("Got free bytes successfully:"+ number); console.info("getFreeBytes callback successfully:" + number);
}); });
}); });
``` ```
...@@ -76,26 +76,26 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -76,26 +76,26 @@ Obtains the total number of bytes of the specified file system in asynchronous m
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- **Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ---------------------------- | | ---- | ------ | ---- | ---------------------------- |
| path | string | Yes | File path of the file system.| | path | string | Yes | File path of the file system.|
- Return value **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------ | | --------------------- | ------------ |
| Promise&lt;number&gt; | Promise used to return the total number of bytes obtained.| | Promise&lt;number&gt; | Promise used to return the total number of bytes obtained.|
- Example **Example**
```js ```js
let path = "/dev"; let path = "/dev";
statfs.getTotalBytes(path).then(function (number){ statfs.getTotalBytes(path).then(function (number) {
console.info("getTotalBytes promise successfully:"+ number); console.info("getTotalBytes promise successfully:" + number);
}).catch(function(err){ }).catch(function (err) {
console.info("getTotalBytes failed with error:"+ err); console.info("getTotalBytes failed with error:" + err);
}); });
``` ```
...@@ -107,21 +107,21 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -107,21 +107,21 @@ Obtains the total number of bytes of the specified file system in asynchronous m
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- **Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------- | | -------- | --------------------------- | ---- | ---------------------------- |
| path | string | Yes | File path of the file system.| | path | string | Yes | File path of the file system.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the total number of bytes obtained. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the total number of bytes obtained. |
- Example **Example**
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext(); let context = featureAbility.getContext();
context.getFilesDir().then(function (path) { context.getFilesDir().then(function (path) {
statfs.getTotalBytes(path, function(err, number){ statfs.getTotalBytes(path, function(err, number) {
console.info("Got total bytes successfully:"+ number); console.info("getTotalBytes callback successfully:" + number);
}); });
}); });
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册