1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 ****************************************************************************/
20 #ifndef _LAYERMANAGER_H_
21 #define _LAYERMANAGER_H_
23 #include "ICommandExecutor.h"
24 #include "NotificationQueue.h"
25 #include "CommandList.h"
33 class IApplicationReference;
39 typedef std::map<unsigned int, CommandList> CommandListMap;
40 typedef std::map<unsigned int, const char*> PidToProcessNameTable;
41 typedef std::list<IPlugin*> PluginList;
44 class Layermanager: public ICommandExecutor
47 Layermanager(Configuration& config);
48 virtual ~Layermanager();
50 void signalRendererRedraw();
52 virtual bool execute(ICommand* commandToBeExecuted);
53 virtual uint getLayerTypeCapabilities(const LayerType layertype) const;
54 virtual uint getNumberOfHardwareLayers(const uint screenID) const;
55 virtual uint* getScreenResolution(const uint screenID) const;
56 virtual uint* getScreenIDs(uint* length) const;
58 virtual void addRenderer(IRenderer* renderer);
59 virtual void removeRenderer(IRenderer* renderer);
61 virtual void addCommunicator(ICommunicator* communicator);
62 virtual void removeCommunicator(ICommunicator* communicator);
64 virtual void addSceneProvider(ISceneProvider* sceneProvider);
65 virtual void removeSceneProvider(ISceneProvider* sceneProvider);
67 virtual void addApplicationReference(t_ilm_client_handle client, IApplicationReference* reference);
68 virtual void removeApplicationReference(t_ilm_client_handle client);
69 virtual t_ilm_uint getSenderPid(t_ilm_client_handle client);
70 const char* getSenderName(t_ilm_client_handle client);
71 const char* getSenderName(unsigned int pid);
73 virtual bool startManagement();
74 virtual bool stopManagement();
76 virtual Scene* getScene(void);
77 virtual RendererList* getRendererList(void);
78 virtual CommunicatorList* getCommunicatorList(void);
79 virtual SceneProviderList* getSceneProviderList(void);
81 virtual void addClientNotification(GraphicalObject* object, t_ilm_notification_mask mask);
82 virtual NotificationQueue& getClientNotificationQueue();
83 virtual ApplicationReferenceMap* getApplicationReferenceMap(void);
85 virtual HealthCondition getHealth();
87 virtual CommandList& getEnqueuedCommands(unsigned int clientPid);
90 void printDebugInformation() const;
91 bool startAllRenderers(const int width, const int height, const char *displayName);
92 bool startAllCommunicators();
94 void stopAllRenderers();
95 void stopAllCommunicators();
96 bool executeCommand(ICommand* commandToBeExecuted);
97 bool enqueueCommand(ICommand* commandToBeExecuted);
101 RendererList* m_pRendererList;
102 CommunicatorList* m_pCommunicatorList;
103 SceneProviderList* m_pSceneProviderList;
104 NotificationQueue m_clientNotificationQueue;
105 ApplicationReferenceMap* m_pApplicationReferenceMap;
106 PidToProcessNameTable m_pidToProcessNameTable;
107 CommandListMap m_EnqueuedCommands;
109 pthread_t m_pWatchdogThread;
111 PluginList mMonitoredPlugins;
112 Configuration& mConfiguration;
113 PluginManager* m_pPluginManager;
116 inline Scene* Layermanager::getScene(void)
121 inline RendererList* Layermanager::getRendererList(void)
123 return m_pRendererList;
126 inline CommunicatorList* Layermanager::getCommunicatorList(void)
128 return m_pCommunicatorList;
131 inline SceneProviderList* Layermanager::getSceneProviderList(void)
133 return m_pSceneProviderList;
136 inline ApplicationReferenceMap* Layermanager::getApplicationReferenceMap(void)
138 return m_pApplicationReferenceMap;
141 inline void Layermanager::addClientNotification(GraphicalObject* object, t_ilm_notification_mask newMask)
143 if (m_clientNotificationQueue.find(object) != m_clientNotificationQueue.end())
145 m_clientNotificationQueue[object] = (t_ilm_notification_mask)(m_clientNotificationQueue[object] | newMask);
149 m_clientNotificationQueue[object] = newMask;
153 inline NotificationQueue& Layermanager::getClientNotificationQueue()
155 return m_clientNotificationQueue;
158 inline CommandList& Layermanager::getEnqueuedCommands(unsigned int clientPid)
160 return m_EnqueuedCommands[clientPid];
163 #endif /* _LAYERMANAGER_H_ */