config.h
5.23 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#ifndef CONFIG_H
#define CONFIG_H
#include <QObject>
#include <QSet>
#define STRUCT_PACK __attribute__ ((packed))
#define MAX_CONFIG_COUNT 21
namespace Define
{
enum ConfigType {
config_language = 0,
config_datetime,
config_temptype,
config_backlight,
config_stop_delay,
config_best_dish_weight,
config_party_dish_weight,
config_ilc_rack_number,
config_ilc_rack_sequnece,
config_ilc_cook_wait_time,
config_cooktime_format,
config_time_type,
config_resttime_format,
config_marster_vol,
config_keypad_sound1,
config_keypad_sound2,
config_request_loadexec,
config_programstep_finish,
config_cooktime_finish,
config_stoperror_distinguish,
config_sound_factory_reset,
config_invalid = 65535
};
typedef union _config_item{
uint32_t d32;
float f32;
struct{
uint8_t d8_0;
uint8_t d8_1;
uint8_t d8_2;
uint8_t d8_3;
}d8;
}config_item;
typedef union _config_lists{
uint8_t data[MAX_CONFIG_COUNT*4];
config_item values[MAX_CONFIG_COUNT];
struct{
config_item language;
config_item datetime;
config_item temptype;
config_item backlight;
config_item stop_delay;
config_item best_dish_weight;
config_item party_dish_weight;
config_item ilc_rack_number;
config_item ilc_rack_sequnece;
config_item ilc_cook_wait_time;
config_item cooktime_format;
config_item time_type;
config_item resttime_format;
config_item marster_vol;
config_item keypad_sound1;
config_item keypad_sound2;
config_item request_loadexec;
config_item programstep_finish;
config_item cooktime_finish;
config_item stoperror_distinguish;
config_item sound_factory_reset;
}items;
}STRUCT_PACK config_lists;
}
class Config : public QObject
{
Q_OBJECT
explicit Config(QObject *parent = 0);
~Config(void);
static Config *instance;
const char language_menu[3][20]{
"한국어\0",
"中國語\0",
"English"
};
const char temptype_menu[2][16]{
"섭씨(℃)\0",
"화씨(℉)\0"
};
const char best_dish_weight_menu[4][16]={
"700g\0",
"700-899g\0",
"900-1099g\0",
"1100g"
};
const char time_type_menu[2][16]={
"24h\0",
"am/pm\0"
};
const char rest_time_type_menu[2][16] = {
"잔여시간\0",
"타겟시간\0"
};
/* config_data_type & Formatter Description
* 80 = use Cutom Formatter
* 0 = int
* 1 = float
* 2 = only String,
*/
const uint8_t config_data_type[MAX_CONFIG_COUNT] = {
0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, //Settings
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
};
const char config_format_kr[MAX_CONFIG_COUNT][64]={
"%S",
"%S",
"%S",
"%d",
"%d 분",
"%d g", //5
"%d g",
"%d",
"%d",
"%d min", //9
"%S", //10
"%S",
"%S", //end of Settings
"%d" ,//start of Sound
"%d번",
"%d번",
"%d번",
"%d번",
"%d번",
"%d번",
"공장초기화"
};
char config_format[MAX_CONFIG_COUNT][64];
const char config_title[MAX_CONFIG_COUNT][64]={
"언어설정", //0
"날짜와 시간",
"온도단위",
"화면밝기",
"응축식 후드의 정지지연",
"일품요리용 접시무게", //5
"연회용 접시무게",
"ILC 조리선반 개수",
"ILC 조리선반 순서",
"ILC 조리 온습도 대기시간",
"조리시간 포맷", //10
"실시간 포맷",
"잔여시간 포맷", //12
"마스터 볼륨", //13
"키패드 소리 - 1",
"키패드 소리 - 2 ", //15
"프로그램 단계 종료",
"적재/실행 요청",
"조리시간 종료",
"과정 중단/오류 식별", //19
"음향설정 초기화" //20
};
QSet<uint32_t> m_setFavorite;
public:
static Config *getInstance(QObject *parent=0);
//static void init();
bool loadConfig(void);
bool saveConfig(void);
Define::config_item getConfigValue(Define::ConfigType idx);
void setConfigValue(Define::ConfigType idx, Define::config_item& itemdata);
QString getValueString(Define::ConfigType idx);
QString getTitleString(Define::ConfigType idx);
bool isFavorite(Define::ConfigType idx);
QSetIterator<uint32_t> getConstBeginFavorite();
bool loadFavorite(void);
bool saveFavorite(void);
void insertFavorite(Define::ConfigType idx);
void removeFavorite(Define::ConfigType idx);
static QString getDateTimeString(uint32_t sec);
static QString getTempString(int cel_temp);
void execConfigWindow(QWidget *parent, Define::ConfigType idx);
Define::config_lists configlist;
signals:
public slots:
};
#endif // CONFIG_H