LayerManagerService: added support for client specific command queues
[profile/ivi/layer-management.git] / LayerManagerService / include / ICommandExecutor.h
1 /***************************************************************************
2 *
3 * Copyright 2010,2011 BMW Car IT GmbH
4 *
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *        http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 ****************************************************************************/
19
20 #ifndef _COMMANDEXECUTOR_H_
21 #define _COMMANDEXECUTOR_H_
22
23 #include "RendererList.h"
24 #include "CommunicatorList.h"
25 #include "SceneProviderList.h"
26 #include "ApplicationReferenceMap.h"
27 #include "LayerType.h"
28 #include "ObjectType.h"
29 #include "CommandList.h"
30 #include "NotificationQueue.h"
31 #include <pthread.h>
32
33 class ICommand;
34 class Scene;
35 class Configuration;
36
37 /**
38  * \brief Interface for LayerManagement Command Executors
39  *
40  * \defgroup ServiceAPI Layer Management Service API
41  *
42  * Objects who implement this interface can be used to have command objects
43  * executed. Communication classes must only know this interface of a class to
44  * be able to pass along command objects.
45  *
46  * \note This interface is used to reduce dependency of communicators on the
47  * main layermanagement component
48  */
49 class ICommandExecutor
50 {
51 public:
52     /**
53      * \brief default destructor
54      * \ingroup ServiceAPI
55      */
56     virtual ~ICommandExecutor() {}
57
58     /**
59      * \brief Have a command processed.
60      * \ingroup ServiceAPI
61      * \param[in] commandToBeExecuted The command to be processed
62      * \return TRUE: execution of command successful
63      * \return FALSE: execution of command failed
64      */
65     virtual bool execute(ICommand* commandToBeExecuted) = 0;
66
67     /**
68      * \brief start layer management
69      * \ingroup ServiceAPI
70      * \return TRUE: start management successful
71      * \return FALSE: start management failed
72      */
73     virtual bool startManagement() = 0;
74
75     /**
76      * \brief stop layer management
77      * \ingroup ServiceAPI
78      * \return TRUE: stopped management successfully
79      * \return FALSE: stopping management failed
80      */
81     virtual bool stopManagement() = 0;
82
83     /**
84      * \brief get handle to scene data structure
85      * \ingroup ServiceAPI
86      * \return Pointer to the internal scene data structure
87      */
88     virtual Scene* getScene(void) = 0;
89
90     // renderer management
91
92     /**
93      * \brief get list of renderer plugins currently used
94      * \ingroup ServiceAPI
95      * \return Pointer to list of renderer plugins
96      */
97     virtual RendererList* getRendererList(void) = 0;
98
99     /**
100      * \brief add a renderer to be used for layer management
101      * \ingroup ServiceAPI
102      * \param[in] renderer pointer to renderer object
103      */
104     virtual void addRenderer(IRenderer* renderer) = 0;
105
106     /**
107      * \brief remove renderer from layer management
108      * \ingroup ServiceAPI
109      * \param[in] renderer pointer to renderer object
110      */
111     virtual void removeRenderer(IRenderer* renderer) = 0;
112
113     // communicator management
114
115     /**
116      * \brief get list of communicator plugins currently used
117      * \ingroup ServiceAPI
118      * \return Pointer to internal list of communicators
119      */
120     virtual CommunicatorList* getCommunicatorList(void) = 0;
121
122     /**
123      *
124      * \brief add a communicator to be used for layer management
125      * \ingroup ServiceAPI
126      * \param[in] communicator pointer to communicator object
127      */
128     virtual void addCommunicator(ICommunicator* communicator) = 0;
129
130     /**
131      *
132      * \brief remove communicator from layer management
133      * \ingroup ServiceAPI
134      * \param[in] communicator pointer to communicator object
135      */
136     virtual void removeCommunicator(ICommunicator* communicator) = 0;
137     
138     // scene provider management
139
140     /**
141      * \brief get list of scene provider plugins currently used
142      * \ingroup ServiceAPI
143      * \return Pointer to internal list of communicators
144      */
145     virtual SceneProviderList* getSceneProviderList(void) = 0;
146
147     /**
148      *
149      * \brief add a scene provider to be used for layer management
150      * \ingroup ServiceAPI
151      * \param[in] sceneProvider pointer to scene provider object
152      */
153     virtual void addSceneProvider(ISceneProvider* sceneProvider) = 0;
154
155     /**
156      *
157      * \brief remove scene provider from layer management
158      * \ingroup ServiceAPI
159      * \param[in] sceneProvider pointer to scene provider object
160      */
161     virtual void removeSceneProvider(ISceneProvider* sceneProvider) = 0;
162
163     // client application management
164
165     /**
166      * \brief get map of currently registered applications
167      * \ingroup ServiceAPI
168      * \return map of currently registered applications
169      */
170     virtual ApplicationReferenceMap* getApplicationReferenceMap(void) = 0;
171
172     /**
173      * \brief add application to list of currently registered applications
174      * \ingroup ServiceAPI
175      * \param[in] client handle to connected client application
176      * \param[in] applicationReference pointer to application object
177      */
178     virtual void addApplicationReference(t_ilm_client_handle client, IApplicationReference* applicationReference) = 0;
179
180     /**
181      * \brief remove application from list of currently registered applications
182      * \ingroup ServiceAPI
183      * \param[in] client handle to connected client application
184      */
185     virtual void removeApplicationReference(t_ilm_client_handle client) = 0;
186
187     /**
188      * \brief get pid of a connected application
189      * \ingroup ServiceAPI
190      * \param[in] client client handle to get process id for
191      */
192     virtual t_ilm_uint getSenderPid(t_ilm_client_handle client) = 0;
193
194     /**
195      * \brief get name of a connected application
196      * \ingroup ServiceAPI
197      * \param[in] client client handle to get process name for
198      */
199     virtual const char* getSenderName(t_ilm_client_handle client) = 0;
200
201     /**
202      * \brief get name of a connected application
203      * \ingroup ServiceAPI
204      * \param[in] pid process id to get process name for
205      */
206     virtual const char* getSenderName(unsigned int pid) = 0;
207
208     /**
209      * \brief get capabilities of layer type
210      * \ingroup ServiceAPI
211      * \param[in] layertype layer type
212      * \return bitmask with capability flags set according to layer type capabilities
213      * \todo removable, use default command processing
214      */
215     virtual unsigned int getLayerTypeCapabilities(const LayerType layertype) const = 0;
216
217     /**
218      * \brief get number of supported hardware layers for screen
219      * \ingroup ServiceAPI
220      * \param[in] screenID id of screen
221      * \return number of supported hardware layers for screen
222      * \todo removable, use default command processing
223      */
224     virtual unsigned int getNumberOfHardwareLayers(const unsigned int screenID) const = 0;
225
226     /**
227      * \brief get resolution of screen
228      * \ingroup ServiceAPI
229      * \param[in] screenID id of screen
230      * \return array of integer with width and height of screen
231      * \todo removable, use default command processing
232      */
233     virtual unsigned int* getScreenResolution(const unsigned int screenID) const = 0;
234
235     /**
236      * \brief get list of available screens
237      * \ingroup ServiceAPI
238      * \param[out] length of returned array
239      * \return list of screen ids
240      * \todo removable, use default command processing
241      */
242     virtual unsigned int* getScreenIDs(unsigned int* length) const = 0;
243
244     /**
245      * \brief add a notification for an updated scene element
246      * \ingroup ServiceAPI
247      * \param[in] object pointer to updated scene element, e.g. layer or surface
248      * \param[in] mask bitmask indicating which property of scene element was udpated
249      */
250     virtual void addClientNotification(GraphicalObject* object, t_ilm_notification_mask mask) = 0;
251
252     /**
253      * \brief get the list of updated scene elements
254      * \ingroup ServiceAPI
255      * \return reference to current list of updated scene elements
256      */
257     virtual NotificationQueue& getClientNotificationQueue() = 0;
258
259     /**
260      * \brief get the list of enqueued commands for a client
261      * \ingroup ServiceAPI
262      * \param[in] clientPid process id of client
263      * \return Reference to command list for client
264      */
265     virtual CommandList& getEnqueuedCommands(unsigned int clientPid) = 0;
266
267     /**
268      * \brief get system health state
269      * \ingroup ServiceAPI
270      * \return system health condition
271      */
272     virtual HealthCondition getHealth() = 0;
273 };
274
275 #endif /* _COMMANDEXECUTOR_H_ */