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.h
14 * @brief This file is definition of CicoSCResourceManager class
16 //==========================================================================
17 #ifndef __CICO_SC_RESOURCE_MANAGER_H__
18 #define __CICO_SC_RESOURCE_MANAGER_H__
25 #include "ico_syc_mrp_resource_private.h"
27 //==========================================================================
28 // Forward declaration
29 //==========================================================================
31 class CicoSCPolicyManager;
32 class CicoSCWindowController;
33 class CicoSCInputController;
35 //==========================================================================
37 * @brief This class manages resources
39 //==========================================================================
40 class CicoSCResourceManager
43 // default constructor
44 CicoSCResourceManager();
47 ~CicoSCResourceManager();
49 // initialize resource manager
52 // terminate resource manager
56 void handleCommand(const CicoSCCommand &cmd, bool internal=false);
58 // set CicoSCWindowController instance
59 void setWindowController(CicoSCWindowController *winCtrl);
61 // set CicoSCInputController instance
62 void setInputController(CicoSCInputController *inputCtrl);
64 // receive changed state
65 void receiveChangedState(int state);
67 // get resource manager instance
68 CicoSCPolicyManager * getPolicyManager(void);
71 // assignment operator
72 CicoSCResourceManager& operator=(const CicoSCResourceManager &object);
75 CicoSCResourceManager(const CicoSCResourceManager &object);
77 bool acquireDisplayResource(resource_request_t *newreq,
79 void releaseDisplayResource(resource_request_t *newreq);
81 bool acquireSoundResource(resource_request_t *newreq);
82 void releaseSoundResource(resource_request_t *newreq);
84 bool acquireInputResource(resource_request_t *newreq);
85 void releaseInputResource(resource_request_t *newreq);
87 resource_request_t* newResourceRequest(int resid,
89 const CicoSCCommand &cmd);
91 void delResourceRequest(resource_request_t *req);
93 static void enforceSound(unsigned short state,
94 resource_request_t *req,
97 resource_request_t * popDispResReq(resource_request_t *req);
99 resource_request_t * popSoundResReq(resource_request_t *req);
101 resource_request_t * popInputResReq(resource_request_t *req);
103 void updateDisplayResource(resource_request_t *req, int chgzoneid=-1);
104 void updateSoundResource(resource_request_t *req);
105 void updateInputResource(resource_request_t *req);
107 void updateDisplayResourceRegulation(int state);
108 void updateSoundResourceRegulation(int state);
109 void updateInputResourceRegulation(int state);
111 void updateDispResRegulationPreProc(resource_request_t *req);
112 void updateSoundResRegulationPreProc(resource_request_t *req);
113 void updateInputResRegulationPreProc(resource_request_t *req);
115 resource_request_t * findCurDispResOwerReq(resource_request_t *req);
116 resource_request_t * popCurDispResOwerReq(resource_request_t *req);
117 void dumpCurDispResOwerReq(void);
119 resource_request_t * findWaitingDispResReq(resource_request_t *req);
120 resource_request_t * popWaitingDispResReq(resource_request_t *req);
121 void dumpWaitingDispResReq(void);
123 bool isMatchDisplayed(void);
126 CicoSCPolicyManager *m_policyMgr;
127 CicoSCWindowController *m_winCtrl;
128 CicoSCInputController *m_inputCtrl;
130 // pair zoneid and request
131 std::map<unsigned int, resource_request_t*> m_curDispResOwerReq;
132 std::map<int, resource_request_t*> m_curSoundResReq;
133 std::map<int, resource_request_t*> m_curInputResReq;
135 std::list<resource_request_t*> m_waitingDispResReq;
136 map<int, list<resource_request_t*> > m_soundReqQueue;
137 map<int, list<resource_request_t*> > m_inputReqQueue;
139 // show/hide animation name at regulation on or off
140 const std::string m_animaName;
142 // show/hide animation time at regulation on or off
145 #endif // __CICO_SC_RESOURCE_MANAGER_H__
146 // vim:set expandtab ts=4 sw=4: