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 3ec285d8d35cb3d04cec0b20c8698f10ae30e609..dabd05b0cd8fc4ba58c8e3a76b5e983b38accff7 100644
--- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md
+++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md
@@ -38,11 +38,11 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ----------------------------------------------------------- |
+| **ID**| **Error Message** |
+| ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. |
-| 14800011 | Failed to open database by database corrupted. |
-| 14800000 | Inner error. |
+| 14800011 | Failed open database, database corrupted. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -122,11 +122,11 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ----------------------------------------------------------- |
+| **ID**| **Error Message** |
+| ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. |
-| 14800011 | Failed to open database by database corrupted. |
-| 14800000 | Inner error. |
+| 14800011 | Failed open database, database corrupted. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -198,10 +198,10 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ----------------------------------------------------------- |
+| **ID**| **Error Message** |
+| ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -265,10 +265,10 @@ Deletes an RDB store. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ----------------------------------------------------------- |
+| **ID**| **Error Message** |
+| ------------ | ------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -378,22 +378,6 @@ Defines the subscription type.
| Name | Value | Description |
| --------------------- | ---- | ------------------ |
| SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.|
-| SUBSCRIBE_TYPE_CLOUD10+ | 1 | Subscribe to cloud data changes.|
-
-## ConflictResolution10+
-
-Defines the resolution to use when **insert()** and **update()** conflict.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-| Name | Value | Description |
-| -------------------- | ---- | ------------------------------------------------------------ |
-| ON_CONFLICT_NONE | 0 | No operation is performed.|
-| ON_CONFLICT_ROLLBACK | 1 | Abort the SQL statement and roll back the current transaction. |
-| ON_CONFLICT_ABORT | 2 | Abort the current SQL statement and revert any changes made by the current SQL statement. However, the changes made by the previous SQL statement in the same transaction are retained and the transaction remains active.|
-| ON_CONFLICT_FAIL | 3 | Abort the current SQL statement. The **FAIL** resolution does not revert previous changes made by the failed SQL statement or end the transaction.|
-| ON_CONFLICT_IGNORE | 4 | Skip the rows that contain constraint violations and continue to process the subsequent rows of the SQL statement.|
-| ON_CONFLICT_REPLACE | 5 | Delete pre-existing rows that cause the constraint violation before inserting or updating the current row, and continue to execute the command normally.|
## RdbPredicates
@@ -1257,23 +1241,6 @@ Provides APIs to manage an RDB store.
Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data.
-### Attributes10+
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-| Name | Type | Mandatory| Description |
-| ------------ | ----------- | ---- | -------------------------------- |
-| version10+ | number | Yes | RDB store version, which is an integer greater than 0. |
-
-**Example**
-
-```js
-// Set the RDB store version.
-store.version = 3;
-// Obtain the RDB store version.
-console.info(`RdbStore version is ${store.version}`);
-```
-
### insert
insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void
@@ -1290,15 +1257,6 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
-
**Example**
```js
@@ -1317,49 +1275,6 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) {
})
```
-### insert10+
-
-insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callback: AsyncCallback<number>):void
-
-Inserts a row of data into a table. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------- | ---- | ---------------------------------------------------------- |
-| table | string | Yes | Name of the target table. |
-| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
-| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
-
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
-
-**Example**
-
-```js
-const valueBucket = {
- "NAME": "Lisa",
- "AGE": 18,
- "SALARY": 100.5,
- "CODES": new Uint8Array([1, 2, 3, 4, 5]),
-};
-store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rowId) {
- if (err) {
- console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
- return;
- }
- console.info(`Insert is successful, rowId = ${rowId}`);
-})
-```
### insert
@@ -1388,8 +1303,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1408,53 +1322,6 @@ promise.then((rowId) => {
})
```
-### insert10+
-
-insert(table: string, values: ValuesBucket, conflict: ConflictResolution):Promise<number>
-
-Inserts a row of data into a table. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------- | ---- | -------------------------- |
-| table | string | Yes | Name of the target table. |
-| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert.|
-| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
-
-**Return value**
-
-| Type | Description |
-| --------------------- | ------------------------------------------------- |
-| Promise<number> | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
-
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
-
-**Example**
-
-```js
-const valueBucket = {
- "NAME": "Lisa",
- "AGE": 18,
- "SALARY": 100.5,
- "CODES": new Uint8Array([1, 2, 3, 4, 5]),
-};
-let promise = store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
-promise.then((rowId) => {
- console.info(`Insert is successful, rowId = ${rowId}`);
-}).catch((err) => {
- console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
-})
-```
### batchInsert
@@ -1478,8 +1345,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1540,8 +1406,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1590,14 +1455,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. |
+
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1619,51 +1484,6 @@ store.update(valueBucket, predicates, function (err, rows) {
})
```
-### update10+
-
-update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution, callback: AsyncCallback<number>):void
-
-Updates data in the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
-| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
-| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
-| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. |
-
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
-
-**Example**
-
-```js
-const valueBucket = {
- "NAME": "Rose",
- "AGE": 22,
- "SALARY": 200.5,
- "CODES": new Uint8Array([1, 2, 3, 4, 5]),
-};
-let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
-predicates.equalTo("NAME", "Lisa");
-store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rows) {
- if (err) {
- console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
- return;
- }
- console.info(`Updated row count: ${rows}`);
-})
-```
### update
@@ -1692,8 +1512,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1714,55 +1533,6 @@ promise.then(async (rows) => {
})
```
-### update10+
-
-update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution):Promise<number>
-
-Updates data based on the specified **RdbPredicates** object. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
-| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
-| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
-| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
-
-**Return value**
-
-| Type | Description |
-| --------------------- | ----------------------------------------- |
-| Promise<number> | Promise used to return the number of rows updated.|
-
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
-
-**Example**
-
-```js
-const valueBucket = {
- "NAME": "Rose",
- "AGE": 22,
- "SALARY": 200.5,
- "CODES": new Uint8Array([1, 2, 3, 4, 5]),
-};
-let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
-predicates.equalTo("NAME", "Lisa");
-let promise = store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
-promise.then(async (rows) => {
- console.info(`Updated row count: ${rows}`);
-}).catch((err) => {
- console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
-})
-```
### update
@@ -1791,8 +1561,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1847,8 +1616,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1891,8 +1659,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1934,8 +1701,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -1976,8 +1742,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2025,8 +1790,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2062,9 +1826,9 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2076,17 +1840,8 @@ store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err,
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return;
}
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
})
```
@@ -2105,20 +1860,20 @@ Queries data from the RDB store based on specified conditions. This API uses a p
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
| columns | Array<string> | No | Columns to query. If this parameter is not specified, the query applies to all columns.|
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
-
**Return value**
| Type | Description |
| ------------------------------------------------------- | -------------------------------------------------- |
| Promise<[ResultSet](#resultset)> | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
+**Error codes**
+
+For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
+
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
+
**Example**
```js
@@ -2126,17 +1881,8 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Rose");
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => {
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
}).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
})
@@ -2167,9 +1913,9 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2182,17 +1928,8 @@ store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], fu
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return;
}
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
})
```
@@ -2226,9 +1963,9 @@ Queries data from the RDB store based on specified conditions. This API uses a p
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2238,17 +1975,8 @@ let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo("NAME", "Rose");
let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => {
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
}).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
})
@@ -2280,9 +2008,9 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2309,17 +2037,8 @@ store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALAR
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
return;
}
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
}
)
```
@@ -2355,9 +2074,9 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2380,17 +2099,8 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0);
let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => {
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
}).catch((err) => {
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
})
@@ -2416,9 +2126,9 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2428,17 +2138,8 @@ store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['s
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return;
}
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
})
```
@@ -2467,26 +2168,17 @@ Queries data using the specified SQL statement. This API uses a promise to retur
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
```js
let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'");
promise.then((resultSet) => {
- console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
- // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
- while(resultSet.goToNextRow()) {
- const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
- const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
- const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
- const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
- console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
- }
- // Release the dataset memory.
- resultSet.close();
+ console.info(`ResultSet column names: ${resultSet.columnNames}`);
+ console.info(`ResultSet column count: ${resultSet.columnCount}`);
}).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`);
})
@@ -2514,8 +2206,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2557,8 +2248,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2586,8 +2276,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
-| 14800047 | The WAL file size exceeds the default limit. |
-| 14800000 | Inner error. |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2708,9 +2397,9 @@ Backs up an RDB store. This API uses an asynchronous callback to return the resu
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2738,20 +2427,20 @@ Backs up an RDB store. This API uses a promise to return the result.
| -------- | ------ | ---- | ------------------------ |
| destName | string | Yes | Name of the RDB store backup file.|
+**Error codes**
+
+For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
+
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
+
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise<void> | Promise that returns no value.|
-**Error codes**
-
-For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
-
**Example**
```js
@@ -2782,9 +2471,9 @@ Restores an RDB store from a backup file. This API uses an asynchronous callback
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2822,9 +2511,9 @@ Restores an RDB store from a backup file. This API uses a promise to return the
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2858,9 +2547,9 @@ Sets distributed tables. This API uses an asynchronous callback to return the re
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2900,9 +2589,9 @@ Sets distributed tables. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2921,7 +2610,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried.
-> **NOTE**
+> **NOTE**
>
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
@@ -2941,9 +2630,9 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -2977,7 +2666,7 @@ store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName)
Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried.
-> **NOTE**
+> **NOTE**
>
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
@@ -3002,9 +2691,9 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -3053,9 +2742,9 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -3117,9 +2806,9 @@ Synchronizes data between devices. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
-| **ID**| **Error Message** |
-| ------------ | ---------------------------- |
-| 14800000 | Inner error. |
+| **ID**| **Error Message** |
+| ------------ | -------------------------------------------- |
+| 14800000 | The inner error is occurred. |
**Example**
@@ -3188,7 +2877,7 @@ try {
off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void
-Unregisters the observer of the specified type from the RDB store.
+Unregisters the observer of the specified type.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md
index dbb9244fbe3f973baf0b307a80b7a0ed23482f71..052d9901d7661081cb8a32859eaf154c249a7e03 100644
--- a/en/application-dev/reference/apis/js-apis-data-storage.md
+++ b/en/application-dev/reference/apis/js-apis-data-storage.md
@@ -8,8 +8,6 @@ The **DataStorage** module provides applications with data processing capability
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
->
-> - The APIs of this module can be used only in the FA model.
## Modules to Import
@@ -188,7 +186,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------- |
| path | string | Yes | Path of the target file.|
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
@@ -230,7 +228,7 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
| Type | Description |
| ------------------- | ------------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -295,7 +293,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------- |
| path | string | Yes | Path of the target file.|
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
@@ -337,7 +335,7 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
| Type | Description |
| ------------------- | ------------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -490,7 +488,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat
| -------- | ------------------------- | ---- | ----------------------------------------- |
| key | string | Yes | Key of the data. It cannot be empty. |
| value | [ValueType](#valuetype) | Yes | New value to store. It can be a number, string, or Boolean value.|
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
@@ -524,7 +522,7 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat
| Type | Description |
| ------------------- | --------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -672,7 +670,7 @@ Deletes data with the specified key from this storage object. This API uses an a
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------- |
| key | string | Yes | Key of the data. It cannot be empty.|
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
@@ -705,7 +703,7 @@ Deletes data with the specified key from this storage object. This API uses a pr
| Type | Description |
| ------------------- | --------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -746,7 +744,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
**Example**
@@ -773,7 +771,7 @@ Saves the modification of this object to the **Storage** instance and synchroniz
| Type | Description |
| ------------------- | --------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -814,7 +812,7 @@ Clears this **Storage** object. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
-| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
**Example**
@@ -840,7 +838,7 @@ Clears this **Storage** object. This API uses a promise to return the result.
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
-| Promise<void> | Promise that returns no value. |
+| Promise<void> | Promise that returns no value.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-rpc.md b/en/application-dev/reference/apis/js-apis-rpc.md
index 4e2f4ed96e608f1f91cca03faea5188893be128f..22df13e5169b5c8589753aeb553689576e6f7c65 100644
--- a/en/application-dev/reference/apis/js-apis-rpc.md
+++ b/en/application-dev/reference/apis/js-apis-rpc.md
@@ -247,7 +247,7 @@ Obtains the data size of this **MessageSequence** object.
| Type | Description |
| ------ | ----------------------------------------------- |
- | number | Size of the **MessageSequence** object obtained, in bytes.|
+ | number | Size of the **MessageSequence** instance obtained, in bytes.|
**Example**
@@ -293,6 +293,14 @@ Sets the size of the data contained in this **MessageSequence** object.
| ------ | ------ | ---- | ------ |
| size | number | Yes | Data size to set, 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 |
+
**Example**
```ts
@@ -326,6 +334,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message|
| -------- | -------- |
+ | 1900009 | write data to message sequence failed |
| 1900011 | parcel memory alloc failed |
**Example**
@@ -452,6 +461,12 @@ Moves the read pointer to the specified position.
| ------ | ------ | ---- | ------- |
| pos | number | Yes | Position from which data is to read.|
+**Error codes**
+
+ | ID| Error Message|
+ | -------- | -------- |
+ | 1900010 | read data from message sequence failed |
+
**Example**
```ts
@@ -484,6 +499,12 @@ Moves the write pointer to the specified position.
| ------ | ------ | ---- | ----- |
| pos | number | Yes | Position from which data is to write.|
+**Error codes**
+
+ | ID| Error Message|
+ | -------- | -------- |
+ | 1900009 | write data to message sequence failed |
+
**Example**
```ts
@@ -2701,7 +2722,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
super(descriptor);
this.modifyLocalInterface(this, descriptor);
}
-
+
asObject(): rpc.IRemoteObject {
return this;
}
@@ -2718,7 +2739,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
}
```
-
### closeFileDescriptor9+
static closeFileDescriptor(fd: number): void
@@ -2805,7 +2825,6 @@ Checks whether this **MessageSequence** object contains file descriptors.
**Example**
-
```ts
import fs from '@ohos.file.fs';
let sequence = new rpc.MessageSequence();
@@ -2926,8 +2945,8 @@ Writes an anonymous shared object to this **MessageSequence** object.
For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md).
| ID| Error Message|
- | -------- | ------- |
- | 1900003 | write to ashmem failed |
+ | -------- | -------- |
+ | 1900009 | write data to message sequence failed |
**Example**
@@ -2948,7 +2967,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
}
```
-
### readAshmem
readAshmem(): Ashmem
@@ -2969,7 +2987,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message|
| -------- | -------- |
- | 1900004 | read from ashmem failed |
+ | 1900010 | read data from message sequence failed |
**Example**
@@ -3263,7 +3281,6 @@ Writes an interface token to this **MessageParcel** object. The remote object ca
console.log("RpcServer: writeInterfaceToken is " + result);
```
-
### readInterfaceToken
readInterfaceToken(): string
@@ -3672,7 +3689,7 @@ Writes an Int value to this **MessageParcel** object.
**Return value**
| Type | Description |
- | ------- | ----------------------------- |
+ | ------- | ----------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
@@ -5825,7 +5842,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -5836,7 +5853,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| ------- | -------------------------------- |
| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.|
-
### sendRequest8+(deprecated)
>This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9).
@@ -5851,7 +5867,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ---------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -5862,7 +5878,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| -------------------------------- | --------------------------------------------- |
| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.|
-
### sendMessageRequest9+
sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult>
@@ -5875,7 +5890,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -5886,7 +5901,6 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| ---------------------------- | ----------------------------------------- |
| Promise<RequestResult> | Promise used to return the **requestResult** object.|
-
### sendMessageRequest9+
sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void
@@ -5899,7 +5913,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -5919,7 +5933,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -5946,7 +5960,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message|
| -------- | -------- |
- | 1900008 | proxy or remote object is invalid |
+ | 1900005 | only proxy object permitted |
### addDeathrecipient(deprecated)
@@ -5971,7 +5985,6 @@ Adds a callback for receiving death notifications of the remote object. This met
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.|
-
### unregisterDeathRecipient9+
unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void
@@ -5993,7 +6006,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| ID| Error Message|
| -------- | -------- |
- | 1900008 | proxy or remote object is invalid |
+ | 1900005 | only proxy object permitted |
### removeDeathRecipient(deprecated)
@@ -6040,7 +6053,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
| -------- | -------- |
| 1900008 | proxy or remote object is invalid |
-
### getInterfaceDescriptor(deprecated)
>This API is no longer maintained since API version 9. You are advised to use [getDescriptor](#getdescriptor9).
@@ -6057,7 +6069,6 @@ Obtains the interface descriptor (which is a string) of this object.
| ------ | ---------------- |
| string | Interface descriptor obtained.|
-
### isObjectDead
isObjectDead(): boolean
@@ -6072,7 +6083,6 @@ Checks whether this object is dead.
| ------- | ---------------------------------- |
| boolean | Returns **true** if the object is dead; returns **false** otherwise.|
-
## RemoteProxy
Provides APIs to implement **IRemoteObject**.
@@ -6101,7 +6111,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -6177,7 +6187,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -6261,7 +6271,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -6343,7 +6353,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -6424,7 +6434,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -7079,13 +7089,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 (0x00) | Synchronous call. |
+ | TF_ASYNC | 1 (0x01) | Asynchronous call. |
+ | TF_ACCEPT_FDS | 16 (0x10) | Indication to **sendMessageRequest9+** for returning the file descriptor.|
+ | TF_WAIT_TIME | 4 (0x4) | Default waiting time, in seconds. |
### constructor9+
@@ -7101,7 +7110,6 @@ A constructor used to create a **MessageOption** object.
| ------ | ------- | ---- | -------------------------------------- |
| async | boolean | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.|
-
**Example**
```ts
@@ -7391,7 +7399,6 @@ Obtains the caller's token ID, which is used to verify the caller identity.
}
```
-
### getCallingDeviceID
static getCallingDeviceID(): string
@@ -7484,7 +7491,6 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp
| ------ | ------------------------------- | ---- | ------------------- |
| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. |
-
**Example**
```ts
@@ -7577,7 +7583,6 @@ Changes the UID and PID of the remote user to the UID and PID of the local user.
}
```
-
### restoreCallingIdentity9+
static restoreCallingIdentity(identity: string): void
@@ -7667,7 +7672,6 @@ A constructor used to create a **RemoteObject** object.
| ---------- | ------ | ---- | ------------ |
| descriptor | string | Yes | Interface descriptor.|
-
### sendRequest(deprecated)
>This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9).
@@ -7682,7 +7686,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -7748,7 +7752,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -7818,7 +7822,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -7874,7 +7878,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -7924,7 +7928,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
| Name | Type | Mandatory| Description |
| ------------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- |
- | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.|
+ | code | number | Yes | Message code (1-16777215) called by the request, which is determined by the communication parties. 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. |
@@ -8239,7 +8243,6 @@ Obtains the interface descriptor.
| ------------- | --------------------------------------------- |
| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.|
-
**Example**
```ts
@@ -8612,7 +8615,6 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash
| ------ | ---------------------- |
| Ashmem | **Ashmem** object created.|
-
**Example**
```ts
diff --git a/en/application-dev/reference/apis/js-apis-wifiManager.md b/en/application-dev/reference/apis/js-apis-wifiManager.md
index 8e3526343a3f62066af7686b4fbe5cb587fa1cbc..bd8bae5e1c450143ce183ff29881445e413dc79b 100644
--- a/en/application-dev/reference/apis/js-apis-wifiManager.md
+++ b/en/application-dev/reference/apis/js-apis-wifiManager.md
@@ -1,5 +1,4 @@
-# WLAN
-
+# @ohos.wifiManager (WLAN)
The **WLAN** module provides basic wireless local area network (WLAN) functions, peer-to-peer (P2P) functions, and WLAN message notification services. It allows applications to communicate with other devices over WLAN.
> **NOTE**
@@ -31,6 +30,14 @@ Enables WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+
## wifi.disableWifi9+
@@ -50,6 +57,13 @@ Disables WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.isWifiActive9+
@@ -67,6 +81,13 @@ Checks whether WLAN is enabled.
| -------- | -------- |
| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.scan9+
@@ -74,7 +95,7 @@ scan(): void
Starts a scan for WLAN.
-**Required permissions**: **ohos.permission.SET_WIFI_INFO** and **ohos.permission.LOCATION**
+**Required permissions**: ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.WiFi.STA
@@ -84,6 +105,13 @@ Starts a scan for WLAN.
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getScanResults9+
@@ -101,6 +129,13 @@ Obtains the scan result. This API uses a promise to return the result.
| -------- | -------- |
| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getScanResults9+
@@ -118,6 +153,14 @@ Obtains the scan result. This API uses an asynchronous callback to return the re
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+
**Example**
```js
import wifi from '@ohos.wifi';
@@ -251,6 +294,13 @@ Obtains the scan result. This API returns the result synchronously.
| -------- | -------- |
| Array<[WifiScanInfo](#wifiscaninfo)> | Scan result obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.addDeviceConfig9+
@@ -276,6 +326,14 @@ Adds network configuration. This API uses a promise to return the result.
| -------- | -------- |
| Promise<number> | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+
## WifiDeviceConfig9+
Represents the WLAN configuration.
@@ -351,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.|
@@ -418,6 +478,13 @@ Adds network configuration. This API uses an asynchronous callback to return the
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. 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**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.addCandidateConfig9+
@@ -441,6 +508,13 @@ Adds the configuration of a candidate network. This API uses a promise to return
| -------- | -------- |
| Promise<number> | Promise used to return the network configuration ID.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.addCandidateConfig9+
@@ -459,6 +533,13 @@ Adds the configuration of a candidate network. This API uses an asynchronous cal
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. 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**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.removeCandidateConfig9+
@@ -482,6 +563,13 @@ Removes the configuration of a candidate network. This API uses a promise to ret
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.removeCandidateConfig9+
@@ -500,6 +588,13 @@ Removes the configuration of a candidate network. This API uses an asynchronous
| networkId | number | Yes| ID of the network configuration to remove.|
| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. 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**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getCandidateConfigs9+
@@ -517,6 +612,13 @@ Obtains candidate network configuration.
| -------- | -------- |
| Array<[WifiDeviceConfig](#wifideviceconfig)> | Candidate network configuration obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.connectToCandidateConfig9+
@@ -534,6 +636,14 @@ Connects to a candidate network.
| -------- | -------- | -------- | -------- |
| networkId | number | Yes| ID of the candidate network configuration.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.connectToNetwork9+
@@ -553,12 +663,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- |
| networkId | number | Yes| Network configuration ID.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.connectToDevice9+
@@ -579,12 +691,14 @@ Connects to the specified network.
| -------- | -------- | -------- | -------- |
| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.disconnect9+
@@ -599,12 +713,13 @@ Disconnects the network.
**System capability**:
SystemCapability.Communication.WiFi.STA
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getSignalLevel9+
@@ -629,6 +744,13 @@ Obtains the WLAN signal level.
| -------- | -------- |
| number | Signal level obtained. The value range is [0, 4].|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getLinkedInfo9+
@@ -646,6 +768,14 @@ Obtains WLAN connection information. This API uses a promise to return the resul
| -------- | -------- |
| Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise used to return the WLAN connection information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.getLinkedInfo9+
@@ -663,6 +793,15 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information 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**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
+
**Example**
```js
import wifi from '@ohos.wifi';
@@ -767,6 +906,13 @@ Checks whether the WLAN is connected.
| -------- | -------- |
| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getSupportedFeatures9+
@@ -795,12 +941,19 @@ Obtains the features supported by this device.
| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature|
| 0x0008 | Wi-Fi Direct|
| 0x0010 | SoftAP|
-| 0x0040 | Wi-Fi AWare|
+| 0x0040 | Wi-Fi Aware|
| 0x8000 | WLAN AP/STA concurrency|
| 0x8000000 | WPA3 Personal (WPA-3 SAE)|
| 0x10000000 | WPA3-Enterprise Suite B |
| 0x20000000 | Enhanced open feature|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2401000 | Operation failed.|
## wifi.isFeatureSupported9+
@@ -825,6 +978,13 @@ Checks whether the device supports the specified WLAN feature.
| -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2401000 | Operation failed.|
## wifi.getDeviceMacAddress9+
@@ -844,6 +1004,13 @@ Obtains the device MAC address.
| -------- | -------- |
| string[] | MAC address obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.getIpInfo9+
@@ -861,6 +1028,13 @@ Obtains IP information.
| -------- | -------- |
| [IpInfo](#ipinfo9) | IP information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## IpInfo9+
@@ -895,6 +1069,13 @@ Obtains the country code.
| -------- | -------- |
| string | Country code obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2401000 | Operation failed.|
## wifi.reassociate9+
@@ -908,12 +1089,14 @@ Re-associates with the network.
**System capability**: SystemCapability.Communication.WiFi.STA
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.reconnect9+
@@ -927,12 +1110,14 @@ Reconnects to the network.
**System capability**: SystemCapability.Communication.WiFi.STA
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+| 2501001 | Wifi is closed.|
## wifi.getDeviceConfigs9+
@@ -952,6 +1137,13 @@ Obtains network configuration.
| -------- | -------- |
| Array<[WifiDeviceConfig](#wifideviceconfig)> | Array of network configuration obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.updateNetwork9+
@@ -977,6 +1169,13 @@ Updates network configuration.
| -------- | -------- |
| number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.disableNetwork9+
@@ -996,12 +1195,13 @@ Disables network configuration.
| -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the network configuration to disable.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.removeAllNetwork9+
@@ -1015,12 +1215,13 @@ Removes the configuration of all networks.
**System capability**: SystemCapability.Communication.WiFi.STA
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.removeDevice9+
@@ -1038,14 +1239,15 @@ Removes the specified network configuration.
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
-| id | number | Yes| ID of the network configuration to remove.|
+ | id | number | Yes| ID of the network configuration to remove.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.enableHotspot9+
@@ -1059,12 +1261,13 @@ Enables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.disableHotspot9+
@@ -1078,12 +1281,13 @@ Disables this hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Core
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.isHotspotDualBandSupported9+
@@ -1103,6 +1307,13 @@ Checks whether the hotspot supports dual band.
| -------- | -------- |
| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.isHotspotActive9+
@@ -1122,6 +1333,13 @@ Checks whether this hotspot is active.
| -------- | -------- |
| boolean | Returns **true** if the hotspot is active; returns **false** otherwise.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.setHotspotConfig9+
@@ -1141,12 +1359,13 @@ Sets hotspot configuration.
| -------- | -------- | -------- | -------- |
| config | [HotspotConfig](#hotspotconfig9) | Yes| Hotspot configuration to set.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## HotspotConfig9+
@@ -1169,7 +1388,7 @@ Represents the hotspot configuration.
getHotspotConfig(): HotspotConfig
-obtains hotspot configuration.
+Obtains hotspot configuration.
**System API**: This is a system API.
@@ -1183,6 +1402,13 @@ obtains hotspot configuration.
| -------- | -------- |
| [HotspotConfig](#hotspotconfig9) | Hotspot configuration obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.getStations9+
@@ -1202,6 +1428,13 @@ Obtains information about the connected stations.
| -------- | -------- |
| Array<[StationInfo](#stationinfo9)> | Connected stations obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## StationInfo9+
@@ -1234,7 +1467,13 @@ Obtains P2P link information. This API uses a promise to return the result.
| -------- | -------- |
| Promise<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | Promise used to return the P2P link information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## WifiP2pLinkedInfo9+
@@ -1294,6 +1533,13 @@ Obtains the current P2P group information. This API uses a promise to return the
| -------- | -------- |
| Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | Promise used to return the P2P group information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.getCurrentGroup9+
@@ -1311,6 +1557,13 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information 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**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices9+
@@ -1328,6 +1581,13 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
| -------- | -------- |
| Promise<[WifiP2pDevice[]](#wifip2pdevice9)> | Promise used to return the peer device list.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.getP2pPeerDevices9+
@@ -1345,6 +1605,13 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice9)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list 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**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## WifiP2pDevice9+
@@ -1392,6 +1659,13 @@ Obtains the local device information in the P2P connection. This API uses a prom
| -------- | -------- |
| Promise<[WifiP2pDevice](#wifip2pdevice9)> | Promise used to return the local device information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.getP2pLocalDevice9+
@@ -1426,12 +1700,13 @@ Creates a P2P group.
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| Group configuration.|
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## WifiP2PConfig9+
@@ -1471,12 +1746,13 @@ Removes this P2P group.
**System capability**: SystemCapability.Communication.WiFi.P2P
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.p2pConnect9+
@@ -1495,12 +1771,13 @@ Sets up a P2P connection.
| -------- | -------- | -------- | -------- |
| config | [WifiP2PConfig](#wifip2pconfig9) | Yes| P2P group configuration.|
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
**Example**
```js
@@ -1579,12 +1856,13 @@ Cancels this P2P connection.
**System capability**: SystemCapability.Communication.WiFi.P2P
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.startDiscoverDevices9+
@@ -1596,12 +1874,13 @@ Starts to discover devices.
**System capability**: SystemCapability.Communication.WiFi.P2P
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.stopDiscoverDevices9+
@@ -1613,12 +1892,13 @@ Stops discovering devices.
**System capability**: SystemCapability.Communication.WiFi.P2P
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.deletePersistentGroup9+
@@ -1639,12 +1919,13 @@ Deletes a persistent group.
| -------- | -------- | -------- | -------- |
| netId | number | Yes| ID of the group to delete.|
-**Return value**
+**Error codes**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.getP2pGroups9+
@@ -1664,6 +1945,13 @@ Obtains information about all P2P groups. This API uses a promise to return the
| -------- | -------- |
| Promise< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)> > | Promise used to return the group information obtained.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## WifiP2pGroupInfo9+
@@ -1702,6 +1990,13 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo9)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information 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**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.setDeviceName9+
@@ -1721,12 +2016,13 @@ Sets the device name.
| -------- | -------- | -------- | -------- |
| devName | string | Yes| Device name to set.|
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('wifiStateChange')9+
@@ -1745,6 +2041,14 @@ Registers the WLAN state change events.
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | Yes| Callback invoked to return the WLAN state.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+
**WLAN states**
| **Value**| **Description**|
@@ -1772,6 +2076,14 @@ Unregisters the WLAN state change events.
| type | string | Yes| Event type. The value is **wifiStateChange**.|
| callback | Callback<number> | No| Callback for the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
+
**Example**
```js
import wifi from '@ohos.wifi';
@@ -1788,7 +2100,7 @@ Unregisters the WLAN state change events.
```
-## wifi.on('wifiConnectionChange')7+
+## wifi.on('wifiConnectionChange')9+
on(type: "wifiConnectionChange", callback: Callback<number>): void
@@ -1812,6 +2124,13 @@ Registers the WLAN connection state change events.
| 0 | Disconnected.|
| 1 | Connected.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.off('wifiConnectionChange')9+
@@ -1830,6 +2149,13 @@ Unregisters the WLAN connection state change events.
| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
| callback | Callback<number> | No| Callback for the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.on('wifiScanStateChange')9+
@@ -1855,6 +2181,13 @@ Registers the WLAN scan state change events.
| 0 | Scan failed.|
| 1 | Scan successful.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.off('wifiScanStateChange')9+
@@ -1873,6 +2206,13 @@ Unregisters the WLAN scan state change events.
| type | string | Yes| Event type. The value is **wifiScanStateChange**.|
| callback | Callback<number> | No| Callback for the WLAN scan state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.on('wifiRssiChange')9+
@@ -1891,6 +2231,13 @@ Registers the RSSI change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | Yes| Callback invoked to return the RSSI, in dBm.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.off('wifiRssiChange')9+
@@ -1909,6 +2256,13 @@ Unregisters the RSSI change events.
| type | string | Yes| Event type. The value is **wifiRssiChange**.|
| callback | Callback<number> | No| Callback for the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2501000 | Operation failed.|
## wifi.on('hotspotStateChange')9+
@@ -1936,6 +2290,13 @@ Registers the hotspot state change events.
| 2 | Activating|
| 3 | Deactivating|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.off('hotspotStateChange')9+
@@ -1954,6 +2315,13 @@ Unregisters the hotspot state change events.
| type | string | Yes| Event type. The value is **hotspotStateChange**.|
| callback | Callback<number> | No| Callback for the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2601000 | Operation failed.|
## wifi.on('p2pStateChange')9+
@@ -1982,6 +2350,14 @@ Registers the P2P state change events.
| 4 | Closing|
| 5 | Closed|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
+
## wifi.off('p2pStateChange')9+
off(type: "p2pStateChange", callback?: Callback<number>): void
@@ -1999,6 +2375,13 @@ Unregisters the P2P state change events.
| type | string | Yes| Event type. The value is **p2pStateChange**.|
| callback | Callback<number> | No| Callback for the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('p2pConnectionChange')9+
@@ -2017,6 +2400,13 @@ Registers the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | Yes| Callback invoked to return the P2P connection state.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.off('p2pConnectionChange')9+
@@ -2035,6 +2425,13 @@ Unregisters the P2P connection state change events.
| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo9)> | No| Callback for the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('p2pDeviceChange')9+
@@ -2053,6 +2450,13 @@ Registers the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | Yes| Callback invoked to return the P2P device state.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.off('p2pDeviceChange')9+
@@ -2071,6 +2475,13 @@ Unregisters the P2P device state change events.
| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
| callback | Callback<[WifiP2pDevice](#wifip2pdevice9)> | No| Callback for the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('p2pPeerDeviceChange')9+
@@ -2089,6 +2500,13 @@ Registers the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | Yes| Callback invoked to return the P2P peer device state.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.off('p2pPeerDeviceChange')9+
@@ -2107,6 +2525,13 @@ Unregisters the P2P peer device state change events.
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice9)> | No| Callback for the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('p2pPersistentGroupChange')9+
@@ -2125,6 +2550,13 @@ Registers the P2P persistent group state change events.
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback<void> | Yes| Callback invoked to return the P2P persistent group state.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.off('p2pPersistentGroupChange')9+
@@ -2143,6 +2575,13 @@ Unregisters the P2P persistent group state change events.
| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
| callback | Callback<void> | No| Callback for the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.on('p2pDiscoveryChange')9+
@@ -2168,6 +2607,13 @@ Registers the P2P device discovery state change events.
| 0 | Initial state.|
| 1 | Discovered.|
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
## wifi.off('p2pDiscoveryChange')9+
@@ -2185,3 +2631,11 @@ Unregisters the P2P device discovery state change events.
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
| callback | Callback<number> | No| Callback for the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
+
+| **Type**| **Description**|
+ | -------- | -------- |
+| 2801000 | Operation failed.|
diff --git a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md
index f024294ddbc393a57394a1ad20d2686d30060e52..9e274ab40504c4cb192d0863e774168a9f3db15e 100644
--- a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md
+++ b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md
@@ -1,11 +1,11 @@
-# WLAN Extension Interface
+# @ohos.wifiManagerExt (WLAN Extension)
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
@@ -14,9 +14,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.
@@ -24,16 +24,17 @@ Enables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+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.
@@ -41,18 +42,19 @@ Disables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
-**Return value**
+**Error codes**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+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,14 +62,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).
-## PowerModel
+| **Type**| **Description**|
+| -------- | -------- |
+| 2701000 | Operation failed.|
-Enumerates the power models.
+## PowerMode
+
+Enumerates the power modes.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
@@ -78,11 +87,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
@@ -90,16 +99,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
@@ -107,16 +123,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 model obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.|
+**Error codes**
-## wifiext.getPowerModel
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
-getPowerModel(callback: AsyncCallback<PowerModel>): void
+| **Type**| **Description**|
+| -------- | -------- |
+| 2701000 | Operation failed.|
-Obtains the power model. This API uses an asynchronous callback to return the result.
+## wifiext.getPowerMode9+
+
+getPowerMode(callback: AsyncCallback<PowerMode>): void
+
+Obtains the power mode. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_WIFI_INFO
@@ -124,16 +147,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).
-## wifiext.setPowerModel
+| **Type**| **Description**|
+| -------- | -------- |
+| 2701000 | Operation failed.|
-setPowerModel(model: PowerModel) : boolean;
+## wifiext.setPowerMode9+
- Sets the power model.
+setPowerMode(model: PowerMode) : boolean;
+
+ Sets the power mode.
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
@@ -141,12 +171,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.|
-**Return value**
+**Error codes**
+
+For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| 2701000 | Operation failed.|
diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md
index 789d602a1c02fb349f1461101102ac7ac34ff15a..7f4ba92a036d816de403527ccdf01dad5b4b9351 100644
--- a/en/application-dev/reference/errorcodes/Readme-EN.md
+++ b/en/application-dev/reference/errorcodes/Readme-EN.md
@@ -59,6 +59,7 @@
- [NFC Error Codes](errorcode-nfc.md)
- [RPC Error Codes](errorcode-rpc.md)
- [Bluetooth Error Codes](errorcode-bluetoothManager.md)
+ - [Wi-Fi Error Codes](errorcode-wifi.md)
- Basic Features
- [Accessibility Error Codes](errorcode-accessibility.md)
- [FaultLogger Error Codes](errorcode-faultlogger.md)
diff --git a/en/application-dev/reference/errorcodes/errorcode-wifi.md b/en/application-dev/reference/errorcodes/errorcode-wifi.md
new file mode 100644
index 0000000000000000000000000000000000000000..1d7443e49c03cc29f89c5b5d426eda752e7c36a7
--- /dev/null
+++ b/en/application-dev/reference/errorcodes/errorcode-wifi.md
@@ -0,0 +1,124 @@
+# Wi-Fi Error Codes
+
+## 2401000 STA Internal Error
+
+**Error Message**
+
+Operation failed.
+
+**Description**
+
+An error occurs when the Wi-Fi service performs an operation related to the station (STA).
+
+**Possible Causes**
+
+1. Communication between the Wi-Fi service and the STA failed.
+2. The Wi-Fi chip communication is abnormal.
+3. An unknown error has occurred.
+
+**Solution**
+
+1. Disable and then enable the Wi-Fi function again.
+2. If the error persists, restart the device.
+
+## 2501000 STA Internal Error
+
+**Error Message**
+
+Operation failed.
+
+**Description**
+
+An error occurs when the Wi-Fi service performs a STA-related operation.
+
+**Possible Causes**
+
+1. Communication between the Wi-Fi service and the STA failed.
+2. The Wi-Fi chip communication is abnormal.
+3. An unknown error has occurred.
+
+**Solution**
+
+1. Disable and then enable the Wi-Fi function again.
+2. If the error persists, restart the device.
+
+## 2501001 STA Disabled
+
+**Error Message**
+
+Wifi is closed.
+
+**Description**
+
+The Wi-Fi STA function is disabled.
+
+**Possible Causes**
+
+The Wi-Fi function is disabled.
+
+**Solution**
+
+Enable the Wi-Fi function.
+
+## 2601000 Hotspot Module Error
+
+**Error Message**
+
+Operation failed.
+
+**Description**
+
+An error occurs when the Wi-Fi service performs a hotspot-related operation.
+
+**Possible Causes**
+
+1. Communication between the Wi-Fi service and the hotspot failed.
+2. The Wi-Fi chip communication is abnormal.
+3. An unknown error has occurred.
+
+**Solution**
+
+1. Disable and then enable the hotspot again.
+2. If the error persists, restart the device.
+
+## 2701000 AP Extension Module Error
+
+**Error Message**
+
+Operation failed.
+
+**Description**
+
+An error occurs when the Wi-Fi service performs a hotspot-related operation.
+
+**Possible Causes**
+
+1. Communication between the Wi-Fi service and the hotspot failed.
+2. The Wi-Fi chip communication is abnormal.
+3. An unknown error has occurred.
+
+**Solution**
+
+1. Disable and then enable the hotspot again.
+2. If the error persists, restart the device.
+
+## 2801000 P2P Module Error
+
+**Error Message**
+
+Operation failed.
+
+**Description**
+
+An error occurs when the Wi-Fi service performs a P2P-related operation.
+
+**Possible Causes**
+
+1. Communication with the Wi-Fi service failed.
+2. The Wi-Fi chip communication is abnormal.
+3. An unknown error has occurred.
+
+**Solution**
+
+1. Disable and then enable the Wi-Fi function again.
+2. If the error persists, restart the device.