diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 54cea921d80648b17fe5384e4ea9e57336d32fc1..874518b0e5ca7692fd902f26bcf49b07719eefc5 100644 --- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -504,8 +504,8 @@ For details about the error codes, see [Application Access Control Error Codes]( | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID in list is all invalid, or the permissionName in list is all invalid. | -| 12100004 | The API is not used together with "on()". | +| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. | +| 12100004 | The interface is not used together with "on". | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -532,7 +532,9 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<Gran Verifies whether a permission is granted to an application. This API uses a promise to return the result. -> **NOTE**
You are advised to use [checkAccessToken](#checkaccesstoken9). +> **NOTE** +> +> You are advised to use [checkAccessToken](#checkaccesstoken9). **System capability**: SystemCapability.Security.AccessToken @@ -619,7 +621,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | context | Context | Yes| Ability context of the application that requests the permissions. | -| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | +| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| **Return value** @@ -659,7 +661,9 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStat Verifies whether a permission is granted to an application. This API uses a promise to return the result. -> NOTE
This API is deprecated since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9). +> **NOTE** +> +> This API is no longer maintained since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9). **System capability**: SystemCapability.Security.AccessToken diff --git a/en/application-dev/reference/apis/js-apis-data-relationalStore.md b/en/application-dev/reference/apis/js-apis-data-relationalStore.md index 1b9948db2d3decf6b7d21d17cb74b53450ae3865..e49fa27eb58c01d5ccfaa905159c9124f7812687 100644 --- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md +++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md @@ -8,7 +8,7 @@ The **relationalStore** module provides the following functions: - [RdbStore](#rdbstore): provides APIs for managing data in an RDB store. - [Resultset](#resultset): provides APIs for accessing the result set obtained from the RDB store. -> **NOTE**
+> **NOTE** > > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -30,7 +30,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | | callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. | @@ -108,7 +108,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set | Name | Type | Mandatory| Description | | ------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | **Return value** @@ -188,7 +188,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | name | string | Yes | Name of the RDB store to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | @@ -249,7 +249,7 @@ Deletes an RDB store. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | name | string | Yes | Name of the RDB store to delete. | **Return value** @@ -2612,9 +2612,9 @@ Synchronizes data between devices. This API uses a promise to return the result. let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.inDevices(['12345678abcde']); let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates); -promise.then((resultSet) =>{ +promise.then((result) =>{ console.info(`Sync done.`); - for (let i = 0; i < resultSet.length; i++) { + for (let i = 0; i < result.length; i++) { console.info(`device= ${result[i][0]}, status= ${result[i][1]}`); } }).catch((err) => { @@ -2693,10 +2693,12 @@ Provides APIs to access the result set obtained by querying the RDB store. A res Obtain the **resultSet** object first. ```js +let resultSet = null; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("AGE", 18); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promise.then((resultSet) => { +promise.then((result) => { + resultSet = result; console.info(`resultSet columnNames: ${resultSet.columnNames}`); console.info(`resultSet columnCount: ${resultSet.columnCount}`); }); @@ -2867,7 +2869,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - resultSet.(5); + resultSet.goToRow(5); resultSet.close(); }).catch((err) => { console.error(`query failed, err: ${err}`); diff --git a/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md index 44ed633f182665681e3dbb844c38406113bf9ff7..4e19154377bb2b91e8f47af1b92a126f5c429cbd 100644 --- a/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md +++ b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md @@ -86,8 +86,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes | ID| Error Message | | ------- | ---------------------------------------------------------------------------- | -| 9200001 | The application is not an administrator application of the device. | -| 9200002 | The administrator application does not have permission to manage the device.| +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md index 306d752c6de0ec32a36b5bc024d8b88b016bcb3d..44296a0c8391d0b8005277b3e363571f01892900 100644 --- a/en/application-dev/reference/apis/js-apis-file-fs.md +++ b/en/application-dev/reference/apis/js-apis-file-fs.md @@ -16,7 +16,7 @@ import fs from '@ohos.file.fs'; ## Guidelines -Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the file or directory in the application sandbox as follows: +Before using the APIs provided by this module to perform operations on files or folders, obtain the path of the file or directory in the application sandbox as follows: **Stage Model** @@ -60,14 +60,14 @@ Obtains detailed file information. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the file information obtained.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** ```js - let filePath = pathDir + "test.txt"; + let filePath = pathDir + "/test.txt"; fs.stat(filePath).then((stat) => { console.info("get file info succeed, the size of file is " + stat.size); }).catch((err) => { @@ -119,9 +119,9 @@ Obtains detailed file information synchronously. **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -146,9 +146,9 @@ Checks whether a file exists. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<boolean> | Promise used to return a Boolean value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<boolean> | Promise used to return a Boolean value.| **Example** @@ -233,15 +233,15 @@ Closes a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -266,10 +266,10 @@ Closes a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| **Example** @@ -295,9 +295,9 @@ Synchronously closes a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| **Example** @@ -317,23 +317,23 @@ Copies a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file of the same name.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file of the same name.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath).then(() => { console.info("copy file succeed"); }).catch((err) => { @@ -351,18 +351,18 @@ Copies a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath, (err) => { if (err) { console.info("copy file failed with error message: " + err.message + ", error code: " + err.code); @@ -383,17 +383,17 @@ Synchronously copies a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFileSync(srcPath, dstPath); ``` @@ -414,14 +414,14 @@ Creates a directory. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath).then(() => { console.info("Directory created"); }).catch((err) => { @@ -448,7 +448,7 @@ Creates a directory. This API uses an asynchronous callback to return the result **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath, (err) => { if (err) { console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); @@ -476,7 +476,7 @@ Synchronously creates a directory. **Example** ```js - let dirPath = path + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdirSync(dirPath); ``` @@ -498,9 +498,9 @@ Opens a file. This API uses a promise to return the result. File uniform resourc **Return value** -| Type | Description | -| --------------------- | ----------- | -| Promise<[File](#file)> | Promise used to return the file object.| + | Type | Description | + | --------------------- | ----------- | + | Promise<[File](#file)> | Promise used to return the file object.| **Example** @@ -559,9 +559,9 @@ Synchronously opens a file. File URIs are supported. **Return value** -| Type | Description | -| ------ | ----------- | -| [File](#file) | File object opened.| + | Type | Description | + | ------ | ----------- | + | [File](#file) | File object opened.| **Example** @@ -590,9 +590,9 @@ Reads data from a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<number> | Promise used to return the data read.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<number> | Promise used to return the data read.| **Example** @@ -602,7 +602,7 @@ Reads data from a file. This API uses a promise to return the result. let buf = new ArrayBuffer(4096); fs.read(file.fd, buf).then((readLen) => { console.info("Read file data successfully"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); }).catch((err) => { console.info("read file data failed with error message: " + err.message + ", error code: " + err.code); @@ -619,12 +619,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | -| options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | + | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. | **Example** @@ -637,7 +637,7 @@ Reads data from a file. This API uses an asynchronous callback to return the res console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("Read file data successfully"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); } }); @@ -654,17 +654,17 @@ Synchronously reads data from a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | -| options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | + | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data read.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -693,14 +693,14 @@ Deletes a directory. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath).then(() => { console.info("Directory deleted"); }).catch((err) => { @@ -727,7 +727,7 @@ Deletes a directory. This API uses an asynchronous callback to return the result **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath, (err) => { if (err) { console.info("rmdir failed with error message: " + err.message + ", error code: " + err.code); @@ -755,7 +755,7 @@ Synchronously deletes a directory. **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdirSync(dirPath); ``` @@ -776,9 +776,9 @@ Deletes a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -853,17 +853,17 @@ Writes data into a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| --------------------- | -------- | -| Promise<number> | Promise used to return the length of the data written.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -889,12 +889,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -922,17 +922,17 @@ Synchronously writes data into a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data written in the file.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -961,9 +961,9 @@ Truncates a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1050,9 +1050,9 @@ Reads the text content of a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| --------------------- | ---------- | -| Promise<string> | Promise used to return the content read.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the content read.| **Example** @@ -1113,9 +1113,9 @@ Synchronously reads the text of a file. **Return value** -| Type | Description | -| ------ | -------------------- | -| string | Promise used to return the content of the file read.| + | Type | Description | + | ------ | -------------------- | + | string | Promise used to return the content of the file read.| **Example** @@ -1141,9 +1141,9 @@ Obtains information about a symbolic link. This API uses a promise to return the **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.| **Example** @@ -1201,9 +1201,9 @@ Obtains information about a symbolic link synchronously. **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -1216,7 +1216,7 @@ Obtains information about a symbolic link synchronously. rename(oldPath: string, newPath: string): Promise<void> -Renames a file or directory. This API uses a promise to return the result. +Renames a file or folder. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1229,15 +1229,15 @@ Renames a file or directory. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile).then(() => { console.info("File renamed"); }).catch((err) => { @@ -1249,7 +1249,7 @@ Renames a file or directory. This API uses a promise to return the result. rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void -Renames a file or directory. This API uses an asynchronous callback to return the result. +Renames a file or folder. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1265,7 +1265,7 @@ Renames a file or directory. This API uses an asynchronous callback to return th ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile, (err) => { if (err) { console.info("rename failed with error message: " + err.message + ", error code: " + err.code); @@ -1279,7 +1279,7 @@ Renames a file or directory. This API uses an asynchronous callback to return th renameSync(oldPath: string, newPath: string): void -Renames a file or directory synchronously. +Renames a file or folder synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1294,7 +1294,7 @@ Renames a file or directory synchronously. ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.renameSync(srcFile, dstFile); ``` @@ -1309,15 +1309,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1342,10 +1342,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | --------------- | -| fd | number | Yes | FD of the file. | -| Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | --------------- | + | fd | number | Yes | FD of the file. | + | Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** @@ -1373,9 +1373,9 @@ Flushes data of a file to disk synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Example** @@ -1397,15 +1397,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1431,10 +1431,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------------- | ---- | ----------------- | -| fd | number | Yes | FD of the file. | -| callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------------- | ---- | ----------------- | + | fd | number | Yes | FD of the file. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** @@ -1461,9 +1461,9 @@ Synchronizes data in a file synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Example** @@ -1492,15 +1492,15 @@ Creates a symbolic link based on a file path. This API uses a promise to return **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile).then(() => { console.info("Symbolic link created"); }).catch((err) => { @@ -1528,7 +1528,7 @@ Creates a symbolic link based on a file path. This API uses an asynchronous call ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile, (err) => { if (err) { console.info("symlink failed with error message: " + err.message + ", error code: " + err.code); @@ -1557,7 +1557,7 @@ Synchronously creates a symbolic link based on a file path. ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlinkSync(srcFile, dstFile); ``` @@ -1568,30 +1568,30 @@ listFile(path: string, options?: { filter?: Filter; }): Promise; -Lists all files in a directory. This API uses a promise to return the result.
This API supports recursive listing of all files (including files in subdirectories) and file filtering. +Lists all files in a folder. This API uses a promise to return the result.
This API supports recursive listing of all files (including files in subfolders) and file filtering. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| -| options | Object | No | File filtering options.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | path | string | Yes | Path of the folder in the application sandbox.| + | options | Object | No | File filtering options.| **options parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| -| listNum | number | No | Number of file names to list. The default value **0** means to list all files.| -| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.| + | listNum | number | No | Number of file names to list. The default value **0** means to list all files.| + | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| **Return value** -| Type | Description | -| --------------------- | ---------- | -| Promise<string[]> | Promise used to return the files names listed.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string[]> | Promise used to return the files names listed.| **Example** @@ -1608,7 +1608,7 @@ Lists all files in a directory. This API uses a promise to return the result.
{ console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("fileName: %s", filenames[i]); } }).catch((err) => { @@ -1623,23 +1623,23 @@ listFile(path: string, options?: { filter?: Filter; }, callback: AsyncCallback): void; -Lists all files in a directory. This API uses an asynchronous callback to return the result.
This API supports recursive listing of all files (including files in subdirectories) and file filtering. +Lists all files in a folder. This API uses an asynchronous callback to return the result.
This API supports recursive listing of all files (including files in subfolders) and file filtering. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| -| options | Object | No | File filtering options.| -| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. | + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | path | string | Yes | Path of the folder in the application sandbox.| + | options | Object | No | File filtering options.| + | callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. | **options parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| -| listNum | number | No | Number of file names to list. The default value **0** means to list all files.| -| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.| + | listNum | number | No | Number of file names to list. The default value **0** means to list all files.| + | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| **Example** @@ -1659,7 +1659,7 @@ Lists all files in a directory. This API uses an asynchronous callback to return console.info("list file failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } } @@ -1674,28 +1674,28 @@ listFileSync(path: string, options?: { filter?: Filter; }): string[]; -Lists all files in a directory synchronously. This API supports recursive listing of all files (including files in subdirectories) and file filtering. +Lists all files in a folder synchronously. This API supports recursive listing of all files (including files in subfolders) and file filtering. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| -| options | Object | No | File filtering options.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | path | string | Yes | Path of the folder in the application sandbox.| + | options | Object | No | File filtering options.| **options parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| -| listNum | number | No | Number of file names to list. The default value **0** means to list all files.| -| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.| + | listNum | number | No | Number of file names to list. The default value **0** means to list all files.| + | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| **Return value** -| Type | Description | -| --------------------- | ---------- | -| string[] | File names listed.| + | Type | Description | + | --------------------- | ---------- | + | string[] | File names listed.| **Example** @@ -1712,13 +1712,13 @@ Lists all files in a directory synchronously. This API supports recursive listin }; let filenames = fs.listFileSync(pathDir, options); console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } ``` ## fs.moveFile -moveFile(src: string, dest: string, mode?: number): Promise; +moveFile(src: string, dest: string, mode?: number): Promise\; Moves a file. This API uses a promise to return the result. @@ -1726,15 +1726,17 @@ Moves a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Path of the file to move in the application sandbox.| + | dest | string | Yes | Destination path of the file in the application sandbox.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0).then(() => { console.info("move file succeed"); }).catch((err) => { @@ -1744,7 +1746,7 @@ Moves a file. This API uses a promise to return the result. ## fs.moveFile -moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback): void; +moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback\): void; Moves a file. This API uses an asynchronous callback to return the result. @@ -1752,16 +1754,18 @@ Moves a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. | + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Path of the file to move in the application sandbox.| + | dest | string | Yes | Destination path of the file in the application sandbox.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. | **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0, (err) => { if (err) { console.info("move file failed with error message: " + err.message + ", error code: " + err.code); @@ -1781,15 +1785,17 @@ Moves a file synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Path of the file to move in the application sandbox.| + | dest | string | Yes | Destination path of the file in the application sandbox.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFileSync(srcPath, destPath, 0); console.info("move file succeed"); ``` @@ -1804,15 +1810,15 @@ Creates a temporary directory. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** -| Type | Description | -| --------------------- | ---------- | -| Promise<string> | Promise used to return the unique directory generated.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the unique directory generated.| **Example** @@ -1835,10 +1841,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------- | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| -| callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | --------------------------- | ---- | --------------------------- | + | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. | **Example** @@ -1862,21 +1868,21 @@ Synchronously creates a temporary directory. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| **Return value** -| Type | Description | -| ------ | ---------- | -| string | Unique path generated.| + | Type | Description | + | ------ | ---------- | + | string | Unique path generated.| **Example** ```js let res = fs.mkdtempSync(pathDir + "/XXXXXX"); - ``` + ``` ## fs.createStream @@ -1895,9 +1901,9 @@ Opens a file stream based on the file path. This API uses a promise to return th **Return value** -| Type | Description | -| --------------------------------- | --------- | -| Promise<[Stream](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -1957,9 +1963,9 @@ Synchronously opens a stream based on the file path. **Return value** -| Type | Description | -| ------------------ | --------- | -| [Stream](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -1979,16 +1985,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** -| Type | Description | -| --------------------------------- | --------- | -| Promise<[Stream](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2014,11 +2020,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| -| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| + | callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** @@ -2045,16 +2051,16 @@ Synchronously opens a stream based on the file descriptor. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | mode | string | Yes | - **r**: Open a file for reading. The file must exist.
- **r+**: Open a file for both reading and writing. The file must exist.
- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.
- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.
- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).
- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).| **Return value** -| Type | Description | -| ------------------ | --------- | -| [Stream](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -2077,17 +2083,17 @@ Creates a **Watcher** object to observe file or directory changes. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| path | string | Yes | Path of the file or directory to observe in the application sandbox. | -| events | number | Yes | Events to observe. Multiple events can be separated|by a bitwise OR operator (|).
- **0x1: IN_ACCESS**: A file is accessed.
- **0x2: IN_MODIFY**: The file content is modified.
- **0x4: IN_ATTRIB**: Metadata is changed.
- **0x8: IN_CLOSE_WRITE**: The file opened for writing is closed.
- **0x10: IN_CLOSE_NOWRITE**: The file or directory not opened for writing is closed.
- **0x20: IN_OPEN**: A file or directory is opened.
- **0x40: IN_MOVED_FROM**: A file in the observed directory is moved.
- **0x80: IN_MOVED_TO**: A file is moved to the observed directory.
- **0x100: IN_CREATE**: A file or directory is created in the observed directory.
- **0x200: IN_DELETE**: A file or directory is deleted form the observed directory.
- **0x400: IN_DELETE_SELF**: The observed directory is deleted. After the directory is deleted, the listening stops.
- **0x800: IN_MOVE_SELF**: The observed file or directory is moved. After the file or directory is moved, the listening continues.
- **0xfff: IN_ALL_EVENTS**: All events.| -| listener | WatchEventListener | Yes | Callback invoked when an observed event occurs. The callback will be invoked each time an observed event occurs. | + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | path | string | Yes | Path of the file or directory to observe in the application sandbox. | + | events | number | Yes | Events to observe. Multiple events can be separated by a bitwise OR operator (|).
- **0x1: IN_ACCESS**: A file is accessed.
- **0x2: IN_MODIFY**: The file content is modified.
- **0x4: IN_ATTRIB**: Metadata is changed.
- **0x8: IN_CLOSE_WRITE**: The file opened for writing is closed.
- **0x10: IN_CLOSE_NOWRITE**: The file or directory not opened for writing is closed.
- **0x20: IN_OPEN**: A file or directory is opened.
- **0x40: IN_MOVED_FROM**: A file in the observed directory is moved.
- **0x80: IN_MOVED_TO**: A file is moved to the observed directory.
- **0x100: IN_CREATE**: A file or directory is created in the observed directory.
- **0x200: IN_DELETE**: A file or directory is deleted form the observed directory.
- **0x400: IN_DELETE_SELF**: The observed directory is deleted. After the directory is deleted, the listening stops.
- **0x800: IN_MOVE_SELF**: The observed file or directory is moved. After the file or directory is moved, the listening continues.
- **0xfff: IN_ALL_EVENTS**: All events.| + | listener | WatchEventListener | Yes | Callback invoked when an observed event occurs. The callback will be invoked each time an observed event occurs. | **Return value** -| Type | Description | -| ------------------ | --------- | -| [Watcher](#watcher10) | **Watcher** object created.| + | Type | Description | + | ------------------ | --------- | + | [Watcher](#watcher10) | **Watcher** object created.| **Example** @@ -2119,10 +2125,10 @@ Called when an observed event occurs. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| event | WatchEvent | Yes | Event for the callback to invoke. | - + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | event | WatchEvent | Yes | Event for the callback to invoke. | + ## WatchEvent10+ Defines the event to observe. @@ -2146,7 +2152,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c ### Attributes | Name | Type | Readable | Writable | Description | -| ------ | ------ | ---- | ---- | ---------------------------------------- | +| ------ | ------ | ---- | ---- | ---------------------------------------- | | ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| | | mode | number | Yes | No | File permissions. The meaning of each bit is as follows:
- **0o400**: The owner has the read permission on a regular file or a directory entry.
- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.
- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.
- **0o040**: The user group has the read permission on a regular file or a directory entry.
- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.
- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.
- **0o004**: Other users have the permission to read a regular file or read a directory entry.
- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.
- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| | uid | number | Yes | No | ID of the file owner.| @@ -2167,9 +2173,9 @@ Checks whether this file is a block special file. A block special file supports **Return value** -| Type | Description | -| ------- | ---------------- | -| boolean | Whether the file is a block special file.| + | Type | Description | + | ------- | ---------------- | + | boolean | Whether the file is a block special file.| **Example** @@ -2188,9 +2194,9 @@ Checks whether this file is a character special file. A character special file s **Return value** -| Type | Description | -| ------- | ----------------- | -| boolean | Whether the file is a character special file.| + | Type | Description | + | ------- | ----------------- | + | boolean | Whether the file is a character special file.| **Example** @@ -2210,9 +2216,9 @@ Checks whether this file is a directory. **Return value** -| Type | Description | -| ------- | ------------- | -| boolean | Whether the file is a directory.| + | Type | Description | + | ------- | ------------- | + | boolean | Whether the file is a directory.| **Example** @@ -2232,9 +2238,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int **Return value** -| Type | Description | -| ------- | --------------------- | -| boolean | Whether the file is a FIFO.| + | Type | Description | + | ------- | --------------------- | + | boolean | Whether the file is a FIFO.| **Example** @@ -2254,9 +2260,9 @@ Checks whether this file is a regular file. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a regular file.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a regular file.| **Example** @@ -2276,9 +2282,9 @@ Checks whether this file is a socket. **Return value** -| Type | Description | -| ------- | -------------- | -| boolean | Whether the file is a socket.| + | Type | Description | + | ------- | -------------- | + | boolean | Whether the file is a socket.| **Example** @@ -2298,9 +2304,9 @@ Checks whether this file is a symbolic link. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a symbolic link.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a symbolic link.| **Example** @@ -2324,9 +2330,9 @@ Closes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream close result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream close result.| **Example** @@ -2351,9 +2357,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| **Example** @@ -2395,9 +2401,9 @@ Flushes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream flushing result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream flushing result.| **Example** @@ -2422,9 +2428,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | -------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | -------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| **Example** @@ -2466,16 +2472,16 @@ Writes data into the stream. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to write. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to write. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| --------------------- | -------- | -| Promise<number> | Promise used to return the length of the data written.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -2500,11 +2506,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------- | ---- | ------------------------------------------------------------ | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -2532,16 +2538,16 @@ Synchronously writes data into the stream. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data written in the file.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -2561,16 +2567,16 @@ Reads data from the stream. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. By default, data is read from the current position.| + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. By default, data is read from the current position.| **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<number> | Promise used to return the data read.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<number> | Promise used to return the data read.| **Example** @@ -2580,7 +2586,7 @@ Reads data from the stream. This API uses a promise to return the result. let buf = new ArrayBuffer(4096); ss.read(buf, {offset: 5, length: 5}).then((readLen) => { console.info("Read data successfully"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); }).catch((err) => { console.info("read data failed with error message: " + err.message + ", error code: " + err.code); }); @@ -2597,11 +2603,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.| -| callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.| + | callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. | **Example** @@ -2614,7 +2620,7 @@ Reads data from the stream. This API uses an asynchronous callback to return the console.info("read stream failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("Read data successfully"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); } }); ``` @@ -2629,16 +2635,16 @@ Synchronously reads data from the stream. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data read.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -2662,7 +2668,7 @@ Represents a **File** object opened by **open()**. ### lock -lock(exclusive?: boolean): Promise; +lock(exclusive?: boolean): Promise\; Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result. @@ -2670,15 +2676,15 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<void> | Promise that returns no value.| **Example** @@ -2693,7 +2699,7 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A ### lock -lock(exclusive?: boolean, callback: AsyncCallback): void; +lock(exclusive?: boolean, callback: AsyncCallback\): void; Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result. @@ -2701,10 +2707,10 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. | **Example** @@ -2729,9 +2735,9 @@ Applies an exclusive lock or a shared lock on this file in non-blocking mode. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | **Example** @@ -2760,13 +2766,13 @@ Unlocks this file synchronously. ## Watcher10+ -Provides APIs for file or directory listening. Before using the APIs of **Watcher** , call **createWatcher()** to create a **Watcher** object. +Provides APIs for observing the changes of files or folders. Before using the APIs of **Watcher** , call **createWatcher()** to create a **Watcher** object. ### start10+ start(): void -Starts file or directory listening. +Starts listening. **System API**: This is a system API. @@ -2785,7 +2791,7 @@ Starts file or directory listening. stop(): void -Stops file or directory listening. +Stops listening. **System API**: This is a system API. diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index 94a4257dfcc0af730c79334f61473c4811cb3bfd..692e834592970b9a7bdf92dc84a291c0fd2135a1 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -326,9 +326,9 @@ Checks whether the specified constraint is enabled for an OS account. This API u | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId or constraint. | +| 12300003 | the account indicated by localId dose not exist. | **Example**: Check whether OS account 100 is forbidden to use Wi-Fi. @@ -376,9 +376,9 @@ Checks whether the specified constraint is enabled for an OS account. This API u | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId or constraint. | +| 12300003 | the account indicated by localId dose not exist. | **Example**: Check whether OS account 100 is forbidden to use Wi-Fi. @@ -475,23 +475,19 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void Checks whether this OS account has been verified. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - **System capability**: SystemCapability.Account.OsAccount **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------- | -| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means the OS account has been verified; the value **false** means the opposite.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. If true is returned, the current account has been verified. If false is returned, the current account has not been verified.| **Error codes** | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | **Example** @@ -531,9 +527,9 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId. | +| 12300003 | the account indicated by localId dose not exist. | **Example** @@ -555,7 +551,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca ### checkOsAccountVerified9+ -checkOsAccountVerified(localId?: number): Promise<boolean> +checkOsAccountVerified(localId: number): Promise<boolean> Checks whether an OS account has been verified. This API uses a promise to return the result. @@ -567,7 +563,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur | Name | Type | Mandatory| Description | | ------- | ------ | ---- | --------------------------------------------------------------- | -| localId | number | No | ID of the target OS account. If this parameter is not specified, this API checks whether the current OS account has been verified.| +| localId | number | Yes | ID of the target OS account. If this parameter is not specified, this API checks whether the current OS account has been verified.| **Return value** @@ -579,9 +575,9 @@ Checks whether an OS account has been verified. This API uses a promise to retur | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId. | +| 12300003 | the account indicated by localId dose not exist. | **Example** @@ -991,7 +987,7 @@ Obtains the ID of the OS account to which the current process belongs. This API | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | +| 12300001 | system service exception. | **Example** @@ -1028,7 +1024,7 @@ Obtains the ID of the OS account to which the current process belongs. This API | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | +| 12300001 | system service exception. | **Example** @@ -1064,8 +1060,8 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou | ID| Error Message | | -------- | --------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid uid. | +| 12300001 | system service exception. | +| 12300002 | invalid uid. | **Example**: Obtain the ID of the OS account whose process UID is **12345678**. @@ -1108,8 +1104,8 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid uid. | +| 12300001 | system service exception. | +| 12300002 | invalid uid. | **Example**: Obtain the ID of the OS account whose process UID is **12345678**. @@ -1148,8 +1144,8 @@ Obtains the OS account ID based on the domain account information. This API uses | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid domainInfo. | +| 12300001 | system service exception. | +| 12300002 | invalid domainInfo. | **Example** @@ -1195,8 +1191,8 @@ Obtains the OS account ID based on the domain account information. This API uses | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid domainInfo. | +| 12300001 | system service exception. | +| 12300002 | invalid domainInfo. | **Example** @@ -1474,7 +1470,7 @@ Obtains information about all activated OS accounts. This API uses an asynchrono | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | +| 12300001 | system service exception. | **Example** @@ -1511,7 +1507,7 @@ Obtains information about all activated OS accounts. This API uses a promise to | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | +| 12300001 | system service exception. | **Example** @@ -2233,9 +2229,9 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid serialNumber. | +| 12300003 | the account indicated by serialNumber dose not exist. | **Example**: Obtain the ID of the OS account whose SN is 12345. @@ -2276,9 +2272,9 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid serialNumber. | +| 12300003 | the account indicated by serialNumber dose not exist. | **Example**: Obtain the ID of the OS account whose SN is 12345. @@ -2315,9 +2311,9 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId. | +| 12300003 | the account indicated by localId dose not exist. | **Example**: Obtain the SN of the OS account 100. @@ -2358,9 +2354,9 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise | ID| Error Message | | -------- | ------------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid localId. | +| 12300003 | the account indicated by localId dose not exist. | **Example**: Obtain the SN of the OS account 100. @@ -2483,8 +2479,8 @@ Obtains the bundle ID based on the UID. This API uses an asynchronous callback t | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid uid. | +| 12300001 | system service exception. | +| 12300002 | invalid uid. | **Example** @@ -2526,8 +2522,8 @@ Obtains the bundle ID based on the UID. This API uses a promise to return the re | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid uid. | +| 12300001 | system service exception. | +| 12300002 | invalid uid. | **Example** @@ -2644,9 +2640,9 @@ Obtains the constraint source information of an OS account. This API uses an asy | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid name or constraint. | +| 12300003 | the account indicated by localId dose not exist. | **Example** @@ -2691,9 +2687,9 @@ Obtains the constraint source information of an OS account. This API uses a prom | ID| Error Message | | -------- | ------------- | -| 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | -| 12300003 | Account not found. | +| 12300001 | system service exception. | +| 12300002 | invalid name or constraint. | +| 12300003 | the account indicated by localId dose not exist. | **Example** @@ -4433,15 +4429,26 @@ Authenticates a domain account. **Example** ```js let plugin = { - auth: (domainInfo, credential, callback) => { + auth: (domainAccountInfo, credential, callback) => { // mock authentication - callback.onResult(0, {}); - } + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} } account_osAccount.DomainAccountManager.registerPlugin(plugin); let userAuth = new account_osAccount.UserAuth(); let challenge = new Uint8Array([0]); - let authType = account_osAccount.AuthType.PIN; + let authType = account_osAccount.AuthType.DOMAIN; let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; try { userAuth.auth(challenge, authType, authTrustLevel, { @@ -4455,6 +4462,235 @@ Authenticates a domain account. } ``` +### authWithPopup10+ + +authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void + +Authenticates a domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### authWithToken10+ + +authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void + +Authenticates a domain account by the authorization token. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| token | Uint8Array | Yes | Authorization token generated when the PIN or biometric authentication is successful.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAccountInfo10+ + +getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<DomainAccountInfo>): void + +Obtains information about a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domain | string | Yes | Domain to which the account belongs.| +| accountName | string | Yes | Name of the account.| +| callback | AsyncCallback<[DomainAccountInfo](#domainaccountinfo8)> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => { + // mock getting account information + // notify result + callback({ + code: 0 + }, { + domain: domain, + accountName: accountName, + accountId: "xxxx" + }) + }, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAuthStatusInfo10+ + +getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void + +Obtains the authentication status of a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<[AuthStatusInfo](#authstatusinfo10)> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => { + callback({ + code: 0 + }, { + remainTimes: 5, + freezingTime: 0 + }) + }, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### bindAccount10+ + +bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void + +Binds a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => { + // mock unbinding operation + // notify binding result + callback({code: 0}) + }, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### unbindAccount10+ + +unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void + +Unbinds a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => { + // mock unbinding operation + // notify unbinding result + callback({code: 0}) + } + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + ## DomainAccountManager 9+ Provides APIs for domain account management. @@ -4480,15 +4716,18 @@ Registers a domain plug-in. | ID| Error Message | | -------- | --------------------------- | -| 12300201 | The domain plugin has been registered. | +| 12300201 | the domain plugin has been registered. | **Example** ```js let plugin = { - auth: (domainInfo, credential, callback) => { - // mock authentication - callback.onResult(0, {}); - } + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} } try { account_osAccount.DomainAccountManager.registerPlugin(plugin); @@ -4520,6 +4759,252 @@ Unregisters this domain plug-in. } ``` +### auth10+ + +auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void + +Authenticates a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| credential | Uint8Array | Yes | Credentials of the domain account.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | system service exception. | +| 12300002 | invalid domainAccountInfo or credential. | +| 12300003 | domain account does not exist. | +| 12300013 | network exception. | +| 12300101 | authentication failed. | +| 12300109 | authentication is canceled. | +| 12300110 | authentication is locked. | +| 12300111 | authentication timeout. | +| 12300112 | authentication service is busy. | +| 12300113 | authentication service does not exist. | +| 12300114 | authentication service exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + let credential = new Uint8Array([0]) + try { + account_osAccount.DomainAccountManager.auth(domainAccountInfo, credential, { + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }); + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(callback: IUserAuthCallback): void + +Authenticates this domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | system service exception. | +| 12300003 | no domain account is bound. | +| 12300013 | network exception. | +| 12300101 | authentication failed. | +| 12300109 | authentication is canceled. | +| 12300110 | authentication is locked. | +| 12300111 | authentication timeout. | +| 12300112 | authentication service is busy. | +| 12300113 | authentication service does not exist. | +| 12300114 | authentication service exception. | + +**Example** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup({ + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(localId: number, callback: IUserAuthCallback): void + +Authenticates a domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| localId | number | Yes | Local ID of the OS account bound to the domain account.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | system service exception. | +| 12300002 | invalid localId. | +| 12300003 | no domain account is bound. | +| 12300013 | network exception. | +| 12300101 | authentication failed. | +| 12300109 | authentication is canceled. | +| 12300110 | authentication is locked. | +| 12300111 | authentication timeout. | +| 12300112 | authentication service is busy. | +| 12300113 | authentication service does not exist. | +| 12300114 | authentication service exception. | + +**Example** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup(100, { + onResult: (resultCode, authResult) => { + console.log('authWithPopup resultCode = ' + resultCode); + console.log('authWithPopup authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('authWithPopup exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void + +Checks whether a domain account exists. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | system service exception. | +| 12300002 | invalid domainAccountInfo. | +| 12300013 | network exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => { + if (err) { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + } else { + console.log("hasAccount result: " + result); + } + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean> + +Checks whether a domain account exists. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| + +**Return value** + +| Type | Description | +| :------------------------ | ----------------------- | +| Promise<boolean> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | system service exception. | +| 12300002 | invalid domainAccountInfo. | +| 12300013 | network exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => { + console.log("hasAccount result: " + result); + }).catch((err) => { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + ## UserIdentityManager8+ Provides APIs for user identity management (IDM). @@ -5254,7 +5739,7 @@ Defines the executor property. | ------------ | ---------------------------------------- | ----- | ----------------- | | result | number | Yes | Result. | | authSubType | [AuthSubType](#authsubtype8) | Yes | Authentication credential subtype.| -| remainTimes | number | No | Remaining time. | +| remainTimes | number | No | Number of remaining authentication times. | | freezingTime | number | No | Freezing time. | ## AuthResult8+ @@ -5268,7 +5753,7 @@ Defines the authentication result information. | Name | Type | Mandatory | Description | | ------------ | ----------- | ----- | ----------------- | | token | Uint8Array | No | Authentication token. | -| remainTimes | number | No | Remaining time. | +| remainTimes | number | No | Number of remaining authentication times. | | freezingTime | number | No | Freezing time. | ## CredentialInfo8+ @@ -5351,7 +5836,7 @@ Enumerates the authentication credential types. | PIN | 1 | PIN authentication.| | FACE | 2 | Facial authentication.| | FINGERPRINT10+ | 4 | Fingerprint authentication.| -| DOMAIN10+ | 1024 | Domain authentication.| +| DOMAIN9+ | 1024 | Domain authentication.| ## AuthSubType8+ @@ -5368,7 +5853,7 @@ Enumerates the authentication credential subtypes. | PIN_MIXED | 10002 | Custom mixed credentials.| | FACE_2D | 20000 | 2D face credential. | | FACE_3D | 20001 | 3D face credential. | -| DOMAIN_MIXED10+ | 10240001 | Mixed domain authentication credentials. | +| DOMAIN_MIXED9+ | 10240001 | Mixed domain authentication credentials. | ## AuthTrustLevel8+ @@ -5490,6 +5975,7 @@ Defines the domain account information. | ----------- | ------ | ---- | ---------- | | domain | string | Yes | Domain name. | | accountName | string | Yes | Domain account name.| +| accountId10+ | string | No | Domain account ID.| ## Constraints @@ -5586,3 +6072,16 @@ Enumerates the constraint sources. | CONSTRAINT_TYPE_BASE | 1 | Constraint from system settings. | | CONSTRAINT_TYPE_DEVICE_OWNER | 2 | Constraint from the device owners' settings. | | CONSTRAINT_TYPE_PROFILE_OWNER | 3 | Constraint from the profile owners' settings. | + +## AuthStatusInfo10+ + +Presents the authentication status information. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +| Name | Type | Mandatory| Description | +| ----------- | ------ | ---- | ---------- | +| remainTimes | number | Yes | Number of remaining authentication times. | +| freezingTime | number | Yes | Freezing time.| diff --git a/en/application-dev/reference/apis/js-apis-rpc.md b/en/application-dev/reference/apis/js-apis-rpc.md index c806d10c6963add3231f68a1a790d68c31d4b3a5..3b12ce374b7adcebeb45323fe3eda08efb0c9245 100644 --- a/en/application-dev/reference/apis/js-apis-rpc.md +++ b/en/application-dev/reference/apis/js-apis-rpc.md @@ -20,22 +20,22 @@ The APIs of this module return exceptions since API version 9. The following tab **System capability**: SystemCapability.Communication.IPC.Core -| Name | Value | Description | -| ------------------------------------- | ------- | --------------------------------------------- | -| CHECK_PARAM_ERROR | 401 | Parameter check failed. | -| OS_MMAP_ERROR | 1900001 | Failed to call mmap. | -| OS_IOCTL_ERROR | 1900002 | Failed to call **ioctl** with the shared memory file descriptor.| -| WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. | -| READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. | -| ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. | -| ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | This operation is allowed only on the remote object. | -| COMMUNICATION_ERROR | 1900007 | Failed to communicate with the remote object over IPC. | -| PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | Invalid proxy or remote object. | -| WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | Failed to write data to MessageSequence. | -| READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | Failed to read data from MessageSequence. | -| PARCEL_MEMORY_ALLOC_ERROR | 1900011 | Failed to allocate memory during serialization. | -| CALL_JS_METHOD_ERROR | 1900012 | Failed to invoke the JS callback. | -| OS_DUP_ERROR | 1900013 | Failed to call dup. | + | Name | Value | Description | + | ------------------------------------- | ------- | --------------------------------------------- | + | CHECK_PARAM_ERROR | 401 | Parameter check failed. | + | OS_MMAP_ERROR | 1900001 | Failed to call mmap. | + | OS_IOCTL_ERROR | 1900002 | Failed to call **ioctl** with the shared memory file descriptor.| + | WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. | + | READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. | + | ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. | + | ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | This operation is allowed only on the remote object. | + | COMMUNICATION_ERROR | 1900007 | Failed to communicate with the remote object over IPC. | + | PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | Invalid proxy or remote object. | + | WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | Failed to write data to MessageSequence. | + | READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | Failed to read data from MessageSequence. | + | PARCEL_MEMORY_ALLOC_ERROR | 1900011 | Failed to allocate memory during serialization. | + | CALL_JS_METHOD_ERROR | 1900012 | Failed to invoke the JS callback. | + | OS_DUP_ERROR | 1900013 | Failed to call dup. | ## MessageSequence9+ @@ -54,9 +54,9 @@ During RPC or IPC, the sender can use the **write()** method provided by **Messa **Return value** -| Type | Description | -| --------------- | ------------------------------- | -| MessageSequence | **MessageSequence** object created.| + | Type | Description | + | --------------- | ------------------------------- | + | MessageSequence | **MessageSequence** object created.| **Example** @@ -90,18 +90,18 @@ Serializes a remote object and writes it to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ----------------------------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageSequence** object.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ----------------------------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageSequence** object.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900008 | proxy or remote object is invalid | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900008 | proxy or remote object is invalid | + | 1900009 | write data to message sequence failed | **Example** @@ -131,18 +131,18 @@ Reads the remote object from **MessageSequence**. You can use this API to deseri **Return value** -| Type | Description | -| ------------------------------- | ------------------ | -| [IRemoteObject](#iremoteobject) | Remote object obtained.| + | Type | Description | + | ------------------------------- | ------------------ | + | [IRemoteObject](#iremoteobject) | Remote object obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | + | 1900010 | read data from message sequence failed | **Example** @@ -173,17 +173,17 @@ Writes an interface token to this **MessageSequence** object. The remote object **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| token | string | Yes | Interface token to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | token | string | Yes | Interface token to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -207,17 +207,17 @@ Reads the interface token from this **MessageSequence** object. The interface to **Return value** -| Type | Description | -| ------ | ------------------------ | -| string | Interface token obtained.| + | Type | Description | + | ------ | ------------------------ | + | string | Interface token obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ----- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ----- | + | 1900010 | read data from message sequence failed | **Example** @@ -246,9 +246,9 @@ Obtains the data size of this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ----------------------------------------------- | -| number | Size of the **MessageSequence** object obtained, in bytes.| + | Type | Description | + | ------ | ----------------------------------------------- | + | number | Size of the **MessageSequence** object obtained, in bytes.| **Example** @@ -268,9 +268,9 @@ Obtains the capacity of this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ----- | -| number | **MessageSequence** capacity obtained, in bytes.| + | Type | Description| + | ------ | ----- | + | number | **MessageSequence** capacity obtained, in bytes.| **Example** @@ -290,9 +290,9 @@ Sets the size of the data contained in this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ------ | ------ | ---- | ------ | -| size | number | Yes | Data size to set, in bytes.| + | Name| Type | Mandatory| Description| + | ------ | ------ | ---- | ------ | + | size | number | Yes | Data size to set, in bytes.| **Example** @@ -317,17 +317,17 @@ Sets the storage capacity of this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | --------------------------------------------- | -| size | number | Yes | Storage capacity of the **MessageSequence** object to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | --------------------------------------------- | + | size | number | Yes | Storage capacity of the **MessageSequence** object to set, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900011 | parcel memory alloc failed | + | ID| Error Message| + | -------- | ------ | + | 1900011 | parcel memory alloc failed | **Example** @@ -352,9 +352,9 @@ Obtains the writable capacity (in bytes) of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------ | -| number | Writable capacity of the **MessageSequence** instance, in bytes.| + | Type| Description| + | ------ | ------ | + | number | Writable capacity of the **MessageSequence** instance, in bytes.| **Example** @@ -378,9 +378,9 @@ Obtains the readable capacity of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------- | -| number | Readable capacity of the **MessageSequence** instance, in bytes.| + | Type| Description| + | ------ | ------- | + | number | Readable capacity of the **MessageSequence** instance, in bytes.| **Example** @@ -404,9 +404,9 @@ Obtains the read position of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------ | -| number | Read position obtained.| + | Type| Description| + | ------ | ------ | + | number | Read position obtained.| **Example** @@ -426,9 +426,9 @@ Obtains the write position of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ----- | -| number | Write position obtained.| + | Type| Description| + | ------ | ----- | + | number | Write position obtained.| **Example** @@ -449,9 +449,9 @@ Moves the read pointer to the specified position. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | ------ | ---- | ------- | -| pos | number | Yes | Position from which data is to read.| + | Name| Type| Mandatory| Description| + | ------ | ------ | ---- | ------- | + | pos | number | Yes | Position from which data is to read.| **Example** @@ -481,9 +481,9 @@ Moves the write pointer to the specified position. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | ------ | ---- | ----- | -| pos | number | Yes | Position from which data is to write.| + | Name| Type| Mandatory| Description| + | ------ | ------ | ---- | ----- | + | pos | number | Yes | Position from which data is to write.| **Example** @@ -511,17 +511,17 @@ Writes a byte value to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ----- | ------ | ---- | ----- | -| val | number | Yes| Byte value to write.| + | Name| Type | Mandatory| Description| + | ----- | ------ | ---- | ----- | + | val | number | Yes| Byte value to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -545,17 +545,17 @@ Reads the byte value from this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ----- | -| number | Byte value read.| + | Type | Description| + | ------ | ----- | + | number | Byte value read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -586,17 +586,17 @@ Writes a short integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ------ | ------ | --- | --- | -| val | number | Yes| Short integer to write.| + | Name| Type | Mandatory| Description| + | ------ | ------ | --- | --- | + | val | number | Yes| Short integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -620,17 +620,17 @@ Reads the short integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Short integer read.| + | Type | Description | + | ------ | -------------- | + | number | Short integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -661,17 +661,17 @@ Writes an integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Integer to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -695,17 +695,17 @@ Reads the integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Integer read.| + | Type | Description | + | ------ | ------------ | + | number | Integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -736,17 +736,17 @@ Writes a long integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Long integer to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Long integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -770,17 +770,17 @@ Reads the long integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Long integer read.| + | Type | Description | + | ------ | -------------- | + | number | Long integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -811,17 +811,17 @@ Writes a floating-point number to this **MessageSequence** object. **Parameters** -| Name| Type| Mandatory| Description| -| ----- | ---- | ---- | ----- | -| val | number | Yes| Floating-point number to write.| + | Name| Type| Mandatory| Description| + | ----- | ---- | ---- | ----- | + | val | number | Yes| Floating-point number to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -845,17 +845,17 @@ Reads the floating-pointer number from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Floating-point number read.| + | Type | Description | + | ------ | ------------ | + | number | Floating-point number read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -886,17 +886,17 @@ Writes a double-precision floating-point number to this **MessageSequence** obje **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| val | number | Yes | Double-precision floating-point number to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------- | + | val | number | Yes | Double-precision floating-point number to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -920,17 +920,17 @@ Reads the double-precision floating-point number from this **MessageSequence** o **Return value** -| Type | Description | -| ------ | ------------------ | -| number | Double-precision floating-point number read.| + | Type | Description | + | ------ | ------------------ | + | number | Double-precision floating-point number read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -961,17 +961,17 @@ Writes a Boolean value to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------- | ---- | ---------------- | -| val | boolean | Yes | Boolean value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------- | ---- | ---------------- | + | val | boolean | Yes | Boolean value to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -995,17 +995,17 @@ Reads the Boolean value from this **MessageSequence** object. **Return value** -| Type | Description | -| ------- | -------------------- | -| boolean | Boolean value read.| + | Type | Description | + | ------- | -------------------- | + | boolean | Boolean value read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1036,17 +1036,17 @@ Writes a character to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| val | number | Yes | Single character to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | val | number | Yes | Single character to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1070,17 +1070,17 @@ Reads the character from this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ---- | -| number | Character read.| + | Type | Description| + | ------ | ---- | + | number | Character read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------ | --------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------ | --------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1111,17 +1111,17 @@ Writes a string to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------------- | -| val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------------- | + | val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1145,17 +1145,17 @@ Reads the string from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| string | String read.| + | Type | Description | + | ------ | -------------- | + | string | String read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1186,17 +1186,17 @@ Writes a **Parcelable** object to this **MessageSequence** object. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | --------- | ---- | ------ | -| val | Parcelable | Yes | **Parcelable** object to write.| + | Name| Type| Mandatory| Description| + | ------ | --------- | ---- | ------ | + | val | Parcelable | Yes | **Parcelable** object to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1239,18 +1239,18 @@ Reads a **Parcelable** object from this **MessageSequence** object to the specif **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------- | ---- | ----------------------------------------- | -| dataIn | Parcelable | Yes | **Parcelable** object to read.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------- | ---- | ----------------------------------------- | + | dataIn | Parcelable | Yes | **Parcelable** object to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | -| 1900012 | call js callback function failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **Example** @@ -1295,17 +1295,17 @@ Writes a byte array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ------------------ | -| byteArray | number[] | Yes | Byte array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ------------------ | + | byteArray | number[] | Yes | Byte array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1330,17 +1330,17 @@ Reads a byte array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Byte array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Byte array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1372,17 +1372,17 @@ Reads the byte array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Byte array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Byte array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1414,17 +1414,17 @@ Writes a short array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | -------------------- | -| shortArray | number[] | Yes | Short array to write.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | -------------------- | + | shortArray | number[] | Yes | Short array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | ----- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ----- | ----- | + | 1900009 | write data to message sequence failed | **Example** @@ -1448,17 +1448,17 @@ Reads a short array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Short array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Short array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------ | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------ | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1489,17 +1489,17 @@ Reads the short array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Short array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Short array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1530,17 +1530,17 @@ Writes an integer array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------- | ---- | ------------------ | -| intArray | number[] | Yes | Integer array to write.| + | Name | Type | Mandatory| Description | + | -------- | -------- | ---- | ------------------ | + | intArray | number[] | Yes | Integer array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | --------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ----- | --------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1564,17 +1564,17 @@ Reads an integer array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Integer array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Integer array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1605,17 +1605,17 @@ Reads the integer array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Integer array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Integer array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ----- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1646,17 +1646,17 @@ Writes a long array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | -------------------- | -| longArray | number[] | Yes | Long array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | -------------------- | + | longArray | number[] | Yes | Long array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ----- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ----- | + | 1900009 | write data to message sequence failed | **Example** @@ -1680,17 +1680,17 @@ Reads a long array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Long array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Long array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900010 | read data from message sequence failed | **Example** @@ -1721,17 +1721,17 @@ Reads the long array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Long array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Long array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1762,17 +1762,17 @@ Writes a floating-point array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | -| floatArray | number[] | Yes | Floating-point array 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.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | + | floatArray | number[] | Yes | Floating-point array 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.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1796,17 +1796,17 @@ Reads a floating-point array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | -| dataIn | number[] | Yes | Floating-point array 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.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | + | dataIn | number[] | Yes | Floating-point array 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.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1837,17 +1837,17 @@ Reads the floating-point array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Floating-point array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Floating-point array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1878,17 +1878,17 @@ Writes a double-precision floating-point array to this **MessageSequence** objec **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | -------- | ---- | ------------------------ | -| doubleArray | number[] | Yes | Double-precision floating-point array to write.| + | Name | Type | Mandatory| Description | + | ----------- | -------- | ---- | ------------------------ | + | doubleArray | number[] | Yes | Double-precision floating-point array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1912,17 +1912,17 @@ Reads a double-precision floating-point array from this **MessageSequence** obje **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------------ | -| dataIn | number[] | Yes | Double-precision floating-point array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------------ | + | dataIn | number[] | Yes | Double-precision floating-point array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1953,17 +1953,17 @@ Reads the double-precision floating-point array from this **MessageSequence** ob **Return value** -| Type | Description | -| -------- | -------------------- | -| number[] | Double-precision floating-point array read.| + | Type | Description | + | -------- | -------------------- | + | number[] | Double-precision floating-point array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1994,17 +1994,17 @@ Writes a Boolean array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | --------- | ---- | ------------------ | -| booleanArray | boolean[] | Yes | Boolean array to write.| + | Name | Type | Mandatory| Description | + | ------------ | --------- | ---- | ------------------ | + | booleanArray | boolean[] | Yes | Boolean array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2028,17 +2028,17 @@ Reads a Boolean array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------- | ---- | ------------------ | -| dataIn | boolean[] | Yes | Boolean array to read.| + | Name| Type | Mandatory| Description | + | ------ | --------- | ---- | ------------------ | + | dataIn | boolean[] | Yes | Boolean array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2069,17 +2069,17 @@ Reads the Boolean array from this **MessageSequence** object. **Return value** -| Type | Description | -| --------- | -------------- | -| boolean[] | Boolean array read.| + | Type | Description | + | --------- | -------------- | + | boolean[] | Boolean array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2110,17 +2110,17 @@ Writes a character array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ---------------------- | -| charArray | number[] | Yes | Character array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ---------------------- | + | charArray | number[] | Yes | Character array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -2144,17 +2144,17 @@ Reads a character array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ---------------------- | -| dataIn | number[] | Yes | Character array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ---------------------- | + | dataIn | number[] | Yes | Character array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2185,17 +2185,17 @@ Reads the character array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ------------------ | -| number[] | Character array read.| + | Type | Description | + | -------- | ------------------ | + | number[] | Character array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2227,17 +2227,17 @@ Writes a string array to this **MessageSequence** object. **Parameters** -| 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.| + | 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.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2261,17 +2261,17 @@ Reads a string array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | string[] | Yes | String array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | string[] | Yes | String array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2302,17 +2302,17 @@ Reads the string array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| string[] | String array read.| + | Type | Description | + | -------- | ---------------- | + | string[] | String array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2345,9 +2345,9 @@ Writes information to this **MessageSequence** object indicating that no excepti For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2387,9 +2387,9 @@ Reads the exception information from this **MessageSequence** object. For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2417,7 +2417,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -2459,17 +2459,17 @@ Writes a **Parcelable** array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------ | ---- | -------------------------- | -| parcelableArray | Parcelable[] | Yes | **Parcelable** array to write.| + | Name | Type | Mandatory| Description | + | --------------- | ------------ | ---- | -------------------------- | + | parcelableArray | Parcelable[] | Yes | **Parcelable** array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2515,18 +2515,18 @@ Reads a **Parcelable** array from this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------ | ---- | -------------------------- | -| parcelableArray | Parcelable[] | Yes | **Parcelable** array to read.| + | Name | Type | Mandatory| Description | + | --------------- | ------------ | ---- | -------------------------- | + | parcelableArray | Parcelable[] | Yes | **Parcelable** array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | -| 1900012 | call js callback function failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **Example** @@ -2576,17 +2576,17 @@ Writes an array of **IRemoteObject** objects to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | --------------- | ---- | ---------------------------------------------- | -| objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| + | Name | Type | Mandatory| Description | + | ----------- | --------------- | ---- | ---------------------------------------------- | + | objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2623,17 +2623,17 @@ Reads an array of **IRemoteObject** objects from this **MessageSequence** object **Parameters** -| Name | Type | Mandatory| Description | -| ------- | --------------- | ---- | ---------------------------------------------- | -| objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| + | Name | Type | Mandatory| Description | + | ------- | --------------- | ---- | ---------------------------------------------- | + | objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2676,17 +2676,17 @@ Reads the **IRemoteObject** object array from this **MessageSequence** object. **Return value** -| Type | Description | -| --------------- | --------------------------- | -| IRemoteObject[] | **IRemoteObject** object array read.| + | Type | Description | + | --------------- | --------------------------- | + | IRemoteObject[] | **IRemoteObject** object array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2724,9 +2724,9 @@ Closes a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| fd | number | Yes | File descriptor to close.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | fd | number | Yes | File descriptor to close.| **Example** @@ -2752,23 +2752,23 @@ Duplicates a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| fd | number | Yes | File descriptor to duplicate.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | fd | number | Yes | File descriptor to duplicate.| **Return value** -| Type | Description | -| ------ | -------------------- | -| number | New file descriptor.| + | Type | Description | + | ------ | -------------------- | + | number | New file descriptor.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900013 | call os dup function failed | + | ID| Error Message| + | ------- | ------- | + | 1900013 | call os dup function failed | **Example** @@ -2794,9 +2794,9 @@ Checks whether this **MessageSequence** object contains file descriptors. **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------- | -| boolean | Returns **true** if the **MessageSequence** object contains file descriptors; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------- | + | boolean | Returns **true** if the **MessageSequence** object contains file descriptors; returns **false** otherwise.| **Example** @@ -2832,17 +2832,17 @@ Writes a file descriptor to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -2869,17 +2869,17 @@ Reads the file descriptor from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | File descriptor read.| + | Type | Description | + | ------ | ---------------- | + | number | File descriptor read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2912,17 +2912,17 @@ Writes an anonymous shared object to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| ashmem | Ashmem | Yes | Anonymous shared object to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------- | + | ashmem | Ashmem | Yes | Anonymous shared object to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900003 | write to ashmem failed | + | ID| Error Message| + | ------- | ------- | + | 1900003 | write to ashmem failed | **Example** @@ -2954,17 +2954,17 @@ Reads the anonymous shared object from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| Ashmem | Anonymous share object read.| + | Type | Description | + | ------ | ------------------ | + | Ashmem | Anonymous share object read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900004 | read from ashmem failed | + | ID| Error Message| + | ------- | -------- | + | 1900004 | read from ashmem failed | **Example** @@ -3002,9 +3002,9 @@ Obtains the maximum amount of raw data that can be held by this **MessageSequenc **Return value** -| Type | Description | -| ------ | ------------------------------------------------------------ | -| number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageSequence** object.| + | Type | Description | + | ------ | ------------------------------------------------------------ | + | number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageSequence** object.| **Example** @@ -3024,18 +3024,18 @@ Writes raw data to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | -------- | ---- | ---------------------------------- | -| rawData | number[] | Yes | Raw data to write. | -| size | number | Yes | Size of the raw data, in bytes.| + | Name | Type | Mandatory| Description | + | ------- | -------- | ---- | ---------------------------------- | + | rawData | number[] | Yes | Raw data to write. | + | size | number | Yes | Size of the raw data, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -3060,23 +3060,23 @@ Reads raw data from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| size | number | Yes | Size of the raw data to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | size | number | Yes | Size of the raw data to read.| **Return value** -| Type | Description | -| -------- | ------------------------------ | -| number[] | Raw data read, in bytes.| + | Type | Description | + | -------- | ------------------------------ | + | number[] | Raw data read, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -3116,9 +3116,9 @@ Creates a **MessageParcel** object. This method is a static method. **Return value** -| Type | Description | -| ------------- | ----------------------------- | -| MessageParcel | **MessageParcel** object created.| + | Type | Description | + | ------------- | ----------------------------- | + | MessageParcel | **MessageParcel** object created.| **Example** @@ -3152,15 +3152,15 @@ Serializes a remote object and writes it to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageParcel** object.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageParcel** object.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3199,9 +3199,9 @@ Reads the remote object from this **MessageParcel** object. You can use this met **Return value** -| Type | Description | -| ------------------------------- | ------------------ | -| [IRemoteObject](#iremoteobject) | Remote object obtained.| + | Type | Description | + | ------------------------------- | ------------------ | + | [IRemoteObject](#iremoteobject) | Remote object obtained.| **Example** @@ -3241,15 +3241,15 @@ Writes an interface token to this **MessageParcel** object. The remote object ca **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| token | string | Yes | Interface token to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | token | string | Yes | Interface token to write.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3270,9 +3270,9 @@ Reads the interface token from this **MessageParcel** object. The interface toke **Return value** -| Type | Description | -| ------ | ------------------------ | -| string | Interface token obtained.| + | Type | Description | + | ------ | ------------------------ | + | string | Interface token obtained.| **Example** @@ -3296,9 +3296,9 @@ Obtains the data size of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------- | -| number | Size of the **MessageParcel** object obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------- | + | number | Size of the **MessageParcel** object obtained, in bytes.| **Example** @@ -3318,9 +3318,9 @@ Obtains the capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------- | -| number | **MessageParcel** capacity obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------- | + | number | **MessageParcel** capacity obtained, in bytes.| **Example** @@ -3340,15 +3340,15 @@ Sets the size of data contained in this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------------- | -| size | number | Yes | Data size to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------------- | + | size | number | Yes | Data size to set, in bytes.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3368,15 +3368,15 @@ Sets the storage capacity of this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------------- | -| size | number | Yes | Storage capacity to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------------- | + | size | number | Yes | Storage capacity to set, in bytes.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3396,9 +3396,9 @@ Obtains the writable capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------------- | -| number | **MessageParcel** writable capacity obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------------- | + | number | **MessageParcel** writable capacity obtained, in bytes.| **Example** @@ -3422,9 +3422,9 @@ Obtains the readable capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------------- | -| number | **MessageParcel** object readable capacity, in bytes.| + | Type | Description | + | ------ | --------------------------------------------------- | + | number | **MessageParcel** object readable capacity, in bytes.| **Example** @@ -3448,9 +3448,9 @@ Obtains the read position of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------- | -| number | Current read position of the **MessageParcel** object.| + | Type | Description | + | ------ | --------------------------------------- | + | number | Current read position of the **MessageParcel** object.| **Example** @@ -3470,9 +3470,9 @@ Obtains the write position of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------- | -| number | Current write position of the **MessageParcel** object.| + | Type | Description | + | ------ | --------------------------------------- | + | number | Current write position of the **MessageParcel** object.| **Example** @@ -3493,15 +3493,15 @@ Moves the read pointer to the specified position. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| pos | number | Yes | Position from which data is to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | pos | number | Yes | Position from which data is to read.| **Return value** -| Type | Description | -| ------- | ------------------------------------------------- | -| boolean | Returns **true** if the read position changes; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------------- | + | boolean | Returns **true** if the read position changes; returns **false** otherwise.| **Example** @@ -3526,15 +3526,15 @@ Moves the write pointer to the specified position. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| pos | number | Yes | Position from which data is to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | pos | number | Yes | Position from which data is to write.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the write position changes; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the write position changes; returns **false** otherwise.| **Example** @@ -3557,15 +3557,15 @@ Writes a Byte value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Byte value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Byte value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3585,9 +3585,9 @@ Reads the Byte value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Byte value read.| + | Type | Description | + | ------ | ------------ | + | number | Byte value read.| **Example** @@ -3609,15 +3609,15 @@ Writes a Short int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| val | number | Yes | Short int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | val | number | Yes | Short int value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3637,9 +3637,9 @@ Reads the Short int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Short int value read.| + | Type | Description | + | ------ | -------------- | + | number | Short int value read.| **Example** @@ -3661,15 +3661,15 @@ Writes an Int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Int value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -3689,9 +3689,9 @@ Reads the Int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Int value read.| + | Type | Description | + | ------ | ------------ | + | number | Int value read.| **Example** @@ -3713,15 +3713,15 @@ Writes a Long int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Long int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Long int value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3741,9 +3741,9 @@ Reads the Long int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Long int value read.| + | Type | Description | + | ------ | -------------- | + | number | Long int value read.| **Example** @@ -3765,15 +3765,15 @@ Writes a Float value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Float value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Float value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3793,9 +3793,9 @@ Reads the Float value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Float value read.| + | Type | Description | + | ------ | ------------ | + | number | Float value read.| **Example** @@ -3817,15 +3817,15 @@ Writes a Double value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| val | number | Yes | Double value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------- | + | val | number | Yes | Double value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3845,9 +3845,9 @@ Reads the Double value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| number | Double value read.| + | Type | Description | + | ------ | ------------------ | + | number | Double value read.| **Example** @@ -3869,15 +3869,15 @@ Writes a Boolean value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------- | ---- | ---------------- | -| val | boolean | Yes | Boolean value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------- | ---- | ---------------- | + | val | boolean | Yes | Boolean value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3897,9 +3897,9 @@ Reads the Boolean value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------- | -------------------- | -| boolean | Boolean value read.| + | Type | Description | + | ------- | -------------------- | + | boolean | Boolean value read.| **Example** @@ -3921,15 +3921,15 @@ Writes a Char value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| val | number | Yes | Char value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | val | number | Yes | Char value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3949,9 +3949,9 @@ Reads the Char value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | Char value read.| + | Type | Description | + | ------ | ---------------- | + | number | Char value read.| **Example** @@ -3973,15 +3973,15 @@ Writes a string to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------------- | -| val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------------- | + | val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4001,9 +4001,9 @@ Reads the string from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| string | String read.| + | Type | Description | + | ------ | -------------- | + | string | String read.| **Example** @@ -4025,15 +4025,15 @@ Writes a sequenceable object to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ----------------------------- | ---- | -------------------- | -| val | [Sequenceable](#sequenceable) | Yes | Sequenceable object to write.| + | Name| Type | Mandatory| Description | + | ------ | ----------------------------- | ---- | -------------------- | + | val | [Sequenceable](#sequenceable) | Yes | Sequenceable object to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4072,15 +4072,15 @@ Reads member variables from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ----------------------------- | ---- | --------------------------------------- | -| dataIn | [Sequenceable](#sequenceabledeprecated) | Yes | Object that reads member variables from the **MessageParcel** object.| + | Name| Type | Mandatory| Description | + | ------ | ----------------------------- | ---- | --------------------------------------- | + | dataIn | [Sequenceable](#sequenceabledeprecated) | Yes | Object that reads member variables from the **MessageParcel** object.| **Return value** -| Type | Description | -| ------- | ------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -4122,15 +4122,15 @@ Writes a byte array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ------------------ | -| byteArray | number[] | Yes | Byte array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ------------------ | + | byteArray | number[] | Yes | Byte array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4151,9 +4151,9 @@ Reads a byte array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Byte array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Byte array to read.| **Example** @@ -4176,9 +4176,9 @@ Reads the byte array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Byte array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Byte array read.| **Example** @@ -4201,15 +4201,15 @@ Writes a short array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | -------------------- | -| shortArray | number[] | Yes | Short array to write.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | -------------------- | + | shortArray | number[] | Yes | Short array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4229,9 +4229,9 @@ Reads a short array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Short array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Short array to read.| **Example** @@ -4253,9 +4253,9 @@ Reads the short array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Short array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Short array read.| **Example** @@ -4277,15 +4277,15 @@ Writes an integer array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------- | ---- | ------------------ | -| intArray | number[] | Yes | Integer array to write.| + | Name | Type | Mandatory| Description | + | -------- | -------- | ---- | ------------------ | + | intArray | number[] | Yes | Integer array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4305,9 +4305,9 @@ Reads an integer array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Integer array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Integer array to read.| **Example** @@ -4329,9 +4329,9 @@ Reads the integer array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Integer array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Integer array read.| **Example** @@ -4353,15 +4353,15 @@ Writes a long array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | -------------------- | -| longArray | number[] | Yes | Long array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | -------------------- | + | longArray | number[] | Yes | Long array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4381,9 +4381,9 @@ Reads a long array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Long array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Long array to read.| **Example** @@ -4405,9 +4405,9 @@ Reads the long array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Long array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Long array read.| **Example** @@ -4429,15 +4429,15 @@ Writes a FloatArray to this **MessageParcel** object. **Parameters** -| Name| Type| Mandatory| Description| -| ---------- | -------- | ---- | --- | -| floatArray | number[] | Yes | Floating-point array 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.| + | Name| Type| Mandatory| Description| + | ---------- | -------- | ---- | --- | + | floatArray | number[] | Yes | Floating-point array 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** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4457,9 +4457,9 @@ Reads a FloatArray from this **MessageParcel** object. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | -------- | ---- | ------ | -| dataIn | number[] | Yes | Floating-point array 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.| + | Name| Type| Mandatory| Description| + | ------ | -------- | ---- | ------ | + | dataIn | number[] | Yes | Floating-point array 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.| **Example** @@ -4481,9 +4481,9 @@ Reads the FloatArray from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | FloatArray read.| + | Type | Description | + | -------- | -------------- | + | number[] | FloatArray read.| **Example** @@ -4505,15 +4505,15 @@ Writes a DoubleArray to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | -------- | ---- | ------------------------ | -| doubleArray | number[] | Yes | DoubleArray to write.| + | Name | Type | Mandatory| Description | + | ----------- | -------- | ---- | ------------------------ | + | doubleArray | number[] | Yes | DoubleArray to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4533,9 +4533,9 @@ Reads a DoubleArray from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------------ | -| dataIn | number[] | Yes | DoubleArray to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------------ | + | dataIn | number[] | Yes | DoubleArray to read.| **Example** @@ -4557,9 +4557,9 @@ Reads the DoubleArray from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------------- | -| number[] | DoubleArray read.| + | Type | Description | + | -------- | -------------------- | + | number[] | DoubleArray read.| **Example** @@ -4581,15 +4581,15 @@ Writes a Boolean array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | --------- | ---- | ------------------ | -| booleanArray | boolean[] | Yes | Boolean array to write.| + | Name | Type | Mandatory| Description | + | ------------ | --------- | ---- | ------------------ | + | booleanArray | boolean[] | Yes | Boolean array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4609,9 +4609,9 @@ Reads a Boolean array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------- | ---- | ------------------ | -| dataIn | boolean[] | Yes | Boolean array to read.| + | Name| Type | Mandatory| Description | + | ------ | --------- | ---- | ------------------ | + | dataIn | boolean[] | Yes | Boolean array to read.| **Example** @@ -4633,9 +4633,9 @@ Reads the Boolean array from this **MessageParcel** object. **Return value** -| Type | Description | -| --------- | -------------- | -| boolean[] | Boolean array read.| + | Type | Description | + | --------- | -------------- | + | boolean[] | Boolean array read.| **Example** @@ -4657,15 +4657,15 @@ Writes a character array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ---------------------- | -| charArray | number[] | Yes | Character array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ---------------------- | + | charArray | number[] | Yes | Character array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4685,9 +4685,9 @@ Reads a character array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ---------------------- | -| dataIn | number[] | Yes | Character array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ---------------------- | + | dataIn | number[] | Yes | Character array to read.| **Example** @@ -4709,9 +4709,9 @@ Reads the character array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ------------------ | -| number[] | Character array read.| + | Type | Description | + | -------- | ------------------ | + | number[] | Character array read.| **Example** @@ -4733,15 +4733,15 @@ Writes a string array to this **MessageParcel** object. **Parameters** -| 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.| + | 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.| **Return value** -| Type | Description| -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description| + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4761,9 +4761,9 @@ Reads a string array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | string[] | Yes | String array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | string[] | Yes | String array to read.| **Example** @@ -4785,9 +4785,9 @@ Reads the string array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| string[] | String array read.| + | Type | Description | + | -------- | ---------------- | + | string[] | String array read.| **Example** @@ -4850,7 +4850,7 @@ Reads the exception information from this **MessageParcel** object. **System capability**: SystemCapability.Communication.IPC.Core **Example** - + Obtain the service. ```ts @@ -4875,7 +4875,7 @@ Reads the exception information from this **MessageParcel** object. FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -4912,15 +4912,15 @@ Writes a sequenceable array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------------- | -------------- | ---- | -------------------------- | -| sequenceableArray | Sequenceable[] | Yes | Sequenceable array to write.| + | Name | Type | Mandatory| Description | + | ----------------- | -------------- | ---- | -------------------------- | + | sequenceableArray | Sequenceable[] | Yes | Sequenceable array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4962,9 +4962,9 @@ Reads a sequenceable array from this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------------- | -------------- | ---- | -------------------------- | -| sequenceableArray | Sequenceable[] | Yes | Sequenceable array to read.| + | Name | Type | Mandatory| Description | + | ----------------- | -------------- | ---- | -------------------------- | + | sequenceableArray | Sequenceable[] | Yes | Sequenceable array to read.| **Example** @@ -5008,15 +5008,15 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description| -| ----------- | --------------- | ---- | ----- | -| objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| + | Name | Type | Mandatory| Description| + | ----------- | --------------- | ---- | ----- | + | objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5060,9 +5060,9 @@ Reads an **IRemoteObject** array from this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description| -| ------- | --------------- | ---- | --------- | -| objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| + | Name | Type | Mandatory| Description| + | ------- | --------------- | ---- | --------- | + | objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| **Example** @@ -5107,9 +5107,9 @@ Reads the **IRemoteObject** array from this **MessageParcel** object. **Return value** -| Type| Description| -| --------------- | -------- | -| IRemoteObject[] | **IRemoteObject** object array obtained.| + | Type| Description| + | --------------- | -------- | + | IRemoteObject[] | **IRemoteObject** object array obtained.| **Example** @@ -5155,9 +5155,9 @@ Closes a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| fd | number | Yes | File descriptor to close.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | fd | number | Yes | File descriptor to close.| **Example** @@ -5178,15 +5178,15 @@ Duplicates a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| fd | number | Yes | File descriptor to duplicate.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | fd | number | Yes | File descriptor to duplicate.| **Return value** -| Type | Description | -| ------ | -------------------- | -| number | New file descriptor.| + | Type | Description | + | ------ | -------------------- | + | number | New file descriptor.| **Example** @@ -5207,9 +5207,9 @@ Checks whether this **MessageParcel** object contains file descriptors. **Return value** -| Type | Description | -| ------- | ------------------------------------------------------------------ | -| boolean |Returns **true** if the **MessageParcel** object contains file descriptors; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------------------------------ | + | boolean |Returns **true** if the **MessageParcel** object contains file descriptors; returns **false** otherwise.| **Example** @@ -5235,15 +5235,15 @@ Writes a file descriptor to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor to write.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -5266,9 +5266,9 @@ Reads the file descriptor from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | File descriptor read.| + | Type | Description | + | ------ | ---------------- | + | number | File descriptor read.| **Example** @@ -5292,15 +5292,15 @@ Writes an anonymous shared object to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------- | -| ashmem | Ashmem | Yes | Anonymous shared object to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------- | + | ashmem | Ashmem | Yes | Anonymous shared object to write.| **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5321,9 +5321,9 @@ Reads the anonymous shared object from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| Ashmem | Anonymous share object obtained.| + | Type | Description | + | ------ | ------------------ | + | Ashmem | Anonymous share object obtained.| **Example** @@ -5346,9 +5346,9 @@ Obtains the maximum amount of raw data that can be held by this **MessageParcel* **Return value** -| Type | Description | -| ------ | ---------------------------------------------------------- | -| number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.| + | Type | Description | + | ------ | ---------------------------------------------------------- | + | number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.| **Example** @@ -5368,16 +5368,16 @@ Writes raw data to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | -------- | ---- | ---------------------------------- | -| rawData | number[] | Yes | Raw data to write. | -| size | number | Yes | Size of the raw data, in bytes.| + | Name | Type | Mandatory| Description | + | ------- | -------- | ---- | ---------------------------------- | + | rawData | number[] | Yes | Raw data to write. | + | size | number | Yes | Size of the raw data, in bytes.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5398,15 +5398,15 @@ Reads raw data from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| size | number | Yes | Size of the raw data to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | size | number | Yes | Size of the raw data to read.| **Return value** -| Type | Description | -| -------- | ------------------------------ | -| number[] | Raw data obtained, in bytes.| + | Type | Description | + | -------- | ------------------------------ | + | number[] | Raw data obtained, in bytes.| **Example** @@ -5433,15 +5433,15 @@ Marshals this **Parcelable** object into a **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | --------------- | ---- | ------------------------------------------- | -| dataOut | MessageSequence | Yes | **MessageSequence** object to which the **Parcelable** object is to be marshaled.| + | Name | Type | Mandatory| Description | + | ------- | --------------- | ---- | ------------------------------------------- | + | dataOut | MessageSequence | Yes | **MessageSequence** object to which the **Parcelable** object is to be marshaled.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** ```ts @@ -5482,15 +5482,15 @@ Unmarshals this **Parcelable** object from a **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------------- | ---- | ----------------------------------------------- | -| dataIn | MessageSequence | Yes | **MessageSequence** object from which the **Parcelable** object is to be unmarshaled.| + | Name| Type | Mandatory| Description | + | ------ | --------------- | ---- | ----------------------------------------------- | + | dataIn | MessageSequence | Yes | **MessageSequence** object from which the **Parcelable** object is to be unmarshaled.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -5538,15 +5538,15 @@ Marshals the sequenceable object into a **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | ----------------------------------------- | -| dataOut | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object to which the sequenceable object is to be marshaled.| + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | ----------------------------------------- | + | dataOut | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object to which the sequenceable object is to be marshaled.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** ```ts @@ -5587,15 +5587,15 @@ Unmarshals this sequenceable object from a **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------------- | -| dataIn | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object in which the sequenceable object is to be unmarshaled.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------------- | + | dataIn | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object in which the sequenceable object is to be unmarshaled.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -5641,9 +5641,9 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl **Return value** -| Type | Description| -| ---- | ----- | -| [IRemoteObject](#iremoteobject) | Returns the **RemoteObject** if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.| + | Type | Description| + | ---- | ----- | + | [IRemoteObject](#iremoteobject) | Returns the **RemoteObject** if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.| **Example** @@ -5653,7 +5653,7 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl return this; } } - let remoteObject = new TestAbility().asObject(); + let remoteObject = new TestAbility("testObject").asObject(); ``` **Example** @@ -5681,9 +5681,9 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **asObject()** of the proxy object is called to obtain the proxy or remote object. - + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **asObject()** of the proxy object is called to obtain the proxy or remote object. + ```ts class TestProxy { remote: rpc.RemoteObject; @@ -5726,12 +5726,12 @@ Defines the response to the request. **System capability**: SystemCapability.Communication.IPC.Core -| Name | Type | Readable| Writable| Description | -| ------- | --------------- | ---- | ---- |-------------------------------------- | -| errCode | number | Yes | No | Error Code | -| code | number | Yes | No | Message code. | -| data | MessageSequence | Yes | No | **MessageSequence** object sent to the remote process.| -| reply | MessageSequence | Yes | No | **MessageSequence** object returned by the remote process. | + | Name | Type | Readable| Writable| Description | + | ------- | --------------- | ---- | ---- |-------------------------------------- | + | errCode | number | Yes | No | Error code. | + | code | number | Yes | No | Message code. | + | data | MessageSequence | Yes | No | **MessageSequence** object sent to the remote process.| + | reply | MessageSequence | Yes | No | **MessageSequence** object returned by the remote process. | ## SendRequestResult8+(deprecated) @@ -5741,12 +5741,12 @@ Defines the response to the request. **System capability**: SystemCapability.Communication.IPC.Core -| Name | Type | Readable| Writable| Description | -| ------- | ------------- | ---- | ---- | ----------------------------------- | -| errCode | number | Yes | No | Error Code | -| code | number | Yes | No | Message code. | -| data | MessageParcel | Yes | No | **MessageParcel** object sent to the remote process.| -| reply | MessageParcel | Yes | No | **MessageParcel** object returned by the remote process. | + | Name | Type | Readable| Writable| Description | + | ------- | ------------- | ---- | ---- | ----------------------------------- | + | errCode | number | Yes | No | Error code. | + | code | number | Yes | No | Message code. | + | data | MessageParcel | Yes | No | **MessageParcel** object sent to the remote process.| + | reply | MessageParcel | Yes | No | **MessageParcel** object returned by the remote process. | ## IRemoteObject @@ -5762,15 +5762,15 @@ Obtains the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| ### queryLocalInterface(deprecated) @@ -5784,15 +5784,15 @@ Queries the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| ### sendRequest(deprecated) @@ -5806,18 +5806,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| ### sendRequest8+(deprecated) @@ -5832,18 +5832,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| ### sendMessageRequest9+ @@ -5856,18 +5856,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | ----------------------------------------- | -| Promise<RequestResult> | Promise used to return the **requestResult** object.| + | Type | Description | + | ---------------------------- | ----------------------------------------- | + | Promise<RequestResult> | Promise used to return the **requestResult** object.| ### sendMessageRequest9+ @@ -5880,13 +5880,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | ### sendRequest8+(deprecated) @@ -5900,13 +5900,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | ### registerDeathRecipient9+ @@ -5918,18 +5918,18 @@ Registers a callback for receiving death notifications of the remote object. The **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### addDeathrecipient(deprecated) @@ -5943,16 +5943,16 @@ Adds a callback for receiving death notifications of the remote object. This met **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| + | flags | number | Yes | Flag of the death notification.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| ### unregisterDeathRecipient9+ @@ -5965,18 +5965,18 @@ Unregisters the callback used to receive death notifications of the remote objec **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### removeDeathRecipient(deprecated) @@ -5990,16 +5990,16 @@ Removes the callback used to receive death notifications of the remote object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| + | flags | number | Yes | Flag of the death notification.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is removed; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| ### getDescriptor9+ @@ -6011,17 +6011,17 @@ Obtains the interface descriptor (which is a string) of this object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### getInterfaceDescriptor(deprecated) @@ -6036,9 +6036,9 @@ Obtains the interface descriptor (which is a string) of this object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| ### isObjectDead @@ -6051,9 +6051,9 @@ Checks whether this object is dead. **Return value** -| Type | Description | -| ------- | ------------------------------------------- | -| boolean | Returns **true** if the object is dead; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------- | + | boolean | Returns **true** if the object is dead; returns **false** otherwise.| ## RemoteProxy @@ -6082,18 +6082,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** @@ -6120,9 +6120,9 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. - + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); @@ -6152,18 +6152,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | ----------------------------------------- | -| Promise<RequestResult> | Promise used to return the **requestResult** object.| + | Type | Description | + | ---------------------------- | ----------------------------------------- | + | Promise<RequestResult> | Promise used to return the **requestResult** object.| **Example** @@ -6190,8 +6190,8 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6230,18 +6230,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -6269,7 +6269,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6300,22 +6300,22 @@ The proxy object in the **onConnect** callback can be assigned a value only afte sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If **options** is the synchronous mode, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | **Example** - + Obtain the service. ```ts @@ -6353,7 +6353,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6381,13 +6381,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -6428,7 +6428,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6449,23 +6449,23 @@ Obtains the **LocalInterface** object of an interface token. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | ---------------------- | -| interface | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | ---------------------- | + | interface | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------ | -| IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| + | Type | Description | + | ------------- | ------------------------------------------ | + | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900006 | only remote object permitted | + | ID| Error Message| + | ------- | -------- | + | 1900006 | only remote object permitted | **Example** @@ -6493,7 +6493,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getLocalInterface()** of the proxy object is called to obtain the interface descriptor. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getLocalInterface()** of the proxy object is called to obtain the interface descriptor. ```ts try { @@ -6517,15 +6517,15 @@ Obtains the **LocalInterface** object of an interface token. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | ---------------------- | -| interface | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | ---------------------- | + | interface | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------ | -| IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| + | Type | Description | + | ------------- | ------------------------------------------ | + | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| **Example** @@ -6552,8 +6552,8 @@ Obtains the **LocalInterface** object of an interface token. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **queryLocalInterface()** of the proxy object is called to obtain the interface descriptor. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **queryLocalInterface()** of the proxy object is called to obtain the interface descriptor. ```ts let broker = proxy.queryLocalInterface("testObject"); @@ -6570,18 +6570,18 @@ Registers a callback for receiving death notifications of the remote object. The **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -6609,8 +6609,8 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **registerDeathRecipient()** of the proxy object is called to register a callback for receiving the death notification of the remote object. - + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **registerDeathRecipient()** of the proxy object is called to register a callback for receiving the death notification of the remote object. + ```ts class MyDeathRecipient { onRemoteDied() { @@ -6638,16 +6638,16 @@ Adds a callback for receiving the death notifications of the remote object, incl **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | --------------------------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add. | -| flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | --------------------------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add. | + | flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| **Example** @@ -6674,8 +6674,8 @@ Adds a callback for receiving the death notifications of the remote object, incl }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. ```ts class MyDeathRecipient { @@ -6697,18 +6697,18 @@ Unregisters the callback used to receive death notifications of the remote objec **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -6735,8 +6735,8 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **unregisterDeathRecipient()** of the proxy object is called to unregister the callback for receiving the death notification of the remote object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **unregisterDeathRecipient()** of the proxy object is called to unregister the callback for receiving the death notification of the remote object. ```ts class MyDeathRecipient { @@ -6766,16 +6766,16 @@ Removes the callback used to receive death notifications of the remote object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | --------------------------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove. | -| flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | --------------------------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove. | + | flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is removed; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| **Example** @@ -6802,8 +6802,8 @@ Removes the callback used to receive death notifications of the remote object. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **removeDeathRecipient()** of the proxy object is called to remove the callback used to receive the death notification of the remote object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **removeDeathRecipient()** of the proxy object is called to remove the callback used to receive the death notification of the remote object. ```ts class MyDeathRecipient { @@ -6826,18 +6826,18 @@ Obtains the interface descriptor (which is a string) of this proxy object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900008 | proxy or remote object is invalid | -| 1900007 | communication failed | + | ID| Error Message| + | -------- | ------- | + | 1900008 | proxy or remote object is invalid | + | 1900007 | communication failed | **Example** @@ -6864,7 +6864,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode }; FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. ```ts try { @@ -6888,9 +6888,9 @@ Obtains the interface descriptor of this proxy object. **Return value** -| Type | Description | -| ------ | ------------------ | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ------------------ | + | string | Interface descriptor obtained.| **Example** @@ -6917,8 +6917,8 @@ Obtains the interface descriptor of this proxy object. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getInterfaceDescriptor()** of the proxy object is called to obtain the interface descriptor of the current proxy object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getInterfaceDescriptor()** of the proxy object is called to obtain the interface descriptor of the current proxy object. ```ts let descriptor = proxy.getInterfaceDescriptor(); @@ -6935,9 +6935,9 @@ Checks whether the **RemoteObject** is dead. **Return value** -| Type | Description | -| ------- | --------------------------------------------------------- | -| boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------------------- | + | boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.| **Example** @@ -6965,7 +6965,7 @@ Checks whether the **RemoteObject** is dead. FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **isObjectDead()** of the proxy object is called to check whether this object is dead. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **isObjectDead()** of the proxy object is called to check whether this object is dead. ```ts let isDead = proxy.isObjectDead(); @@ -6978,12 +6978,12 @@ Provides common message options (flag and wait time). Use the specified flag to **System capability**: SystemCapability.Communication.IPC.Core -| Name | Value | Description | -| ------------- | ---- | ----------------------------------------------------------- | -| TF_SYNC | 0 | Synchronous call. | -| TF_ASYNC | 1 | Asynchronous call. | -| TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest9+** for returning the file descriptor.| -| TF_WAIT_TIME | 8 | Default waiting time, in seconds. | + | Name | Value | Description | + | ------------- | ---- | ----------------------------------------------------------- | + | TF_SYNC | 0 | Synchronous call. | + | TF_ASYNC | 1 | Asynchronous call. | + | TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest9+** for returning the file descriptor.| + | TF_WAIT_TIME | 8 | Default waiting time, in seconds. | ### constructor9+ @@ -6996,9 +6996,9 @@ A constructor used to create a **MessageOption** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | -------------------------------------- | -| syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | -------------------------------------- | + | syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| **Example** @@ -7021,10 +7021,10 @@ A constructor used to create a **MessageOption** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | --------------------------------------------- | -| 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**.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | --------------------------------------------- | + | 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**.| **Example** @@ -7045,9 +7045,9 @@ Checks whether **SendMessageRequest** is called synchronously or asynchronously. **Return value** -| Type | Description | -| ------- | ------------------------------------ | -| boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| + | Type | Description | + | ------- | ------------------------------------ | + | boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| **Example** @@ -7082,9 +7082,9 @@ Obtains the call flag, which can be synchronous or asynchronous. **Return value** -| Type | Description | -| ------ | ------------------------------------ | -| number | Call mode obtained.| + | Type | Description | + | ------ | ------------------------------------ | + | number | Call mode obtained.| **Example** @@ -7113,9 +7113,9 @@ Sets the call flag, which can be synchronous or asynchronous. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| flags | number | Yes | Call flag to set.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | flags | number | Yes | Call flag to set.| **Example** @@ -7141,9 +7141,9 @@ Obtains the maximum wait time for this RPC call. **Return value** -| Type | Description | -| ------ | ----------------- | -| number | Maximum wait time obtained.| + | Type | Description | + | ------ | ----------------- | + | number | Maximum wait time obtained.| **Example** @@ -7170,9 +7170,9 @@ Sets the maximum wait time for this RPC call. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | --------------------- | -| waitTime | number | Yes | Maximum wait time to set.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | --------------------- | + | waitTime | number | Yes | Maximum wait time to set.| **Example** @@ -7201,9 +7201,9 @@ Obtains the system capability manager. This API is a static method. **Return value** -| Type | Description | -| ------------------------------- | -------------------- | -| [IRemoteObject](#iremoteobject) | System capability manager obtained.| + | Type | Description | + | ------------------------------- | -------------------- | + | [IRemoteObject](#iremoteobject) | System capability manager obtained.| **Example** @@ -7222,9 +7222,9 @@ Obtains the PID of the caller. This API is a static method, which is invoked by **Return value** -| Type | Description | -| ------ | ----------------- | -| number | PID of the caller.| + | Type | Description | + | ------ | ----------------- | + | number | PID of the caller.| **Example** @@ -7248,9 +7248,9 @@ Obtains the UID of the caller. This API is a static method, which is invoked by **Return value** -| Type | Description | -| ------ | ----------------- | -| number | UID of the caller.| + | Type | Description | + | ------ | ----------------- | + | number | UID of the caller.| **Example** @@ -7274,9 +7274,9 @@ Obtains the caller's token ID, which is used to verify the caller identity. **Return value** -| Type | Description | -| ------ | --------------------- | -| number | Token ID of the caller obtained.| + | Type | Description | + | ------ | --------------------- | + | number | Token ID of the caller obtained.| **Example** @@ -7301,9 +7301,9 @@ Obtains the ID of the device hosting the caller's process. This API is a static **Return value** -| Type | Description | -| ------ | ---------------------------- | -| string | Device ID obtained.| + | Type | Description | + | ------ | ---------------------------- | + | string | Device ID obtained.| **Example** @@ -7327,9 +7327,9 @@ Obtains the local device ID. This API is a static method. **Return value** -| Type | Description | -| ------ | ------------------ | -| string | Local device ID obtained.| + | Type | Description | + | ------ | ------------------ | + | string | Local device ID obtained.| **Example** @@ -7353,9 +7353,9 @@ Checks whether the remote process is a process of the local device. This API is **Return value** -| Type | Description | -| ------- | --------------------------------------------------------- | -| boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------------------- | + | boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.| **Example** @@ -7379,9 +7379,9 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | **Example** @@ -7413,15 +7413,15 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | **Return value** -| 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.| + | 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.| **Example** @@ -7460,9 +7460,9 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Return value** -| Type | Description | -| ------ | ------------------------------------ | -| string | String containing the UID and PID of the remote user.| + | Type | Description | + | ------ | ------------------------------------ | + | string | String containing the UID and PID of the remote user.| **Example** @@ -7487,9 +7487,9 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------------ | -| identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | ------------------------------------------------------------------ | + | identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| **Example** @@ -7520,15 +7520,15 @@ Sets the UID and PID of the remote user. This API is a static method. It is usua **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------------ | -| identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | ------------------------------------------------------------------ | + | identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -7562,9 +7562,9 @@ A constructor used to create a **RemoteObject** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ------------ | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | ------------ | + | descriptor | string | Yes | Interface descriptor.| ### sendRequest(deprecated) @@ -7579,18 +7579,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** @@ -7645,18 +7645,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -7715,18 +7715,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | --------------------------------------------- | -| Promise<RequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | ---------------------------- | --------------------------------------------- | + | Promise<RequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -7771,13 +7771,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| 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.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| AsyncCallback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | AsyncCallback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -7821,13 +7821,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| 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.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| AsyncCallback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | 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.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | AsyncCallback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -7885,18 +7885,18 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------- | -| code | number | Yes | Service request code sent by the remote end. | -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that holds the parameters called by the client.| -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object carrying the result. | -| option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------- | + | code | number | Yes | Service request code sent by the remote end. | + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that holds the parameters called by the client.| + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object carrying the result. | + | option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -7946,19 +7946,19 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ----------------------------------------- | -| code | number | Yes | Service request code sent by the remote end. | -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that holds the parameters called by the client.| -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object to which the result is written. | -| option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ----------------------------------------- | + | code | number | Yes | Service request code sent by the remote end. | + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that holds the parameters called by the client.| + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object to which the result is written. | + | 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 **onRemoteMessageRequest**. The value **true** means the operation is successful; the value **false** means the opposite.| -| Promise\ | Returns a promise object if the request is processed asynchronously in **onRemoteMessageRequest**. | + | Type | Description | + | ----------------- | ---------------------------------------------------------------------------------------------- | + | boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteMessageRequest**. The value **true** means the operation is successful; the value **false** means the opposite.| + | Promise\ | Returns a promise object if the request is processed asynchronously in **onRemoteMessageRequest**. | **Example**: Overload **onRemoteMessageRequest** to process requests synchronously. @@ -8076,9 +8076,9 @@ Obtains the UID of the remote process. **System capability**: SystemCapability.Communication.IPC.Core **Return value** -| Type | Description | -| ------ | ----------------------- | -| number | UID of the remote process obtained.| + | Type | Description | + | ------ | ----------------------- | + | number | UID of the remote process obtained.| **Example** @@ -8102,9 +8102,9 @@ Obtains the PID of the remote process. **Return value** -| Type | Description | -| ------ | ----------------------- | -| number | PID of the remote process obtained.| + | Type | Description | + | ------ | ----------------------- | + | number | PID of the remote process obtained.| **Example** @@ -8128,15 +8128,15 @@ Obtains the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| **Example** @@ -8182,15 +8182,15 @@ Checks whether the remote object corresponding to the specified interface token **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ---------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | ---------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------------------------------ | -| IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.| + | Type | Description | + | ------------- | ------------------------------------------------------------------ | + | IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.| **Example** @@ -8228,17 +8228,17 @@ Obtains the interface descriptor of this object. The interface descriptor is a s **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -8263,13 +8263,13 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } } let testRemoteObject = new TestRemoteObject("testObject"); + console.log("RpcServer: descriptor is: " + descriptor); try { let descriptor = testRemoteObject.getDescriptor(); } catch(error) { console.info("rpc get local interface fail, errorCode " + error.code); console.info("rpc get local interface fail, errorMessage " + error.message); } - console.log("RpcServer: descriptor is: " + descriptor); ``` ### getInterfaceDescriptor(deprecated) @@ -8284,9 +8284,9 @@ Obtains the interface descriptor. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Example** @@ -8325,10 +8325,10 @@ Binds an interface descriptor to an **IRemoteBroker** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------------- | ---- | ------------------------------------- | -| localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | -------------- | ------------- | ---- | ------------------------------------- | + | localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | + | descriptor | string | Yes | Interface descriptor.| **Example** @@ -8344,8 +8344,8 @@ Binds an interface descriptor to an **IRemoteBroker** object. try { this.modifyLocalInterface(this, descriptor); } catch(error) { - console.info(rpc attach local interface fail, errorCode " + error.code); - console.info(rpc attach local interface fail, errorMessage " + error.message); + console.info(" rpc attach local interface fail, errorCode " + error.code); + console.info(" rpc attach local interface fail, errorMessage " + error.message); } } registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { @@ -8376,10 +8376,10 @@ Binds an interface descriptor to an **IRemoteBroker** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------------- | ---- | ------------------------------------- | -| localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | -------------- | ------------- | ---- | ------------------------------------- | + | localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | + | descriptor | string | Yes | Interface descriptor.| **Example** @@ -8418,12 +8418,12 @@ Provides methods related to anonymous shared memory objects, including creating, The table below describes the protection types of the mapped memory. -| Name | Value | Description | -| ---------- | --- | ------------------ | -| PROT_EXEC | 4 | The mapped memory is executable. | -| PROT_NONE | 0 | The mapped memory is inaccessible.| -| PROT_READ | 1 | The mapped memory is readable. | -| PROT_WRITE | 2 | The mapped memory is writeable. | + | Name | Value | Description | + | ---------- | --- | ------------------ | + | PROT_EXEC | 4 | The mapped memory is executable. | + | PROT_NONE | 0 | The mapped memory is inaccessible.| + | PROT_READ | 1 | The mapped memory is readable. | + | PROT_WRITE | 2 | The mapped memory is writeable. | ### create9+ @@ -8435,16 +8435,16 @@ Creates an **Ashmem** object with the specified name and size. This API is a sta **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| name | string | Yes | Name of the **Ashmem** object to create. | -| size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------------- | + | name | string | Yes | Name of the **Ashmem** object to create. | + | size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| **Return value** -| Type | Description | -| ------ | ---------------------------------------------- | -| Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| + | Type | Description | + | ------ | ---------------------------------------------- | + | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| **Example** @@ -8472,16 +8472,16 @@ Creates an **Ashmem** object with the specified name and size. This API is a sta **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| name | string | Yes | Name of the **Ashmem** object to create. | -| size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------------- | + | name | string | Yes | Name of the **Ashmem** object to create. | + | size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| **Return value** -| Type | Description | -| ------ | ---------------------------------------------- | -| Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| + | Type | Description | + | ------ | ---------------------------------------------- | + | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| **Example** @@ -8501,15 +8501,15 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| ashmem | Ashmem | Yes | Existing **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | ashmem | Ashmem | Yes | Existing **Ashmem** object.| **Return value** -| Type | Description | -| ------ | ---------------------- | -| Ashmem | **Ashmem** object created.| + | Type | Description | + | ------ | ---------------------- | + | Ashmem | **Ashmem** object created.| **Example** @@ -8539,15 +8539,15 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| ashmem | Ashmem | Yes | Existing **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | ashmem | Ashmem | Yes | Existing **Ashmem** object.| **Return value** -| Type | Description | -| ------ | ---------------------- | -| Ashmem | **Ashmem** object created.| + | Type | Description | + | ------ | ---------------------- | + | Ashmem | **Ashmem** object created.| **Example** @@ -8598,9 +8598,9 @@ Obtains the memory size of this **Ashmem** object. **Return value** -| Type | Description | -| ------ | -------------------------- | -| number | **Ashmem** size obtained.| + | Type | Description | + | ------ | -------------------------- | + | number | **Ashmem** size obtained.| **Example** @@ -8620,17 +8620,17 @@ Creates the shared file mapping on the virtual address space of this process. Th **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------------ | -| mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| + | Name | Type | Mandatory| Description | + | ------- | ------ | ---- | ------------------------------ | + | mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | ------ | + | 1900001 | call mmap function failed | **Example** @@ -8656,15 +8656,15 @@ Creates the shared file mapping on the virtual address space of this process. Th **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------------ | -| mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| + | Name | Type | Mandatory| Description | + | ------- | ------ | ---- | ------------------------------ | + | mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8686,9 +8686,9 @@ Maps the shared file to the readable and writable virtual address space of the p For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | -------- | + | 1900001 | call mmap function failed | **Example** @@ -8714,9 +8714,9 @@ Maps the shared file to the readable and writable virtual address space of the p **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8738,9 +8738,9 @@ Maps the shared file to the read-only virtual address space of the process. For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | -------- | + | 1900001 | call mmap function failed | **Example** @@ -8766,9 +8766,9 @@ Maps the shared file to the read-only virtual address space of the process. **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8788,17 +8788,17 @@ Sets the protection level of the memory region to which the shared file is mappe **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ------------------ | -| protectionType | number | Yes | Protection type to set.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ------------------ | + | protectionType | number | Yes | Protection type to set.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900002 | call os ioctl function failed | + | ID| Error Message| + | -------- | ------- | + | 1900002 | call os ioctl function failed | **Example** @@ -8824,15 +8824,15 @@ Sets the protection level of the memory region to which the shared file is mappe **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ------------------ | -| protectionType | number | Yes | Protection type to set.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ------------------ | + | protectionType | number | Yes | Protection type to set.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| **Example** @@ -8852,19 +8852,19 @@ Writes data to the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------------------------------------- | -| buf | number[] | Yes | 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.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------------------------------------- | + | buf | number[] | Yes | 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.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900003 | write to ashmem failed | + | ID| Error Message| + | ------- | -------- | + | 1900003 | write to ashmem failed | **Example** @@ -8892,17 +8892,17 @@ Writes data to the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------------------------------------- | -| buf | number[] | Yes | 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.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------------------------------------- | + | buf | number[] | Yes | 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.| **Return value** -| Type | Description | -| ------- | ----------------------------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -8925,24 +8925,24 @@ Reads data from the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------------------- | -| 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.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------------------------------------- | + | 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.| **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Data read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Data read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID | Error Message| -| -------- | -------- | -| 1900004 | read from ashmem failed | + | ID | Error Message| + | -------- | -------- | + | 1900004 | read from ashmem failed | **Example** @@ -8972,16 +8972,16 @@ Reads data from the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------------------- | -| 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.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------------------------------------- | + | 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.| **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Data read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Data read.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-system-capability.md b/en/application-dev/reference/apis/js-apis-system-capability.md index 7949bae9880af5a8e428e62440595a4a6e990da7..e32c909193a5090737c37c70864c32573ec127b5 100644 --- a/en/application-dev/reference/apis/js-apis-system-capability.md +++ b/en/application-dev/reference/apis/js-apis-system-capability.md @@ -16,7 +16,7 @@ import systemcapability from '@ohos.systemCapability' ## systemcapability.querySystemCapabilities -querySystemCapabilities(callback: AsyncCallback): void; +querySystemCapabilities(callback: AsyncCallback<string>): void; Queries system capabilities. This API uses an asynchronous callback to return the result. @@ -51,7 +51,7 @@ querySystemCapabilities(): Promise<string> Queries system capabilities. This API uses a promise to return the result. -**System capability**: SystemCapability.Startup.SystemInfo +**System capability**: SystemCapability.Developtools.Syscap **Return value** @@ -76,4 +76,5 @@ try { > **NOTE** -> - The system capabilities returned by the preceding APIs are in the form of an encoded numeric string. +> +> The system capabilities returned by the preceding APIs are in the form of an encoded numeric string. diff --git a/en/application-dev/reference/apis/js-apis-wifiManager.md b/en/application-dev/reference/apis/js-apis-wifiManager.md index c4b50a6993017a534e846fc2edb761ae0f74e12d..dc9beb94d7fcc13d6c82e805bf8855d537e907bd 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManager.md +++ b/en/application-dev/reference/apis/js-apis-wifiManager.md @@ -127,7 +127,7 @@ Obtains the scan result. This API uses a promise to return the result. | **Type**| **Description**| | -------- | -------- | - | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.| + | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the hotspots detected.| **Error codes** @@ -409,6 +409,8 @@ Represents EAP configuration information. | caCertAliases | string | Yes| No| CA certificate alias.| | caPath | string | Yes| No| CA certificate path.| | clientCertAliases | string | Yes| No| Client certificate alias.| +| certEntry | Uint8Array | Yes| Yes| CA certificate content.| +| certPassword | string | Yes| Yes| CA certificate password.| | altSubjectMatch | string | Yes| No| A string to match the alternate subject.| | domainSuffixMatch | string | Yes| No| A string to match the domain suffix.| | realm | string | Yes| No| Realm for the passpoint credential.| diff --git a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md index 852b58547ddaf7b5c6eac648016d400ed13f35f9..4d9f1c83dd5fb5739f63520ce52c132c514d0fa7 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md +++ b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md @@ -2,8 +2,9 @@ This **wifiext** module provides WLAN extension interfaces for non-universal products. > **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -The APIs described in this document are used only for non-universal products, such as routers. +> +> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The APIs described in this document are used only for non-universal products, such as routers. ## Modules to Import @@ -12,9 +13,9 @@ The APIs described in this document are used only for non-universal products, su import wifiManagerExt from '@ohos.wifiManagerExt'; ``` -## wifiext.enableHotspot +## wifiext.enableHotspot9+ -enableHotspot(): boolean; +enableHotspot(): void; Enables the WLAN hotspot. @@ -27,12 +28,12 @@ Enables the WLAN hotspot. For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.disableHotspot +## wifiext.disableHotspot9+ -disableHotspot(): boolean; +disableHotspot(): void; Disables the WLAN hotspot. @@ -45,14 +46,14 @@ Disables the WLAN hotspot. For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(): Promise<Array<PowerModel>> +getSupportedPowerMode(): Promise<Array<PowerMode>> -Obtains the supported power models. This API uses a promise to return the result. +Obtains the supported power modes. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -60,21 +61,21 @@ Obtains the supported power models. This API uses a promise to return the result **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## PowerModel +## PowerMode -Enumerates the power models. +Enumerates the power modes. **System capability**: SystemCapability.Communication.WiFi.AP.Extension @@ -85,11 +86,11 @@ Enumerates the power models. | THROUGH_WALL | 2 | Through_wall| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void +getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void -Obtains the supported power models. This API uses an asynchronous callback to return the result. +Obtains the supported power modes. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -97,23 +98,23 @@ Obtains the supported power models. This API uses an asynchronous callback to re **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power models obtained. If **err** is not **0**, an error has occurred.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<Array<[PowerMode](#powermode)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(): Promise<PowerModel> +getPowerMode(): Promise<PowerMode> -Obtains the power model. This API uses a promise to return the result. +Obtains the power mode. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -121,23 +122,23 @@ Obtains the power model. This API uses a promise to return the result. **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[PowerModel](#powermodel)> | Promise used to return the power models obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(callback: AsyncCallback<PowerModel>): void +getPowerMode(callback: AsyncCallback<PowerMode>): void -Obtains the power model. This API uses an asynchronous callback to return the result. +Obtains the power mode. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -145,23 +146,23 @@ Obtains the power model. This API uses an asynchronous callback to return the re **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#powermodel)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[PowerMode](#powermode)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.setPowerModel +## wifiext.setPowerMode9+ -setPowerModel(model: PowerModel) : boolean; +setPowerMode(model: PowerMode) : boolean; - Sets the power model. + Sets the power mode. **Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT @@ -169,14 +170,14 @@ setPowerModel(model: PowerModel) : boolean; **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | model | [PowerModel](#powermodel) | Yes| Power model to set.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| model | [PowerMode](#powermode) | Yes| Power mode to set.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.|