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 CicoSCResourceManager.cpp
14 * @brief This file implementation of CicoSCResourceManager class
16 //==========================================================================
21 #include "CicoSCResourceManager.h"
23 #include "ico_syc_error.h"
24 #include "ico_syc_mrp_resource_private.h"
26 #include "ico_syc_msg_cmd_def.h"
27 #include "CicoSystemConfig.h"
29 #include "CicoSCCommand.h"
30 #include "CicoSCPolicyManager.h"
31 #include "CicoSCLifeCycleController.h"
32 #include "CicoAilItems.h"
33 #include "CicoSCWindow.h"
34 #include "CicoSCWindowController.h"
35 #include "CicoSCInputController.h"
36 #include "CicoSCPolicyDef.h"
37 #include "CicoSCMessage.h"
38 #include "CicoSCMessageRes.h"
39 #include "CicoSCServer.h"
41 struct CompDisplayResourceRequest
43 CompDisplayResourceRequest(const resource_request_t *req)
46 bool operator() (const resource_request_t *req)
51 ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
52 if ((0 == strcmp(m_req->appid, req->appid)) &&
53 (m_req->pid == req->pid) &&
54 ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK)) &&
55 (m_req->surfaceid == req->surfaceid)) {
61 const resource_request_t *m_req;
64 struct CompSoundResourceRequest
66 CompSoundResourceRequest(const resource_request_t *req)
69 bool operator() (const resource_request_t *req)
75 ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
76 if ((0 == strcmp(m_req->appid, req->appid)) &&
77 (m_req->pid == req->pid) &&
78 ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK)) &&
79 (m_req->soundid == req->soundid)) {
85 const resource_request_t *m_req;
88 struct CompInputResourceRequest
90 CompInputResourceRequest(const resource_request_t *req)
93 bool operator() (const resource_request_t *req)
99 ICO_DBG("appid=%s:%s", req->appid, m_req->appid);
100 if ((0 == strcmp(m_req->appid, req->appid)) &&
101 (0 == strcmp(m_req->device, req->device)) &&
102 (m_req->pid == req->pid) &&
103 ((m_req->resid & RESID_TYPE_MASK) == (req->resid & RESID_TYPE_MASK))) {
109 const resource_request_t *m_req;
113 CicoSCResourceManager::CicoSCResourceManager()
114 : m_policyMgr(NULL), m_winCtrl(NULL), m_inputCtrl(NULL),
115 m_animaName("Fade"), m_animaTime(400)
117 m_policyMgr = new CicoSCPolicyManager(this);
119 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
120 list<resource_request_t*> l;
123 // initialize display current request and waiting queue
124 const vector<CicoSCDisplayConf*>& dispConfList
125 = sysConf->getDisplayConfList();
126 vector<CicoSCDisplayConf*>::const_iterator itr;
127 itr = dispConfList.begin();
128 for (; itr != dispConfList.end(); ++itr) {
129 vector<CicoSCDisplayZoneConf*>::iterator itr2;
130 itr2 = (*itr)->zoneConfList.begin();
131 for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
132 m_curDispResOwerReq[(*itr2)->id] = NULL;
138 // initialize sound current request and waiting queue
139 const vector<CicoSCSoundConf*>& soundConfList
140 = sysConf->getSoundConfList();
141 vector<CicoSCSoundConf*>::const_iterator itr;
142 itr = soundConfList.begin();
143 for (; itr != soundConfList.end(); ++itr) {
144 vector<CicoSCSoundZoneConf*>::iterator itr2;
145 itr2 = (*itr)->zoneConfList.begin();
146 for (; itr2 != (*itr)->zoneConfList.end(); ++itr2) {
147 m_curSoundResReq[(*itr2)->id] = NULL;
148 m_soundReqQueue[(*itr2)->id] = l;
154 // initialize input current request and waiting queue
155 const vector<CicoSCInputDevConf*>& inputDevConfList
156 = sysConf->getInputDevConfList();
157 vector<CicoSCInputDevConf*>::const_iterator itr;
158 itr = inputDevConfList.begin();
159 for (; itr != inputDevConfList.end(); ++itr) {
160 vector<CicoSCSwitchConf*>::iterator itr2;
161 itr2 = (*itr)->switchConfList.begin();
162 for (; itr2 != (*itr)->switchConfList.end(); ++itr2) {
163 m_curInputResReq[(*itr2)->id] = NULL;
164 m_inputReqQueue[(*itr2)->id] = l;
168 m_rrtHO = (resource_request_t*)NULL;
171 CicoSCResourceManager::~CicoSCResourceManager()
177 CicoSCResourceManager::initialize(void)
179 ICO_TRA("CicoSCResourceManager::initialize Enter");
181 int ret = ICO_SYC_EOK;
183 ret = ico_syc_mrp_init(enforceSound, this);
184 if (ICO_SYC_EOK != ret) {
185 ICO_TRA("CicoSCResourceManager::initialize Leave");
189 ret = m_policyMgr->initialize();
190 if (ICO_SYC_EOK != ret) {
191 ICO_TRA("CicoSCResourceManager::initialize Leave");
196 ICO_TRA("CicoSCResourceManager::initialize Leave");
201 CicoSCResourceManager::terminate(void)
203 ICO_TRA("CicoSCResourceManager::terminate Enter");
204 m_policyMgr->terminate();
206 ICO_TRA("CicoSCResourceManager::terminate Leave");
210 CicoSCResourceManager::handleCommand(const CicoSCCommand &cmd,
213 ICO_TRA("CicoSCResourceManager::handleCommand Enter"
214 "(cmdid=0x%08X internal=%s)",
215 cmd.cmdid, internal ? "true" : "false");
217 CicoSCCmdResCtrlOpt *opt = (CicoSCCmdResCtrlOpt*)cmd.opt;
219 // request command from application or internal
220 int reqtype = internal ? REQTYPE_AUTO : REQTYPE_APP;
221 if ((MSG_CMD_CREATE_RES == cmd.cmdid) ||
222 (MSG_CMD_ACQUIRE_RES == cmd.cmdid)) {
224 if (true == opt->dispres) {
225 resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
228 if (MSG_CMD_CREATE_RES == cmd.cmdid) {
229 acquireDisplayResource(req, false);
232 // cmdid is MSG_CMD_ACQUIRE_RES
233 if (true == isTypeOnScreen(*req)) {
234 acquireOnScreenDisplayResource(req);
237 if ((true == m_policyMgr->getRegulation()) &&
238 (false == isMatchDisplayed())) {
239 updateDispResRegulationPreProc(req);
240 updateDisplayResourceRegulation(STID_DRVREGULATION_ON);
243 acquireDisplayResource(req);
248 if (true == opt->soundres) {
249 resource_request_t *req = newResourceRequest(RESID_KIND_SOUND,
252 if ((true == m_policyMgr->getRegulation()) &&
253 (false == isMatchDisplayed())) {
254 updateSoundResRegulationPreProc(req);
255 updateSoundResourceRegulation(STID_DRVREGULATION_ON);
258 acquireSoundResource(req);
262 if (true == opt->inputres) {
263 resource_request_t *req = newResourceRequest(RESID_KIND_INPUT,
266 if ((true == m_policyMgr->getRegulation()) &&
267 (false == isMatchDisplayed())) {
268 updateInputResRegulationPreProc(req);
269 updateInputResourceRegulation(STID_DRVREGULATION_ON);
272 acquireInputResource(req);
276 else if ((MSG_CMD_RELEASE_RES == cmd.cmdid) ||
277 (MSG_CMD_DESTORY_RES == cmd.cmdid)) {
279 if (true == opt->dispres) {
280 resource_request_t *req = newResourceRequest(RESID_KIND_DISPLAY,
283 if (true == isTypeOnScreen(*req)) {
284 releaseOnScreenDisplayResource(req);
287 releaseDisplayResource(req);
290 if (true == opt->soundres) {
291 resource_request_t *req = newResourceRequest(RESID_KIND_SOUND,
294 releaseSoundResource(req);
296 if (true == opt->inputres) {
297 resource_request_t *req = newResourceRequest(RESID_KIND_INPUT,
300 releaseInputResource(req);
304 ICO_WRN("Unknown command");
307 ICO_TRA("CicoSCResourceManager::handleCommand Leave");
311 CicoSCResourceManager::setWindowController(CicoSCWindowController *winCtrl)
317 CicoSCResourceManager::setInputController(CicoSCInputController *inputCtrl)
319 m_inputCtrl = inputCtrl;
324 CicoSCResourceManager::popDispResReq(resource_request_t *req)
326 ICO_TRA("CicoSCResourceManager::popDispResReq Enter");
328 map<int, list<resource_request_t*> >::iterator itr;
329 itr = m_dispReqQueue.begin();
330 CompDisplayResourceRequest comp(req);
331 for (; itr != m_dispReqQueue.end(); ++itr) {
332 list<resource_request_t*>::iterator itr2;
333 itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
334 if (itr->second.end() != itr2) {
335 ICO_DBG("Dequeue waiting display request queue zone=%d req=0x%08x",
337 m_dispReqQueue[req->dispzoneid].erase(itr2);
338 ICO_TRA("CicoSCResourceManager::popDispResReq Leave"
344 ICO_TRA("CicoSCResourceManager::popDispResReq Leave(NULL)");
350 CicoSCResourceManager::popSoundResReq(resource_request_t *req)
352 ICO_TRA("CicoSCResourceManager::popSoundResReq Enter");
354 map<int, list<resource_request_t*> >::iterator itr;
355 itr = m_soundReqQueue.begin();
356 CompSoundResourceRequest comp(req);
357 for (; itr != m_soundReqQueue.end(); ++itr) {
358 list<resource_request_t*>::iterator itr2;
359 itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
360 if (itr->second.end() != itr2) {
361 ICO_DBG("Dequeue waiting sound request queue"
362 "(req=0x%08x zone:%02d:%s appid=%s)",
363 *itr2, itr->first, (*itr2)->soundzone, (*itr2)->appid);
364 m_soundReqQueue[req->soundzoneid].erase(itr2);
365 ICO_TRA("CicoSCResourceManager::popSoundResReq Leave"
370 ICO_TRA("CicoSCResourceManager::popSoundResReq Leave(NULL)");
375 CicoSCResourceManager::popInputResReq(resource_request_t *req)
377 ICO_TRA("CicoSCResourceManager::popInputResReq Enter");
379 map<int, list<resource_request_t*> >::iterator itr;
380 itr = m_inputReqQueue.begin();
381 CompInputResourceRequest comp(req);
382 for (; itr != m_inputReqQueue.end(); ++itr) {
383 list<resource_request_t*>::iterator itr2;
384 itr2 = find_if(itr->second.begin(), itr->second.end(), comp);
385 if (itr->second.end() != itr2) {
386 ICO_DBG("Dequeue waiting input request queue"
387 "(req=0x%08x input:%d appid=%s)",
388 *itr2, (*itr2)->input, (*itr2)->appid);
389 m_inputReqQueue[req->input].erase(itr2);
390 ICO_TRA("CicoSCResourceManager::popInputResReq Leave"
396 ICO_TRA("CicoSCResourceManager::popDispResReq Leave(NULL)");
402 CicoSCResourceManager::acquireDisplayResource(resource_request_t *newreq,
405 ICO_TRA("CicoSCResourceManager::acquireDisplayResource Enter");
407 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
408 const CicoSCAppKindConf *appKindConf = NULL;
409 appKindConf = sysConf->findAppKindConfbyId(newreq->appkind);
410 if (NULL == appKindConf) {
411 ICO_ERR("not found CicoSCAppKindConf instance");
412 ICO_TRA("CicoSCResourceManager::acquireDisplayResource Leave(false)");
416 if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
417 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM) ||
418 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_VISIBLE)) {
420 if ((NULL != m_winCtrl) && (true == control)) {
421 m_winCtrl->show(newreq->surfaceid,
423 newreq->animationTime);
425 delResourceRequest(newreq);
427 ICO_DBG("kind of system application");
428 ICO_TRA("CicoSCResourceManager::acquireDisplayResource Leave(true)");
432 // if exist current ower request, pop request
433 resource_request_t *req = findCurDispResOwerReq(newreq);
436 ICO_DBG("dispzoneid=%d/%d zone=%s/%s",
437 req->dispzoneid, newreq->dispzoneid,
438 req->dispzone, newreq->dispzone);
439 if (req->dispzoneid != newreq->dispzoneid) {
440 req = popCurDispResOwerReq(req);
441 m_policyMgr->releaseDisplayResource(req->dispzoneid, req->prio);
442 chgzone = newreq->dispzoneid;
446 // if exist in wating request list, pop request
448 req = popWaitingDispResReq(newreq);
450 ICO_DBG("dispzoneid=%d/%d zone=%s/%s",
451 req->dispzoneid, newreq->dispzoneid,
452 req->dispzone, newreq->dispzone);
453 if (req->dispzoneid != newreq->dispzoneid) {
454 chgzone = newreq->dispzoneid;
462 bool displayMatch = false;
465 char zoneO[128],zoneN[128];
466 zoneO[0] = zoneN[0] = '\0';
467 if ((NULL != req) && (NULL != req->dispzone)) {
469 const char* s = req->dispzone;
470 while ('\0' != *s) { // is stop code
471 if ('.' == *s) { // DISPLAY.ZONE found a period
472 break; // break of while
474 *d++ = *s++; // char copy
476 *d='\0'; // set stop code
478 if ((NULL != newreq) && (NULL != newreq->dispzone)) {
480 const char* s = newreq->dispzone;
481 while ('\0' != *s) { // is stop code
482 if ('.' == *s) { // DISPLAY.ZONE found a period
483 break; // break of while
485 *d++ = *s++; // char copy
487 *d='\0'; // set stop code
489 if ((0 != strlen(zoneO)) || (0 != strlen(zoneN))) {
490 if (0 == strcmp(zoneO, zoneN)) {
494 // update request data
495 req->dispzoneid = newreq->dispzoneid;
497 req->dispzone = strdup(newreq->dispzone);
498 req->layerid = newreq->layerid;
499 free(req->animation);
500 req->animation = strdup(newreq->animation);
501 req->animationTime = newreq->animationTime;
503 // delete new request
504 delResourceRequest(newreq);
507 if (false == control) {
508 ICO_TRA("Enqueue waiting display resource request"
509 "(req=0x%08x appid=%s)", req, req->appid);
510 m_waitingDispResReq.push_front(req);
512 dumpWaitingDispResReq();
517 int type = req->resid & RESID_TYPE_MASK;
518 bool state = m_policyMgr->acquireDisplayResource(type,
521 if ((true == state) && (false == displayMatch)){
522 updateDisplayResource(req, chgzone);
525 if ((-1 != chgzone) || (true == displayMatch)) {
526 if (NULL != m_winCtrl) {
527 // move request window
528 m_winCtrl->setGeometry(req->surfaceid, req->dispzone, req->layerid,
529 req->animation, req->animationTime,
530 req->animation, req->animationTime);
534 // just in case, hide window
535 if (NULL != m_winCtrl) {
536 // hide request window
537 m_winCtrl->hide(req->surfaceid, NULL, 0);
540 ICO_DBG("Enqueue waiting display resource request"
541 "(req=0x%08x appid=%s)", req, req->appid);
542 m_waitingDispResReq.push_front(req);
544 dumpWaitingDispResReq();
548 ICO_TRA("CicoSCResourceManager::acquireDisplayResource Leave");
553 CicoSCResourceManager::releaseDisplayResource(resource_request_t *newreq)
555 ICO_TRA("CicoSCResourceManager::releaseDisplayResource Enter"
556 "(newreq=0x%08x)", newreq);
558 // if exist in wating request list, pop request
559 resource_request_t *req = popWaitingDispResReq(newreq);
561 delResourceRequest(req);
562 delResourceRequest(newreq);
563 ICO_TRA("CicoSCResourceManager::releaseDisplayResource Leave");
567 // if exist current ower request, pop request
568 req = popCurDispResOwerReq(newreq);
570 m_policyMgr->releaseDisplayResource(req->dispzoneid, req->prio);
571 delResourceRequest(req);
573 delResourceRequest(newreq);
575 list<resource_request_t*>::iterator itr;
576 itr = m_waitingDispResReq.begin();
577 for (; itr != m_waitingDispResReq.end(); ++itr) {
578 if (NULL != m_curDispResOwerReq[(*itr)->dispzoneid]) {
581 int type = (*itr)->resid & RESID_TYPE_MASK;
582 bool active = m_policyMgr->acquireDisplayResource(type,
585 if (true == active) {
586 resource_request_t* popreq = popWaitingDispResReq(*itr);
587 updateDisplayResource(popreq);
588 m_winCtrl->activeCB(NULL, NULL, popreq->surfaceid, -1);
593 ICO_TRA("CicoSCResourceManager::releaseDisplayResource Leave");
597 CicoSCResourceManager::acquireSoundResource(resource_request_t *newreq)
599 ICO_TRA("CicoSCResourceManager::acquireSoundResource Enter");
601 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
602 const CicoSCAppKindConf *appKindConf = NULL;
603 appKindConf = sysConf->findAppKindConfbyId(newreq->appkind);
604 if (NULL == appKindConf) {
605 ICO_ERR("not found CicoSCAppKindConf instance");
606 ICO_TRA("CicoSCResourceManager::acquireSoundResource Leave(false)");
610 if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
611 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM) ||
612 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_AUDIO)) {
614 delResourceRequest(newreq);
616 ICO_DBG("kind of system application");
617 ICO_TRA("CicoSCResourceManager::acquireSoundResource Leave(true)");
621 resource_request_t *req = popSoundResReq(newreq);
627 CompSoundResourceRequest comp(req);
628 if (true == comp(m_curSoundResReq[req->soundzoneid])) {
629 ICO_DBG("already acquired appid=%s pid=%d soundid=0x%08X",
630 req->appid, req->pid, req->soundid);
631 ICO_TRA("CicoSCResourceManager::acquireSoundResource Leave(true)");
633 delResourceRequest(newreq);
637 int type = req->resid & RESID_TYPE_MASK;
638 bool state = m_policyMgr->acquireSoundResource(type,
642 updateSoundResource(req);
645 ICO_DBG("Enqueue waiting sound request queue"
646 "(req=0x%08x zone:%02d:%s appid=%s)",
647 req, req->soundzoneid, req->soundzone, req->appid);
648 m_soundReqQueue[req->soundzoneid].push_front(req);
651 ICO_TRA("CicoSCResourceManager::acquireSoundResource Leave");
656 CicoSCResourceManager::releaseSoundResource(resource_request_t *newreq)
658 ICO_TRA("CicoSCResourceManager::releaseSoundResource Enter");
661 CompSoundResourceRequest comp(newreq);
662 for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
663 if (NULL == m_curSoundResReq[i]) {
667 if (true == comp(m_curSoundResReq[i])) {
668 ICO_DBG("Dequeue current sound resource ower request"
669 "(req=0x%08x zoneid=%02d:%s appid=%s)",
670 m_curSoundResReq[i], m_curSoundResReq[i]->dispzoneid,
671 m_curSoundResReq[i]->dispzone,
672 m_curSoundResReq[i]->appid);
673 ICO_PRF("CHG_GUI_RES sound deprived zone=%02d:%s appid=%s",
674 m_curSoundResReq[i]->dispzoneid,
675 m_curSoundResReq[i]->dispzone,
676 m_curSoundResReq[i]->appid);
677 ico_syc_mrp_release_sound_resource(m_curSoundResReq[i]);
678 delResourceRequest(newreq);
679 delResourceRequest(m_curSoundResReq[i]);
680 m_curSoundResReq[i] = NULL;
686 // If current request is not changed,
687 // remove the request from the waiting queue.
688 if (false == curchg) {
689 resource_request_t *req = popSoundResReq(newreq);
691 ico_syc_mrp_release_sound_resource(req);
692 delResourceRequest(req);
695 delResourceRequest(newreq);
696 ICO_TRA("CicoSCResourceManager::releaseSoundResource Leave");
700 map<int, list<resource_request_t*> >::iterator itr;
701 itr = m_soundReqQueue.begin();
702 for (; itr != m_soundReqQueue.end(); ++itr) {
703 list<resource_request_t*>::iterator itr2;
704 itr2 = itr->second.begin();
705 for (; itr2 != itr->second.end(); ++itr2) {
706 if (NULL != m_curSoundResReq[(*itr2)->soundzoneid]) {
710 int type = (*itr2)->resid & RESID_TYPE_MASK;
711 bool active = m_policyMgr->acquireSoundResource(type,
712 (*itr2)->soundzoneid,
714 if (true == active) {
715 resource_request_t* req = *itr2;
716 ICO_DBG("Dequeue waiting sound request queue "
717 "(req=0x%08x zone:%02d:%s appid=%s)",
718 *itr2, itr->first, (*itr2)->soundzone, (*itr2)->appid);
719 itr->second.erase(itr2);
720 updateSoundResource(req);
726 ICO_TRA("CicoSCResourceManager::releaseSoundResource Leave");
730 CicoSCResourceManager::acquireInputResource(resource_request_t *newreq)
732 ICO_TRA("CicoSCResourceManager::acquireInputResource Enter");
734 resource_request_t *req = popInputResReq(newreq);
740 CompInputResourceRequest comp(req);
741 if (true == comp(m_curInputResReq[req->input])) {
742 ICO_DBG("already acquired appid=%s pid=%d input=0x%08X",
743 req->appid, req->pid, req->input);
744 ICO_TRA("CicoSCResourceManager::acquireInputResource Leave(true)");
746 delResourceRequest(newreq);
750 bool state = m_policyMgr->acquireInputResource(req->input, req->prio);
752 updateInputResource(req);
755 ICO_DBG("Enqueue waiting input request queue"
756 "(req=0x%08x input:%d appid=%s)", req, req->input, req->appid);
757 m_inputReqQueue[req->input].push_front(req);
760 ICO_TRA("CicoSCResourceManager::acquireInputResource Leave(true)");
765 CicoSCResourceManager::releaseInputResource(resource_request_t *newreq)
767 ICO_TRA("CicoSCResourceManager::releaseInputResource Enter");
769 CompInputResourceRequest comp(newreq);
770 for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
771 if (NULL == m_curInputResReq[i]) {
775 if (true == comp(m_curInputResReq[i])) {
776 if (NULL != m_inputCtrl) {
777 m_inputCtrl->delInputApp(m_curInputResReq[i]->appid,
778 m_curInputResReq[i]->device,
779 m_curInputResReq[i]->input);
781 ICO_DBG("Dequeue current input resource ower request"
782 "(req=0x%08x input=%d appid=%s)",
783 m_curInputResReq[i], m_curInputResReq[i]->input,
784 m_curInputResReq[i]->appid);
785 ICO_PRF("CHG_GUI_RES input deprived input=%d appid=%s",
786 m_curInputResReq[i]->input, m_curInputResReq[i]->appid);
787 delResourceRequest(newreq);
788 delResourceRequest(m_curInputResReq[i]);
789 m_curInputResReq[i] = NULL;
795 // If current request is not changed,
796 // remove the request from the waiting queue.
797 if (false == curchg) {
798 resource_request_t *req = popInputResReq(newreq);
800 delResourceRequest(req);
803 delResourceRequest(newreq);
804 ICO_TRA("CicoSCResourceManager::releaseInputResource Leave");
808 map<int, list<resource_request_t*> >::iterator itr;
809 itr = m_inputReqQueue.begin();
810 for (; itr != m_inputReqQueue.end(); ++itr) {
811 list<resource_request_t*>::iterator itr2;
812 itr2 = itr->second.begin();
813 for (; itr2 != itr->second.end(); ++itr2) {
814 if (NULL != m_curInputResReq[(*itr2)->input]) {
817 bool active = m_policyMgr->acquireInputResource((*itr2)->input,
819 if (true == active) {
820 resource_request_t* req = *itr2;
821 ICO_DBG("Dequeue waiting input request queue "
822 "(req=0x%08x input:%d appid=%s)",
823 *itr2, (*itr2)->input, (*itr2)->appid);
824 itr->second.erase(itr2);
825 updateInputResource(req);
830 ICO_TRA("CicoSCResourceManager::releaseInputResource Leave");
834 CicoSCResourceManager::newResourceRequest(int resid,
836 const CicoSCCommand &cmd)
838 ICO_TRA("CicoSCResourceManager::newResourceRequest Enter");
840 resource_request_t *req = NULL;
841 req = (resource_request_t*)calloc(1, sizeof(resource_request_t));
842 CicoSCCmdResCtrlOpt *opt = (CicoSCCmdResCtrlOpt*)cmd.opt;
843 CicoSystemConfig *systemConfig = CicoSystemConfig::getInstance();
845 req->reqtype = reqtype;
847 CicoSCLifeCycleController *lifeCycle =
848 CicoSCLifeCycleController::getInstance();
849 const CicoAilItems* ailItem = lifeCycle->findAIL(cmd.appid);
850 if (NULL != ailItem) {
851 req->category = ailItem->m_categoryID;
852 req->appkind = ailItem->m_kindID;
855 req->prio = req->category;
859 /* set resource id */
861 case ICO_SYC_RES_INTERRUPT:
862 req->resid = RESID_TYPE_INTERRUPT;
864 case ICO_SYC_RES_ONSCREEN:
865 req->resid = RESID_TYPE_ONSCREEN;
867 default: // include case ICO_SYC_RES_BASIC:
868 req->resid = RESID_TYPE_BASIC;
873 req->resid |= RESID_CMD_RELEASE;
874 if (MSG_CMD_ACQUIRE_RES == cmd.cmdid) {
875 req->resid |= RESID_CMD_ACQUIRE;
878 /* set application information */
879 req->appid = strdup(cmd.appid.c_str());
881 req->state = RES_STATE_WAITING;
883 if (resid == RESID_KIND_DISPLAY) {
884 req->dispzone = strdup(opt->dispzone.c_str());
885 req->dispzoneid = systemConfig->getDizplayZoneIdbyFullName(req->dispzone);
886 req->layerid = opt->layerid;
887 req->winname = strdup(opt->winname.c_str());
888 req->surfaceid = opt->surfaceid;
889 req->id = opt->surfaceid;
890 req->animation = strdup(opt->animation.c_str());
891 req->animationTime = opt->animationTime;
892 req->bEx = opt->dispresEx;
893 req->ECU = strdup(opt->ECU.c_str()); // name to identify ECU
894 req->display = strdup(opt->display.c_str()); // name to identify Display in ECU
895 req->layer = strdup(opt->layer.c_str()); // name to identify Layer in Display
896 req->layout = strdup(opt->layout.c_str()); // name to identify layout in Layer
897 req->area = strdup(opt->area.c_str()); // name to Output position in Layout
898 req->dispatchApp= strdup(opt->dispatchApp.c_str()); // dispatch of application
899 req->role = strdup(opt->role.c_str()); // role of notice
900 req->resourceId = opt->resourceID; // ID number of resource
902 else if (resid == RESID_KIND_SOUND) {
903 req->soundzone = strdup(opt->soundzone.c_str());
904 req->soundzoneid = systemConfig->getSoundZoneIdbyFullName(req->soundzone);
905 ICO_DBG("req->soundzoneid=%d", req->soundzoneid);
906 req->soundname = strdup(opt->soundname.c_str());
907 req->soundid = opt->soundid;
908 req->soundadjust = opt->adjust;
909 req->id = opt->soundid;
911 else if (resid == RESID_KIND_INPUT) {
912 req->device = strdup(opt->device.c_str());
913 req->input = opt->input;
914 req->id = opt->input;
917 ICO_TRA("CicoSCResourceManager::newResourceRequest Leave"
918 "(req=0x%08x appid=%s)", req, req->appid);
923 CicoSCResourceManager::delResourceRequest(resource_request_t *req)
925 if (NULL == req) return;
930 free(req->animation);
931 free(req->soundzone);
932 free(req->soundname);
934 free(req->ECU); // name to identify ECU
935 free(req->display); // name to identify Display in ECU
936 free(req->layer); // name to identify Layer in Display
937 free(req->layout); // name to identify layout in Layer
938 free(req->area); // name to Output position in Layout
939 free(req->dispatchApp); // origin of application
940 free(req->role); // role of notice
945 CicoSCResourceManager::enforceSound(unsigned short state,
946 resource_request_t *req,
949 ICO_TRA("CicoSCResourceManager::enforceSound Enter");
951 ICO_TRA("CicoSCResourceManager::enforceSound Leave");
954 // receive changed state
956 CicoSCResourceManager::receiveChangedState(int state)
958 ICO_TRA("CicoSCResourceManager::receiveChangedState Enter"
959 "(state=%d)", state);
961 if (STID_DRVREGULATION_ON == state) {
962 if (true == isMatchDisplayed()) {
963 updateDisplayResourceRegulation(state);
964 updateSoundResourceRegulation(state);
965 updateInputResourceRegulation(state);
969 updateDisplayResourceRegulation(state);
970 updateSoundResourceRegulation(state);
971 updateInputResourceRegulation(state);
974 ICO_TRA("CicoSCResourceManager::receiveChangedState Leave");
977 //--------------------------------------------------------------------------
979 * @brief get policy manager instance
981 * @return resource manager instace
983 //--------------------------------------------------------------------------
984 CicoSCPolicyManager *
985 CicoSCResourceManager::getPolicyManager(void)
991 CicoSCResourceManager::updateDisplayResource(resource_request_t *req,
994 ICO_TRA("CicoSCResourceManager::updateDisplayResource Enter"
995 "(req=0x%08x)", req);
997 std::map<unsigned int, resource_request_t*>::iterator itr;
998 itr = m_curDispResOwerReq.find(req->dispzoneid);
999 if ((m_curDispResOwerReq.end() != itr) && (NULL != itr->second)) {
1001 if (itr->second == req) {
1002 ICO_DBG("already ower appid=%s pid=%d surfaceid=0x%08X",
1003 req->appid, req->pid, req->surfaceid);
1004 // show request window
1005 m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
1007 m_winCtrl->activeCB(NULL, NULL, req->surfaceid, -1);
1009 ICO_TRA("CicoSCResourceManager::updateDisplayResource Leave");
1012 resource_request_t *popreq = popCurDispResOwerReq(itr->second);
1013 if (NULL != popreq) {
1014 if (NULL != m_winCtrl) {
1015 // hide current window
1016 m_winCtrl->hide(popreq->surfaceid, NULL, 0);
1019 // state change to waiting
1020 popreq->state = RES_STATE_WAITING;
1022 ICO_DBG("Enqueue waiting display resource request"
1023 "(req=0x%08x zone=%02d:%s appid=%s",
1024 popreq, popreq->dispzoneid,
1025 popreq->dispzone, popreq->appid);
1026 m_waitingDispResReq.push_front(popreq);
1028 dumpWaitingDispResReq();
1033 std::map<unsigned int, resource_request_t*>::iterator itr2;
1034 itr2 = m_curDispResOwerReq.begin();
1035 for (; itr2 != m_curDispResOwerReq.end(); ++itr2) {
1036 resource_request_t *tmpreq = itr2->second;
1038 if (true == m_policyMgr->getDispZoneState(itr2->first)) {
1042 if (NULL == itr2->second) {
1046 ICO_DBG("Dequeue current display resource ower request"
1047 "(req=0x%08x zoneid=%02d:%s appid=%s)",
1048 tmpreq, tmpreq->dispzoneid, tmpreq->dispzone, tmpreq->appid);
1049 ICO_PRF("CHG_GUI_RES display deprived zone=%02d:%s appid=%s",
1050 tmpreq->dispzoneid, tmpreq->dispzone, tmpreq->appid);
1051 itr2->second = NULL;
1053 // hide current window
1054 m_winCtrl->hide(tmpreq->surfaceid, NULL, 0);
1056 ICO_DBG("Enqueue waiting display resource request"
1057 "(req=0x%08x zone=%02d:%s appid=%s",
1058 tmpreq, tmpreq->dispzoneid, tmpreq->dispzone, tmpreq->appid);
1059 m_waitingDispResReq.push_front(tmpreq);
1062 if (NULL != m_winCtrl) {
1063 int ret = ICO_SYC_EOK;
1064 if (-1 != chgzoneid) {
1065 // move request window
1066 ret = m_winCtrl->setGeometry(req->surfaceid, req->dispzone,
1068 req->animation, req->animationTime,
1069 req->animation, req->animationTime);
1070 if (ICO_SYC_EOK != ret) {
1075 // show request window
1076 m_winCtrl->show(req->surfaceid, req->animation, req->animationTime);
1078 // state change to acquired
1079 req->state = RES_STATE_ACQUIRED;
1080 // update current zone request
1081 ICO_DBG("Enqueue current display resource ower request"
1082 "(req=0x%08x zoneid=%02d:%s appid=%s)",
1083 req, req->dispzoneid, req->dispzone, req->appid);
1084 ICO_PRF("CHG_GUI_RES display acquired zone=%02d:%s appid=%s",
1085 req->dispzoneid, req->dispzone, req->appid);
1086 m_curDispResOwerReq[req->dispzoneid] = req;
1088 dumpCurDispResOwerReq();
1091 // if current zone ower not exist after zone change
1092 if (-1 != chgzoneid) {
1093 list<resource_request_t*>::iterator itr;
1094 itr = m_waitingDispResReq.begin();
1095 for (; itr != m_waitingDispResReq.end(); ++itr) {
1096 if (m_curDispResOwerReq[(*itr)->dispzoneid] != NULL) {
1100 if (true == m_policyMgr->isExistDisplayZoneOwer((*itr)->dispzoneid)) {
1104 int type = (*itr)->resid & RESID_TYPE_MASK;
1105 bool active = false;
1106 active = m_policyMgr->acquireDisplayResource(type,
1109 if (true == active) {
1110 resource_request_t* req = *itr;
1111 ICO_DBG("Dequeue waiting display resource request"
1112 "(req=0x%08x zone=%02d:%s appid=%s)",
1113 *itr, (*itr)->dispzoneid,
1114 (*itr)->dispzone, (*itr)->appid);
1115 m_waitingDispResReq.erase(itr);
1117 dumpWaitingDispResReq();
1119 updateDisplayResource(req);
1121 m_winCtrl->active(req->surfaceid, -1);
1128 ICO_TRA("CicoSCResourceManager::updateDisplayResource Leave");
1132 CicoSCResourceManager::updateSoundResource(resource_request_t *req)
1134 ICO_TRA("CicoSCResourceManager::updateSoundResource Enter"
1135 "(req=0x%08x)", req);
1136 for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
1137 ICO_DBG("zoneid=%d active=%d current=0x%08x",
1138 i, m_policyMgr->getSoundZoneState(i), m_curSoundResReq[i]);
1140 if (NULL == m_curSoundResReq[i]) {
1144 if ((i == req->soundzoneid) ||
1145 (false == m_policyMgr->getSoundZoneState(i))) {
1147 // state change to waiting
1148 m_curSoundResReq[i]->state = RES_STATE_WAITING;
1150 ICO_DBG("Enqueue waiting sound request queue "
1151 "(req=0x%08x zone:%02d:%s appid=%s)",
1152 m_curSoundResReq[i], i,
1153 m_curSoundResReq[i]->soundzone, m_curSoundResReq[i]->appid);
1154 m_soundReqQueue[i].push_front(m_curSoundResReq[i]);
1156 // initialize current zone request
1157 ICO_DBG("Dequeue current sound request queue "
1158 "(req=0x%08x zone:%02d:%s appid=%s)",
1159 m_curSoundResReq[i], i,
1160 m_curSoundResReq[i]->soundzone, m_curSoundResReq[i]->appid);
1161 ICO_PRF("CHG_GUI_RES sound deprived zone=%02d:%s appid=%s",
1162 i, m_curSoundResReq[i]->soundzone,
1163 m_curSoundResReq[i]->appid);
1164 m_curSoundResReq[i] = NULL;
1168 if (req != m_curSoundResReq[req->soundzoneid]) {
1169 ico_syc_mrp_acquire_sound_resource(req);
1170 ico_syc_mrp_active_app(req->appid);
1172 // state change to acquired
1173 req->state = RES_STATE_ACQUIRED;
1174 // update current zone request
1175 ICO_DBG("Enqueue current sound request queue "
1176 "(req=0x%08x zone:%02d:%s appid=%s)",
1177 req, req->soundzoneid, req->soundzone, req->appid);
1178 ICO_PRF("CHG_GUI_RES sound acquired zone=%02d:%s appid=%s",
1179 req->soundzoneid, req->soundzone, req->appid);
1180 m_curSoundResReq[req->soundzoneid] = req;
1182 ICO_TRA("CicoSCResourceManager::updateSoundResource Leave");
1186 CicoSCResourceManager::updateInputResource(resource_request_t *req)
1188 ICO_TRA("CicoSCResourceManager::updateInputResource Enter"
1189 "(req=0x%08x)", req);
1190 for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
1191 ICO_DBG("input=%d active=%d current=0x%08x",
1192 i, m_policyMgr->getInputState(i), m_curInputResReq[i]);
1194 if (NULL == m_curInputResReq[i]) {
1198 if ((i == req->input) ||
1199 (false == m_policyMgr->getInputState(i))) {
1201 if (NULL != m_inputCtrl) {
1202 // add input control
1203 m_inputCtrl->delInputApp(req->appid, req->device, req->input);
1206 // state change to waiting
1207 m_curInputResReq[i]->state = RES_STATE_WAITING;
1209 ICO_DBG("Enqueue waiting input request queue "
1210 "(req=0x%08x input:%d appid=%s)",
1211 m_curInputResReq[i], i, m_curInputResReq[i]->appid);
1212 m_inputReqQueue[i].push_front(m_curInputResReq[i]);
1213 // initialize current zone request
1214 ICO_DBG("Dequeue current input request queue "
1215 "(req=0x%08x input:%d appid=%s)",
1216 m_curInputResReq[i],
1217 m_curInputResReq[i]->input, m_curInputResReq[i]->appid);
1218 ICO_PRF("CHG_GUI_RES input deprived input=%d appid=%s",
1219 m_curInputResReq[i]->input,
1220 m_curInputResReq[i]->appid);
1221 m_curInputResReq[i] = NULL;
1225 if (req != m_curInputResReq[req->input]) {
1226 // delete input control
1227 m_inputCtrl->addInputApp(req->appid, req->device, req->input, 0, 0);
1228 // state change to acquired
1229 req->state = RES_STATE_ACQUIRED;
1230 // update current zone request
1231 ICO_DBG("Enqueue current input request queue "
1232 "(req=0x%08x input:%d appid=%s)", req, req->input, req->appid);
1233 ICO_PRF("CHG_GUI_RES input acquired input=%d appid=%s",
1234 req->input, req->appid);
1235 m_curInputResReq[req->input] = req;
1237 ICO_TRA("CicoSCResourceManager::updateInputResource Leave");
1241 CicoSCResourceManager::updateDisplayResourceRegulation(int state)
1243 ICO_TRA("CicoSCResourceManager::updateDisplayResourceRegulation Enter"
1244 "(state=%d)", state);
1246 if (STID_DRVREGULATION_ON == state) {
1247 bool curchg = false;
1248 std::map<unsigned int, resource_request_t*>::iterator itr;
1249 itr = m_curDispResOwerReq.begin();
1250 for (; itr != m_curDispResOwerReq.end(); ++itr) {
1251 resource_request_t *current = itr->second;
1252 if (NULL == current) {
1256 int type = current->resid & RESID_TYPE_MASK;
1257 bool active = false;
1258 active = m_policyMgr->acquireDisplayResource(type,
1259 current->dispzoneid,
1261 if (false == active) {
1262 if (NULL != m_winCtrl) {
1263 // hide current window
1264 m_winCtrl->hide(current->surfaceid,
1265 m_animaName.c_str(), m_animaTime);
1271 if (false == curchg) {
1272 ICO_TRA("CicoSCResourceManager::updateDisplayResourceRegulation "
1277 list<resource_request_t*>::iterator itr2;
1278 itr2 = m_waitingDispResReq.begin();
1279 for (; itr2 != m_waitingDispResReq.end(); ++itr2) {
1280 int type = (*itr2)->resid & RESID_TYPE_MASK;
1281 bool active = false;
1282 active = m_policyMgr->acquireDisplayResource(type,
1283 (*itr2)->dispzoneid,
1285 if (true == active) {
1286 if (NULL != m_winCtrl) {
1287 // show current window
1288 m_winCtrl->show((*itr2)->surfaceid,
1289 m_animaName.c_str(), m_animaTime);
1295 else if (STID_DRVREGULATION_OFF == state) {
1296 std::map<unsigned int, resource_request_t*>::iterator itr;
1297 itr = m_curDispResOwerReq.begin();
1298 for (; itr != m_curDispResOwerReq.end(); ++itr) {
1299 resource_request_t *current = itr->second;
1300 if (NULL == current) {
1301 if (true == m_policyMgr->isExistDisplayZoneOwer(itr->first)) {
1302 if (NULL != m_winCtrl) {
1303 int surfaceid = m_winCtrl->getDisplayedWindow(itr->first);
1306 if ((surfaceid > 0) && (NULL != itr->second) &&
1307 (itr->second->surfaceid != surfaceid)) {
1308 m_winCtrl->hide(surfaceid,
1309 m_animaName.c_str(),
1313 if (surfaceid > 0) {
1314 m_winCtrl->hide(surfaceid,
1315 m_animaName.c_str(),
1323 list<resource_request_t*>::iterator itr2;
1324 itr2 = m_waitingDispResReq.begin();
1325 for (; itr2 != m_waitingDispResReq.end(); ++itr2) {
1326 resource_request_t *req = *itr2;
1327 if (itr->first != (unsigned int)req->dispzoneid) {
1330 int type = req->resid & RESID_TYPE_MASK;
1331 bool active = false;
1332 active = m_policyMgr->acquireDisplayResource(type,
1335 if (true == active) {
1336 ICO_DBG("Dequeue waiting display resource request"
1337 "(req=0x%08x zone=%02d:%s appid=%s)",
1338 req, req->dispzoneid,
1339 req->dispzone, req->appid);
1340 m_waitingDispResReq.erase(itr2);
1341 ICO_DBG("Enqueue current display resource request"
1342 "(req=0x%08x zone=%02d:%s appid=%s)",
1343 req, req->dispzoneid,
1344 req->dispzone, req->appid);
1345 ICO_PRF("CHG_GUI_RES display acquired zone=%02d:%s "
1347 req->dispzoneid, req->dispzone, req->appid);
1348 m_curDispResOwerReq[req->dispzoneid] = req;
1350 dumpCurDispResOwerReq();
1351 dumpWaitingDispResReq();
1353 m_winCtrl->show(req->surfaceid,
1354 m_animaName.c_str(), m_animaTime);
1355 m_winCtrl->active(req->surfaceid, -1);
1361 int type = current->resid & RESID_TYPE_MASK;
1362 bool active = false;
1363 active = m_policyMgr->acquireDisplayResource(type,
1364 current->dispzoneid,
1366 if (true == active) {
1367 if (NULL != m_winCtrl) {
1368 int surfaceid = m_winCtrl->getDisplayedWindow(
1369 itr->second->dispzoneid);
1370 if ((itr->second->surfaceid != surfaceid) &&
1372 m_winCtrl->hide(surfaceid,
1373 m_animaName.c_str(), m_animaTime);
1376 // show current window
1377 m_winCtrl->show(current->surfaceid,
1378 m_animaName.c_str(), m_animaTime);
1382 dumpCurDispResOwerReq();
1383 dumpWaitingDispResReq();
1389 ICO_TRA("CicoSCResourceManager::updateDisplayResourceRegulation Leave");
1393 CicoSCResourceManager::updateSoundResourceRegulation(int state)
1395 ICO_TRA("CicoSCResourceManager::updateSoundResourceRegulation Enter"
1396 "(state=%d)", state);
1398 bool curchg = false;
1399 for (int i = 0; i < (int)m_curSoundResReq.size(); ++i) {
1400 resource_request_t *current = m_curSoundResReq[i];
1401 if (NULL == current) {
1405 int type = current->resid & RESID_TYPE_MASK;
1406 bool active = false;
1407 active = m_policyMgr->acquireSoundResource(type,
1408 current->soundzoneid,
1410 if (false == active) {
1411 // state change to waiting
1412 current->state = RES_STATE_WAITING;
1414 ICO_DBG("Enqueue waiting sound request queue "
1415 "(req=0x%08x zone:%02d:%s appid=%s)",
1416 current, i, current->soundzone, current->appid);
1417 m_soundReqQueue[i].push_front(current);
1418 // initialize current zone request
1419 m_curSoundResReq[i] = NULL;
1424 if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
1425 ICO_TRA("CicoSCResourceManager::updateSoundResourceRegulation Leave");
1429 map<int, list<resource_request_t*> >::iterator itr;
1430 itr = m_soundReqQueue.begin();
1431 for (; itr != m_soundReqQueue.end(); ++itr) {
1432 if (NULL != m_curSoundResReq[itr->first]) {
1436 list<resource_request_t*>::iterator itr2;
1437 itr2 = itr->second.begin();
1438 for (; itr2 != itr->second.end(); ++itr2) {
1439 int type = (*itr2)->resid & RESID_TYPE_MASK;
1440 bool active = false;
1441 active = m_policyMgr->acquireSoundResource(type,
1442 (*itr2)->soundzoneid,
1444 if (true == active) {
1445 resource_request_t* req = *itr2;
1446 ICO_DBG("Dequeue waiting sound request queue "
1447 "(req=0x%08x zone:%02d:%s appid=%s)",
1448 *itr2, itr->first, (*itr2)->soundzone, (*itr2)->appid);
1449 itr->second.erase(itr2);
1450 updateSoundResource(req);
1456 ICO_TRA("CicoSCResourceManager::updateSoundResourceRegulation Leave");
1460 CicoSCResourceManager::updateInputResourceRegulation(int state)
1462 ICO_TRA("CicoSCResourceManager::updateInputResourceRegulation Enter"
1463 "(state=%d)", state);
1465 bool curchg = false;
1466 for (int i = 0; i < (int)m_curInputResReq.size(); ++i) {
1467 resource_request_t *current = m_curInputResReq[i];
1468 if (NULL == current) {
1472 bool active = false;
1473 active = m_policyMgr->acquireInputResource(current->input,
1475 if (false == active) {
1476 if (NULL != m_inputCtrl) {
1477 // hide current window
1478 m_inputCtrl->delInputApp(current->appid,
1482 // state change to waiting
1483 current->state = RES_STATE_WAITING;
1485 ICO_DBG("Enqueue waiting input request queue "
1486 "(req=0x%08x input:%d appid=%s)",
1487 current, i, current->appid);
1488 m_inputReqQueue[i].push_front(current);
1489 // initialize current zone request
1490 m_curInputResReq[i] = NULL;
1495 if ((false == curchg) && (STID_DRVREGULATION_ON == state)) {
1496 ICO_TRA("CicoSCResourceManager::updateInputResourceRegulation Leave");
1500 map<int, list<resource_request_t*> >::iterator itr;
1501 itr = m_inputReqQueue.begin();
1502 for (; itr != m_inputReqQueue.end(); ++itr) {
1503 if (NULL != m_curInputResReq[itr->first]) {
1507 list<resource_request_t*>::iterator itr2;
1508 itr2 = itr->second.begin();
1509 for (; itr2 != itr->second.end(); ++itr2) {
1510 bool active = false;
1511 active = m_policyMgr->acquireInputResource((*itr2)->input,
1513 if (true == active) {
1514 resource_request_t* req = *itr2;
1515 ICO_DBG("Dequeue waiting input request queue "
1516 "(req=0x%08x input:%d appid=%s)",
1517 *itr2, (*itr2)->input, (*itr2)->appid);
1518 itr->second.erase(itr2);
1519 updateInputResource(req);
1525 ICO_TRA("CicoSCResourceManager::updateInputResourceRegulation Leave");
1528 //--------------------------------------------------------------------------
1530 * @brief find currnet dipalay resource ower request
1532 * @param [in] request compare requset
1534 * @return request object on same requeset found, NULL on not found
1536 //--------------------------------------------------------------------------
1537 resource_request_t *
1538 CicoSCResourceManager::findCurDispResOwerReq(resource_request_t *req)
1541 ICO_WRN("invalid argument. req is null");
1544 std::map<unsigned int, resource_request_t*>::iterator itr;
1545 itr = m_curDispResOwerReq.begin();
1546 for (; itr != m_curDispResOwerReq.end(); ++itr) {
1547 CompDisplayResourceRequest comp(req);
1548 if (true == comp(itr->second)) {
1555 //--------------------------------------------------------------------------
1557 * @brief pop currnet dipalay resource ower request from list
1559 * @param [in] request compare requset
1561 * @return request object on same requeset found, NULL on not found
1563 //--------------------------------------------------------------------------
1564 resource_request_t *
1565 CicoSCResourceManager::popCurDispResOwerReq(resource_request_t *req)
1568 ICO_WRN("invalid argument. req is null");
1571 std::map<unsigned int, resource_request_t*>::iterator itr;
1572 itr = m_curDispResOwerReq.begin();
1573 for (; itr != m_curDispResOwerReq.end(); ++itr) {
1574 CompDisplayResourceRequest comp(req);
1575 if (true == comp(itr->second)) {
1576 ICO_DBG("Dequeue current display resource ower request"
1577 "(req=0x%08x zoneid=%02d:%s appid=%s)",
1578 itr->second, itr->first,
1579 itr->second->dispzone, itr->second->appid);
1580 ICO_PRF("CHG_GUI_RES display deprived zone=%02d:%s appid=%s",
1581 itr->first, itr->second->dispzone, itr->second->appid);
1582 resource_request_t *findreq = itr->second;
1585 dumpCurDispResOwerReq();
1593 //--------------------------------------------------------------------------
1595 * @brief dump currnet dipalay resource ower request
1597 //--------------------------------------------------------------------------
1599 CicoSCResourceManager::dumpCurDispResOwerReq(void)
1601 std::map<unsigned int, resource_request_t*>::iterator itr;
1602 itr = m_curDispResOwerReq.begin();
1603 for (; itr != m_curDispResOwerReq.end(); ++itr) {
1604 if (NULL == itr->second) {
1605 ICO_DBG("current req=0x%08x zone=%02d:(null) appid=(null)",
1606 itr->second, itr->first);
1609 ICO_DBG("current req=0x%08x zone=%02d:%s appid=%s",
1610 itr->second, itr->first, itr->second->dispzone,
1611 itr->second->appid);
1616 //--------------------------------------------------------------------------
1618 * @brief find waiting dipalay resource request
1620 * @param [in] request compare requset
1622 * @return request object on same requeset found, NULL on not found
1624 //--------------------------------------------------------------------------
1625 resource_request_t *
1626 CicoSCResourceManager::findWaitingDispResReq(resource_request_t *req)
1629 ICO_WRN("invalid argument. req is null");
1632 CompDisplayResourceRequest comp(req);
1633 std::list<resource_request_t*>::iterator itr;
1634 itr = find_if(m_waitingDispResReq.begin(), m_waitingDispResReq.end(), comp);
1635 if (m_waitingDispResReq.end() != itr) {
1641 //--------------------------------------------------------------------------
1643 * @brief pop waiting dipalay resource request from waiting list
1645 * @param [in] request compare requset
1647 * @return request object on same requeset found, NULL on not found
1649 //--------------------------------------------------------------------------
1650 resource_request_t *
1651 CicoSCResourceManager::popWaitingDispResReq(resource_request_t *req)
1654 ICO_WRN("invalid argument. req is null");
1657 CompDisplayResourceRequest comp(req);
1658 std::list<resource_request_t*>::iterator itr;
1659 itr = find_if(m_waitingDispResReq.begin(), m_waitingDispResReq.end(), comp);
1660 if (m_waitingDispResReq.end() != itr) {
1661 ICO_DBG("Dequeue waiting display resource request"
1662 "(req=0x%08x zone:%02d:%s appid=%s)",
1663 *itr, (*itr)->dispzoneid, (*itr)->dispzone, (*itr)->appid);
1664 resource_request_t *findreq = *itr;
1665 m_waitingDispResReq.erase(itr);
1667 dumpWaitingDispResReq();
1674 //--------------------------------------------------------------------------
1676 * @brief dump waiting dipalay resource request
1678 //--------------------------------------------------------------------------
1680 CicoSCResourceManager::dumpWaitingDispResReq(void)
1682 std::list<resource_request_t*>::iterator itr;
1683 itr = m_waitingDispResReq.begin();
1684 for (; itr != m_waitingDispResReq.end(); ++itr) {
1686 ICO_DBG("waiting req=null");
1689 ICO_DBG("waiting req=0x%08x zone=%02d:%s appid=%s",
1690 *itr, (*itr)->dispzoneid, (*itr)->dispzone, (*itr)->appid);
1695 //--------------------------------------------------------------------------
1697 * @brief update display request for regulation pre-process
1699 //--------------------------------------------------------------------------
1701 CicoSCResourceManager::updateDispResRegulationPreProc(resource_request_t *req)
1703 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Enter");
1705 dumpCurDispResOwerReq();
1706 dumpWaitingDispResReq();
1710 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Leave");
1714 if (false == m_policyMgr->getRegulation()) {
1715 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Leave");
1719 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
1720 const CicoSCAppKindConf *appKindConf = NULL;
1721 appKindConf = sysConf->findAppKindConfbyId(req->appkind);
1722 if (NULL == appKindConf) {
1723 ICO_ERR("not found CicoSCAppKindConf instance");
1724 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Leave");
1728 if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
1729 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM) ||
1730 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_VISIBLE)) {
1732 if (NULL != m_winCtrl) {
1733 m_winCtrl->show(req->surfaceid,
1735 req->animationTime);
1737 delResourceRequest(req);
1739 ICO_DBG("kind of system application");
1740 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Leave");
1744 int surfaceid = req->surfaceid;
1745 if (NULL != m_winCtrl) {
1746 surfaceid = m_winCtrl->getDisplayedWindow(req->dispzoneid);
1747 if (-1 == surfaceid) {
1748 ICO_WRN("displayed surface id is invalid.");
1749 surfaceid = req->surfaceid;
1753 if (req->surfaceid != surfaceid) {
1754 ICO_WRN("req->surfaceid(0x%08X) != displayedsurfaceid(0x%08X)",
1755 req->surfaceid, surfaceid);
1758 resource_request_t *curreq = NULL;
1759 int min = ICO_DISPLAY0_ZONEID_MIN;
1760 int max = ICO_DISPLAY0_ZONEID_MAX;
1761 if ((req->dispzoneid >= min) && (req->dispzoneid <= max)) {
1762 for (int i = min; i <= max; ++i) {
1763 std::map<unsigned int, resource_request_t*>::iterator itr;
1764 itr = m_curDispResOwerReq.find(i);
1765 if (itr != m_curDispResOwerReq.end()) {
1766 if (NULL != itr->second) {
1767 curreq = itr->second;
1774 min = ICO_DISPLAY1_ZONEID_MIN;
1775 max = ICO_DISPLAY1_ZONEID_MAX;
1776 if ((NULL == curreq) &&
1777 (req->dispzoneid >= min) && (req->dispzoneid <= max)) {
1778 for (int i = min; i <= max; ++i) {
1779 std::map<unsigned int, resource_request_t*>::iterator itr;
1780 itr = m_curDispResOwerReq.find(i);
1781 if (itr != m_curDispResOwerReq.end()) {
1782 if (NULL != itr->second) {
1783 curreq = itr->second;
1791 resource_request_t *curreq = NULL;
1792 std::map<unsigned int, resource_request_t*>::iterator itr;
1793 itr = m_curDispResOwerReq.find(req->dispzoneid);
1794 if (itr != m_curDispResOwerReq.end()) {
1795 curreq = itr->second;
1799 if (NULL != curreq) {
1800 ICO_DBG("Dequeue current display resource request"
1801 "(req=0x%08x zone:%02d:%s appid=%s)",
1802 curreq, curreq->dispzoneid, curreq->dispzone, curreq->appid);
1803 ICO_PRF("CHG_GUI_RES display deprived zone=%02d:%s appid=%s",
1804 curreq->dispzoneid, curreq->dispzone, curreq->appid);
1805 m_curDispResOwerReq[curreq->dispzoneid] = NULL;
1807 if (curreq->surfaceid != req->surfaceid) {
1808 resource_request_t *waitreq = popWaitingDispResReq(req);
1809 ICO_DBG("Enqueue waiting display resource request"
1810 "(req=0x%08x zone:%02d:%s appid=%s)",
1811 curreq, curreq->dispzoneid,
1812 curreq->dispzone, curreq->appid);
1813 m_waitingDispResReq.push_front(curreq);
1815 if (NULL != waitreq) {
1816 ICO_DBG("Enqueue current display resource request"
1817 "(req=0x%08x zone:%02d:%s appid=%s)",
1818 waitreq, waitreq->dispzoneid,
1819 waitreq->dispzone, waitreq->appid);
1820 ICO_PRF("CHG_GUI_RES display acquired zone=%02d:%s appid=%s",
1821 waitreq->dispzoneid, waitreq->dispzone, waitreq->appid);
1822 m_curDispResOwerReq[waitreq->dispzoneid] = waitreq;
1826 ICO_DBG("Enqueue current display resource request"
1827 "(req=0x%08x zone:%02d:%s appid=%s)",
1828 curreq, curreq->dispzoneid,
1829 curreq->dispzone, curreq->appid);
1830 ICO_PRF("CHG_GUI_RES display acquired zone=%02d:%s appid=%s",
1831 curreq->dispzoneid, curreq->dispzone, curreq->appid);
1832 m_curDispResOwerReq[curreq->dispzoneid] = curreq;
1835 delResourceRequest(req);
1838 dumpCurDispResOwerReq();
1839 dumpWaitingDispResReq();
1841 ICO_TRA("CicoSCResourceManager::updateDispResRegulationPreProc Leave");
1844 //--------------------------------------------------------------------------
1846 * @brief update sound request for regulation pre-process
1848 //--------------------------------------------------------------------------
1850 CicoSCResourceManager::updateSoundResRegulationPreProc(resource_request_t *req)
1852 ICO_TRA("CicoSCResourceManager::updateSoundResRegulationPreProc Enter");
1858 if (false == m_policyMgr->getRegulation()) {
1862 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
1863 const CicoSCAppKindConf *appKindConf = NULL;
1864 appKindConf = sysConf->findAppKindConfbyId(req->appkind);
1865 if (NULL == appKindConf) {
1866 ICO_ERR("not found CicoSCAppKindConf instance");
1867 ICO_TRA("CicoSCResourceManager::updateSoundResRegulationPreProc Leave");
1871 if ((appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_ALMIGHTY) ||
1872 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM) ||
1873 (appKindConf->privilege == CicoSCAppKindConf::PRIVILEGE_SYSTEM_AUDIO)) {
1875 delResourceRequest(req);
1877 ICO_DBG("kind of system application");
1878 ICO_TRA("CicoSCResourceManager::updateSoundResRegulationPreProc Leave");
1882 resource_request_t *curreq = NULL;
1883 std::map<int, resource_request_t*>::iterator itr;
1884 itr = m_curSoundResReq.find(req->soundzoneid);
1885 if (itr != m_curSoundResReq.end()) {
1886 curreq = itr->second;
1889 if (NULL != curreq) {
1890 ICO_DBG("Dequeue current sound resource request"
1891 "(req=0x%08x zone:%02d:%s appid=%s)",
1892 curreq, curreq->soundzoneid, curreq->soundzone, curreq->appid);
1893 ICO_PRF("CHG_GUI_RES sound deprived zone=%02d:%s appid=%s",
1894 curreq->soundzoneid, curreq->soundzone, curreq->appid);
1895 m_curSoundResReq[curreq->soundzoneid] = NULL;
1897 if (0 != strcmp(curreq->appid, req->appid)) {
1898 resource_request_t *waitreq = popSoundResReq(req);
1899 ICO_DBG("Enqueue waiting sound resource request"
1900 "(req=0x%08x zone:%02d:%s appid=%s)",
1901 curreq, curreq->soundzoneid,
1902 curreq->soundzone, curreq->appid);
1903 m_soundReqQueue[curreq->soundzoneid].push_front(curreq);
1905 if (NULL != waitreq) {
1906 ICO_DBG("Enqueue current sound resource request"
1907 "(req=0x%08x zone:%02d:%s appid=%s)",
1908 waitreq, waitreq->soundzoneid,
1909 waitreq->soundzone, waitreq->appid);
1910 ICO_PRF("CHG_GUI_RES sound acquired zone=%02d:%s appid=%s",
1911 waitreq->soundzoneid, waitreq->soundzone,
1913 m_curSoundResReq[curreq->soundzoneid] = waitreq;
1917 ICO_DBG("Enqueue current sound resource request"
1918 "(req=0x%08x zone:%02d:%s appid=%s)",
1919 curreq, curreq->soundzoneid,
1920 curreq->soundzone, curreq->appid);
1921 ICO_PRF("CHG_GUI_RES sound acquired zone=%d:%s appid=%s",
1922 curreq->soundzoneid, curreq->soundzone, curreq->appid);
1923 m_curSoundResReq[curreq->soundzoneid] = curreq;
1926 delResourceRequest(req);
1927 ICO_TRA("CicoSCResourceManager::updateSoundResRegulationPreProc Leave");
1930 //--------------------------------------------------------------------------
1932 * @brief update input request for regulation pre-process
1934 //--------------------------------------------------------------------------
1936 CicoSCResourceManager::updateInputResRegulationPreProc(resource_request_t *req)
1938 ICO_TRA("CicoSCResourceManager::updateInputResRegulationPreProc Enter");
1944 if (false == m_policyMgr->getRegulation()) {
1948 resource_request_t *curreq = NULL;
1949 std::map<int, resource_request_t*>::iterator itr;
1950 itr = m_curInputResReq.find(req->input);
1951 if (itr != m_curInputResReq.end()) {
1952 curreq = itr->second;
1955 if (NULL != curreq) {
1956 ICO_DBG("Dequeue current input resource request"
1957 "(req=0x%08x input:%d appid=%s)",
1958 curreq, curreq->input, curreq->appid);
1959 ICO_PRF("CHG_GUI_RES input deprived input=%d appid=%s",
1960 curreq->input, curreq->appid);
1961 m_curInputResReq[curreq->input] = NULL;
1963 if (0 != strcmp(curreq->appid, req->appid)) {
1964 resource_request_t *waitreq = popInputResReq(req);
1965 ICO_DBG("Enqueue waiting input resource request"
1966 "(req=0x%08x input:%d appid=%s)",
1967 curreq, curreq->input, curreq->appid);
1968 m_inputReqQueue[curreq->input].push_front(curreq);
1970 if (NULL != waitreq) {
1971 ICO_DBG("Enqueue current input resource request"
1972 "(req=0x%08x input:%d appid=%s)",
1973 waitreq, waitreq->input, waitreq->appid);
1974 ICO_PRF("CHG_GUI_RES input acquired input=%d appid=%s",
1975 waitreq->input, waitreq->appid);
1976 m_curInputResReq[curreq->input] = waitreq;
1980 ICO_DBG("Enqueue current input resource request"
1981 "(req=0x%08x input:%d appid=%s)",
1982 curreq, curreq->input, curreq->appid);
1983 ICO_PRF("CHG_GUI_RES input acquired input=%d appid=%s",
1984 curreq->input, curreq->appid);
1985 m_curInputResReq[curreq->input] = curreq;
1988 delResourceRequest(req);
1989 ICO_TRA("CicoSCResourceManager::updateInputResRegulationPreProc Leave");
1992 //--------------------------------------------------------------------------
1994 * @brief compare displayed surface and ower surface
1996 //--------------------------------------------------------------------------
1998 CicoSCResourceManager::isMatchDisplayed(void)
2001 std::map<unsigned int, resource_request_t*>::iterator itr;
2002 itr = m_curDispResOwerReq.begin();
2003 for (; itr != m_curDispResOwerReq.end(); ++itr) {
2004 if (NULL == itr->second) {
2007 if (NULL != m_winCtrl) {
2008 int surfaceid = m_winCtrl->getDisplayedWindow(
2009 itr->second->dispzoneid);
2010 std::map<unsigned int, resource_request_t*>::iterator itr2;
2011 itr2 = m_curDispResOwerReq.begin();
2012 for (; itr2 != m_curDispResOwerReq.end(); ++itr2) {
2013 if (NULL == itr2->second) {
2016 if ((itr2->second->surfaceid == surfaceid)) {
2018 break; // break of for itr2
2023 break; // break of for itr
2030 CicoSCResourceManager::acquireOnScreenDisplayResource(resource_request_t *newreq)
2032 ICO_TRA("Enter (%08x)", newreq);
2033 if (NULL == newreq) {
2034 ICO_TRA("Leave param is NULL pointer");
2037 CicoSystemConfig *sysConf = CicoSystemConfig::getInstance();
2039 if (0 == newreq->role_stt) {
2040 newreq->role_stt = sysConf->getRoleStt(newreq->role);
2042 m_OnScreenItems.push_back(newreq);
2044 const resource_request_t* rrtHO = getNoticeOfHighOder();
2045 if (NULL == rrtHO) {
2046 ICO_TRA("Leave %s, %d is not notice", newreq->role, newreq->resourceId);
2050 const CicoSCWindow* nwo = m_winCtrl->findWindowObj(newreq->pid,
2051 newreq->resourceId);
2053 const CicoSCWindow* bwo = NULL; // before window oject
2054 const CicoSCWindow* awo = NULL; // after window object
2056 if (NULL != m_rrtHO) {
2057 bwo = m_winCtrl->findWindowObj(m_rrtHO->pid, m_rrtHO->resourceId);
2059 if (NULL != rrtHO) {
2060 awo = m_winCtrl->findWindowObj(rrtHO->pid, rrtHO->resourceId);
2062 if ((NULL == m_rrtHO) && (NULL != rrtHO)) { // none -> on notice
2063 ICO_TRA("_____ OPEN Layer \"%s\":%d", rrtHO->role, rrtHO->resourceId);
2065 m_winCtrl->showLayer(awo->displayid, awo->layerid);
2068 ICO_WRN("ON SCREEN none layer");
2072 if ((NULL != nwo) && (awo != nwo) && (bwo != nwo)) {
2073 ICO_TRA("_____ HIDW new REQUEST %x:%s:%d", newreq, newreq->role,
2074 newreq->resourceId);
2075 m_winCtrl->hide(nwo->surfaceid, NULL, 0);
2078 if (rrtHO != m_rrtHO) { // change Hige Oder notice
2079 if (NULL != m_rrtHO) {
2080 ICO_TRA("_____ HIDE surface %x:%s:%d", m_rrtHO, m_rrtHO->role,
2081 m_rrtHO->resourceId);
2083 m_winCtrl->hide(bwo->surfaceid, NULL, 0);
2086 ICO_WRN("ON SCREEN none Hide control");
2088 resCB(ICO_SYC_EV_RES_WAITING, *m_rrtHO);
2090 ICO_TRA("_____ SHOW surface %x:%s:%d", rrtHO, rrtHO->role, rrtHO->resourceId);
2092 m_winCtrl->show(awo->surfaceid, NULL, 0);
2095 ICO_WRN("ON SCREEN none show control");
2097 resCB(ICO_SYC_EV_RES_ACQUIRE, *rrtHO);
2098 ICO_TRA("_____ change %x -> %x", m_rrtHO, rrtHO);
2101 //- if (m_rrtHO != newreq) {
2102 //- resCB(ICO_SYC_EV_RES_WAITING, *newreq);
2105 ICO_TRA("_____ no change %x", m_rrtHO);
2107 m_winCtrl->show(awo->surfaceid, NULL, 0);
2108 m_winCtrl->raise(awo->surfaceid, NULL, 0);
2110 if (m_rrtHO != newreq) {
2111 resCB(ICO_SYC_EV_RES_WAITING, *newreq);
2119 CicoSCResourceManager::releaseOnScreenDisplayResource(resource_request_t *req)
2121 ICO_TRA("Enter %08x", req);
2123 ICO_TRA("Leave param is NULL pointer");
2126 resource_request_t* tgt = NULL;
2127 list<resource_request_t*>::iterator itr = m_OnScreenItems.begin();
2128 for (; itr != m_OnScreenItems.end(); ++itr) {
2129 if ((req->pid == (*itr)->pid) &&
2130 (req->resourceId == (*itr)->resourceId)) {
2132 break; // break of for itr
2137 ICO_TRA("_____ erase list %x", tgt);
2138 m_OnScreenItems.erase(itr);
2141 const resource_request_t* rrtHO = getNoticeOfHighOder();
2143 const CicoSCWindow* bwo = NULL; // before window oject
2144 const CicoSCWindow* awo = NULL; // after window object
2145 if (NULL != m_rrtHO) {
2146 bwo = m_winCtrl->findWindowObj(m_rrtHO->pid, m_rrtHO->resourceId);
2148 if (NULL != rrtHO) {
2149 awo = m_winCtrl->findWindowObj(rrtHO->pid, rrtHO->resourceId);
2152 if ((NULL == rrtHO) && (NULL == m_rrtHO)) {
2153 ICO_WRN("ON SCREEN Resource NG");
2155 resCB(ICO_SYC_EV_RES_RELEASE, *tgt);
2156 delResourceRequest(tgt);
2158 delResourceRequest(req);
2159 ICO_TRA("Leave ON SCREEN Resource NG");
2163 if (rrtHO != m_rrtHO) {
2164 if (NULL != m_rrtHO) {
2166 m_winCtrl->hide(bwo->surfaceid, NULL, 0);
2167 if (m_rrtHO != tgt) {
2168 ICO_DBG("_____ NG Control OnScreen Resource %x(%d, %d), %x",
2169 m_rrtHO, m_rrtHO->pid, m_rrtHO->resourceId, tgt);
2170 resCB(ICO_SYC_EV_RES_WAITING, *m_rrtHO);
2174 ICO_WRN("ON SCREEN Hide control NG");
2177 if (NULL != rrtHO) {
2179 m_winCtrl->show(awo->surfaceid, NULL, 0);
2180 m_winCtrl->raise(awo->surfaceid, NULL, 0);
2181 resCB(ICO_SYC_EV_RES_ACQUIRE, *rrtHO);
2184 ICO_WRN("ON SCREEN Hide control NG");
2189 m_winCtrl->hideLayer(bwo->displayid, bwo->layerid);
2192 ICO_WRN("ON SCREEN layer hide control NG");
2198 ICO_TRA("_____ no change");
2202 resCB(ICO_SYC_EV_RES_RELEASE, *tgt);
2203 delResourceRequest(tgt);
2205 delResourceRequest(req);
2211 CicoSCResourceManager::resCB(const ico_syc_ev_e ev, const resource_request_t& p) const
2213 ICO_TRA("Enter %d", (int)ev);
2214 if ((NULL == p.appid) || (0 == strlen(p.appid))) {
2215 ICO_TRA("Leave false");
2218 if (false == p.bEx) {
2219 ICO_TRA("Leave false");
2223 if (ICO_SYC_EV_RES_ACQUIRE == ev) {
2224 nEv = MSG_CMD_ACQUIRE_RES;
2226 else if (ICO_SYC_EV_RES_DEPRIVE == ev) {
2227 nEv = MSG_CMD_DEPRIVE_RES;
2229 else if (ICO_SYC_EV_RES_WAITING == ev) {
2230 nEv = MSG_CMD_WAITING_RES;
2232 else if (ICO_SYC_EV_RES_REVERT == ev) {
2233 nEv = MSG_CMD_REVERT_RES;
2235 else if (ICO_SYC_EV_RES_RELEASE == ev) {
2236 nEv = MSG_CMD_RELEASE_RES;
2238 else if (ICO_SYC_EV_RES_WINDOW_ID == ev) {
2239 nEv = MSG_CMD_WINDOW_ID_RES;
2242 ICO_TRA("Leave false ev(%d) is not supp.",(int)ev);
2247 r = resCB(p.appid, nEv, p.ECU, p.display, p.layer, p.layout, p.area,
2248 p.dispatchApp, p.role, p.resourceId);
2249 ICO_TRA("Leave %s", r? "true":"false");
2254 CicoSCResourceManager::resCB(const char* sendToAppid, const int ev,
2255 const char* ECU, const char* display,
2256 const char* layer, const char* layout,
2257 const char* area, const char* dispatchApp,
2258 const char* role, uint32_t resourceId) const
2261 if (NULL == sendToAppid) {
2262 ICO_TRA("Leave false");
2265 CicoSCMessageRes* msg = new CicoSCMessageRes();
2266 msg->addRootObject("command", ev);
2268 msg->addWinObject("ECU", ECU);
2270 if (NULL != display) {
2271 msg->addWinObject("display", display);
2273 if (NULL != layer) {
2274 msg->addWinObject("layer", layer);
2276 if (NULL != layout) {
2277 msg->addWinObject("layout", layout);
2280 msg->addWinObject("area", area);
2282 if (NULL != dispatchApp) {
2283 msg->addWinObject("dispatchApp", dispatchApp);
2286 msg->addWinObject("role", role);
2288 msg->addWinObject("resourceId", resourceId);
2289 CicoSCServer *cscs = CicoSCServer::getInstance();
2290 int r = cscs->sendMessage(sendToAppid, (CicoSCMessage*)msg);
2291 if (ICO_SYC_EOK != r) {
2292 ICO_TRA("Leave false(%d)", r);
2295 ICO_TRA("Leave true");
2299 const resource_request_t* CicoSCResourceManager::getNoticeOfHighOder()
2301 ICO_TRA("Enter (%d)", (int)m_OnScreenItems.size());
2302 const CicoSCRoleConf* rC = CicoSystemConfig::getInstance()->getRoleConf();
2303 m_policyMgr->sendSMEvent(rC->m_rst); // RESET OnScreen State
2304 const resource_request_t* r = NULL;
2305 list<resource_request_t*>::iterator itr = m_OnScreenItems.begin();
2306 for (; itr != m_OnScreenItems.end(); ++itr) {
2307 short hEv = (*itr)->role_stt;
2308 if ((ICO_SYC_ROLE_CONF_DEF == hEv) || (0 == hEv)) {
2309 continue; // continue of for itr
2311 bool test = m_policyMgr->testSMEvent(hEv);
2312 if (true == m_policyMgr->sendSMEvent(hEv)) {
2315 else if (true == test) {
2319 ICO_TRA("Leave %x", r);
2323 // vim:set expandtab ts=4 sw=4: