Why not make esp_wifi_set_country take only the cc code?

axellin
Posts: 48
Joined: Mon Sep 17, 2018 9:09 am

Why not make esp_wifi_set_country take only the cc code?

Postby axellin » Mon Dec 09, 2019 9:10 am

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.

ESP_Sprite
Posts: 3260
Joined: Thu Nov 26, 2015 4:08 am

Re: Why not make esp_wifi_set_country take only the cc code?

Postby ESP_Sprite » Tue Dec 10, 2019 3:54 am

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.

axellin
Posts: 48
Joined: Mon Sep 17, 2018 9:09 am

Re: Why not make esp_wifi_set_country take only the cc code?

Postby axellin » Tue Dec 10, 2019 5:39 am

Is there any good reference for the settings of each count code?
i.e. cc/schan/nchan/max_tx_power fields

ESP_Sprite
Posts: 3260
Joined: Thu Nov 26, 2015 4:08 am

Re: Why not make esp_wifi_set_country take only the cc code?

Postby ESP_Sprite » Wed Dec 11, 2019 3:02 am

You could look at e.g. the database the Linux people maintain.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 43 guests