diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index 09034ce9408058dacd486db08869deaa054ecf29..7041eaef2788d011c6e953e7657d2d4b38a2100e 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -387,7 +387,7 @@ Checks whether an app account allows application data synchronization. This meth ### setAccountCredential -setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback<void>): void +setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void Sets a credential for an app account. This method uses an asynchronous callback to return the result. diff --git a/en/application-dev/reference/apis/js-apis-distributed-account.md b/en/application-dev/reference/apis/js-apis-distributed-account.md index ee8b2f2a0aa057e168de6286e9624924d20d4f77..ddf747f7566d06b48c2d13f99f187b21f997b467 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-account.md +++ b/en/application-dev/reference/apis/js-apis-distributed-account.md @@ -1,306 +1,149 @@ -# Distributed Account Management +# Distributed Account Management ->![](../../public_sys-resources/icon-note.gif) **NOTE** -> ->The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -## Modules to Import + +## Modules to Import ``` import account_distributedAccount from '@ohos.account.distributedAccount'; ``` -## System Capabilities +## System Capability SystemCapability.Account.OsAccount -## account\_distributedAccount.getDistributedAccountAbility +## account_distributedAccount.getDistributedAccountAbility + +getDistributedAccountAbility(): DistributedAccountAbility -getDistributedAccountAbility\(\): DistributedAccountAbility +Obtains a **DistributedAccountAbility** instance. -Obtains a **DistributedAccountAbility** instance. +- Return value + | Type| Description| + | -------- | -------- | + | [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.| -- Return values +- Example + ``` + const accountAbility = account_distributedAccount.getDistributedAccountAbility(); + ``` - - - - - - - - - -

Type

-

Description

-

DistributedAccountAbility

-

Instance that provides methods for querying and updating the login state of a distributed account.

-
+## DistributedAccountAbility -- Example +Provides methods for querying and updating the login state of a distributed account. You must obtain a **DistributedAccountAbility** instance first. - ``` - const accountAbility = account_distributedAccount.getDistributedAccountAbility(); - ``` +### queryOsAccountDistributedInfo +queryOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): void -## DistributedAccountAbility +Obtains distributed account information. This method uses an asynchronous callback to return the result. -Provides methods for querying and updating the login state of a distributed account. \(You must obtain a **DistributedAccountAbility** instance first.\) +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications) -### queryOsAccountDistributedInfo +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<[DistributedInfo](#distributedinfo)> | Yes| Callback invoked to return the distributed account information obtained.| -queryOsAccountDistributedInfo\(callback: AsyncCallback\): void +- Example + ``` + const accountAbility = account_distributedAccount.getDistributedAccountAbility(); + accountAbility.queryOsAccountDistributedInfo((err, data) => { + console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); + console.log('Query account info name: ' + data.name); + console.log('Query account info id: ' + data.id); + }); + ``` -Obtains distributed account information. This method uses an asynchronous callback to return the result. +### queryOsAccountDistributedInfo -The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS or ohos.permission.DISTRIBUTED\_DATASYNC** permission is required. This permission is intended for system applications only. - -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

callback

-

AsyncCallback<DistributedInfo>

-

Yes

-

Callback invoked to return the distributed account information.

-
- -- Example - - ``` - const accountAbility = account_distributedAccount.getDistributedAccountAbility(); - accountAbility.queryOsAccountDistributedInfo((err, data) => { - console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); - console.log('Query account info name: ' + data.name); - console.log('Query account info id: ' + data.id); - }); - ``` - - -### queryOsAccountDistributedInfo - -queryOsAccountDistributedInfo\(\): Promise +queryOsAccountDistributedInfo(): Promise<DistributedInfo> Obtains distributed account information. This method uses a promise to return the result asynchronously. -The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS or ohos.permission.DISTRIBUTED\_DATASYNC** permission is required. This permission is intended for system applications only. +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications) -- Return values +- Return value + | Type| Description| + | -------- | -------- | + | Promise<[DistributedInfo](#distributedinfo)> | Promise used to return the distributed account information obtained.| - - - - - - - - - -

Type

-

Description

-

Promise<DistributedInfo>

-

Promise used to return the result.

-
+- Example + ``` + const accountAbility = account_distributedAccount.getDistributedAccountAbility(); + accountAbility.queryOsAccountDistributedInfo().then((data) => { + console.log('Query account info name: ' + data.name); + console.log('Query account info id: ' + data.id); + }).catch((err) => { + console.log("queryOsAccountDistributedInfoerr: " + JSON.stringify(err)); + }); + ``` -- Example +### updateOsAccountDistributedInfo - ``` - const accountAbility = account_distributedAccount.getDistributedAccountAbility(); - accountAbility.queryOsAccountDistributedInfo().then((data) => { - console.log('Query account info name: ' + data.name); - console.log('Query account info id: ' + data.id); - }).catch((err) => { - console.log("queryOsAccountDistributedInfoerr: " + JSON.stringify(err)); - }); - ``` +updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback<void>): void +Updates distributed account information. This method uses an asynchronous callback to return the result. -### updateOsAccountDistributedInfo +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications) -updateOsAccountDistributedInfo\(accountInfo: DistributedInfo, callback: AsyncCallback\): void +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information.| + | callback | AsyncCallback<void> | Yes| Callback invoked when the distributed account information is updated.| -Updates distributed account information. This method uses an asynchronous callback to return the result. +- Example + ``` + const accountAbility = account_distributedAccount.getDistributedAccountAbility(); + let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; + accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => { + console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); + }); + ``` + +### updateOsAccountDistributedInfo -The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS** permission is required. This permission is intended for system applications only. - -- Parameters - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

accountInfo

-

DistributedInfo

-

Yes

-

Distributed account information.

-

callback

-

AsyncCallback<void>

-

Yes

-

Callback invoked when the distributed account information is updated.

-
- -- Example - - ``` - const accountAbility = account_distributedAccount.getDistributedAccountAbility(); - let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; - accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => { - console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); - }); - ``` - - -### updateOsAccountDistributedInfo - -updateOsAccountDistributedInfo\(accountInfo: DistributedInfo\): Promise +updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void> Updates distributed account information. This method uses a promise to return the result asynchronously. -The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS** permission is required. This permission is intended for system applications only. - -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

accountInfo

-

DistributedInfo

-

Yes

-

Distributed account information.

-
- -- Return values - - - - - - - - - - -

Type

-

Description

-

Promise<void>

-

Promise used to return the result.

-
- -- Example - - ``` - const accountAbility = account_distributedAccount.getDistributedAccountAbility(); - let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; - accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => { - console.log('updateOsAccountDistributedInfo Success'); - }).catch((err) => { - console.log("updateOsAccountDistributedInfo err: " + JSON.stringify(err)); - }); - ``` - - -## DistributedInfo +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications) + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information.| + +- Return value + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result.| + +- Example + ``` + const accountAbility = account_distributedAccount.getDistributedAccountAbility(); + let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; + accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => { + console.log('updateOsAccountDistributedInfo Success'); + }).catch((err) => { + console.log("updateOsAccountDistributedInfo err: " + JSON.stringify(err)); + }); + ``` + + +## DistributedInfo Defines distributed OS account information. - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

name

-

string

-

Yes

-

Name of a distributed account. It must be a non-null string.

-

id

-

string

-

Yes

-

UID of a distributed account. It must be a non-null string.

-

event

-

string

-

Yes

-

Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:

-
  • Ohos.account.event.LOGIN
  • Ohos.account.event.LOGOUT
  • Ohos.account.event.TOKEN_INVALID
  • Ohos.account.event.LOGOFF
-

scalableData

-

object

-

No

-

Extended information about a distributed account. Customized information is passed in key-value pairs.

-

Note: This parameter is reserved and not used in query and update methods.

-
+ +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| name | string | Yes| Name of a distributed account. It must be a non-null string.| +| id | string | Yes| UID of a distributed account. It must be a non-null string.| +| event | string | Yes| Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:
- Ohos.account.event.LOGIN
- Ohos.account.event.LOGOUT
- Ohos.account.event.TOKEN_INVALID
- Ohos.account.event.LOGOFF | +| scalableData | object | No| Extended information about a distributed account. Customized information is passed in key-value pairs.
Note: This parameter is reserved and not used in query and update methods.| diff --git a/en/application-dev/reference/apis/js-apis-wifi.md b/en/application-dev/reference/apis/js-apis-wifi.md index 2070b5438c925d2b97bc0ac4f9321d0879388afa..c4d8d105f13c4214912120eb9fc1659276ba07be 100644 --- a/en/application-dev/reference/apis/js-apis-wifi.md +++ b/en/application-dev/reference/apis/js-apis-wifi.md @@ -147,11 +147,11 @@ Enumerates the WLAN security types. | **Name**| **Default Value**| **Description**| | -------- | -------- | -------- | -| WIFI_SEC_TYPE_INVALID | 0 | Invalid security type | -| WIFI_SEC_TYPE_OPEN | 1 | Open security type | -| WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP) | -| WIFI_SEC_TYPE_PSK | 3 | Pre-shared key (PSK) | -| WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE) | +| WIFI_SEC_TYPE_INVALID | 0 | Invalid security type| +| WIFI_SEC_TYPE_OPEN | 1 | Open security type| +| WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP)| +| WIFI_SEC_TYPE_PSK | 3 | Pre-shared key (PSK)| +| WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE)| ## wifi.addUntrustedConfig7+ @@ -182,11 +182,11 @@ Represents the WLAN configuration. | **Name**| **Type**| **Readable/Writable**| **Description**| | -------- | -------- | -------- | -------- | -| ssid | string | Read only| Hotspot SSID, in UTF-8 format.| +| ssid | string | Read only| Hotspot service set identifier (SSID), in UTF-8 format.| | bssid | string | Read only| BSSID of the hotspot.| | preSharedKey | string | Read only| Private key of the hotspot.| | isHiddenSsid | boolean | Read only| Whether to hide the network.| -| securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type. | +| securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type| ## wifi.addUntrustedConfig7+ @@ -335,7 +335,7 @@ Represents the WLAN connection information. | Name| Type| Readable/Writable| Description| | -------- | -------- | -------- | -------- | -| ssid | string | Read only| SSID of the hotspot, in UTF-8 format.| +| ssid | string | Read only| Hotspot SSID, in UTF-8 format.| | bssid | string | Read only| BSSID of the hotspot.| | rssi | number | Read only| Signal strength of the hotspot, in dBm.| | band | number | Read only| Frequency band of the WLAN AP.| @@ -443,13 +443,13 @@ Represents IP information. | **Name**| **Type**| **Readable/Writable**| **Description**| | -------- | -------- | -------- | -------- | -| ipAddress | number | Read only| IP address. | -| gateway | number | Read only| Gateway. | -| netmask | number | Read only| Subnet mask. | -| primaryDns | number | Read only| IP address of the preferred DNS server. | -| secondDns | number | Read only| IP address of the alternate DNS server. | -| serverIp | number | Read only| IP address of the DHCP server. | -| leaseDuration | number | Read only| Lease duration of the IP address. | +| ipAddress | number | Read only| IP address| +| gateway | number | Read only| Gateway| +| netmask | number | Read only| Subnet mask| +| primaryDns | number | Read only| IP address of the preferred DNS server| +| secondDns | number | Read only| IP address of the alternate DNS server| +| serverIp | number | Read only| IP address of the DHCP server| +| leaseDuration | number | Read only| Lease duration of the IP address| ## wifi.getCountryCode7+ @@ -589,7 +589,7 @@ Represents the P2P device information. | deviceAddress | string | Read only| MAC address of the device.| | primaryDeviceType | string | Read only| Type of the primary device.| | deviceStatus | [P2pDeviceStatus](#P2pDeviceStatus) | Read only| Device status.| -| groupCapabilitys | number | Read only| Group capabilities.| +| groupCapabilities | number | Read only| Group capabilities.| ## P2pDeviceStatus8+ @@ -1046,7 +1046,7 @@ Registers the hotspot state change events. ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.AP + SystemCapability.Communication.WiFi.AP.Core - Parameters | **Name**| **Type**| **Mandatory**| **Description**| @@ -1073,7 +1073,7 @@ Unregisters the hotspot state change events. ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.AP + SystemCapability.Communication.WiFi.AP.Core - Parameters | **Name**| **Type**| **Mandatory**| **Description**| @@ -1239,7 +1239,7 @@ Unregisters the P2P peer device state change events. | **Name**| **Type**| **Mandatory**| **Description**| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| - | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| + | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.| ## wifi.on('p2pPersistentGroupChange')8+ diff --git a/en/application-dev/reference/apis/js-apis-wifiext.md b/en/application-dev/reference/apis/js-apis-wifiext.md index d3b1c26cd6eddc26f04dd3a5dc64c885f96ca9ca..2e2e9394b2a4361fa8adad332c459d4ff33a4e4d 100644 --- a/en/application-dev/reference/apis/js-apis-wifiext.md +++ b/en/application-dev/reference/apis/js-apis-wifiext.md @@ -1,7 +1,7 @@ # WLAN > ![icon-note.gif](public_sys-resources/icon-note.gif) **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 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. @@ -21,7 +21,7 @@ Enables the WLAN hotspot. ohos.permission.MANAGE_WIFI_HOTSPOT_EXT - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Return value | **Type**| **Description**| @@ -39,7 +39,7 @@ Disables the WLAN hotspot. ohos.permission.MANAGE_WIFI_HOTSPOT_EXT - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Return value | **Type**| **Description**| @@ -57,7 +57,7 @@ Obtains the supported power models. The method uses a promise to return the resu ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Return value | Type| Description| @@ -86,7 +86,7 @@ Obtains the supported power models. The method uses an asynchronous callback to ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Parameters | Name| Type| Mandatory| Description| @@ -104,7 +104,7 @@ Obtains the power model. The method uses a promise to return the result. ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Return value | Type| Description| @@ -122,7 +122,7 @@ Obtains the power model. The method uses an asynchronous callback to return the ohos.permission.GET_WIFI_INFO - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Parameters | Name| Type| Mandatory| Description| @@ -140,7 +140,7 @@ setPowerModel(model: PowerModel) : boolean; ohos.permission.MANAGE_WIFI_HOTSPOT_EXT - System capability: - SystemCapability.Communication.WiFi.HotspotExt + SystemCapability.Communication.WiFi.AP.Extension - Parameters | Name| Type| Mandatory| Description|