aboutsummaryrefslogtreecommitdiff
path: root/client/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/strings.c')
-rw-r--r--client/strings.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/client/strings.c b/client/strings.c
index 4dda1c8..c89cbbf 100644
--- a/client/strings.c
+++ b/client/strings.c
@@ -1,7 +1,11 @@
+#include "../shared/errcatch.h"
#include "strings.h"
char *g_w2_mode_strings[W2_MODE_COUNT];
char *g_w2_tab_strings[W2_UI_TAB_COUNT];
+char *g_w2_error_type_strings[4];
+char *g_w2_error_internal_strings[0x100];
+char *g_w2_error_user_strings[0x100];
void w2_strings_modes_init() {
g_w2_mode_strings[W2_M_CHRG] = W2_UI_MODE_CHRG;
@@ -19,7 +23,55 @@ void w2_strings_tabs_init() {
g_w2_tab_strings[W2_UI_TAB_DIRC] = W2_UI_TAB_LABEL_DIRC;
}
+void w2_strings_errors_types() {
+ g_w2_error_type_strings[0b00] = W2_UI_ERROR_SEVERITY_CRIT;
+ g_w2_error_type_strings[0b01] = W2_UI_ERROR_SEVERITY_WARN;
+ g_w2_error_type_strings[0b10] = W2_UI_ERROR_SEVERITY_INFO;
+ g_w2_error_type_strings[0b11] = W2_UI_ERROR_SEVERITY_VERB;
+}
+
+void w2_strings_errors_internal() {
+ g_w2_error_internal_strings[W2_E_CRIT_CONN_LOST] = W2_UI_ERROR_INT_W2_E_CRIT_CONN_LOST;
+ g_w2_error_internal_strings[W2_E_CRIT_COM_UNAVAILABLE] = W2_UI_ERROR_INT_W2_E_CRIT_COM_UNAVAILABLE;
+ g_w2_error_internal_strings[W2_E_CRIT_LINE_LOST] = W2_UI_ERROR_INT_W2_E_CRIT_LINE_LOST;
+ g_w2_error_internal_strings[W2_E_CRIT_OBSTACLE_STUCK] = W2_UI_ERROR_INT_W2_E_CRIT_OBSTACLE_STUCK;
+ g_w2_error_internal_strings[W2_E_CRIT_VERSION_INCOMPATIBLE] = W2_UI_ERROR_INT_W2_E_CRIT_VERSION_INCOMPATIBLE;
+ g_w2_error_internal_strings[W2_E_WARN_BATTERY_LOW] = W2_UI_ERROR_INT_W2_E_WARN_BATTERY_LOW;
+ g_w2_error_internal_strings[W2_E_WARN_OBSTACLE_DETECTED] = W2_UI_ERROR_INT_W2_E_WARN_OBSTACLE_DETECTED;
+ g_w2_error_internal_strings[W2_E_WARN_CYCLE_EXPIRED] = W2_UI_ERROR_INT_W2_E_WARN_CYCLE_EXPIRED;
+ g_w2_error_internal_strings[W2_E_WARN_UNCAUGHT_ERROR] = W2_UI_ERROR_INT_W2_E_WARN_UNCAUGHT_ERROR;
+ g_w2_error_internal_strings[W2_E_WARN_ERR_BUFFER_FULL] = W2_UI_ERROR_INT_W2_E_WARN_ERR_BUFFER_FULL;
+ g_w2_error_internal_strings[W2_E_WARN_LINE_LOST] = W2_UI_ERROR_INT_W2_E_WARN_LINE_LOST;
+ g_w2_error_internal_strings[W2_E_WARN_SERCOMM_BUFFER_FULL] = W2_UI_ERROR_INT_W2_E_WARN_SERCOMM_BUFFER_FULL;
+ g_w2_error_internal_strings[W2_E_WARN_VERSION_INCOMPATIBLE] = W2_UI_ERROR_INT_W2_E_WARN_VERSION_INCOMPATIBLE;
+ g_w2_error_internal_strings[W2_E_WARN_SERIAL_NOISY] = W2_UI_ERROR_INT_W2_E_WARN_SERIAL_NOISY;
+ g_w2_error_internal_strings[W2_E_WARN_MODE_HISTORY_BUFFER_IOB] = W2_UI_ERROR_INT_W2_E_WARN_MODE_HISTORY_BUFFER_IOB;
+ g_w2_error_internal_strings[W2_E_WARN_PING_TIMEOUT] = W2_UI_ERROR_INT_W2_E_WARN_PING_TIMEOUT;
+}
+
+void w2_strings_errors_user() {
+ g_w2_error_user_strings[W2_E_CRIT_CONN_LOST] = W2_UI_ERROR_USR_W2_E_CRIT_CONN_LOST;
+ g_w2_error_user_strings[W2_E_CRIT_COM_UNAVAILABLE] = W2_UI_ERROR_USR_W2_E_CRIT_COM_UNAVAILABLE;
+ g_w2_error_user_strings[W2_E_CRIT_LINE_LOST] = W2_UI_ERROR_USR_W2_E_CRIT_LINE_LOST;
+ g_w2_error_user_strings[W2_E_CRIT_OBSTACLE_STUCK] = W2_UI_ERROR_USR_W2_E_CRIT_OBSTACLE_STUCK;
+ g_w2_error_user_strings[W2_E_CRIT_VERSION_INCOMPATIBLE] = W2_UI_ERROR_USR_W2_E_CRIT_VERSION_INCOMPATIBLE;
+ g_w2_error_user_strings[W2_E_WARN_BATTERY_LOW] = W2_UI_ERROR_USR_W2_E_WARN_BATTERY_LOW;
+ g_w2_error_user_strings[W2_E_WARN_OBSTACLE_DETECTED] = W2_UI_ERROR_USR_W2_E_WARN_OBSTACLE_DETECTED;
+ g_w2_error_user_strings[W2_E_WARN_CYCLE_EXPIRED] = W2_UI_ERROR_USR_W2_E_WARN_CYCLE_EXPIRED;
+ g_w2_error_user_strings[W2_E_WARN_UNCAUGHT_ERROR] = W2_UI_ERROR_USR_W2_E_WARN_UNCAUGHT_ERROR;
+ g_w2_error_user_strings[W2_E_WARN_ERR_BUFFER_FULL] = W2_UI_ERROR_USR_W2_E_WARN_ERR_BUFFER_FULL;
+ g_w2_error_user_strings[W2_E_WARN_LINE_LOST] = W2_UI_ERROR_USR_W2_E_WARN_LINE_LOST;
+ g_w2_error_user_strings[W2_E_WARN_SERCOMM_BUFFER_FULL] = W2_UI_ERROR_USR_W2_E_WARN_SERCOMM_BUFFER_FULL;
+ g_w2_error_user_strings[W2_E_WARN_VERSION_INCOMPATIBLE] = W2_UI_ERROR_USR_W2_E_WARN_VERSION_INCOMPATIBLE;
+ g_w2_error_user_strings[W2_E_WARN_SERIAL_NOISY] = W2_UI_ERROR_USR_W2_E_WARN_SERIAL_NOISY;
+ g_w2_error_user_strings[W2_E_WARN_MODE_HISTORY_BUFFER_IOB] = W2_UI_ERROR_USR_W2_E_WARN_MODE_HISTORY_BUFFER_IOB;
+ g_w2_error_user_strings[W2_E_WARN_PING_TIMEOUT] = W2_UI_ERROR_USR_W2_E_WARN_PING_TIMEOUT;
+}
+
void w2_strings_init() {
+ w2_strings_errors_types();
+ w2_strings_errors_internal();
+ w2_strings_errors_user();
w2_strings_modes_init();
w2_strings_tabs_init();
}