docs: update wifi country code docs.

This commit is contained in:
muhaidong 2022-09-12 19:43:59 +08:00
parent 73912c07ce
commit 329d978c89

View File

@ -1290,105 +1290,111 @@ When to Use LR
*************************
The general conditions for using LR are:
- Both the AP and station are devices.
- Long distance WiFi connection and data transmission is required.
- Both the AP and station are Espressif devices.
- Long distance Wi-Fi connection and data transmission is required.
- Data throughput requirements are very small, such as remote device control, etc.
Wi-Fi Country Code
+++++++++++++++++++++++++
Call esp_wifi_set_country() to set the country info.
The table below describes the fields in detail, please consult local 2.4GHz RF operating regulations before configuring these fields.
Call :cpp:func:`esp_wifi_set_country()` to set the country info. The table below describes the fields in detail, please consult local 2.4 GHz RF operating regulations before configuring these fields.
+------------------+-----------------------------------------------------------------------------------+
| Field | Description |
+==================+===================================================================================+
| cc[3] | Country code string, this attributes identify the country or noncountry entity |
| | in which the station/AP is operating. If it's a country, the first two |
| | octets of this string is the two character country info as described in document |
| | ISO/IEC3166-1. The third octect is one of the following: |
| | |
| | - an ASCII space character, if the regulations under which the station/AP is |
| | operating encompass all environments for the current frequency band in the |
| | country |
| | - an ASCII 'O' character if the regulations under which the station/AP is |
| | operating are for an outdoor environment only, or |
| | - an ASCII 'I' character if the regulations under which the station/AP is |
| | operating are for an indoor environment only. |
| | - an ASCII 'X' character if the station/AP is operating under a noncountry |
| | entity. The first two octets of the noncountry entity is two ASSCII 'XX' |
| | characters. |
| | - the binary representation of the Operating Class table number currently in use.|
| | Refer 802.11-2012 Annex E. |
| | |
+------------------+-----------------------------------------------------------------------------------+
| schan | Start channel, it's the minimum channel number of the regulations under which the |
| | station/AP can operate. |
| | |
+------------------+-----------------------------------------------------------------------------------+
| snum | Total channel number of the regulations, e.g. if the schan=1, nchan=13, it means |
| | the station/AP can send data from channel 1 to 13. |
| | |
+------------------+-----------------------------------------------------------------------------------+
| policy | Country policy, this field control which country info will be used if the |
| | configured country info is conflict with the connected AP's. More description |
| | about policy is provided in following section. |
| | |
+------------------+-----------------------------------------------------------------------------------+
.. list-table::
:header-rows: 1
:widths: 15 55
The default country info is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}, if the WiFi Mode is station/AP coexist mode, they share the same configured country info. Sometimes, the country info of AP, to which the station is connected, is different from the country info of configured. For example, the configured station has country info {.cc="JP", .schan=1, .nchan=14, policy=WIFI_COUNTRY_POLICY_AUTO}, but the connected AP has country info {.cc="CN", .schan=1, .nchan=13}, then country info of connected AP's is used.
Following table depicts which country info is used in different WiFi Mode and different country policy, also describe the impact to active scan.
* - Field
- Description
* - cc[3]
- Country code string, this attributes identify the country or noncountry entity in which the station/AP is operating. If its a country, the first two octets of this string is the two character country info as described in document ISO/IEC3166-1. The third octect is one of the following:
- an ASCII space character, if the regulations under which the station/AP is operating encompass all environments for the current frequency band in the country.
- an ASCII O character if the regulations under which the station/AP is operating are for an outdoor environment only.
- an ASCII I character if the regulations under which the station/AP is operating are for an indoor environment only.
- an ASCII X character if the station/AP is operating under a noncountry entity. The first two octets of the noncountry entity is two ASCII XX characters.
- the binary representation of the Operating Class table number currently in use. Refer to Annex E, IEEE Std 802.11-2020.
* - schan
- Start channel, its the minimum channel number of the regulations under which the station/AP can operate.
* - nchan
- Total number of channels as per the regulations, e.g. if the schan=1, nchan=13, it means the station/AP can send data from channel 1 to 13.
* - policy
- Country policy, this field control which country info will be used if the configured country info is conflict with the connected APs. More description about policy is provided in following section.
The default country info is::
wifi_country_t config = {
.cc = "CN",
.schan = 1,
.nchan = 13,
.policy = WIFI_COUNTRY_POLICY_AUTO,
};
If the Wi-Fi Mode is station/AP coexist mode, they share the same configured country info. Sometimes, the country info of AP, to which the station is connected, is different from the country info of configured. For example, the configured station has country info::
wifi_country_t config = {
.cc = "JP",
.schan = 1,
.nchan = 14,
.policy = WIFI_COUNTRY_POLICY_AUTO,
};
but the connected AP has country info::
wifi_country_t config = {
.cc = "CN",
.schan = 1,
.nchan = 13,
};
then country info of connected AP's is used.
Following table depicts which country info is used in different Wi-Fi Mode and different country policy, also describe the impact to active scan.
.. list-table::
:header-rows: 1
:widths: 15 15 35
* - Wi-Fi Mode
- Policy
- Description
* - Station
- WIFI_COUNTRY_POLICY_AUTO
- If the connected AP has country IE in its beacon, the country info equals to the country info in beacon. Otherwise, use the default country info.
For scan:
Use active scan from 1 to 11 and use passive scan from 12 to 14.
Always keep in mind that if an AP with hidden SSID and station is set to a passive scan channel, the passive scan will not find it. In other words, if the application hopes to find the AP with hidden SSID in every channel, the policy of country info should be configured to WIFI_COUNTRY_POLICY_MANUAL.
* - Station
- WIFI_COUNTRY_POLICY_MANUAL
- Always use the configured country info.
For scan:
Use active scan from schan to schan+nchan-1.
* - AP
- WIFI_COUNTRY_POLICY_AUTO
- Always use the configured country info.
* - AP
- WIFI_COUNTRY_POLICY_MANUAL
- Always use the configured country info.
* - Station/AP-coexistence
- WIFI_COUNTRY_POLICY_AUTO
- Station: Same as station mode with policy WIFI_COUNTRY_POLICY_AUTO.
AP: If the station does not connect to any external AP, the AP uses the configured country info. If the station connects to an external AP, the AP has the same country info as the station.
* - Station/AP-coexistence
- WIFI_COUNTRY_POLICY_MANUAL
- Station: Same as station mode with policy WIFI_COUNTRY_POLICY_MANUAL.
AP: Same as AP mode with policy WIFI_COUNTRY_POLICY_MANUAL.
+-----------+----------------------------+----------------------------------------------------------------+
| WiFi Mode | Policy | Description |
+===========+============================+================================================================+
| Station | WIFI_COUNTRY_POLICY_AUTO | If the connected AP has country IE in its beacon, the country |
| | | info equals to the country info in beacon, otherwise, use |
| | | default country info. |
| | | |
| | | For scan: |
| | | |
| | | - before the station connects to the AP, scans channel |
| | | "schan" to "min(11, schan+nchan-1)" with active scan and |
| | | channel min(12, schan+nchan)" to 14 with passive scan. |
| | | E.g. if the used country info is |
| | | {.cc="CN", .schan=1, .nchan=6} then 1 to 6 is active scan |
| | | and 7 to 14 is passive scan |
| | | If the used country info is |
| | | {.cc="CN", .schan=1, .nchan=12} then 1 to 11 is active scan |
| | | and 12 to 14 is passive scan |
| | | |
| | | - after the station connects to the AP, scans channel |
| | | "schan" to "schan+nchan-1" with active scan and channel |
| | | "schan+nchan" to 14 with passive scan |
| | | |
| | | Always keep in mind that if if a AP with with hidden SSID |
| | | is set to a passive scan channel, the passive scan will not |
| | | find it. In other words, if the application hopes to find the |
| | | AP with hidden SSID in every channel, the policy of |
| | | country info should be configured to |
| | | WIFI_COUNTRY_POLICY_MANUAL. |
| | | |
+-----------+----------------------------+----------------------------------------------------------------+
| Station | WIFI_COUNTRY_POLICY_MANUAL | Always use the configured country info |
| | | |
| | | For scan, scans channel "schan" to "schan+nchan-1" with active |
| | | scan |
| | | |
+-----------+----------------------------+----------------------------------------------------------------+
| AP | WIFI_COUNTRY_POLICY_AUTO | Always use the configured country info |
| | | |
+-----------+----------------------------+----------------------------------------------------------------+
| AP | WIFI_COUNTRY_POLICY_MANUAL | Always use the configured country info |
| | | |
+-----------+----------------------------+----------------------------------------------------------------+
| Station/AP| WIFI_COUNTRY_POLICY_AUTO | If the station doesn't connects to any AP, the AP use the |
| | | configured country info. |
| coexit | | If the station connects to an AP, the AP has the same |
| | | country info as the station. |
| | | |
| | | Same as station mode with policy WIFI_COUNTRY_POLICY_AUTO |
+-----------+----------------------------+----------------------------------------------------------------+
Home Channel
*************************