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 CicoSCPolicyManager.h
14 * @brief This file is definition of CicoSCPolicyManager class
16 //==========================================================================
17 #ifndef __CICO_SC_POLICY_MANAGER_H__
18 #define __CICO_SC_POLICY_MANAGER_H__
22 #include <dbus/dbus.h>
29 //==========================================================================
30 // Forward declaration
31 //==========================================================================
32 class CicoStateMachine;
34 class CicoSCResourceManager;
36 //==========================================================================
38 * @brief This class manages the policy of resource
40 //==========================================================================
41 class CicoSCPolicyManager
45 CicoSCPolicyManager(CicoSCResourceManager* resourceMgr=NULL);
48 ~CicoSCPolicyManager();
50 // initialize resource manager
53 // terminate resource manager
56 bool acquireDisplayResource(int type, int zoneid, int priority);
57 bool releaseDisplayResource(int zoneid, int category);
59 bool acquireSoundResource(int type, int zoneid, int priority);
60 bool releaseSoundResource(int input, int priority);
62 bool acquireInputResource(int input, int priority);
63 bool releaseInputResource(int input);
65 bool testSMEvent(unsigned short event_id);
66 bool testSMEvent(unsigned short event_id, int value);
68 bool sendSMEvent(unsigned short event_id);
69 bool sendSMEvent(unsigned short event_id, int value);
71 void notifyChangedState(int state);
74 const std::map<int, const CicoState*>& getPolicyStates(void);
76 bool getDispZoneState(int zoneid);
77 bool getSoundZoneState(int zoneid) const;
78 bool getInputState(int input) const;
79 bool getRegulation(void);
81 bool isExistDisplayZoneOwer(int zoneid);
83 // notify connected process
84 void notifyConnected(const std::string & appid);
87 // default constructor
88 CicoSCPolicyManager();
90 // assignment operator
91 CicoSCPolicyManager& operator=(const CicoSCPolicyManager &object);
94 CicoSCPolicyManager(const CicoSCPolicyManager &object);
96 // initialize state machine
97 int initStateMachine(void);
99 // callback function for changed vehicle informantion
100 void onChangedVehicleInfo(int type, void *event);
103 // callback function for changed vehicle informantion
104 static Eina_Bool changedVehicleInfoCB(void *data, int type, void *event);
110 // ecore event handler
111 Ecore_Event_Handler* m_ecoreEvHandler;
113 // CicoStateMachine instance
114 CicoStateMachine *m_stateMachine;
116 // CicoSCResourceManager instance
117 CicoSCResourceManager *m_resourceMgr;
120 std::map<int, const CicoState*> m_policyStates;
122 // display zone state list
123 std::map<int, const CicoState*> m_dispZoneStates;
125 // sound zone state list
126 std::vector<const CicoState*> m_soundZoneStates;
129 std::vector<const CicoState*> m_inputStates;
131 #endif // __CICO_SC_POLICY_MANAGER_H__
132 // vim:set expandtab ts=4 sw=4: