Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIFI_COUNTRY configuration key for country-specific Wi-Fi #83

Merged
merged 5 commits into from
Feb 14, 2024

Conversation

nplanel
Copy link
Contributor

@nplanel nplanel commented Feb 9, 2024

WIFI_COUNTRY configuration key for country-specific Wi-Fi initialisation using the ISO 3166-1 alpha-2 country code

Supported list is defined here

configurator PR

romemul/config.c Show resolved Hide resolved
char *country_entry = find_entry("WIFI_COUNTRY")->value;
if (strlen(country_entry) == 2) {
country = CYW43_COUNTRY(country_entry[0], country_entry[1], 0);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. To ensure consistency, it's important to incorporate a few additional considerations:

  1. Default Value Handling: If the entry is NULL or empty, it must default to 'XX', which serves as the alias for COUNTRY_WORLDWIDE. This step is crucial to ensure seamless upgrades from previous versions without causing disruptions.

  2. Compliance with Standards: The value must adhere to the ISO-3166-alpha-2 standard and be compatible with the CYW43 library, requiring two uppercase letters. Should the value not meet this criterion, it must revert to 'XX'.

  3. Country List Limitation: The list of countries is a subset of the full ISO-3166-alpha-2 list. Prior validation is necessary to handle cases where the library might not recognize a country code. If the library defaults to the 'XX' country code (worldwide) upon encountering an unrecognized country, we should proactively filter the input against the allowed country list in the library, defaulting to 'XX' for any unmatched entries.

While these are the primary validations I've identified, additional checks for any other parameter values are encouraged. The guiding principle here is to design these validations as though the user interface might not perform them— a likely scenario, most users will enjoy a good experience with the default XX country worldwide value.

romemul/config.c Show resolved Hide resolved
@diegoparrilla diegoparrilla merged commit 1a8ebfb into sidecartridge:main Feb 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants