From 7cab7042dce742080538981d743e8cf51536493c Mon Sep 17 00:00:00 2001 From: fad99daf Date: Wed, 15 Jul 2026 18:24:51 +0800 Subject: [PATCH] fix(iot-client): rename US region to AZ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The US West (Oregon) data center's region string and token prefix is AZ, not US. Rename the enum member US→AZ, update iot_region_to_string(), host macros IOT_US_HOST/IOT_US_PRE_HOST → IOT_AZ_HOST/IOT_AZ_PRE_HOST, and all references in DNS resolution, onboarding, examples, and docs. Enum ordinal (1) is preserved so NVS-stored region values are unaffected. --- CHANGELOG.md | 10 ++++++++++ docs-site/docs/reference/iot-client.md | 2 +- examples/esp-idf/ota-demo/main/app_config.h | 2 +- .../pair/scan-by-app/scan_by_app_pair_demo_main.c | 2 +- modules/iot-client/include/iot_client.h | 4 ++-- modules/iot-client/src/iot_client.c | 2 +- modules/iot-client/src/iot_config_defaults.h | 4 ++-- modules/iot-client/src/iot_dns.c | 8 ++++---- modules/iot-client/src/iot_on_boarding.c | 8 ++++---- 9 files changed, 26 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee1035..3fe2e83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +- iot-client — US region renamed to AZ(#7). + - The IoT DNS region string and token prefix for the US West (Oregon) data + center is `AZ`, not `US`. The enum member `US` is renamed to `AZ`, + `iot_region_to_string()` now returns `"AZ"`, and the host macros + `IOT_US_HOST` / `IOT_US_PRE_HOST` are renamed to `IOT_AZ_HOST` / + `IOT_AZ_PRE_HOST` (values unchanged). NVS-stored region integers are + unaffected (enum ordinal 1 is preserved). + ## [0.3.0] - 2026-07-13 ### Added diff --git a/docs-site/docs/reference/iot-client.md b/docs-site/docs/reference/iot-client.md index eac6103..481e062 100644 --- a/docs-site/docs/reference/iot-client.md +++ b/docs-site/docs/reference/iot-client.md @@ -45,7 +45,7 @@ sidebar_position: 3 | 值 | 名称 | 说明 | |----|------|------| | 0 | `AY` | 中国(上海)| -| 1 | `US` | 美国西部(俄勒冈) | +| 1 | `AZ` | 美国西部(俄勒冈) | | 2 | `UEAZ` | 美国东部(佛吉尼亚) | | 3 | `EU` | 欧洲(法兰克福) | | 4 | `WEAZ` | 欧洲西部(荷兰埃姆斯哈文) | diff --git a/examples/esp-idf/ota-demo/main/app_config.h b/examples/esp-idf/ota-demo/main/app_config.h index 445dab9..75a95d8 100644 --- a/examples/esp-idf/ota-demo/main/app_config.h +++ b/examples/esp-idf/ota-demo/main/app_config.h @@ -10,7 +10,7 @@ #define DEFAULT_SECRET_KEY "xxxxxxxxxxxxxxxx" #define DEFAULT_LOCAL_KEY "xxxxxxxxxxxxxxxx" -/* Device region: AY, US, EU, UEAZ, WEAZ, IN, SG */ +/* Device region: AY, AZ, EU, UEAZ, WEAZ, IN, SG */ #define DEFAULT_REGION AY #define DEFAULT_ENV PROD diff --git a/examples/posix/pair/scan-by-app/scan_by_app_pair_demo_main.c b/examples/posix/pair/scan-by-app/scan_by_app_pair_demo_main.c index ab5e878..cf4fb87 100644 --- a/examples/posix/pair/scan-by-app/scan_by_app_pair_demo_main.c +++ b/examples/posix/pair/scan-by-app/scan_by_app_pair_demo_main.c @@ -27,7 +27,7 @@ static void print_usage(const char *prog) printf(" %s Token pairing (activate directly)\n", prog); printf("\n"); printf("Token format: [region:2][activation_token][secret:4]\n"); - printf(" region : AY, US, UE, EU, WE, IN, SG\n"); + printf(" region : AY, AZ, UE, EU, WE, IN, SG\n"); printf(" Example : AYabcdef12340000\n"); } diff --git a/modules/iot-client/include/iot_client.h b/modules/iot-client/include/iot_client.h index ce923f0..380744a 100644 --- a/modules/iot-client/include/iot_client.h +++ b/modules/iot-client/include/iot_client.h @@ -34,7 +34,7 @@ typedef enum { AY = 0, - US, + AZ, UEAZ, EU, WEAZ, @@ -148,7 +148,7 @@ struct iot_dp_context; char mqtt_url[64]; // MQTT broker URL (inline, mqtt://|mqtts://; "" = unresolved) char *schema; // Device schema JSON (dynamically allocated) - iot_region_t region; // Server region (CN, US, EU, IN) + iot_region_t region; // Server region (CN, AZ, EU, IN) iot_env_t env; // Environment (PROD or PRE) bool mqtt_disable_tls; // false = mqtts (TLS), true = mqtt (TCP) const pal_t *pal; // PAL adapter diff --git a/modules/iot-client/src/iot_client.c b/modules/iot-client/src/iot_client.c index c62ca89..ade7c9b 100644 --- a/modules/iot-client/src/iot_client.c +++ b/modules/iot-client/src/iot_client.c @@ -36,7 +36,7 @@ static const char *iot_region_to_string(iot_region_t region) { switch (region) { case AY: return "AY"; - case US: return "US"; + case AZ: return "AZ"; case UEAZ: return "UEAZ"; case EU: return "EU"; case WEAZ: return "WEAZ"; diff --git a/modules/iot-client/src/iot_config_defaults.h b/modules/iot-client/src/iot_config_defaults.h index 76507a4..59dc858 100644 --- a/modules/iot-client/src/iot_config_defaults.h +++ b/modules/iot-client/src/iot_config_defaults.h @@ -23,8 +23,8 @@ #define IOT_DEFAULT_PRE_HOST "a1-cn.wgine.com" #define IOT_CN_HOST "a1.tuyacn.com" #define IOT_CN_PRE_HOST "a1-cn.wgine.com" -#define IOT_US_HOST "a1.tuyaus.com" -#define IOT_US_PRE_HOST "a1-us.wgine.com" +#define IOT_AZ_HOST "a1.tuyaus.com" +#define IOT_AZ_PRE_HOST "a1-us.wgine.com" #define IOT_UEAZ_HOST "a1-ueaz.tuyaeu.com" #define IOT_UEAZ_PRE_HOST "a1-ueaz.wgine.com" #define IOT_EU_HOST "a1.tuyaeu.com" diff --git a/modules/iot-client/src/iot_dns.c b/modules/iot-client/src/iot_dns.c index 4c1ea28..1f7db14 100644 --- a/modules/iot-client/src/iot_dns.c +++ b/modules/iot-client/src/iot_dns.c @@ -352,8 +352,8 @@ char *iot_region_to_host(iot_region_t region, iot_env_t env) switch (region) { case AY: return IOT_CN_PRE_HOST; - case US: - return IOT_US_PRE_HOST; + case AZ: + return IOT_AZ_PRE_HOST; case UEAZ: return IOT_UEAZ_PRE_HOST; case EU: @@ -369,8 +369,8 @@ char *iot_region_to_host(iot_region_t region, iot_env_t env) switch (region) { case AY: return IOT_CN_HOST; - case US: - return IOT_US_HOST; + case AZ: + return IOT_AZ_HOST; case UEAZ: return IOT_UEAZ_HOST; case EU: diff --git a/modules/iot-client/src/iot_on_boarding.c b/modules/iot-client/src/iot_on_boarding.c index 5c463f1..53ea474 100644 --- a/modules/iot-client/src/iot_on_boarding.c +++ b/modules/iot-client/src/iot_on_boarding.c @@ -65,8 +65,8 @@ static void parse_activation_message(const pal_t *pal, const char *json_str, act const char *r = region->valuestring; if (strcmp(r, "AY") == 0) { message->region = AY; - } else if (strcmp(r, "US") == 0) { - message->region = US; + } else if (strcmp(r, "AZ") == 0) { + message->region = AZ; } else if (strcmp(r, "EU") == 0) { message->region = EU; } else if (strcmp(r, "IN") == 0) { @@ -380,8 +380,8 @@ static int __token_to_region(const char *token, iot_region_t *region) if (strcmp(prefix, "AY") == 0) { *region = AY; - } else if (strcmp(prefix, "US") == 0) { - *region = US; + } else if (strcmp(prefix, "AZ") == 0) { + *region = AZ; } else if (strcmp(prefix, "UE") == 0) { *region = UEAZ; } else if (strcmp(prefix, "EU") == 0) {