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 //==========================================================================
92 * @brief This class holds display information of system config
94 //==========================================================================
98 /// default constructor
100 : id(-1), name(""), address(""), type(-1) {}
103 virtual ~CicoSCNodeConf() {}
105 /// dump log this class member variables
108 ICO_DBG("node: id=%d name=%s address=%s type=%d",
109 id, name.c_str(), address.c_str(), type);
114 std::string name; ///< node name
115 std::string address; ///< node ip address
116 int type; ///< node type
119 //==========================================================================
121 * @brief This class holds layer information of system config
123 //==========================================================================
124 class CicoSCLayerConf
127 /// default constructor
129 : id(-1), name(""), type(-1), menuoverlap(false) {}
132 virtual ~CicoSCLayerConf() {}
134 /// dump log this class member variables
137 ICO_DBG(" layer: id=%d name=%s type=%d menuoverlap=%s",
138 id, name.c_str(), type, menuoverlap ? "true" : "false");
142 int id; ///< layer id
143 std::string name; ///< layer name
144 int type; ///< layer type
145 bool menuoverlap; ///< menu overlap flag
148 //==========================================================================
150 * @brief This class holds display zone information of system config
152 //==========================================================================
153 class CicoSCDisplayZoneConf
156 /// default constructor
157 CicoSCDisplayZoneConf()
158 : id(-1), name(""), fullname(""), x(-1), y(-1), w(-1), h(-1),
159 aspectFixed(false), aspectAlignLeft(false),
160 aspectAlignRight(false), aspectAlignTop(false),
161 aspectAlignBottom(false) {}
164 virtual ~CicoSCDisplayZoneConf() {}
166 /// dump log this class member variables
169 ICO_DBG(" zone: id=%d name=%s fullname=%s x/y=%d/%d "
170 "w/h=%d/%d aspect(fixed=%s l/r=%s/%s t/b=%s/%s",
171 id, name.c_str(), fullname.c_str(), x, y, w, h,
172 aspectFixed ? "true" : "false",
173 aspectAlignLeft ? "true" : "false",
174 aspectAlignRight ? "true" : "false",
175 aspectAlignTop ? "true" : "false",
176 aspectAlignBottom ? "true" : "false");
180 int id; ///< display zone id
181 std::string name; ///< display zone name
182 std::string fullname; ///< display zone fullname
183 int x; ///< display zone x position
184 int y; ///< display zone y position
185 int w; ///< display zone width
186 int h; ///< display zone height
188 /// fixed asppect ratio flag
190 /// horizontal direction to aligned at the left
191 bool aspectAlignLeft;
192 /// horizontal direction to aligned at the right
193 bool aspectAlignRight;
194 /// vertical direction is aligned at the top
196 /// vertical direction is aligned at the bottom
197 bool aspectAlignBottom;
200 //==========================================================================
202 * @brief This class holds display information of system config
204 //==========================================================================
205 class CicoSCDisplayConf
208 /// default constructor
210 : id(-1), name(""), node(-1), no(-1),
211 type(-1), width(-1), height(-1), inch(-1) {}
214 virtual ~CicoSCDisplayConf() {}
216 /// dump log this class member variables
219 ICO_DBG("display: id=%d name=%s node=%d no=%d "
220 "type=%d width=%d height=%d inch=%d",
221 id, name.c_str(), node, no, type, width, height, inch);
225 int id; ///< display id
226 std::string name; ///< display name
227 int node; ///< display node id
228 int no; ///< display number
229 int type; ///< display type
230 int width; ///< display width resolution
231 int height; ///< display height resolution
232 int inch; ///< display inch size
235 std::vector<CicoSCLayerConf*> layerConfList;
238 std::vector<CicoSCDisplayZoneConf*> zoneConfList;
241 //==========================================================================
243 * @brief This class holds sound zone information of system config
245 //==========================================================================
246 class CicoSCSoundZoneConf
249 /// default constructor
250 CicoSCSoundZoneConf()
251 : id(-1), name(""), fullname("") {}
254 virtual ~CicoSCSoundZoneConf() {}
256 /// dump log this class member variables
259 ICO_DBG(" zone: id=%d name=%s fullname=%s",
260 id, name.c_str(), fullname.c_str());
264 int id; ///< sound zone id
265 std::string name; ///< sound zone name
266 std::string fullname; ///< sound zone full name
269 //==========================================================================
271 * @brief This class holds sound information of system config
273 //==========================================================================
274 class CicoSCSoundConf
277 /// default constructor
279 : id(-1), name(""), no(-1) {}
282 virtual ~CicoSCSoundConf() {}
284 /// dump log this class member variables
287 ICO_DBG("sound: id=%d name=%s no=%d", id, name.c_str(), no);
291 int id; ///< sound id
292 std::string name; ///< sound name
293 int no; ///< sound number
294 std::vector<CicoSCSoundZoneConf*> zoneConfList; ///< sound config list
297 //==========================================================================
299 * @brief This class holds category information of system config
301 //==========================================================================
302 class CicoSCCategoryConf
305 /// default constructor
307 : id(-1), name(""), type(""),
308 view(-1), sound(-1), input(-1), priority(0), rctrl(-1) {}
311 virtual ~CicoSCCategoryConf() {}
313 /// dump log this class member variables
316 ICO_DBG("category: id=%d name=%s type=%s "
317 "view=%d sound=%d input=%d priority=%d",
318 id, name.c_str(), type.c_str(),
319 view, sound, input, priority);
323 int id; ///< category id
324 std::string name; ///< category name
325 std::string type; ///< category type
326 int view; ///< category view
327 int sound; ///< category sound
328 int input; ///< category input
329 int priority; ///< category priority
330 int rctrl; ///< resource control information
333 //==========================================================================
335 * @brief This class holds application kind information of system config
337 //==========================================================================
338 class CicoSCAppKindConf
342 PRIVILEGE_ALMIGHTY = 0, ///< almighty privilege
343 PRIVILEGE_SYSTEM = 1, ///< system level
344 PRIVILEGE_SYSTEM_AUDIO = 2, ///< system level(audio only)
345 PRIVILEGE_SYSTEM_VISIBLE = 3, ///< system level(visible only)
346 PRIVILEGE_MAKER = 4, ///< maker level
347 PRIVILEGE_CERTIFICATE = 5, ///< certificated
348 PRIVILEGE_NONE = 6, ///< no privilege
351 /// default constructor
353 : id(-1), name(""), privilege(-1), priority(0){}
356 virtual ~CicoSCAppKindConf() {}
358 /// dump log this class member variables
361 ICO_DBG("appkind: id=%d name=%s priority=%d priority=%d",
362 id, name.c_str(), privilege, priority);
366 int id; ///< application kind id
367 std::string name; ///< application kind name
368 int privilege; ///< application privilege
369 int priority; ///< application priority
372 //==========================================================================
374 * @brief This class holds input device switch information of system config
376 //==========================================================================
377 class CicoSCSwitchConf
380 /// default constructor
382 : id(-1), name(""), appid(""), keycode(0){}
385 virtual ~CicoSCSwitchConf() {}
387 /// dump log this class member variables
390 ICO_DBG(" switch: id=%d name=%s appid=%s",
391 id, name.c_str(), appid.c_str());
395 int id; ///< input device switch id
396 std::string name; ///< input device switch name
397 std::string appid; ///< fixed assign apllication name
398 int keycode; ///< keycode of input device switch
401 //==========================================================================
403 * @brief This class holds input device information of system config
405 //==========================================================================
406 class CicoSCInputDevConf
409 /// default constructor
411 : id(-1), name("") {}
414 virtual ~CicoSCInputDevConf() {}
416 /// dump log this class member variables
419 ICO_DBG("inputdev: id=%d name=%s", id, name.c_str());
423 int id; ///< input device id
424 std::string name; ///< input device name
425 std::vector<CicoSCSwitchConf*> switchConfList; ///< switch list
428 //==========================================================================
430 * @brief This class holds default information of system config
432 //==========================================================================
433 class CicoSCDefaultConf
436 /// default constructor
438 : topdir(""), confdir(""),
439 node(-1), appkind(-1), category(-1), display(-1),
440 layer(-1), displayzone(-1), sound(-1), soundzone(-1),
441 inputdev(-1), inputsw(-1) {};
444 virtual ~CicoSCDefaultConf() {}
446 /// dump log this class member variables
449 ICO_DBG("default: topdir=%s confdir=%s "
450 "node=%d appkind=%d category=%d "
451 "display=%d layer=%d displayzone=%d "
452 "sound=%d soundzone=%d inputdev=%d inputsw=%d",
453 topdir.c_str(), confdir.c_str(),
454 node, appkind, category, display, layer, displayzone,
455 sound, soundzone, inputdev, inputsw);
459 std::string topdir; ///< top directory path
460 std::string confdir; ///< config directory path
461 int node; ///< default application node id
462 int appkind; ///< default application kind
463 int category; ///< default application category
464 int display; ///< default application display
465 int layer; ///< default application display layer
466 int displayzone; ///< default application display zone
467 int sound; ///< default application sound
468 int soundzone; ///< default application sound zone
469 int inputdev; ///< default input device
470 int inputsw; ///< default input device switch
473 //==========================================================================
475 * @brief This class holds cpu resource group information of system config
477 //==========================================================================
478 class CicoSCCpuResourceGrp
481 /// default constructor
482 CicoSCCpuResourceGrp()
483 :m_id(-1), m_bDoIt(false), m_grpNm("") {}
486 virtual ~CicoSCCpuResourceGrp() {}
488 /// dump log this class member variables
491 std::stringstream hightlist;
493 std::vector<int>::iterator itr = m_hight.begin();
494 for (; itr != m_hight.end(); ++itr) {
495 hightlist << " " << *itr;
500 std::stringstream lowlist;
502 std::vector<int>::iterator itr = m_low.begin();
503 for (; itr != m_low.end(); ++itr) {
504 lowlist << " " << *itr;
509 ICO_DBG("cpu reousrce group; id=%d doIt=%s grpNm=%s, high=%d, low=%d",
510 m_id, m_bDoIt? "true": "false", m_grpNm.c_str(),
511 hightlist.str().c_str(), lowlist.str().c_str());
515 int m_id; ///< cpu resource group id
516 bool m_bDoIt; ///< cpu resouce control enable flag
517 std::string m_grpNm; ///< cpu resource group name
518 std::vector<int> m_hight; ///< hight threshold list
519 std::vector<int> m_low; ///< low threshold list
522 //==========================================================================
524 * @brief This class holds system resource information of system config
526 //==========================================================================
527 class CicoSCResourceConf
530 /// default constructor
532 :m_bDoIt(false), m_bDoItApp(false), m_bLog(false), m_cpuCGRPPath(""),
533 m_sampling(-1), m_retryCnt(5), m_lowLimitVal(25),
534 m_highLimitVal(90) {}
537 virtual ~CicoSCResourceConf() {}
539 /// dump log this class member variables
542 ICO_DBG("do:%s,%s log:%s, dir:%s, smpl:%d r:%d l:%d h:%d sz:%d",
543 m_bDoIt? "true": "false", m_bDoItApp? "true": "false",
544 m_bLog? "true": "false", m_cpuCGRPPath.c_str(), m_sampling,
545 m_retryCnt, m_lowLimitVal, m_highLimitVal, m_cpuCtrl.size());
549 bool m_bDoIt; ///< resource control enable flag
551 bool m_bLog; ///< resource control log enable flag
552 std::string m_cpuCGRPPath; ///< cpu cgroup path
553 int m_sampling; ///< sampling period
554 int m_retryCnt; ///< retry count
555 int m_lowLimitVal; ///< low limit value
556 int m_highLimitVal; ///< high limit value
557 std::vector<CicoSCCpuResourceGrp*> m_cpuCtrl; ///< cpu control config list
560 //==========================================================================
562 * @brief This class holds user information of system config
564 //==========================================================================
568 /// default constructor
569 CicoSCUserConf() :m_parent_dir("/home/app/ico") {}
571 virtual ~CicoSCUserConf() {}
573 /// dump log this class member variables
576 ICO_DBG("parent dir:%s", m_parent_dir.c_str());
580 std::string m_parent_dir; ///< parent dir
583 //==========================================================================
585 * @brief This class holds vehicle information property of system config
587 //==========================================================================
588 class CicoSCVIPropertyConf
591 /// default constructor
592 CicoSCVIPropertyConf()
593 : name(""), objname(""), property(""), typestr(""),
594 type(ICO_TYPE_UNKNOW) {}
597 virtual ~CicoSCVIPropertyConf() {}
599 /// dump log this class member variables
602 ICO_DBG("vehicle_info: id=%02d name=%s objname=%s property=%s "
603 "zone=%d typestr=%s type=%d",
604 id, name.c_str(), objname.c_str(), property.c_str(),
605 zone, typestr.c_str(), type);
608 int typeStrToInt(const std::string & str)
610 int ret = ICO_TYPE_UNKNOW;
611 if (0 == typestr.compare("BOOLEAN")) {
612 ret = ICO_TYPE_BOOLEAN;
614 else if (0 == typestr.compare("INT8")) {
617 else if ((0 == typestr.compare("UINT8")) ||
618 (0 == typestr.compare("BYTE"))) {
619 ret = ICO_TYPE_UINT8;
621 else if (0 == typestr.compare("INT16")) {
622 ret = ICO_TYPE_INT16;
624 else if (0 == typestr.compare("UINT16")) {
625 ret = ICO_TYPE_UINT16;
627 else if (0 == typestr.compare("INT32")) {
628 ret = ICO_TYPE_INT32;
630 else if (0 == typestr.compare("UINT32")) {
631 ret = ICO_TYPE_UINT32;
633 else if (0 == typestr.compare("INT64")) {
634 ret = ICO_TYPE_INT64;
636 else if (0 == typestr.compare("UINT64")) {
637 ret = ICO_TYPE_UINT64;
639 else if (0 == typestr.compare("DOUBLE")) {
640 ret = ICO_TYPE_DOUBLE;
642 else if (0 == typestr.compare("STRING")) {
643 ret = ICO_TYPE_STRING;
646 ret = ICO_TYPE_UNKNOW;
655 std::string property;
661 //==========================================================================
663 * @brief This class holds vehicle information of system config
665 //==========================================================================
666 class CicoSCVehicleInfoConf
669 /// default constructor
670 CicoSCVehicleInfoConf() : retryCnt(0), waitTime(0) {}
673 virtual ~CicoSCVehicleInfoConf() {}
675 /// dump log this class member variables
678 ICO_DBG("vehicle info: retry=%d waitTime=%d", retryCnt, waitTime);
679 std::map<int, CicoSCVIPropertyConf*>::iterator itr;
680 itr = properties.begin();
681 for(; itr != properties.end(); ++itr) {
682 itr->second->dumpConf();
690 ///< retry wait time[ms]
694 std::map<int, CicoSCVIPropertyConf*> properties;
697 #endif // __CICO_CONF_H__
698 // vim:set expandtab ts=4 sw=4: