Removed unnecessary build dependencies.
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCPolicyManager.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  */
9
10 //==========================================================================
11 /**
12  *  @file   CicoSCPolicyManager.h
13  *
14  *  @brief  This file is definition of CicoSCPolicyManager class
15  */
16 //==========================================================================
17 #ifndef __CICO_SC_POLICY_MANAGER_H__
18 #define __CICO_SC_POLICY_MANAGER_H__
19
20 #include <Ecore.h>
21 #include <Eina.h>
22 #include <dbus/dbus.h>
23
24 #include <map>
25 #include <vector>
26 #include <string>
27 using namespace std;
28
29 //==========================================================================
30 //  Forward declaration
31 //==========================================================================
32 class CicoStateMachine;
33 class CicoState;
34 class CicoSCResourceManager;
35
36 //==========================================================================
37 /*
38  *  @brief  This class manages the policy of resource
39  */
40 //==========================================================================
41 class CicoSCPolicyManager
42 {
43 public:
44     // constructor
45     CicoSCPolicyManager(CicoSCResourceManager* resourceMgr=NULL);
46
47     // destructor
48     ~CicoSCPolicyManager();
49
50     // initialize resource manager
51     int initialize(void);
52
53     // terminate resource manager
54     void terminate(void);
55
56     bool acquireDisplayResource(int type, int zoneid, int priority);
57     bool releaseDisplayResource(int zoneid, int category);
58
59     bool acquireSoundResource(int type, int zoneid, int priority);
60     bool releaseSoundResource(int input, int priority);
61
62     bool acquireInputResource(int input, int priority);
63     bool releaseInputResource(int input);
64
65     bool testSMEvent(unsigned short event_id);
66     bool testSMEvent(unsigned short event_id, int value);
67
68     bool sendSMEvent(unsigned short event_id);
69     bool sendSMEvent(unsigned short event_id, int value);
70
71     void notifyChangedState(int state);
72
73     // get states
74     const std::map<int, const CicoState*>& getPolicyStates(void);
75
76     bool getDispZoneState(int zoneid);
77     bool getSoundZoneState(int zoneid) const;
78     bool getInputState(int input) const;
79     bool getRegulation(void);
80
81     bool isExistDisplayZoneOwer(int zoneid);
82
83     // notify connected process
84     void notifyConnected(const std::string & appid);
85
86 private:
87     // default constructor
88     CicoSCPolicyManager();
89
90     // assignment operator
91     CicoSCPolicyManager& operator=(const CicoSCPolicyManager &object);
92
93     // copy constructor
94     CicoSCPolicyManager(const CicoSCPolicyManager &object);
95
96     // initialize state machine
97     int initStateMachine(void);
98
99     // callback function for changed vehicle informantion
100     void onChangedVehicleInfo(int type, void *event);
101
102 private:
103     // callback function for changed vehicle informantion
104     static Eina_Bool changedVehicleInfoCB(void *data, int type, void *event);
105
106 private:
107     // initialized flag
108     bool m_initialized;
109
110     // ecore event handler
111     Ecore_Event_Handler*  m_ecoreEvHandler;
112
113     // CicoStateMachine instance
114     CicoStateMachine      *m_stateMachine;
115
116     // CicoSCResourceManager instance
117     CicoSCResourceManager *m_resourceMgr;
118
119     // state list
120     std::map<int, const CicoState*> m_policyStates;
121
122     // display zone state list
123     std::map<int, const CicoState*> m_dispZoneStates;
124
125     // sound zone state list
126     std::vector<const CicoState*> m_soundZoneStates;
127
128     // input state list
129     std::vector<const CicoState*> m_inputStates;
130 };
131 #endif  // __CICO_SC_POLICY_MANAGER_H__
132 // vim:set expandtab ts=4 sw=4: