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 /*========================================================================*/
12 * @file CicoSystemConfig.cpp
14 * @brief This file implementation of CicoSystemConfig class
16 /*========================================================================*/
19 #include <boost/property_tree/ptree.hpp>
20 #include <boost/property_tree/json_parser.hpp>
21 #include <boost/foreach.hpp>
22 #include <boost/optional.hpp>
24 #include "CicoSystemConfig.h"
27 using namespace boost::property_tree;
28 //==========================================================================
29 // private static variable
30 //==========================================================================
31 CicoSystemConfig* CicoSystemConfig::ms_myInstance = NULL;
33 //--------------------------------------------------------------------------
35 * @brief default constructor
37 //--------------------------------------------------------------------------
38 CicoSystemConfig::CicoSystemConfig()
40 m_typeTable[""] = ICO_NODETYPE_CENTER;
41 m_typeTable["center"] = ICO_NODETYPE_CENTER;
42 m_typeTable["meter"] = ICO_NODETYPE_METER;
43 m_typeTable["remote"] = ICO_NODETYPE_REMOTE;
44 m_typeTable["passenger"] = ICO_NODETYPE_PASSENGER;
45 m_typeTable["rear"] = ICO_NODETYPE_REAR;
46 m_typeTable["rearleft"] = ICO_NODETYPE_REARLEFT;
47 m_typeTable["rearright"] = ICO_NODETYPE_REARRIGHT;
49 m_displayTypeTable[""] = ICO_DISPLAYTYPE_CENTER;
50 m_displayTypeTable["center"] = ICO_DISPLAYTYPE_CENTER;
51 m_displayTypeTable["meter"] = ICO_DISPLAYTYPE_METER;
52 m_displayTypeTable["remote"] = ICO_DISPLAYTYPE_REMOTE;
53 m_displayTypeTable["passenger"] = ICO_DISPLAYTYPE_PASSENGER;
54 m_displayTypeTable["rear"] = ICO_DISPLAYTYPE_REAR;
55 m_displayTypeTable["rearleft"] = ICO_DISPLAYTYPE_REARLEFT;
56 m_displayTypeTable["rearright"] = ICO_DISPLAYTYPE_REARRIGHT;
59 m_categoryTalbe[""] = ICO_POLICY_ALWAYS;
60 m_categoryTalbe["always"] = ICO_POLICY_ALWAYS;
61 m_categoryTalbe["run"] = ICO_POLICY_RUNNING;
62 m_categoryTalbe["park"] = ICO_POLICY_PARKED;
63 m_categoryTalbe["shift_park"] = ICO_POLICY_SHIFT_PARKING;
64 m_categoryTalbe["shift_back"] = ICO_POLICY_SHIFT_REVERSES;
65 m_categoryTalbe["shift_rev"] = ICO_POLICY_SHIFT_REVERSES;
66 m_categoryTalbe["blinker_left"] = ICO_POLICY_BLINKER_LEFT;
67 m_categoryTalbe["blinker_right"] = ICO_POLICY_BLINKER_RIGHT;
70 m_privilegeTable["almighty"] = ICO_PRIVILEGE_ALMIGHTY;
71 m_privilegeTable["system"] = ICO_PRIVILEGE_SYSTEM;
72 m_privilegeTable["system.audio"] = ICO_PRIVILEGE_SYSTEM_AUDIO;
73 m_privilegeTable["system.visible"] = ICO_PRIVILEGE_SYSTEM_VISIBLE;
74 m_privilegeTable["maker"] = ICO_PRIVILEGE_MAKER;
75 m_privilegeTable["certificate"] = ICO_PRIVILEGE_CERTIFICATE;
76 m_privilegeTable["none"] = ICO_PRIVILEGE_NONE;
77 m_privilegeTable[""] = ICO_PRIVILEGE_NONE;
78 m_resourceConf = NULL;
82 //--------------------------------------------------------------------------
86 //--------------------------------------------------------------------------
87 CicoSystemConfig::~CicoSystemConfig()
92 //--------------------------------------------------------------------------
94 * @brief Get instance of CicoSystemConfig
96 * @return pointer of CicoSystemConfig object
98 //--------------------------------------------------------------------------
100 CicoSystemConfig::getInstance(void)
102 if (NULL == ms_myInstance) {
103 ms_myInstance = new CicoSystemConfig();
105 return ms_myInstance;
108 //--------------------------------------------------------------------------
110 * @brief Get instance of CicoSystemConfig
112 * @param [in] confFile config file name
113 * @return true on success, false on error
115 //--------------------------------------------------------------------------
117 CicoSystemConfig::load(const string & confFile)
121 read_xml(confFile, root);
123 createNodeConfList(root);
124 createDisplayConfList(root);
125 createSoundConfList(root);
126 createPortConf(root);
127 createCategoryConf(root);
128 createAppKindConf(root);
129 createInputDevList(root);
130 createDefaultConf(root);
131 createResourceConf(root);
132 createUserConf(root);
133 createVehicleInfoConf(root);
136 ICO_ERR("catch exception!");
142 //--------------------------------------------------------------------------
148 //--------------------------------------------------------------------------
149 const vector<CicoSCNodeConf*>&
150 CicoSystemConfig::getNodeConfList(void) const
152 return m_nodeConfList;
155 //--------------------------------------------------------------------------
161 //--------------------------------------------------------------------------
162 const vector<CicoSCDisplayConf*>&
163 CicoSystemConfig::getDisplayConfList(void) const
165 return m_displayConfList;
168 //--------------------------------------------------------------------------
174 //--------------------------------------------------------------------------
175 const vector<CicoSCSoundConf*>&
176 CicoSystemConfig::getSoundConfList(void) const
178 return m_soundConfList;
181 //--------------------------------------------------------------------------
187 //--------------------------------------------------------------------------
188 const vector<CicoSCInputDevConf*> &
189 CicoSystemConfig::getInputDevConfList(void) const
191 return m_inputDevConfList;
194 //--------------------------------------------------------------------------
200 //--------------------------------------------------------------------------
201 const vector<CicoSCCategoryConf*> &
202 CicoSystemConfig::getCategoryConfList(void) const
204 return m_categoryConfList;
207 //--------------------------------------------------------------------------
213 //--------------------------------------------------------------------------
214 const vector<CicoSCAppKindConf*> &
215 CicoSystemConfig::getAppKindConfList(void) const
217 return m_appKindConfList;
220 //--------------------------------------------------------------------------
226 //--------------------------------------------------------------------------
228 CicoSystemConfig::createNodeConfList(const ptree & root)
231 // if (root.not_found() == root.find("systemconfig")) {
232 // ICO_ERR("nodes element not found");
235 ptree nodes = root.get_child("systemconfig.nodes");
237 BOOST_FOREACH (const ptree::value_type& child, nodes) {
238 if (0 != strcmp(child.first.data(),"node")) {
239 ICO_ERR("unknown element(%s)", child.first.data());
241 optional<int> id = optional<int>(-1);
242 optional<string> name;
243 optional<string> type;
244 optional<string> address;
246 id = child.second.get_optional<int>("<xmlattr>.id");
247 if (false == id.is_initialized()) {
248 ICO_ERR("node.id attr not found");
251 name = child.second.get_optional<string>("<xmlattr>.name");
252 if (false == name.is_initialized()) {
253 ICO_ERR("node.name attr not found");
256 type = child.second.get_optional<string>("type");
257 if (false == type.is_initialized()) {
258 ICO_ERR("node.type element not found");
261 address = child.second.get_optional<string>("ipaddress");
262 if (false == address.is_initialized()) {
263 ICO_ERR("node.address element not found");
267 CicoSCNodeConf* nodeConf = new CicoSCNodeConf;
268 nodeConf->id = id.get();
269 nodeConf->name = name.get();
270 nodeConf->type = m_typeTable[type.get()];
271 nodeConf->address = address.get();
272 m_nodeConfList.push_back(nodeConf);
274 nodeConf->dumpConf();
278 //--------------------------------------------------------------------------
284 //--------------------------------------------------------------------------
286 CicoSystemConfig::createDisplayConfList(const ptree & root)
289 // if (root.not_found() != root.find("systemconfi.displays")) {
290 // ICO_ERR("displays element not found");
294 ptree displays = root.get_child("systemconfig.displays");
295 BOOST_FOREACH (const ptree::value_type& child, displays) {
296 optional<int> id = optional<int>(-1);
297 optional<string> name;
298 optional<string> node;
299 optional<int> no = optional<int>(-1);
300 optional<string> type;
301 optional<int> width = optional<int>(-1);
302 optional<int> height = optional<int>(-1);
304 id = child.second.get_optional<int>("<xmlattr>.id");
305 if (false == id.is_initialized()) {
306 ICO_ERR("display.id attr not found");
309 name = child.second.get_optional<string>("<xmlattr>.name");
310 if (false == name.is_initialized()) {
311 ICO_ERR("display.name attr not found");
314 node = child.second.get_optional<string>("node");
315 if (false == node.is_initialized()) {
316 ICO_ERR("display.node attr not found");
319 no = child.second.get_optional<int>("no");
320 if (false == no.is_initialized()) {
321 ICO_ERR("display.no element not found");
324 type = child.second.get_optional<string>("type");
325 if (false == type.is_initialized()) {
326 ICO_ERR("display.type element not found");
329 width = child.second.get_optional<int>("width");
330 if (false == width.is_initialized()) {
331 ICO_ERR("display.width element not found");
334 height = child.second.get_optional<int>("height");
335 if (false == height.is_initialized()) {
336 ICO_ERR("display.height element not found");
340 CicoSCDisplayConf* displayConf = new CicoSCDisplayConf();
341 displayConf->id = id.get();
342 displayConf->name = name.get();
343 displayConf->node = getNodeIdbyName(node.get());
344 displayConf->no = no.get();
345 displayConf->type = m_displayTypeTable[type.get()];
346 displayConf->width = width.get();
347 displayConf->height = height.get();
349 displayConf->dumpConf();
351 createLayerConf(child, displayConf);
352 createDisplayZoneConf(child, displayConf);
354 m_displayConfList.push_back(displayConf);
358 //--------------------------------------------------------------------------
364 //--------------------------------------------------------------------------
366 CicoSystemConfig::createLayerConf(const ptree::value_type & child,
367 CicoSCDisplayConf* displayConf)
369 ptree layers = child.second.get_child("layers");
370 BOOST_FOREACH (const ptree::value_type& layer, layers) {
371 optional<int> id = optional<int>(-1);
372 optional<string> name;
373 optional<int> type = optional<int>(-1);
374 optional<bool> overlap = optional<bool>(false);
376 id = layer.second.get_optional<int>("<xmlattr>.id");
377 if (false == id.is_initialized()) {
378 ICO_ERR("disply.layer.id attr not found");
381 name = layer.second.get_optional<string>("<xmlattr>.name");
382 if (false == name.is_initialized()) {
383 ICO_ERR("disply.layer.name attr not found");
386 type = layer.second.get_optional<int>("type");
387 if (false == type.is_initialized()) {
388 ICO_ERR("disply.layer.type element not found");
391 overlap = layer.second.get_optional<bool>("menuoverlap");
392 if (false == overlap.is_initialized()) {
393 ICO_ERR("disply.layer.overlap element not found");
397 CicoSCLayerConf* layerConf = new CicoSCLayerConf();
398 layerConf->id = id.get();
399 layerConf->name = name.get();
400 layerConf->type = type.get();
401 layerConf->menuoverlap = overlap.get();
403 displayConf->layerConfList.push_back(layerConf);
405 layerConf->dumpConf();
409 //--------------------------------------------------------------------------
415 //--------------------------------------------------------------------------
417 CicoSystemConfig::createDisplayZoneConf(const ptree::value_type & child,
418 CicoSCDisplayConf* displayConf)
420 ptree zones = child.second.get_child("zones");
421 BOOST_FOREACH (const ptree::value_type& zone, zones) {
422 optional<int> id = optional<int>(-1);
423 optional<string> name;
428 optional<bool> fixed;
434 id = zone.second.get_optional<int>("<xmlattr>.id");
435 if (false == id.is_initialized()) {
436 ICO_WRN("zone.id.attr not found");
439 name = zone.second.get_optional<string>("<xmlattr>.name");
440 if (false == name.is_initialized()) {
441 ICO_WRN("zone.name.attr not found");
444 x = zone.second.get_optional<string>("geometry.<xmlattr>.x");
445 if (false == x.is_initialized()) {
446 ICO_WRN("zone.geometry.x attr not found");
449 y = zone.second.get_optional<string>("geometry.<xmlattr>.y");
450 if (false == y.is_initialized()) {
451 ICO_WRN("zone.geometry.y attr not found");
454 w = zone.second.get_optional<string>("geometry.<xmlattr>.w");
455 if (false == w.is_initialized()) {
456 ICO_WRN("zone.geometry.w attr not found");
459 h = zone.second.get_optional<string>("geometry.<xmlattr>.h");
460 if (false == h.is_initialized()) {
461 ICO_WRN("zone.geometry.h attr not found");
464 fixed = zone.second.get_optional<bool>("aspect.<xmlattr>.Fixed");
465 if (false == fixed.is_initialized()) {
466 fixed = optional<bool>(false);
468 l = zone.second.get_optional<bool>("aspect.<xmlattr>.AlignLeft");
469 if (false == l.is_initialized()) {
470 l = optional<bool>(false);
472 r = zone.second.get_optional<bool>("aspect.<xmlattr>.AlignRight");
473 if (false == r.is_initialized()) {
474 r = optional<bool>(false);
476 t = zone.second.get_optional<bool>("aspect.<xmlattr>.AlignTop");
477 if (false == t.is_initialized()) {
478 t = optional<bool>(false);
480 b = zone.second.get_optional<bool>("aspect.<xmlattr>.AlignBottom");
481 if (false == b.is_initialized()) {
482 b = optional<bool>(false);
485 CicoSCDisplayZoneConf* zoneConf = new CicoSCDisplayZoneConf();
486 zoneConf->id = id.get();
487 zoneConf->name = name.get();
488 zoneConf->fullname = displayConf->name + "." + name.get();
489 zoneConf->x = calcGeometryExpr(x.get(), displayConf);
490 zoneConf->y = calcGeometryExpr(y.get(), displayConf);
491 zoneConf->w = calcGeometryExpr(w.get(), displayConf);
492 zoneConf->h = calcGeometryExpr(h.get(), displayConf);
493 zoneConf->aspectFixed = fixed.get();
494 zoneConf->aspectAlignLeft = l.get();
495 zoneConf->aspectAlignRight = r.get();
496 zoneConf->aspectAlignTop = t.get();
497 zoneConf->aspectAlignBottom = b.get();
498 displayConf->zoneConfList.push_back(zoneConf);
500 zoneConf->dumpConf();
504 //--------------------------------------------------------------------------
510 //--------------------------------------------------------------------------
512 CicoSystemConfig::createSoundConfList(const ptree & root)
515 ptree sounds = root.get_child("systemconfig.sounds");
516 BOOST_FOREACH (const ptree::value_type& child, sounds) {
517 optional<int> id = optional<int>(-1);
518 optional<string> name;
519 optional<int> no = optional<int>(-1);
521 id = child.second.get_optional<int>("<xmlattr>.id");
522 if (false == id.is_initialized()) {
526 name = child.second.get_optional<string>("<xmlattr>.name");
527 if (false == name.is_initialized()) {
531 no = child.second.get_optional<int>("no");
532 if (false == no.is_initialized()) {
536 CicoSCSoundConf* soundConf = new CicoSCSoundConf();
537 soundConf->id = id.get();
538 soundConf->name = name.get();
539 soundConf->no = no.get();
541 soundConf->dumpConf();
543 createSoundZoneConf(child, soundConf);
545 m_soundConfList.push_back(soundConf);
549 //--------------------------------------------------------------------------
555 //--------------------------------------------------------------------------
557 CicoSystemConfig::createSoundZoneConf(const ptree::value_type & child,
558 CicoSCSoundConf* soundConf)
563 ptree zones = child.second.get_child("zones");
564 BOOST_FOREACH (const ptree::value_type& zone, zones) {
565 optional<int> id = optional<int>(-1);
566 optional<string> name;
568 id = zone.second.get_optional<int>("<xmlattr>.id");
569 if (false == id.is_initialized()) {
572 name = zone.second.get_optional<string>("<xmlattr>.name");
573 if (false == name.is_initialized()) {
577 CicoSCSoundZoneConf* zoneConf = new CicoSCSoundZoneConf();
578 zoneConf->id = id.get();
579 zoneConf->name = name.get();
580 zoneConf->fullname = soundConf->name + "." + name.get();
581 soundConf->zoneConfList.push_back(zoneConf);
583 zoneConf->dumpConf();
587 //--------------------------------------------------------------------------
593 //--------------------------------------------------------------------------
595 CicoSystemConfig::createPortConf(const ptree & root)
598 ptree ports = root.get_child("systemconfig.ports");
599 BOOST_FOREACH (const ptree::value_type& child, ports) {
600 optional<int> id = optional<int>(-1);
601 optional<string> name;
603 id = child.second.get_optional<int>("<xmlattr>.id");
604 if (false == id.is_initialized()) {
607 name = child.second.get_optional<string>("<xmlattr>.name");
608 if (false == name.is_initialized()) {
615 m_sysconPort = atoi(child.second.data().c_str());
618 m_soundPluginPort = atoi(child.second.data().c_str());
626 //--------------------------------------------------------------------------
632 //--------------------------------------------------------------------------
634 CicoSystemConfig::createCategoryConf(const ptree & root)
637 ptree categorys = root.get_child("systemconfig.categorys");
638 BOOST_FOREACH (const ptree::value_type& child, categorys) {
639 optional<int> id = optional<int>(-1);
640 optional<string> name;
641 optional<string> type;
642 optional<string> view;
643 optional<string> sound;
644 optional<string> input;
645 optional<int> priority = optional<int>(-1);
646 optional<int> r_ctrl = optional<int>(-1);
648 id = child.second.get_optional<int>("<xmlattr>.id");
649 if (false == id.is_initialized()) {
652 name = child.second.get_optional<string>("<xmlattr>.name");
653 if (false == name.is_initialized()) {
656 type = child.second.get_optional<string>("type");
657 if (false == type.is_initialized()) {
660 view = child.second.get_optional<string>("view");
661 if (false == view.is_initialized()) {
664 sound = child.second.get_optional<string>("sound");
665 if (false == sound.is_initialized()) {
668 input= child.second.get_optional<string>("input");
669 if (false == sound.is_initialized()) {
672 priority = child.second.get_optional<int>("priority");
673 if (false == priority.is_initialized()) {
676 r_ctrl = child.second.get_optional<int>("r_ctrl");
677 if (false == r_ctrl.is_initialized()) {
681 CicoSCCategoryConf* categoryConf = new CicoSCCategoryConf();
682 categoryConf->id = id.get();
683 categoryConf->name = name.get();
684 categoryConf->type = type.get();
685 categoryConf->view = m_categoryTalbe[view.get()];
686 categoryConf->sound = m_categoryTalbe[sound.get()];
687 categoryConf->input = m_categoryTalbe[input.get()];
688 categoryConf->priority = priority.get();
689 categoryConf->rctrl = r_ctrl.get();
690 m_categoryConfList.push_back(categoryConf);
691 categoryConf->dumpConf();
695 //--------------------------------------------------------------------------
701 //--------------------------------------------------------------------------
703 CicoSystemConfig::createAppKindConf(const ptree & root)
706 ptree appkinds = root.get_child("systemconfig.appkinds");
707 BOOST_FOREACH (const ptree::value_type& child, appkinds) {
708 optional<int> id = optional<int>(-1);
709 optional<string> name;
710 optional<string> privilege;
711 optional<int> priority = optional<int>(-1);
713 id = child.second.get_optional<int>("<xmlattr>.id");
714 if (false == id.is_initialized()) {
718 name = child.second.get_optional<string>("<xmlattr>.name");
719 if (false == name.is_initialized()) {
723 privilege = child.second.get_optional<string>("privilege");
724 if (false == name.is_initialized()) {
728 priority = child.second.get_optional<int>("priority");
729 if (false == priority.is_initialized()) {
733 CicoSCAppKindConf* appKindConf = new CicoSCAppKindConf();
734 appKindConf->id = id.get();
735 appKindConf->name = name.get();
736 appKindConf->privilege = m_privilegeTable[privilege.get()];
737 appKindConf->priority = priority.get();
738 m_appKindConfList.push_back(appKindConf);
739 appKindConf->dumpConf();
743 //--------------------------------------------------------------------------
749 //--------------------------------------------------------------------------
751 CicoSystemConfig::createInputDevList(const ptree & root)
754 ptree inputs = root.get_child("systemconfig.inputs");
755 BOOST_FOREACH (const ptree::value_type& child, inputs) {
756 optional<int> id = optional<int>(-1);
757 optional<string> name;
759 id = child.second.get_optional<int>("<xmlattr>.id");
760 if (false == id.is_initialized()) {
764 name = child.second.get_optional<string>("<xmlattr>.name");
765 if (false == name.is_initialized()) {
769 CicoSCInputDevConf* inputDevConf = new CicoSCInputDevConf();
770 inputDevConf->id = id.get();
771 inputDevConf->name = name.get();
772 inputDevConf->dumpConf();
774 createSwitchList(child, inputDevConf);
775 m_inputDevConfList.push_back(inputDevConf);
779 //--------------------------------------------------------------------------
785 //--------------------------------------------------------------------------
787 CicoSystemConfig::createSwitchList(const ptree::value_type & child,
788 CicoSCInputDevConf* inputDevConf)
790 ptree switchs = child.second.get_child("switchs");
791 BOOST_FOREACH (const ptree::value_type& zone, switchs) {
792 optional<int> id = optional<int>(-1);
793 optional<string> name;
794 optional<string> appid;
796 id = zone.second.get_optional<int>("<xmlattr>.id");
797 if (false == id.is_initialized()) {
801 name = zone.second.get_optional<string>("<xmlattr>.name");
802 if (false == name.is_initialized()) {
806 appid = zone.second.get_optional<string>("<xmlattr>.appid");
807 if (false == appid.is_initialized()) {
811 CicoSCSwitchConf* switchConf = new CicoSCSwitchConf();
812 switchConf->id = id.get();
813 switchConf->name = name.get();
814 switchConf->appid = appid.get();
815 switchConf->dumpConf();
816 inputDevConf->switchConfList.push_back(switchConf);
820 //--------------------------------------------------------------------------
826 //--------------------------------------------------------------------------
828 CicoSystemConfig::createDefaultConf(const ptree & root)
831 ptree defaults = root.get_child("systemconfig.default");
833 optional<string> node;
834 optional<string> appkind;
835 optional<string> category;
836 optional<string> display;
837 optional<string> layer;
838 optional<string> displayzone;
839 optional<string> sound;
840 optional<string> soundzone;
841 optional<string> inputdev;
842 optional<string> inputsw;
844 node = defaults.get_optional<string>("node");
845 if (false == node.is_initialized()) {
846 ICO_WRN("default.node element not found");
849 appkind = defaults.get_optional<string>("appkind");
850 if (false == appkind.is_initialized()) {
851 ICO_WRN("default.appkind element not found");
854 category = defaults.get_optional<string>("category");
855 if (false == category.is_initialized()) {
856 ICO_WRN("default.category element not found");
859 display = defaults.get_optional<string>("display");
860 if (false == display.is_initialized()) {
861 ICO_WRN("default.display element not found");
864 layer = defaults.get_optional<string>("layer");
865 if (false == layer.is_initialized()) {
866 ICO_WRN("default.layer element not found");
869 displayzone = defaults.get_optional<string>("displayzone");
870 if (false == displayzone.is_initialized()) {
871 ICO_WRN("default.displayzone element not found");
874 sound = defaults.get_optional<string>("sound");
875 if (false == sound.is_initialized()) {
876 ICO_WRN("default.sound element not found");
879 soundzone = defaults.get_optional<string>("soundzone");
880 if (false == soundzone.is_initialized()) {
881 ICO_WRN("default.soundzone element not found");
884 inputdev = defaults.get_optional<string>("inputdev");
885 if (false == inputdev.is_initialized()) {
886 ICO_WRN("default.inputdev element not found");
889 inputsw = defaults.get_optional<string>("inputsw");
890 if (false == inputsw.is_initialized()) {
891 ICO_WRN("default.inputdsw element not found");
894 m_defaultConf = new CicoSCDefaultConf();
896 m_defaultConf->node = getNodeIdbyName(node.get());
897 m_defaultConf->appkind = getAppKindIdbyName(appkind.get());
898 m_defaultConf->category = getCategoryIdbyName(category.get());
899 m_defaultConf->display = getDisplayIdbyName(display.get());
900 m_defaultConf->layer = getLayerIdfbyName(display.get(), layer.get());
901 m_defaultConf->displayzone = getDizplayZoneIdbyName(display.get(),
903 m_defaultConf->sound = getSoundIdbyName(sound.get());
904 m_defaultConf->soundzone = getSoundZoneIdbyName(sound.get(),
906 m_defaultConf->inputdev = getInputDevIdbyName(inputdev.get());
907 m_defaultConf->inputsw = getSwitchIdbyName(inputdev.get(),
911 #define ICO_SYC_TOP_EVN (char*)"SYSCON_TOPDIR"
912 #define ICO_SYC_TOP_DIR (char*)"/usr/apps/org.tizen.ico.system-controller"
913 /* decide top directory in all configurations */
914 char *topdir = getenv(ICO_SYC_TOP_EVN);
915 if (NULL == topdir) {
916 topdir = ICO_SYC_TOP_DIR;
918 m_defaultConf->topdir = topdir;
921 #define ICO_SYC_CONFIG_ENV (char*)"SYSCON_CONFDIR"
922 #define ICO_SYC_CONFIG_DIR (char*)"res/config"
923 /* decide top directory in configuration file's */
924 char *confdir = getenv(ICO_SYC_CONFIG_ENV);
925 if (NULL != confdir) {
926 m_defaultConf->confdir = confdir;
929 m_defaultConf->confdir = m_defaultConf->topdir;
930 m_defaultConf->confdir.append("/");
931 m_defaultConf->confdir.append(ICO_SYC_CONFIG_DIR);
934 m_defaultConf->dumpConf();
937 //--------------------------------------------------------------------------
939 * @brief resource config class object create
943 //--------------------------------------------------------------------------
944 void getArray(ptree& t, vector<int>& vec);
945 static const char* g_resource_cpu = "systemconfig.resource_cpu_control";
947 CicoSystemConfig::createResourceConf(const ptree & root)
949 m_resourceConf = new CicoSCResourceConf;
950 ptree rc = root.get_child(g_resource_cpu);
957 if ((CicoSCDefaultConf*)0 != m_defaultConf) {
958 fPath = m_defaultConf->confdir;
959 fPath += string("/");
960 fPath += string("system_sysres.json");
963 memset(&buff, 0, sizeof(buff));
964 if (0 == stat(fPath.c_str(), &buff)) {
965 read_json(fPath.c_str(), lcl_pt);
971 if (boost::optional<std::string> function =
972 lcl_pt.get_optional<std::string>("function")) {
973 string v = function.get();
974 if (0 == v.compare("yes")) {
977 else if (0 == v.compare("app")) {
983 ICO_WRN("NG json file(%s)", fPath.c_str());
989 optional<string> opts = rc.get_optional<string>("do_it");
990 if (true == opts.is_initialized()) {
991 string v = opts.get();
992 if (0 == v.compare("yes")) {
995 else if (0 == v.compare("app")) {
1000 m_resourceConf->m_bDoIt = b;
1001 m_resourceConf->m_bDoItApp = bApp;
1006 if (boost::optional<std::string> ctrl_dir_path =
1007 lcl_pt.get_optional<std::string>("ctrl_dir_path")) {
1008 dirnm = ctrl_dir_path.get();
1012 ICO_WRN("NG json file(%s)", fPath.c_str());
1016 optional<string> opts2 = rc.get_optional<string>("ctrl_dir_path");
1017 if (true == opts2.is_initialized()) {
1018 dirnm = opts2.get();
1021 if (true == dirnm.empty()) {
1022 dirnm = "/sys/fs/cgroup/cpu,cpuacct/SCprivate";
1024 m_resourceConf->m_cpuCGRPPath = dirnm;
1028 optional<string> opts;
1030 opts = rc.get_optional<string>("sampling_wait");
1031 if (true == opts.is_initialized()) {
1032 m_resourceConf->m_sampling = atoi(opts.get().c_str());
1035 opts = rc.get_optional<string>("log");
1036 if (true == opts.is_initialized()) {
1037 string v = opts.get();
1038 if (0 == v.compare("true")) {
1039 m_resourceConf->m_bLog = true;
1043 opts = rc.get_optional<string>("retry_cnt");
1044 if (true == opts.is_initialized()) {
1045 m_resourceConf->m_retryCnt = atoi(opts.get().c_str());
1048 opts = rc.get_optional<string>("low_limit_value");
1049 if (true == opts.is_initialized()) {
1050 m_resourceConf->m_lowLimitVal = atoi(opts.get().c_str());
1053 opts = rc.get_optional<string>("high_limit_value");
1054 if (true == opts.is_initialized()) {
1055 m_resourceConf->m_highLimitVal = atoi(opts.get().c_str());
1058 BOOST_FOREACH(ptree::value_type& child, rc) {
1059 optional<int> id = optional<int>(-1);
1060 optional<string> name;
1061 id = child.second.get_optional<int>("<xmlattr>.id");
1062 if (false == id.is_initialized()) {
1065 name = child.second.get_optional<string>("<xmlattr>.name");
1066 if (false == name.is_initialized()) {
1069 ptree pth = child.second.get_child("hight_array");
1070 ptree ptl = child.second.get_child("low_array");
1072 CicoSCCpuResourceGrp* obj = new CicoSCCpuResourceGrp;
1073 obj->m_id = id.get();
1075 obj->m_grpNm = name.get();
1076 getArray(pth, obj->m_hight);
1077 getArray(ptl, obj->m_low);
1078 m_resourceConf->m_cpuCtrl.push_back(obj);
1080 m_resourceConf->dumpConf();
1083 //--------------------------------------------------------------------------
1085 * @brief vechicle information config class object create
1089 //--------------------------------------------------------------------------
1091 CicoSystemConfig::createVehicleInfoConf(const ptree & root)
1093 m_vehicleInfoConf = new CicoSCVehicleInfoConf();
1095 ptree child = root.get_child("systemconfig.vehicle_info");
1097 optional<int> retryCnt;
1098 optional<int> waitTime;
1100 retryCnt = child.get_optional<int>("retryCnt");
1101 if (false == retryCnt.is_initialized()) {
1102 ICO_WRN("vehicle_info.retryCnt element not found");
1103 retryCnt = optional<int>(0);
1106 waitTime = child.get_optional<int>("waitTime");
1107 if (false == waitTime.is_initialized()) {
1108 ICO_WRN("vehicle_info.waitTime element not found");
1109 waitTime = optional<int>(0);
1112 m_vehicleInfoConf->retryCnt = retryCnt.get();
1113 m_vehicleInfoConf->waitTime = waitTime.get();
1115 BOOST_FOREACH (const ptree::value_type& vinfo, child) {
1117 optional<string> name;
1118 optional<string> objname;
1119 optional<string> property;
1121 optional<string> type;
1123 id = vinfo.second.get_optional<int>("<xmlattr>.id");
1124 if (false == id.is_initialized()) {
1128 name = vinfo.second.get_optional<string>("<xmlattr>.name");
1129 if (false == name.is_initialized()) {
1133 property = vinfo.second.get_optional<string>("property");
1134 if (false == property.is_initialized()) {
1138 objname = vinfo.second.get_optional<string>("objname");
1139 if (false == objname.is_initialized()) {
1143 zone = vinfo.second.get_optional<int>("zone");
1144 if (false == zone.is_initialized()) {
1148 type = vinfo.second.get_optional<string>("type");
1149 if (false == type.is_initialized()) {
1153 CicoSCVIPropertyConf* viprop = new CicoSCVIPropertyConf();
1154 viprop->id = id.get();
1155 viprop->name = name.get();
1156 viprop->objname = objname.get();
1157 viprop->property = property.get();
1158 viprop->zone = zone.get();
1159 viprop->typestr = type.get();
1160 viprop->type = viprop->typeStrToInt(viprop->typestr);
1161 m_vehicleInfoConf->properties[id.get()] = viprop;
1164 m_vehicleInfoConf->dumpConf();
1167 //--------------------------------------------------------------------------
1169 * @brief user config class object create
1173 //--------------------------------------------------------------------------
1174 static const char* g_login_user_conf = "systemconfig.login_user";
1176 CicoSystemConfig::createUserConf(const ptree & root)
1178 m_userConf = new CicoSCUserConf;
1179 ptree rc = root.get_child(g_login_user_conf);
1180 optional<string> opts = rc.get_optional<string>("parent_dir");
1181 if (true == opts.is_initialized()) {
1182 string v = opts.get();
1184 m_userConf->m_parent_dir = v;
1187 m_userConf->dumpConf();
1190 //--------------------------------------------------------------------------
1196 //--------------------------------------------------------------------------
1198 CicoSystemConfig::calcGeometryExpr(const string & expr,
1199 CicoSCDisplayConf* conf)
1208 for (i = 0; ; i++) {
1209 if (expr[i] == ' ') continue;
1210 if ((expr[i] == 0) || (expr[i] == '+') || (expr[i] == '-') ||
1211 (expr[i] == '*') || (expr[i] == '-') || (expr[i] == '/')) {
1214 if ((strcasecmp(word, "dispw") == 0) ||
1215 (strcasecmp(word, "width") == 0)) {
1218 else if ((strcasecmp(word, "disph") == 0) ||
1219 (strcasecmp(word, "heigh") == 0)) {
1220 wval = conf->height;
1223 wval = strtol(word, (char **)0, 0);
1229 switch (sign % 10) {
1230 case 0: /* assign */
1249 if (expr[i] == '+') sign = 1;
1250 else if (expr[i] == '-') sign = 2;
1251 else if (expr[i] == '*') sign = 3;
1252 else if (expr[i] == '/') sign = 4;
1256 if ((sign > 0) && (expr[i] == '-')) {
1260 if (expr[i] == '+') sign = 1;
1261 else if (expr[i] == '-') sign = 2;
1262 else if (expr[i] == '*') sign = 3;
1263 else if (expr[i] == '/') sign = 4;
1267 if (expr[i] == 0) break;
1270 if (j < ((int)sizeof(word)-1)) {
1271 word[j++] = expr[i];
1278 //--------------------------------------------------------------------------
1284 //--------------------------------------------------------------------------
1285 const CicoSCNodeConf*
1286 CicoSystemConfig::findNodeConfbyName(const string & name)
1288 vector<CicoSCNodeConf*>::iterator itr;
1289 itr = m_nodeConfList.begin();
1290 for (; itr != m_nodeConfList.end(); ++itr) {
1291 const CicoSCNodeConf* conf = const_cast<CicoSCNodeConf*>(*itr);
1292 if (name == conf->name) {
1300 //--------------------------------------------------------------------------
1306 //--------------------------------------------------------------------------
1307 const CicoSCDisplayConf*
1308 CicoSystemConfig::findDisplayConfbyName(const string & name)
1310 vector<CicoSCDisplayConf*>::iterator itr;
1311 itr = m_displayConfList.begin();
1312 for (; itr != m_displayConfList.end(); ++itr) {
1313 const CicoSCDisplayConf* conf = NULL;
1314 conf = const_cast<CicoSCDisplayConf*>(*itr);
1315 if (name == conf->name) {
1323 //--------------------------------------------------------------------------
1329 //--------------------------------------------------------------------------
1330 const CicoSCDisplayConf*
1331 CicoSystemConfig::findDisplayConfbyId(int id)
1333 vector<CicoSCDisplayConf*>::iterator itr;
1334 itr = m_displayConfList.begin();
1335 for (; itr != m_displayConfList.end(); ++itr) {
1336 const CicoSCDisplayConf* conf = NULL;
1337 conf = const_cast<CicoSCDisplayConf*>(*itr);
1338 if (id == conf->id) {
1345 //--------------------------------------------------------------------------
1351 //--------------------------------------------------------------------------
1352 const CicoSCLayerConf*
1353 CicoSystemConfig::findLayerConfbyName(const string & displayName,
1354 const string & layerName)
1356 const CicoSCDisplayConf* displayConf = NULL;
1357 displayConf = findDisplayConfbyName(displayName);
1358 if (NULL == displayConf) {
1362 vector<CicoSCLayerConf*>::const_iterator itr;
1363 itr = displayConf->layerConfList.begin();
1364 for (; itr != displayConf->layerConfList.end(); ++itr) {
1365 const CicoSCLayerConf* conf = NULL;
1366 conf = const_cast<CicoSCLayerConf*>(*itr);
1367 if (layerName == conf->name) {
1375 //--------------------------------------------------------------------------
1381 //--------------------------------------------------------------------------
1382 const CicoSCLayerConf*
1383 CicoSystemConfig::findLayerConfbyIdx(int displayid, int idx)
1385 const CicoSCDisplayConf* displayConf = NULL;
1386 displayConf = findDisplayConfbyId(displayid);
1387 if (NULL == displayConf) {
1391 vector<CicoSCLayerConf*>::const_iterator itr;
1392 itr = displayConf->layerConfList.begin();
1393 for (; itr != displayConf->layerConfList.end(); ++itr) {
1394 const CicoSCLayerConf* conf = NULL;
1395 conf = const_cast<CicoSCLayerConf*>(*itr);
1404 //--------------------------------------------------------------------------
1410 //--------------------------------------------------------------------------
1411 const CicoSCDisplayZoneConf*
1412 CicoSystemConfig::findDisplayZoneConfbyName(const string & displayName,
1413 const string & zoneName)
1415 // ICO_TRA("CicoSystemConfig::findDisplayZoneConfbyName Enter"
1416 // "(displayName=%s zoneNmae=%s)",
1417 // displayName.c_str(), zoneName.c_str());
1419 const CicoSCDisplayConf* displayConf = NULL;
1420 displayConf = findDisplayConfbyName(displayName);
1421 if (NULL == displayConf) {
1422 // ICO_TRA("CicoSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
1426 vector<CicoSCDisplayZoneConf*>::const_iterator itr;
1427 itr = displayConf->zoneConfList.begin();
1428 for (; itr != displayConf->zoneConfList.end(); ++itr) {
1429 const CicoSCDisplayZoneConf* conf = NULL;
1430 conf = const_cast<CicoSCDisplayZoneConf*>(*itr);
1431 if (zoneName == conf->name) {
1432 // ICO_TRA("CicoSystemConfig::findDisplayZoneConfbyName Leave"
1433 // "(0x%08x)", conf);
1438 // ICO_TRA("CicoSystemConfig::findDisplayZoneConfbyName Leave(NULL)");
1442 //--------------------------------------------------------------------------
1448 //--------------------------------------------------------------------------
1449 const CicoSCSoundConf*
1450 CicoSystemConfig::findSoundConfbyName(const string & name)
1452 vector<CicoSCSoundConf*>::iterator itr;
1453 itr = m_soundConfList.begin();
1454 for (; itr != m_soundConfList.end(); ++itr) {
1455 const CicoSCSoundConf* conf = NULL;
1456 conf = const_cast<CicoSCSoundConf*>(*itr);
1457 if (name == conf->name) {
1465 //--------------------------------------------------------------------------
1471 //--------------------------------------------------------------------------
1472 const CicoSCSoundZoneConf*
1473 CicoSystemConfig::findSoundZoneConfbyName(const string & soundName,
1474 const string & zoneName)
1476 // ICO_TRA("CicoSystemConfig::findSoundZoneConfbyName Enter"
1477 // "(soundName=%s zoneNmae=%s)",
1478 // soundName.c_str(), zoneName.c_str());
1480 const CicoSCSoundConf* soundConf = NULL;
1481 soundConf = findSoundConfbyName(soundName);
1482 if (NULL == soundConf) {
1486 vector<CicoSCSoundZoneConf*>::const_iterator itr;
1487 itr = soundConf->zoneConfList.begin();
1488 for (; itr != soundConf->zoneConfList.end(); ++itr) {
1489 const CicoSCSoundZoneConf* conf = NULL;
1490 conf = const_cast<CicoSCSoundZoneConf*>(*itr);
1491 if (zoneName == conf->name) {
1499 //--------------------------------------------------------------------------
1505 //--------------------------------------------------------------------------
1506 const CicoSCInputDevConf*
1507 CicoSystemConfig::findInputDevConfbyName(const string & name)
1509 vector<CicoSCInputDevConf*>::iterator itr;
1510 itr = m_inputDevConfList.begin();
1511 for (; itr != m_inputDevConfList.end(); ++itr) {
1512 const CicoSCInputDevConf* conf = NULL;
1513 conf = const_cast<CicoSCInputDevConf*>(*itr);
1514 if (name == conf->name) {
1522 //--------------------------------------------------------------------------
1528 //--------------------------------------------------------------------------
1529 const CicoSCSwitchConf*
1530 CicoSystemConfig::findSwitchConfbyName(const string & inputDevName,
1531 const string & switchName)
1533 const CicoSCInputDevConf* inputDevConf = NULL;
1534 inputDevConf = findInputDevConfbyName(inputDevName);
1535 if (NULL == inputDevConf) {
1536 ICO_WRN("name(%s) input device config not found.",
1537 inputDevName.c_str());
1541 vector<CicoSCSwitchConf*>::const_iterator itr;
1542 itr = inputDevConf->switchConfList.begin();
1543 for (; itr != inputDevConf->switchConfList.end(); ++itr) {
1544 const CicoSCSwitchConf* conf = NULL;
1545 conf = const_cast<CicoSCSwitchConf*>(*itr);
1546 if (switchName == conf->name) {
1551 ICO_WRN("name(%s) switch config not found.", switchName.c_str());
1555 //--------------------------------------------------------------------------
1561 //--------------------------------------------------------------------------
1562 const CicoSCAppKindConf*
1563 CicoSystemConfig::findAppKindConfbyName(const string & name)
1565 vector<CicoSCAppKindConf*>::iterator itr;
1566 itr = m_appKindConfList.begin();
1567 for (; itr != m_appKindConfList.end(); ++itr) {
1568 const CicoSCAppKindConf* conf = NULL;
1569 conf = const_cast<CicoSCAppKindConf*>(*itr);
1570 if (name == conf->name) {
1578 //--------------------------------------------------------------------------
1584 //--------------------------------------------------------------------------
1585 const CicoSCDisplayZoneConf*
1586 CicoSystemConfig::findDisplayZoneConfbyId(int id)
1588 vector<CicoSCDisplayConf*>::iterator itr;
1589 itr = m_displayConfList.begin();
1590 for (; itr != m_displayConfList.end(); ++itr) {
1591 vector<CicoSCDisplayZoneConf*>::iterator itr2;
1592 itr2 = (*itr)->zoneConfList.begin();
1593 for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
1594 if (id == (*itr2)->id) {
1603 //--------------------------------------------------------------------------
1609 //--------------------------------------------------------------------------
1610 const CicoSCSoundZoneConf*
1611 CicoSystemConfig::findSoundZoneConfbyId(int id)
1613 vector<CicoSCSoundConf*>::iterator itr;
1614 itr = m_soundConfList.begin();
1615 for (; itr != m_soundConfList.end(); ++itr) {
1616 vector<CicoSCSoundZoneConf*>::iterator itr2;
1617 itr2 = (*itr)->zoneConfList.begin();
1618 for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
1619 if (id == (*itr2)->id) {
1628 //--------------------------------------------------------------------------
1634 //--------------------------------------------------------------------------
1635 const CicoSCCategoryConf*
1636 CicoSystemConfig::findCategoryConfbyName(const string & name)
1638 vector<CicoSCCategoryConf*>::iterator itr;
1639 itr = m_categoryConfList.begin();
1640 for (; itr != m_categoryConfList.end(); ++itr) {
1641 const CicoSCCategoryConf* conf = NULL;
1642 conf = const_cast<CicoSCCategoryConf*>(*itr);
1643 if (name == conf->name) {
1644 //return const_cast<CicoSCCategoryConf*>(itr->pointer);
1652 //--------------------------------------------------------------------------
1658 //--------------------------------------------------------------------------
1659 const CicoSCCategoryConf*
1660 CicoSystemConfig::findCategoryConfbyId(int id)
1662 vector<CicoSCCategoryConf*>::iterator itr;
1663 itr = m_categoryConfList.begin();
1664 for (; itr != m_categoryConfList.end(); ++itr) {
1665 const CicoSCCategoryConf* conf = NULL;
1666 conf = const_cast<CicoSCCategoryConf*>(*itr);
1667 if (id == conf->id) {
1675 //--------------------------------------------------------------------------
1681 //--------------------------------------------------------------------------
1682 const CicoSCAppKindConf *
1683 CicoSystemConfig::findAppKindConfbyId(int id)
1685 vector<CicoSCAppKindConf*>::iterator itr;
1686 itr = m_appKindConfList.begin();
1687 for (; itr != m_appKindConfList.end(); ++itr) {
1688 if (id == (*itr)->id) {
1696 //--------------------------------------------------------------------------
1702 //--------------------------------------------------------------------------
1703 const CicoSCDefaultConf*
1704 CicoSystemConfig::getDefaultConf(void)
1706 return m_defaultConf;
1709 //--------------------------------------------------------------------------
1715 //--------------------------------------------------------------------------
1717 CicoSystemConfig::getNodeIdbyName(const string & name)
1719 const CicoSCNodeConf* conf = NULL;
1720 conf = findNodeConfbyName(name);
1728 //--------------------------------------------------------------------------
1734 //--------------------------------------------------------------------------
1736 CicoSystemConfig::getDisplayIdbyName(const string & name)
1738 const CicoSCDisplayConf* conf = NULL;
1739 conf = findDisplayConfbyName(name);
1747 //--------------------------------------------------------------------------
1753 //--------------------------------------------------------------------------
1755 CicoSystemConfig::getDisplayIdbyNo(int no)
1757 vector<CicoSCDisplayConf*>::iterator itr;
1758 itr = m_displayConfList.begin();
1759 for (; itr != m_displayConfList.end(); ++itr) {
1760 const CicoSCDisplayConf* conf = NULL;
1761 conf = const_cast<CicoSCDisplayConf*>(*itr);
1762 if (no == conf->no) {
1769 //--------------------------------------------------------------------------
1775 //--------------------------------------------------------------------------
1777 CicoSystemConfig::setDisplaySize(int id, int width, int height)
1779 vector<CicoSCDisplayConf*>::iterator itr;
1780 itr = m_displayConfList.begin();
1781 for (; itr != m_displayConfList.end(); ++itr) {
1782 CicoSCDisplayConf* conf = NULL;
1783 conf = const_cast<CicoSCDisplayConf*>(*itr);
1784 if (id == conf->id) {
1785 ICO_TRA("CicoSystemConfig::setDisplaySize(%d,%d,%d) change size from %d,%d",
1786 id, width, height, conf->width, conf->height);
1787 conf->width = width;
1788 conf->height = height;
1792 ICO_ERR("CicoSystemConfig::setDisplaySize(%d,%d,%d) Error", id, width, height);
1795 //--------------------------------------------------------------------------
1801 //--------------------------------------------------------------------------
1803 CicoSystemConfig::getLayerIdfbyName(const string & displayName,
1804 const string & layerName)
1806 const CicoSCLayerConf* conf = NULL;
1807 conf = findLayerConfbyName(displayName, layerName);
1815 //--------------------------------------------------------------------------
1821 //--------------------------------------------------------------------------
1823 CicoSystemConfig::getDizplayZoneIdbyName(const string & displayName,
1824 const string & zoneName)
1826 const CicoSCDisplayZoneConf* conf = NULL;
1827 conf = findDisplayZoneConfbyName(displayName, zoneName);
1835 //--------------------------------------------------------------------------
1841 //--------------------------------------------------------------------------
1843 CicoSystemConfig::getDizplayZoneIdbyFullName(const string & zoneFullName)
1845 string::size_type index = zoneFullName.find(".", 0);
1846 if (string::npos == index) {
1849 string displayName = zoneFullName.substr(0, index);
1850 string zoneName = zoneFullName.substr(index+1);
1852 const CicoSCDisplayZoneConf* conf = NULL;
1853 conf = findDisplayZoneConfbyName(displayName, zoneName);
1861 //--------------------------------------------------------------------------
1867 //--------------------------------------------------------------------------
1869 CicoSystemConfig::getSoundIdbyName(const string & name)
1871 const CicoSCSoundConf* conf = NULL;
1872 conf = findSoundConfbyName(name);
1880 //--------------------------------------------------------------------------
1886 //--------------------------------------------------------------------------
1888 CicoSystemConfig::getSoundZoneIdbyName(const string & soundName,
1889 const string & zoneName)
1891 const CicoSCSoundZoneConf* conf = NULL;
1892 conf = findSoundZoneConfbyName(soundName, zoneName);
1900 //--------------------------------------------------------------------------
1906 //--------------------------------------------------------------------------
1908 CicoSystemConfig::getSoundZoneIdbyFullName(const string & zoneFullName)
1910 string::size_type index = zoneFullName.find(".", 0);
1911 if (string::npos == index) {
1914 string soundName = zoneFullName.substr(0, index);
1915 string zoneName = zoneFullName.substr(index+1);
1917 const CicoSCSoundZoneConf* conf = NULL;
1918 conf = findSoundZoneConfbyName(soundName, zoneName);
1926 //--------------------------------------------------------------------------
1932 //--------------------------------------------------------------------------
1934 CicoSystemConfig::getInputDevIdbyName(const string & name)
1936 const CicoSCInputDevConf* conf = NULL;
1937 conf = findInputDevConfbyName(name);
1945 //--------------------------------------------------------------------------
1951 //--------------------------------------------------------------------------
1953 CicoSystemConfig::getSwitchIdbyName(const string & inputDevName,
1954 const string & switchName)
1956 const CicoSCSwitchConf* conf = NULL;
1957 conf = findSwitchConfbyName(inputDevName, switchName);
1965 //--------------------------------------------------------------------------
1971 //--------------------------------------------------------------------------
1973 CicoSystemConfig::getAppKindIdbyName(const string & name)
1975 const CicoSCAppKindConf* conf = NULL;
1976 conf = findAppKindConfbyName(name);
1984 //--------------------------------------------------------------------------
1990 //--------------------------------------------------------------------------
1992 CicoSystemConfig::getCategoryIdbyName(const string & name)
1994 const CicoSCCategoryConf* conf = NULL;
1995 conf = findCategoryConfbyName(name);
2003 //--------------------------------------------------------------------------
2005 * @brief get category config object class
2009 //--------------------------------------------------------------------------
2010 const CicoSCCategoryConf*
2011 CicoSystemConfig::getCategoryObjbyCaategoryID(int id)
2016 vector<CicoSCCategoryConf*>::iterator itr;
2017 itr = m_categoryConfList.begin();
2018 for (; itr != m_categoryConfList.end(); ++itr) {
2019 const CicoSCCategoryConf* conf = NULL;
2020 conf = const_cast<CicoSCCategoryConf*>(*itr);
2021 if (id == conf->id) {
2022 //return const_cast<CicoSCCategoryConf*>(itr->pointer);
2029 //--------------------------------------------------------------------------
2031 * @brief array xml tree to vector<int>
2035 //--------------------------------------------------------------------------
2036 CicoSCVehicleInfoConf*
2037 CicoSystemConfig::getVehicleInfoConf(void)
2039 return m_vehicleInfoConf;
2042 //--------------------------------------------------------------------------
2044 * @brief array xml tree to vector<int>
2048 //--------------------------------------------------------------------------
2049 void getArray(ptree& t, vector<int>& vec)
2052 BOOST_FOREACH (const ptree::value_type& child, t) {
2053 const int value = lexical_cast<int>(child.second.data());
2054 vec.push_back(value);
2057 // vim:set expandtab ts=4 sw=4: