Modify error messages

This commit is contained in:
Terrence
2025-02-24 15:47:44 +08:00
parent 6b855eae53
commit de783b7c57
4 changed files with 14 additions and 18 deletions

View File

@@ -22,9 +22,10 @@
"LISTENING": "Listening...", "LISTENING": "Listening...",
"SPEAKING": "Speaking...", "SPEAKING": "Speaking...",
"UNABLE_TO_CONNECT_TO_SERVICE": "Unable to connect to service, please try again later", "SERVER_NOT_FOUND": "Looking for available service",
"WAITING_FOR_RESPONSE_TIMEOUT": "Waiting for response timeout", "SERVER_NOT_CONNECTED": "Unable to connect to service, please try again later",
"SENDING_FAILED_PLEASE_CHECK_THE_NETWORK": "Sending failed, please check the network", "SERVER_TIMEOUT": "Waiting for response timeout",
"SERVER_ERROR": "Sending failed, please check the network",
"CONNECT_TO_HOTSPOT": "Hotspot: ", "CONNECT_TO_HOTSPOT": "Hotspot: ",
"ACCESS_VIA_BROWSER": " Config URL: ", "ACCESS_VIA_BROWSER": " Config URL: ",
@@ -32,9 +33,6 @@
"ENTERING_WIFI_CONFIG_MODE": "Entering Wi-Fi configuration mode...", "ENTERING_WIFI_CONFIG_MODE": "Entering Wi-Fi configuration mode...",
"SCANNING_WIFI": "Scanning Wi-Fi...", "SCANNING_WIFI": "Scanning Wi-Fi...",
"UNABLE_TO_ESTABLISH_AUDIO_CHANNEL": "Unable to establish audio channel",
"TEST": "Test",
"NEW_VERSION": "New version ", "NEW_VERSION": "New version ",
"OTA_UPGRADE": "OTA Upgrade", "OTA_UPGRADE": "OTA Upgrade",
"UPGRADING": "System is upgrading...", "UPGRADING": "System is upgrading...",

View File

@@ -20,9 +20,10 @@
"LISTENING":"聆听中...", "LISTENING":"聆听中...",
"SPEAKING":"说话中...", "SPEAKING":"说话中...",
"UNABLE_TO_CONNECT_TO_SERVICE":"无法连接服务", "SERVER_NOT_FOUND":"正在寻找可用服务",
"WAITING_FOR_RESPONSE_TIMEOUT":"等待响应超时", "SERVER_NOT_CONNECTED":"无法连接服务,请稍后再试",
"SENDING_FAILED_PLEASE_CHECK_THE_NETWORK":"发送失败,请检查网络", "SERVER_TIMEOUT":"等待响应超时",
"SERVER_ERROR":"发送失败,请检查网络",
"CONNECT_TO_HOTSPOT":"手机连接热点 ", "CONNECT_TO_HOTSPOT":"手机连接热点 ",
"ACCESS_VIA_BROWSER":",浏览器访问 ", "ACCESS_VIA_BROWSER":",浏览器访问 ",
@@ -30,9 +31,6 @@
"ENTERING_WIFI_CONFIG_MODE":"进入配网模式...", "ENTERING_WIFI_CONFIG_MODE":"进入配网模式...",
"SCANNING_WIFI":"扫描 Wi-Fi...", "SCANNING_WIFI":"扫描 Wi-Fi...",
"UNABLE_TO_ESTABLISH_AUDIO_CHANNEL": "无法建立音频通道",
"TEST":"测试",
"NEW_VERSION": "新版本 ", "NEW_VERSION": "新版本 ",
"OTA_UPGRADE":"OTA 升级", "OTA_UPGRADE":"OTA 升级",
"UPGRADING":"正在升级系统...", "UPGRADING":"正在升级系统...",

View File

@@ -47,7 +47,7 @@ bool MqttProtocol::StartMqttClient() {
if (endpoint_.empty()) { if (endpoint_.empty()) {
ESP_LOGE(TAG, "MQTT endpoint is not specified"); ESP_LOGE(TAG, "MQTT endpoint is not specified");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::UNABLE_TO_CONNECT_TO_SERVICE); on_network_error_(Lang::Strings::SERVER_NOT_FOUND);
} }
return false; return false;
} }
@@ -91,7 +91,7 @@ bool MqttProtocol::StartMqttClient() {
if (!mqtt_->Connect(endpoint_, 8883, client_id_, username_, password_)) { if (!mqtt_->Connect(endpoint_, 8883, client_id_, username_, password_)) {
ESP_LOGE(TAG, "Failed to connect to endpoint"); ESP_LOGE(TAG, "Failed to connect to endpoint");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::UNABLE_TO_CONNECT_TO_SERVICE); on_network_error_(Lang::Strings::SERVER_NOT_CONNECTED);
} }
return false; return false;
} }
@@ -107,7 +107,7 @@ void MqttProtocol::SendText(const std::string& text) {
if (!mqtt_->Publish(publish_topic_, text)) { if (!mqtt_->Publish(publish_topic_, text)) {
ESP_LOGE(TAG, "Failed to publish message"); ESP_LOGE(TAG, "Failed to publish message");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::SENDING_FAILED_PLEASE_CHECK_THE_NETWORK); on_network_error_(Lang::Strings::SERVER_ERROR);
} }
} }
} }
@@ -182,7 +182,7 @@ bool MqttProtocol::OpenAudioChannel() {
if (!(bits & MQTT_PROTOCOL_SERVER_HELLO_EVENT)) { if (!(bits & MQTT_PROTOCOL_SERVER_HELLO_EVENT)) {
ESP_LOGE(TAG, "Failed to receive server hello"); ESP_LOGE(TAG, "Failed to receive server hello");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::WAITING_FOR_RESPONSE_TIMEOUT); on_network_error_(Lang::Strings::SERVER_TIMEOUT);
} }
return false; return false;
} }

View File

@@ -99,7 +99,7 @@ bool WebsocketProtocol::OpenAudioChannel() {
if (!websocket_->Connect(url.c_str())) { if (!websocket_->Connect(url.c_str())) {
ESP_LOGE(TAG, "Failed to connect to websocket server"); ESP_LOGE(TAG, "Failed to connect to websocket server");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::UNABLE_TO_CONNECT_TO_SERVICE); on_network_error_(Lang::Strings::SERVER_NOT_FOUND);
} }
return false; return false;
} }
@@ -120,7 +120,7 @@ bool WebsocketProtocol::OpenAudioChannel() {
if (!(bits & WEBSOCKET_PROTOCOL_SERVER_HELLO_EVENT)) { if (!(bits & WEBSOCKET_PROTOCOL_SERVER_HELLO_EVENT)) {
ESP_LOGE(TAG, "Failed to receive server hello"); ESP_LOGE(TAG, "Failed to receive server hello");
if (on_network_error_ != nullptr) { if (on_network_error_ != nullptr) {
on_network_error_(Lang::Strings::WAITING_FOR_RESPONSE_TIMEOUT); on_network_error_(Lang::Strings::SERVER_TIMEOUT);
} }
return false; return false;
} }