Hi,
The esp_wifi_set_country takes const wifi_country_t *country as argument.
This seems a little bit odd because the caller needs to set all fields
of wifi_country_t.
I thought the schan/nchan/max_tx_power fields are fixed and determinate by
the cc fields. Why not just take cc fields as argument. (or maybe just cc and policy fields).
In additional, I'm wondering why not using enum for the cc field instead of
char. It's easier to find the supported country code by enum instead of guessing
the supported char field for cc.
Why not make esp_wifi_set_country take only the cc code?
-
- Posts: 9719
- Joined: Thu Nov 26, 2015 4:08 am
Re: Why not make esp_wifi_set_country take only the cc code?
Because this would imply having a database of country codes and parameters that gets linked within every project compiled with ESP-IDF. The merits and disadvantages of having such a database can be discussed, but at the moment it is not implemented so you need to supply all parameters by hand.
Re: Why not make esp_wifi_set_country take only the cc code?
Is there any good reference for the settings of each count code?
i.e. cc/schan/nchan/max_tx_power fields
i.e. cc/schan/nchan/max_tx_power fields
-
- Posts: 9719
- Joined: Thu Nov 26, 2015 4:08 am
Re: Why not make esp_wifi_set_country take only the cc code?
You could look at e.g. the database the Linux people maintain.
Re: Why not make esp_wifi_set_country take only the cc code?
This is an old thread but the information here is useful to me. Please could you help me check my understanding as I think the current situation has changed since the above answers.
Now there is a 'esp_wifi_set_country_code' API and esp_wifi.h contains a warning to use esp_wifi_set_country_code instead of esp_wifi_set_country because esp_wifi_set_country_code validates the per-country rules. I think this means that ESP-IDF now uses a database of the regulatory rules for each country code.
Is there any info for the database that ESP-IDF uses? Can I assume safely that it is the same as the database documented by the linux kernel project that Sprite linked above? https://git.kernel.org/pub/scm/linux/ke ... ree/db.txt
Now there is a 'esp_wifi_set_country_code' API and esp_wifi.h contains a warning to use esp_wifi_set_country_code instead of esp_wifi_set_country because esp_wifi_set_country_code validates the per-country rules. I think this means that ESP-IDF now uses a database of the regulatory rules for each country code.
Is there any info for the database that ESP-IDF uses? Can I assume safely that it is the same as the database documented by the linux kernel project that Sprite linked above? https://git.kernel.org/pub/scm/linux/ke ... ree/db.txt