2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 //==========================================================================
14 * @brief This file is definition of SystemConfigs
16 //==========================================================================
17 #ifndef __CICO_CONF_H__
18 #define __CICO_CONF_H__
26 #include "CicoCommonDef.h"
28 //==========================================================================
30 * @brief enumeration of node type
32 //==========================================================================
33 typedef enum _node_type {
34 ICO_NODETYPE_CENTER = 0, ///< Center display
35 ICO_NODETYPE_METER = 1, ///< Meter display
36 ICO_NODETYPE_REMOTE = 2, ///< Information device(mobile device)
37 ICO_NODETYPE_PASSENGER = 3, ///< Passenger display
38 ICO_NODETYPE_REAR = 4, ///< Rear-seat entertainment
39 ICO_NODETYPE_REARLEFT = 5, ///< Rear-seat entertainment(Left)
40 ICO_NODETYPE_REARRIGHT = 6, ///< Rear-seat entertainment(right)
43 //==========================================================================
45 * @brief enumeration of display type
47 //==========================================================================
48 typedef enum _display_type {
49 ICO_DISPLAYTYPE_CENTER = 0, ///< Center display
50 ICO_DISPLAYTYPE_METER = 1, ///< Meter display
51 ICO_DISPLAYTYPE_REMOTE = 2, ///< Information device(mobile device)
52 ICO_DISPLAYTYPE_PASSENGER = 3, ///< Passenger display
53 ICO_DISPLAYTYPE_REAR = 4, ///< Rear-seat display
54 ICO_DISPLAYTYPE_REARLEFT = 5, ///< Rear-seat display(left)
55 ICO_DISPLAYTYPE_REARRIGHT = 6, ///< Rear-seat display(right)
58 //==========================================================================
60 * @brief enumeration of policy type
62 //==========================================================================
63 typedef enum _policy {
64 ICO_POLICY_ALWAYS = 0, ///< No control
65 ICO_POLICY_RUNNING = 1, ///< Running only
66 ICO_POLICY_PARKED = 2, ///< Parked only
67 ICO_POLICY_SHIFT_PARKING = 3, ///< Shift-position is park
68 ICO_POLICY_SHIFT_REVERSES = 4, ///< Shift-position is reverses
69 ICO_POLICY_BLINKER_LEFT = 5, ///< Blinker is left
70 ICO_POLICY_BLINKER_RIGHT = 6, ///< Blinker is right
73 //==========================================================================
75 * @brief enumeration of application privilege
77 //==========================================================================
78 typedef enum _privilege {
79 ICO_PRIVILEGE_ALMIGHTY = 0, ///< almighty privilege
80 ICO_PRIVILEGE_SYSTEM = 1, ///< system level
81 ICO_PRIVILEGE_SYSTEM_AUDIO = 2, ///< system level(audio only)
82 ICO_PRIVILEGE_SYSTEM_VISIBLE = 3, ///< system level(visible only)
83 ICO_PRIVILEGE_MAKER = 4, ///< maker level
84 ICO_PRIVILEGE_CERTIFICATE = 5, ///< certificated
85 ICO_PRIVILEGE_NONE = 6, ///< no privilege
88 #define ICO_SYC_CONFIG_APPATTR "app_attr.conf" //TODO
90 #define ICO_SYC_ROLE_CONF_DEF -1
91 #define ICO_SYC_ROLE_CONF_DEF_STR "DEFAULT"
92 #define ICO_SYC_ROLE_CONF_RST 14999
93 #define ICO_SYC_ROLE_CONF_RST_STR "RESET"
95 #define ICO_SYC_ONSCREEN_WINDOW_START_X 0
96 #define ICO_SYC_ONSCREEN_WINDOW_START_Y 0
97 #define ICO_SYC_ONSCREEN_WINDOW_WIDTH 1080
98 #define ICO_SYC_ONSCREEN_WINDOW_HEIGHT 1920
99 //==========================================================================
101 * @brief This class holds display information of system config
103 //==========================================================================
107 /// default constructor
109 : id(-1), type(-1) {}
114 /// dump log this class member variables
117 ICO_DBG("node: id=%d name=%s address=%s type=%d",
118 id, name.c_str(), address.c_str(), type);
123 std::string name; ///< node name
124 std::string address; ///< node ip address
125 int type; ///< node type
128 //==========================================================================
130 * @brief This class holds layer information of system config
132 //==========================================================================
133 class CicoSCLayerConf
136 /// default constructor
138 : id(-1), type(-1), menuoverlap(false), layout_id(-1), area_id(-1) {}
141 ~CicoSCLayerConf() {}
143 /// dump log this class member variables
146 if(-1 != layout_id) {
147 ICO_DBG(" layer: %d, \"%s\" type=%d menuoverlap=%s layout: %d, \"%s\" area: %d, \"%s\"",
148 id, name.c_str(), type, menuoverlap ? "true" : "false",
149 layout_id, layout_name.c_str(), area_id, area_name.c_str());
152 ICO_DBG(" layer: %d, \"%s\" type=%d menuoverlap=%s",
153 id, name.c_str(), type, menuoverlap ? "true" : "false");
158 int id; ///< layer id
159 std::string name; ///< layer name
160 int type; ///< layer type
161 bool menuoverlap; ///< menu overlap flag
162 int layout_id; ///< layoyt id
163 std::string layout_name; ///< layout name
164 int area_id; ///< area id
165 std::string area_name; ///< area name
168 //==========================================================================
170 * @brief This class holds display zone information of system config
172 //==========================================================================
173 class CicoSCDisplayZoneConf
176 /// default constructor
177 CicoSCDisplayZoneConf()
178 : id(-1), x(-1), y(-1), w(-1), h(-1),
179 aspectFixed(false), aspectAlignLeft(false),
180 aspectAlignRight(false), aspectAlignTop(false),
181 aspectAlignBottom(false) {}
184 ~CicoSCDisplayZoneConf() {}
186 /// dump log this class member variables
189 ICO_DBG(" zone: id=%d name=%s fullname=%s x/y=%d/%d "
190 "w/h=%d/%d aspect(fixed=%s l/r=%s/%s t/b=%s/%s",
191 id, name.c_str(), fullname.c_str(), x, y, w, h,
192 aspectFixed ? "true" : "false",
193 aspectAlignLeft ? "true" : "false",
194 aspectAlignRight ? "true" : "false",
195 aspectAlignTop ? "true" : "false",
196 aspectAlignBottom ? "true" : "false");
200 int id; ///< display zone id
201 std::string name; ///< display zone name
202 std::string fullname; ///< display zone fullname
203 int x; ///< display zone x position
204 int y; ///< display zone y position
205 int w; ///< display zone width
206 int h; ///< display zone height
208 /// fixed asppect ratio flag
210 /// horizontal direction to aligned at the left
211 bool aspectAlignLeft;
212 /// horizontal direction to aligned at the right
213 bool aspectAlignRight;
214 /// vertical direction is aligned at the top
216 /// vertical direction is aligned at the bottom
217 bool aspectAlignBottom;
220 //==========================================================================
222 * @brief This class holds display information of system config
224 //==========================================================================
225 class CicoSCDisplayConf
228 /// default constructor
230 : id(-1), node(-1), no(-1),
231 type(-1), width(-1), height(-1), inch(-1) {}
234 ~CicoSCDisplayConf() {}
236 /// dump log this class member variables
239 ICO_DBG("display: id=%d name=%s node=%d no=%d "
240 "type=%d width=%d height=%d inch=%d",
241 id, name.c_str(), node, no, type, width, height, inch);
245 int id; ///< display id
246 std::string name; ///< display name
247 int node; ///< display node id
248 int no; ///< display number
249 int type; ///< display type
250 int width; ///< display width resolution
251 int height; ///< display height resolution
252 int inch; ///< display inch size
255 std::vector<CicoSCLayerConf*> layerConfList;
258 std::vector<CicoSCDisplayZoneConf*> zoneConfList;
261 //==========================================================================
263 * @brief This class holds sound zone information of system config
265 //==========================================================================
266 class CicoSCSoundZoneConf
269 /// default constructor
270 CicoSCSoundZoneConf()
274 ~CicoSCSoundZoneConf() {}
276 /// dump log this class member variables
279 ICO_DBG(" zone: id=%d name=%s fullname=%s",
280 id, name.c_str(), fullname.c_str());
284 int id; ///< sound zone id
285 std::string name; ///< sound zone name
286 std::string fullname; ///< sound zone full name
289 //==========================================================================
291 * @brief This class holds sound information of system config
293 //==========================================================================
294 class CicoSCSoundConf
297 /// default constructor
302 ~CicoSCSoundConf() {}
304 /// dump log this class member variables
307 ICO_DBG("sound: id=%d name=%s no=%d", id, name.c_str(), no);
311 int id; ///< sound id
312 std::string name; ///< sound name
313 int no; ///< sound number
314 std::vector<CicoSCSoundZoneConf*> zoneConfList; ///< sound config list
317 //==========================================================================
319 * @brief This class holds category information of system config
321 //==========================================================================
322 class CicoSCCategoryConf
325 /// default constructor
327 : id(-1), view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {}
330 ~CicoSCCategoryConf() {}
332 /// dump log this class member variables
335 ICO_DBG("category: id=%d name=%s type=%s "
336 "view=%d sound=%d input=%d priority=%d",
337 id, name.c_str(), type.c_str(),
338 view, sound, input, priority);
342 int id; ///< category id
343 std::string name; ///< category name
344 std::string type; ///< category type
345 int view; ///< category view
346 int sound; ///< category sound
347 int input; ///< category input
348 int priority; ///< category priority
349 int rctrl; ///< resource control information
352 //==========================================================================
354 * @brief This class holds application kind information of system config
356 //==========================================================================
357 class CicoSCAppKindConf
361 PRIVILEGE_ALMIGHTY = 0, ///< almighty privilege
362 PRIVILEGE_SYSTEM = 1, ///< system level
363 PRIVILEGE_SYSTEM_AUDIO = 2, ///< system level(audio only)
364 PRIVILEGE_SYSTEM_VISIBLE = 3, ///< system level(visible only)
365 PRIVILEGE_MAKER = 4, ///< maker level
366 PRIVILEGE_CERTIFICATE = 5, ///< certificated
367 PRIVILEGE_NONE = 6, ///< no privilege
370 /// default constructor
372 : id(-1), privilege(-1), priority(0){}
375 ~CicoSCAppKindConf() {}
377 /// dump log this class member variables
380 ICO_DBG("appkind: id=%d name=%s priority=%d priority=%d",
381 id, name.c_str(), privilege, priority);
385 int id; ///< application kind id
386 std::string name; ///< application kind name
387 int privilege; ///< application privilege
388 int priority; ///< application priority
391 //==========================================================================
393 * @brief This class holds input device switch information of system config
395 //==========================================================================
396 class CicoSCSwitchConf
399 /// default constructor
401 : id(-1), keycode(0){}
404 ~CicoSCSwitchConf() {}
406 /// dump log this class member variables
409 ICO_DBG(" switch: id=%d name=%s appid=%s",
410 id, name.c_str(), appid.c_str());
414 int id; ///< input device switch id
415 std::string name; ///< input device switch name
416 std::string appid; ///< fixed assign apllication name
417 int keycode; ///< keycode of input device switch
420 //==========================================================================
422 * @brief This class holds input device information of system config
424 //==========================================================================
425 class CicoSCInputDevConf
428 /// default constructor
433 ~CicoSCInputDevConf() {}
435 /// dump log this class member variables
438 ICO_DBG("inputdev: id=%d name=%s", id, name.c_str());
442 int id; ///< input device id
443 std::string name; ///< input device name
444 std::vector<CicoSCSwitchConf*> switchConfList; ///< switch list
447 //==========================================================================
449 * @brief This class holds default information of system config
451 //==========================================================================
452 class CicoSCDefaultConf
455 /// default constructor
457 : node(-1), appkind(-1), category(-1), display(-1),
458 layer(-1), displayzone(-1), sound(-1), soundzone(-1),
459 inputdev(-1), inputsw(-1) {};
462 ~CicoSCDefaultConf() {}
464 /// dump log this class member variables
467 ICO_DBG("default: topdir=%s confdir=%s "
468 "node=%d appkind=%d category=%d "
469 "display=%d layer=%d displayzone=%d "
470 "sound=%d soundzone=%d inputdev=%d inputsw=%d",
471 topdir.c_str(), confdir.c_str(),
472 node, appkind, category, display, layer, displayzone,
473 sound, soundzone, inputdev, inputsw);
477 std::string topdir; ///< top directory path
478 std::string confdir; ///< config directory path
479 int node; ///< default application node id
480 int appkind; ///< default application kind
481 int category; ///< default application category
482 int display; ///< default application display
483 int layer; ///< default application display layer
484 int displayzone; ///< default application display zone
485 int sound; ///< default application sound
486 int soundzone; ///< default application sound zone
487 int inputdev; ///< default input device
488 int inputsw; ///< default input device switch
491 //==========================================================================
493 * @brief This class holds cpu resource group information of system config
495 //==========================================================================
496 class CicoSCCpuResourceGrp
499 /// default constructor
500 CicoSCCpuResourceGrp()
501 :m_id(-1), m_bDoIt(false) {}
504 ~CicoSCCpuResourceGrp() {}
506 /// dump log this class member variables
509 std::stringstream hightlist;
511 std::vector<int>::iterator itr = m_hight.begin();
512 for (; itr != m_hight.end(); ++itr) {
513 hightlist << " " << *itr;
518 std::stringstream lowlist;
520 std::vector<int>::iterator itr = m_low.begin();
521 for (; itr != m_low.end(); ++itr) {
522 lowlist << " " << *itr;
527 ICO_DBG("cpu reousrce group; id=%d doIt=%s grpNm=%s, high=%d, low=%d",
528 m_id, m_bDoIt? "true": "false", m_grpNm.c_str(),
529 hightlist.str().c_str(), lowlist.str().c_str());
533 int m_id; ///< cpu resource group id
534 bool m_bDoIt; ///< cpu resouce control enable flag
535 std::string m_grpNm; ///< cpu resource group name
536 std::vector<int> m_hight; ///< hight threshold list
537 std::vector<int> m_low; ///< low threshold list
540 //==========================================================================
542 * @brief This class holds system resource information of system config
544 //==========================================================================
545 class CicoSCResourceConf
548 /// default constructor
550 :m_bDoIt(false), m_bDoItApp(false), m_bLog(false),
551 m_sampling(-1), m_retryCnt(5), m_lowLimitVal(25),
552 m_highLimitVal(90) {}
555 ~CicoSCResourceConf() {}
557 /// dump log this class member variables
560 ICO_DBG("do:%s,%s log:%s, dir:%s, smpl:%d r:%d l:%d h:%d sz:%d",
561 m_bDoIt? "true": "false", m_bDoItApp? "true": "false",
562 m_bLog? "true": "false", m_cpuCGRPPath.c_str(), m_sampling,
563 m_retryCnt, m_lowLimitVal, m_highLimitVal, m_cpuCtrl.size());
567 bool m_bDoIt; ///< resource control enable flag
569 bool m_bLog; ///< resource control log enable flag
570 std::string m_cpuCGRPPath; ///< cpu cgroup path
571 int m_sampling; ///< sampling period
572 int m_retryCnt; ///< retry count
573 int m_lowLimitVal; ///< low limit value
574 int m_highLimitVal; ///< high limit value
575 std::vector<CicoSCCpuResourceGrp*> m_cpuCtrl; ///< cpu control config list
578 //==========================================================================
580 * @brief This class holds user information of system config
582 //==========================================================================
586 /// default constructor
587 CicoSCUserConf() :m_parent_dir("/home/app/ico") {}
591 /// dump log this class member variables
594 ICO_DBG("parent dir:%s", m_parent_dir.c_str());
598 std::string m_parent_dir; ///< parent dir
601 //==========================================================================
603 * @brief This class holds vehicle information property of system config
605 //==========================================================================
606 class CicoSCVIPropertyConf
609 /// default constructor
610 CicoSCVIPropertyConf()
611 : type(ICO_TYPE_UNKNOW) {}
614 ~CicoSCVIPropertyConf() {}
616 /// dump log this class member variables
619 ICO_DBG("vehicle_info: id=%02d name=%s objname=%s property=%s "
620 "zone=%d typestr=%s type=%d",
621 id, name.c_str(), objname.c_str(), property.c_str(),
622 zone, typestr.c_str(), type);
625 int typeStrToInt(const std::string & str)
627 int ret = ICO_TYPE_UNKNOW;
628 if (0 == typestr.compare("BOOLEAN")) {
629 ret = ICO_TYPE_BOOLEAN;
631 else if (0 == typestr.compare("INT8")) {
634 else if ((0 == typestr.compare("UINT8")) ||
635 (0 == typestr.compare("BYTE"))) {
636 ret = ICO_TYPE_UINT8;
638 else if (0 == typestr.compare("INT16")) {
639 ret = ICO_TYPE_INT16;
641 else if (0 == typestr.compare("UINT16")) {
642 ret = ICO_TYPE_UINT16;
644 else if (0 == typestr.compare("INT32")) {
645 ret = ICO_TYPE_INT32;
647 else if (0 == typestr.compare("UINT32")) {
648 ret = ICO_TYPE_UINT32;
650 else if (0 == typestr.compare("INT64")) {
651 ret = ICO_TYPE_INT64;
653 else if (0 == typestr.compare("UINT64")) {
654 ret = ICO_TYPE_UINT64;
656 else if (0 == typestr.compare("DOUBLE")) {
657 ret = ICO_TYPE_DOUBLE;
659 else if (0 == typestr.compare("STRING")) {
660 ret = ICO_TYPE_STRING;
663 ret = ICO_TYPE_UNKNOW;
672 std::string property;
678 //==========================================================================
680 * @brief This class holds vehicle information of system config
682 //==========================================================================
683 class CicoSCVehicleInfoConf
686 /// default constructor
687 CicoSCVehicleInfoConf() : retryCnt(0), waitTime(0) {}
690 ~CicoSCVehicleInfoConf() {}
692 /// dump log this class member variables
695 ICO_DBG("vehicle info: retry=%d waitTime=%d", retryCnt, waitTime);
696 std::map<int, CicoSCVIPropertyConf*>::iterator itr;
697 itr = properties.begin();
698 for(; itr != properties.end(); ++itr) {
699 itr->second->dumpConf();
707 ///< retry wait time[ms]
711 std::map<int, CicoSCVIPropertyConf*> properties;
714 //==========================================================================
716 * @brief This class Role of system config
718 //==========================================================================
724 : m_def(ICO_SYC_ROLE_CONF_DEF), m_rst(ICO_SYC_ROLE_CONF_RST) {}
727 /// dump log this class member variables
730 ICO_DBG("Role info: default=%d, reset=%d, size=%d",
731 (int)m_def, (int)m_rst, (int)m_stt.size());
732 std::map<std::string, short>::iterator itr;
734 for(; itr != m_stt.end(); ++itr) {
735 ICO_DBG(" key=\"%s\", stt=%d", itr->first.c_str(),
744 std::map<std::string, short> m_stt;
747 //==========================================================================
749 * @brief This class position onscreen window x,y
751 //==========================================================================
752 class CicoSCPositionOSConf
756 CicoSCPositionOSConf(int x, int y, int w, int h)
757 : m_x(x), m_y(y), m_w(w), m_h(h) {}
759 ~CicoSCPositionOSConf() {}
760 /// dump log this class member variables
763 ICO_DBG("OnScreen Window position : x:%d, y:%d, w:%d, h:%d", m_x, m_y, m_w, m_h);
771 #endif // __CICO_CONF_H__
772 // vim:set expandtab ts=4 sw=4: