aboutsummaryrefslogtreecommitdiff
path: root/client/strings.c
blob: c89cbbf8e27517ed9a9379ccfc52ebc6144e5c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#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;
	g_w2_mode_strings[W2_M_DIRC] = W2_UI_MODE_DIRC;
	g_w2_mode_strings[W2_M_GRID] = W2_UI_MODE_GRID;
	g_w2_mode_strings[W2_M_HALT] = W2_UI_MODE_HALT;
	g_w2_mode_strings[W2_M_MAZE] = W2_UI_MODE_MAZE;
	g_w2_mode_strings[W2_M_SCAL] = W2_UI_MODE_SCAL;
	g_w2_mode_strings[W2_M_SPIN] = W2_UI_MODE_SPIN;
}

void w2_strings_tabs_init() {
	g_w2_tab_strings[W2_UI_TAB_START]	 = W2_UI_TAB_LABEL_START;
	g_w2_tab_strings[W2_UI_TAB_ERRCATCH] = W2_UI_TAB_LABEL_ERRCATCH;
	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();
}