pub unsafe extern "C" fn esp_wifi_set_country_code(
    country: *const i8,
    ieee80211d_enabled: bool
) -> i32
Expand description

@brief configure country

@attention 1. When ieee80211d_enabled, the country info of the AP to which the station is connected is used. E.g. if the configured country is US and the country info of the AP to which the station is connected is JP then the country info that will be used is JP. If the station disconnected from the AP the country info is set back to the country info of the station automatically, US in the example. @attention 2. When ieee80211d_enabled is disabled, then the configured country info is used always. @attention 3. When the country info is changed because of configuration or because the station connects to a different external AP, the country IE in probe response/beacon of the soft-AP is also changed. @attention 4. The country configuration is stored into flash. @attention 5. When this API is called, the PHY init data will switch to the PHY init data type corresponding to the country info. @attention 6. Supported country codes are “01”(world safe mode) “AT”,“AU”,“BE”,“BG”,“BR”, “CA”,“CH”,“CN”,“CY”,“CZ”,“DE”,“DK”,“EE”,“ES”,“FI”,“FR”,“GB”,“GR”,“HK”,“HR”,“HU”, “IE”,“IN”,“IS”,“IT”,“JP”,“KR”,“LI”,“LT”,“LU”,“LV”,“MT”,“MX”,“NL”,“NO”,“NZ”,“PL”,“PT”, “RO”,“SE”,“SI”,“SK”,“TW”,“US”

@attention 7. When country code “01” (world safe mode) is set, SoftAP mode won’t contain country IE. @attention 8. The default country is “01” (world safe mode) and ieee80211d_enabled is TRUE. @attention 9. The third octet of country code string is one of the following: ’ ’, ‘O’, ‘I’, ‘X’, otherwise it is considered as ’ ’.

@param country the configured country ISO code @param ieee80211d_enabled 802.11d is enabled or not


  • ESP_OK: succeed
  • ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
  • ESP_ERR_INVALID_ARG: invalid argument