Add implementation of chromakey for layer
[profile/ivi/layer-management.git] / LayerManagerPlugins / Communicators / GenericCommunicator / src / GenericCommunicator.cpp
1 /***************************************************************************
2  * Copyright 2012 BMW Car IT GmbH
3  * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia 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 #include "GenericCommunicator.h"
21 #include "ilm_types.h"
22 #include "Log.h"
23
24 #include "ICommandExecutor.h"
25 #include "CommitCommand.h"
26 #include "LayerCreateCommand.h"
27 #include "LayergroupCreateCommand.h"
28 #include "SurfaceCreateCommand.h"
29 #include "SurfacegroupCreateCommand.h"
30 #include "SurfaceGetDimensionCommand.h"
31 #include "LayerGetDimensionCommand.h"
32 #include "SurfaceGetOpacityCommand.h"
33 #include "LayerGetOpacityCommand.h"
34 #include "SurfaceGetPixelformatCommand.h"
35 #include "LayerGetVisibilityCommand.h"
36 #include "SurfaceGetVisibilityCommand.h"
37 #include "LayerAddSurfaceCommand.h"
38 #include "LayerRemoveSurfaceCommand.h"
39 #include "LayerRemoveCommand.h"
40 #include "SurfaceRemoveCommand.h"
41 #include "LayergroupRemoveCommand.h"
42 #include "SurfacegroupRemoveCommand.h"
43 #include "SurfaceGetOrientationCommand.h"
44 #include "LayerGetOrientationCommand.h"
45 #include "LayergroupAddLayerCommand.h"
46 #include "LayergroupRemoveLayerCommand.h"
47 #include "LayerSetDestinationRectangleCommand.h"
48 #include "SurfaceSetDestinationRectangleCommand.h"
49 #include "LayerSetOpacityCommand.h"
50 #include "LayergroupSetOpacityCommand.h"
51 #include "SurfaceSetOpacityCommand.h"
52 #include "SurfacegroupSetOpacityCommand.h"
53 #include "LayerSetSourceRectangleCommand.h"
54 #include "SurfaceSetSourceRectangleCommand.h"
55 #include "LayerSetOrientationCommand.h"
56 #include "SurfaceSetOrientationCommand.h"
57 #include "SurfacegroupAddSurfaceCommand.h"
58 #include "SurfacegroupRemoveSurfaceCommand.h"
59 #include "LayerSetVisibilityCommand.h"
60 #include "SurfaceSetVisibilityCommand.h"
61 #include "LayergroupSetVisibilityCommand.h"
62 #include "SurfacegroupSetVisibilityCommand.h"
63 #include "DebugCommand.h"
64 #include "ExitCommand.h"
65 #include "ScreenSetRenderOrderCommand.h"
66 #include "LayerSetRenderOrderCommand.h"
67 #include "LayerSetDimensionCommand.h"
68 #include "SurfaceSetDimensionCommand.h"
69 #include "LayerSetPositionCommand.h"
70 #include "SurfaceSetPositionCommand.h"
71 #include "LayerGetPositionCommand.h"
72 #include "SurfaceGetPositionCommand.h"
73 #include "ShaderCreateCommand.h"
74 #include "ShaderDestroyCommand.h"
75 #include "SurfaceSetShaderCommand.h"
76 #include "ShaderSetUniformsCommand.h"
77 #include "ScreenDumpCommand.h"
78 #include "LayerDumpCommand.h"
79 #include "SurfaceDumpCommand.h"
80 #include "SurfaceSetNativeContentCommand.h"
81 #include "SurfaceRemoveNativeContentCommand.h"
82 #include "SurfaceSetKeyboardFocusCommand.h"
83 #include "SurfaceGetKeyboardFocusCommand.h"
84 #include "SurfaceUpdateInputEventAcceptance.h"
85 #include "SurfaceSetChromaKeyCommand.h"
86 #include "LayerSetChromaKeyCommand.h"
87
88 #include <stdbool.h>
89 #include <unistd.h>
90 #include <stdio.h>
91 #include <string.h>
92 #include <stdlib.h>
93 #include <string>
94
95 #define DEFAULT_SCREEN 0
96
97 const char* RESSOURCE_ALREADY_INUSE = "Ressource already in use";
98 const char* INVALID_ARGUMENT = "Invalid argument";
99 const char* RESSOURCE_NOT_FOUND = "Ressource not found";
100
101
102 GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
103 : ICommunicator(executor)
104 , m_running(ILM_FALSE)
105 {
106
107     MethodTable manager_methods[] =
108     {
109         { "ServiceConnect",                   &GenericCommunicator::ServiceConnect },
110         { "ServiceDisconnect",                &GenericCommunicator::ServiceDisconnect },
111         { "Debug",                            &GenericCommunicator::Debug },
112         { "ScreenShot",                       &GenericCommunicator::ScreenShot },
113         { "ScreenShotOfLayer",                &GenericCommunicator::ScreenShotOfLayer },
114         { "ScreenShotOfSurface",              &GenericCommunicator::ScreenShotOfSurface },
115         { "GetScreenResolution",              &GenericCommunicator::GetScreenResolution },
116         { "GetNumberOfHardwareLayers",        &GenericCommunicator::GetNumberOfHardwareLayers },
117         { "GetScreenIDs",                     &GenericCommunicator::GetScreenIDs },
118         { "ListAllLayerIDS",                  &GenericCommunicator::ListAllLayerIDS },
119         { "ListAllLayerIDsOnScreen",          &GenericCommunicator::ListAllLayerIDsOnScreen },
120         { "ListAllSurfaceIDS",                &GenericCommunicator::ListAllSurfaceIDS },
121         { "ListAllLayerGroupIDS",             &GenericCommunicator::ListAllLayerGroupIDS },
122         { "ListAllSurfaceGroupIDS",           &GenericCommunicator::ListAllSurfaceGroupIDS },
123         { "ListSurfacesOfSurfacegroup",       &GenericCommunicator::ListSurfacesOfSurfacegroup },
124         { "ListLayersOfLayergroup",           &GenericCommunicator::ListLayersOfLayergroup },
125         { "ListSurfaceofLayer",               &GenericCommunicator::ListSurfaceofLayer },
126         { "GetPropertiesOfSurface",           &GenericCommunicator::GetPropertiesOfSurface },
127         { "GetPropertiesOfLayer",             &GenericCommunicator::GetPropertiesOfLayer },
128         { "CreateSurface",                    &GenericCommunicator::CreateSurface },
129         { "CreateSurfaceFromId",              &GenericCommunicator::CreateSurfaceFromId },
130         { "InitializeSurface",                &GenericCommunicator::InitializeSurface },
131         { "InitializeSurfaceFromId",          &GenericCommunicator::InitializeSurfaceFromId },
132         { "SetSurfaceNativeContent",          &GenericCommunicator::SetSurfaceNativeContent },
133         { "RemoveSurfaceNativeContent",       &GenericCommunicator::RemoveSurfaceNativeContent },
134         { "RemoveSurface",                    &GenericCommunicator::RemoveSurface },
135         { "CreateLayer",                      &GenericCommunicator::CreateLayer },
136         { "CreateLayerFromId",                &GenericCommunicator::CreateLayerFromId },
137         { "CreateLayerWithDimension",         &GenericCommunicator::CreateLayerWithDimension },
138         { "CreateLayerFromIdWithDimension",   &GenericCommunicator::CreateLayerFromIdWithDimension },
139         { "RemoveLayer",                      &GenericCommunicator::RemoveLayer },
140         { "AddSurfaceToSurfaceGroup",         &GenericCommunicator::AddSurfaceToSurfaceGroup },
141         { "RemoveSurfaceFromSurfaceGroup",    &GenericCommunicator::RemoveSurfaceFromSurfaceGroup },
142         { "AddLayerToLayerGroup",             &GenericCommunicator::AddLayerToLayerGroup },
143         { "RemoveLayerFromLayerGroup",        &GenericCommunicator::RemoveLayerFromLayerGroup },
144         { "AddSurfaceToLayer",                &GenericCommunicator::AddSurfaceToLayer },
145         { "RemoveSurfaceFromLayer",           &GenericCommunicator::RemoveSurfaceFromLayer },
146         { "CreateSurfaceGroup",               &GenericCommunicator::CreateSurfaceGroup },
147         { "CreateSurfaceGroupFromId",         &GenericCommunicator::CreateSurfaceGroupFromId },
148         { "RemoveSurfaceGroup",               &GenericCommunicator::RemoveSurfaceGroup },
149         { "CreateLayerGroup",                 &GenericCommunicator::CreateLayerGroup },
150         { "CreateLayerGroupFromId",           &GenericCommunicator::CreateLayerGroupFromId },
151         { "RemoveLayerGroup",                 &GenericCommunicator::RemoveLayerGroup },
152         { "SetSurfaceSourceRegion",           &GenericCommunicator::SetSurfaceSourceRegion },
153         { "SetLayerSourceRegion",             &GenericCommunicator::SetLayerSourceRegion },
154         { "SetSurfaceDestinationRegion",      &GenericCommunicator::SetSurfaceDestinationRegion },
155         { "SetSurfacePosition",               &GenericCommunicator::SetSurfacePosition },
156         { "GetSurfacePosition",               &GenericCommunicator::GetSurfacePosition },
157         { "SetSurfaceDimension",              &GenericCommunicator::SetSurfaceDimension },
158         { "SetLayerDestinationRegion",        &GenericCommunicator::SetLayerDestinationRegion },
159         { "SetLayerPosition",                 &GenericCommunicator::SetLayerPosition },
160         { "GetLayerPosition",                 &GenericCommunicator::GetLayerPosition },
161         { "SetLayerDimension",                &GenericCommunicator::SetLayerDimension },
162         { "GetLayerDimension",                &GenericCommunicator::GetLayerDimension },
163         { "GetSurfaceDimension",              &GenericCommunicator::GetSurfaceDimension },
164         { "SetSurfaceOpacity",                &GenericCommunicator::SetSurfaceOpacity },
165         { "SetLayerOpacity",                  &GenericCommunicator::SetLayerOpacity },
166         { "SetSurfacegroupOpacity",           &GenericCommunicator::SetSurfacegroupOpacity },
167         { "SetLayergroupOpacity",             &GenericCommunicator::SetLayergroupOpacity },
168         { "GetSurfaceOpacity",                &GenericCommunicator::GetSurfaceOpacity },
169         { "GetLayerOpacity",                  &GenericCommunicator::GetLayerOpacity },
170         { "SetSurfaceOrientation",            &GenericCommunicator::SetSurfaceOrientation },
171         { "GetSurfaceOrientation",            &GenericCommunicator::GetSurfaceOrientation },
172         { "SetLayerOrientation",              &GenericCommunicator::SetLayerOrientation },
173         { "GetLayerOrientation",              &GenericCommunicator::GetLayerOrientation },
174         { "GetSurfacePixelformat",            &GenericCommunicator::GetSurfacePixelformat },
175         { "SetSurfaceVisibility",             &GenericCommunicator::SetSurfaceVisibility },
176         { "SetLayerVisibility",               &GenericCommunicator::SetLayerVisibility },
177         { "GetSurfaceVisibility",             &GenericCommunicator::GetSurfaceVisibility },
178         { "GetLayerVisibility",               &GenericCommunicator::GetLayerVisibility },
179         { "SetSurfacegroupVisibility",        &GenericCommunicator::SetSurfacegroupVisibility },
180         { "SetLayergroupVisibility",          &GenericCommunicator::SetLayergroupVisibility },
181         { "SetRenderOrderOfLayers",           &GenericCommunicator::SetRenderOrderOfLayers },
182         { "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
183         { "GetLayerType",                     &GenericCommunicator::GetLayerType },
184         { "GetLayertypeCapabilities",         &GenericCommunicator::GetLayertypeCapabilities },
185         { "GetLayerCapabilities",             &GenericCommunicator::GetLayerCapabilities },
186         { "Exit",                             &GenericCommunicator::Exit },
187         { "CommitChanges",                    &GenericCommunicator::CommitChanges },
188         { "CreateShader",                     &GenericCommunicator::CreateShader },
189         { "DestroyShader",                    &GenericCommunicator::DestroyShader },
190         { "SetShader",                        &GenericCommunicator::SetShader },
191         { "SetUniforms",                      &GenericCommunicator::SetUniforms },
192         { "SetKeyboardFocusOn",               &GenericCommunicator::SetKeyboardFocusOn },
193         { "GetKeyboardFocusSurfaceId",        &GenericCommunicator::GetKeyboardFocusSurfaceId },
194         { "UpdateInputEventAcceptanceOn",     &GenericCommunicator::UpdateInputEventAcceptanceOn },
195         { "SetSurfaceChromaKey",              &GenericCommunicator::SetSurfaceChromaKey },
196         { "SetLayerChromaKey",                &GenericCommunicator::SetLayerChromaKey },
197     };
198
199     int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
200
201     for (int index = 0; index < entryCount; ++index)
202     {
203         MethodTable* method = &manager_methods[index];
204         if (method->function)
205         {
206             m_callBackTable[method->name] = *method;
207             LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
208         }
209     }
210 }
211
212 bool GenericCommunicator::start()
213 {
214     LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
215
216     if (!loadIpcModule(&m_ipcModule))
217     {
218         LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
219         return ILM_FALSE;
220     }
221     LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
222
223     if (!m_ipcModule.init(ILM_FALSE))
224     {
225         LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
226         return ILM_FALSE;
227     }
228     LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
229
230     m_running = ILM_TRUE;
231
232     return ILM_TRUE;
233 }
234
235 void GenericCommunicator::stop()
236 {
237     LOG_INFO("GenericCommunicator","stopping");
238
239     if (m_running)
240     {
241         m_ipcModule.destroy();
242     }
243 }
244
245 void GenericCommunicator::process(int timeout_ms)
246 {
247     enum IpcMessageType messageType = m_ipcModule.receiveMessage(timeout_ms);
248
249     t_ilm_const_string name = m_ipcModule.getMessageName();
250     t_ilm_const_string sender = m_ipcModule.getSenderName();
251
252     switch(messageType)
253     {
254     case IpcMessageTypeCommand:
255         if (m_callBackTable.end() != m_callBackTable.find(name))
256         {
257             LOG_DEBUG("GenericCommunicator", "Received command " << name << " from " << sender);
258             CallBackMethod method = m_callBackTable[name].function;
259             (this->*method)();
260         }
261         else
262         {
263             LOG_WARNING("GenericCommunicator", "Received unknown command " << name << " from " << sender);
264         }
265         break;
266
267     case IpcMessageTypeDisconnect:
268         LOG_DEBUG("GenericCommunicator", "Received message " << name
269                   << " (type=disconnect" << ", sender=" << sender << ")");
270         ServiceDisconnect();
271         break;
272
273     case IpcMessageTypeNotification:
274         LOG_DEBUG("GenericCommunicator", "Received message " << name
275                   << " (type=notification" << ", sender=" << sender << ")");
276         break;
277
278     case IpcMessageTypeError:
279         LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from " << sender);
280         break;
281
282     case IpcMessageTypeNone:
283         break;
284
285     default:
286         LOG_DEBUG("GenericCommunicator", "Received unknown data from " << sender);
287         break;
288     }
289     m_ipcModule.destroyMessage();
290 }
291
292 void GenericCommunicator::setdebug(bool onoff)
293 {
294     (void)onoff; // TODO: remove, only prevents warning
295 }
296
297 void GenericCommunicator::ServiceConnect()
298 {
299     LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
300     u_int32_t processId = 0;
301     m_ipcModule.getUint(&processId);
302     char* owner = strdup(m_ipcModule.getSenderName());
303     m_executor->addApplicationReference(new IApplicationReference(owner,processId));
304     m_ipcModule.createMessage((char*)__FUNCTION__);
305     m_ipcModule.sendMessage();
306 }
307
308 void GenericCommunicator::ServiceDisconnect()
309 {
310     LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
311     char* owner = strdup(m_ipcModule.getSenderName());
312     long int ownerHash = IApplicationReference::generateApplicationHash(owner);
313     ApplicationReferenceMap* refmap = m_executor->getApplicationReferenceMap();
314
315     ApplicationReferenceMapIterator iter = refmap->find(ownerHash);
316     ApplicationReferenceMapIterator iterEnd = refmap->end();
317
318     for (; iter != iterEnd; ++iter)
319     {
320         IApplicationReference* registeredApp = (*iter).second;
321         m_executor->removeApplicationReference(registeredApp);
322     }
323
324     m_ipcModule.createMessage((char*)__FUNCTION__);
325     m_ipcModule.sendMessage();
326 }
327
328 void GenericCommunicator::Debug()
329 {
330     t_ilm_bool param = ILM_FALSE;
331     m_ipcModule.getBool(&param);
332
333     t_ilm_bool status = m_executor->execute(new DebugCommand(param));
334     if (status)
335     {
336         m_ipcModule.createMessage((char*)__FUNCTION__);
337         m_ipcModule.sendMessage();
338     }
339     else
340     {
341         m_ipcModule.sendError(INVALID_ARGUMENT);
342     }
343 }
344
345 void GenericCommunicator::GetScreenResolution()
346 {
347     uint screenid = 0;
348     m_ipcModule.getUint(&screenid);
349     uint* resolution = m_executor->getScreenResolution(screenid);
350     m_ipcModule.createMessage((char*)__FUNCTION__);
351     m_ipcModule.appendUint(resolution[0]);
352     m_ipcModule.appendUint(resolution[1]);
353     m_ipcModule.sendMessage();
354 }
355
356 void GenericCommunicator::GetNumberOfHardwareLayers()
357 {
358     uint screenid = 0;
359     m_ipcModule.getUint(&screenid);
360     uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
361     m_ipcModule.createMessage((char*)__FUNCTION__);
362     m_ipcModule.appendUint(numberOfHardwareLayers);
363     m_ipcModule.sendMessage();
364 }
365
366 void GenericCommunicator::GetScreenIDs()
367 {
368     uint length = 0;
369     uint* IDs = m_executor->getScreenIDs(&length);
370     m_ipcModule.createMessage((char*)__FUNCTION__);
371     m_ipcModule.appendUintArray(IDs, length);
372     m_ipcModule.sendMessage();
373 }
374
375 void GenericCommunicator::ScreenShot()
376 {
377     uint screenid = 0;
378     m_ipcModule.getUint(&screenid);
379     char filename[1024];
380     m_ipcModule.getString(filename);
381
382     t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(filename, screenid));
383     if (status)
384     {
385         m_ipcModule.createMessage((char*)__FUNCTION__);
386         m_ipcModule.sendMessage();
387     }
388     else
389     {
390         m_ipcModule.sendError(INVALID_ARGUMENT);
391     }
392 }
393
394 void GenericCommunicator::ScreenShotOfLayer()
395 {
396     char filename[1024];
397     m_ipcModule.getString(filename);
398     uint layerid = 0;
399     m_ipcModule.getUint(&layerid);
400
401     t_ilm_bool status = m_executor->execute(new LayerDumpCommand(filename, layerid));
402     if (status)
403     {
404         m_ipcModule.createMessage((char*)__FUNCTION__);
405         m_ipcModule.sendMessage();
406     }
407     else
408     {
409         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
410     }
411 }
412
413 void GenericCommunicator::ScreenShotOfSurface()
414 {
415     char filename[1024];
416     m_ipcModule.getString(filename);
417     uint id = 0;
418     m_ipcModule.getUint(&id);
419     t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(filename, id));
420     if (status)
421     {
422         m_ipcModule.createMessage((char*)__FUNCTION__);
423         m_ipcModule.sendMessage();
424     }
425     else
426     {
427         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
428     }
429 }
430
431 void GenericCommunicator::ListAllLayerIDS()
432 {
433     uint* array = NULL;
434     uint length = 0;
435     m_executor->getScene()->lockScene();
436     m_executor->getScene()->getLayerIDs(&length, &array);
437     m_ipcModule.createMessage((char*)__FUNCTION__);
438     m_ipcModule.appendUintArray(array, length);
439     m_ipcModule.sendMessage();
440     m_executor->getScene()->unlockScene();
441 }
442
443 void GenericCommunicator::ListAllLayerIDsOnScreen()
444 {
445     uint screenID = 0;
446     m_ipcModule.getUint(&screenID);
447
448     uint* array = NULL;
449     uint length = 0;
450     m_executor->getScene()->lockScene();
451     t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
452     if (status)
453     {
454         m_ipcModule.createMessage((char*)__FUNCTION__);
455         m_ipcModule.appendUintArray(array, length);
456         m_ipcModule.sendMessage();
457     }
458     else
459     {
460         m_ipcModule.sendError(INVALID_ARGUMENT);
461     }
462     m_executor->getScene()->unlockScene();
463 }
464
465 void GenericCommunicator::ListAllSurfaceIDS()
466 {
467     uint* array = NULL;
468     uint length = 0;
469     m_executor->getScene()->lockScene();
470     m_executor->getScene()->getSurfaceIDs(&length, &array);
471     m_ipcModule.createMessage((char*)__FUNCTION__);
472     m_ipcModule.appendUintArray(array, length);
473     m_ipcModule.sendMessage();
474     m_executor->getScene()->unlockScene();
475 }
476
477 void GenericCommunicator::ListAllLayerGroupIDS()
478 {
479     uint* array = NULL;
480     uint length = 0;
481     m_executor->getScene()->lockScene();
482     m_executor->getScene()->getLayerGroupIDs(&length, &array);
483     m_ipcModule.createMessage((char*)__FUNCTION__);
484     m_ipcModule.appendUintArray(array, length);
485     m_ipcModule.sendMessage();
486     m_executor->getScene()->unlockScene();
487 }
488
489 void GenericCommunicator::ListAllSurfaceGroupIDS()
490 {
491     uint* array = NULL;
492     uint length = 0;
493     m_executor->getScene()->lockScene();
494     m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
495     m_ipcModule.createMessage((char*)__FUNCTION__);
496     m_ipcModule.appendUintArray(array, length);
497     m_ipcModule.sendMessage();
498     m_executor->getScene()->unlockScene();
499 }
500
501 void GenericCommunicator::ListSurfacesOfSurfacegroup()
502 {
503     uint id = 0;
504     m_ipcModule.getUint(&id);
505     m_executor->getScene()->lockScene();
506     SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
507     if (NULL != sg)
508     {
509         std::list<Surface*> surfaces = sg->getList();
510         uint length = surfaces.size();
511         uint* array = new uint[length];
512         uint arrayPos = 0;
513         m_ipcModule.createMessage((char*)__FUNCTION__);
514
515         for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
516         {
517             Surface* s = *it;
518             array[arrayPos] = s->getID();
519             ++arrayPos;
520         }
521
522         m_ipcModule.appendUintArray(array, length);
523
524         m_ipcModule.sendMessage();
525         m_executor->getScene()->unlockScene();
526     }
527     else
528     {
529         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
530     }
531 }
532
533 void GenericCommunicator::ListLayersOfLayergroup()
534 {
535     uint id = 0;
536     m_ipcModule.getUint(&id);
537     m_executor->getScene()->lockScene();
538     LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
539     if (NULL != sg)
540     {
541         std::list<Layer*> layers = sg->getList();
542
543         uint length = layers.size();
544         uint* array = new uint[length];
545         uint arrayPos = 0;
546
547         m_ipcModule.createMessage((char*)__FUNCTION__);
548         for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
549         {
550             Layer* l = *it;
551             array[arrayPos] = l->getID();
552             ++arrayPos;
553         }
554
555         m_ipcModule.appendUintArray(array, length);
556
557         m_ipcModule.sendMessage();
558         m_executor->getScene()->unlockScene();
559     }
560     else
561     {
562         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
563     }
564 }
565
566 void GenericCommunicator::ListSurfaceofLayer()
567 {
568     uint id = 0;
569     m_ipcModule.getUint(&id);
570     m_executor->getScene()->lockScene();
571     Layer* layer = m_executor->getScene()->getLayer(id);
572     if (layer != NULL)
573     {
574         std::list<Surface*> surfaces = layer->getAllSurfaces();
575
576         uint length = surfaces.size();
577         uint* array = new uint[length];
578         uint arrayPos = 0;
579
580         m_ipcModule.createMessage((char*)__FUNCTION__);
581
582         for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
583         {
584             Surface* s = *it;
585             array[arrayPos] = s->getID();
586             ++arrayPos;
587         }
588
589         m_ipcModule.appendUintArray(array, length);
590
591         m_ipcModule.sendMessage();
592     }
593     else
594     {
595         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
596     }
597     m_executor->getScene()->unlockScene();
598 }
599
600 void GenericCommunicator::GetPropertiesOfSurface()
601 {
602     uint id = 0;
603     m_ipcModule.getUint(&id);
604
605     Surface* surface = m_executor->getScene()->getSurface(id);
606     if (surface != NULL)
607     {
608         Rectangle dest = surface->getDestinationRegion();
609         Rectangle src = surface->getSourceRegion();
610         OrientationType orientation = surface->getOrientation();
611         unsigned char chromaKeyRed = 0;
612         unsigned char chromaKeyGreen = 0;
613         unsigned char chromaKeyBlue = 0;
614         surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
615
616         m_ipcModule.createMessage((char*)__FUNCTION__);
617         m_ipcModule.appendDouble(surface->getOpacity());
618         m_ipcModule.appendUint(src.x);
619         m_ipcModule.appendUint(src.y);
620         m_ipcModule.appendUint(src.width);
621         m_ipcModule.appendUint(src.height);
622         m_ipcModule.appendUint(surface->OriginalSourceWidth);
623         m_ipcModule.appendUint(surface->OriginalSourceHeight);
624         m_ipcModule.appendUint(dest.x);
625         m_ipcModule.appendUint(dest.y);
626         m_ipcModule.appendUint(dest.width);
627         m_ipcModule.appendUint(dest.height);
628         m_ipcModule.appendUint(orientation);
629         m_ipcModule.appendBool(surface->getVisibility());
630         m_ipcModule.appendUint(surface->frameCounter);
631         m_ipcModule.appendUint(surface->drawCounter);
632         m_ipcModule.appendUint(surface->updateCounter);
633         m_ipcModule.appendUint(surface->getPixelFormat());
634         m_ipcModule.appendUint(surface->getNativeContent());
635         m_ipcModule.appendUint(surface->getInputEventAcceptanceOnDevices());
636         m_ipcModule.appendBool(surface->getChromaKeyEnabled());
637         m_ipcModule.appendUint(chromaKeyRed);
638         m_ipcModule.appendUint(chromaKeyGreen);
639         m_ipcModule.appendUint(chromaKeyBlue);
640         m_ipcModule.sendMessage();
641     }
642     else
643     {
644         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
645     }
646 }
647
648 void GenericCommunicator::GetPropertiesOfLayer()
649 {
650     uint id = 0;
651     m_ipcModule.getUint(&id);
652
653     Layer* layer = m_executor->getScene()->getLayer(id);
654     if (layer != NULL)
655     {
656         Rectangle dest = layer->getDestinationRegion();
657         Rectangle src = layer->getSourceRegion();
658         OrientationType orientation = layer->getOrientation();
659         unsigned char chromaKeyRed = 0;
660         unsigned char chromaKeyGreen = 0;
661         unsigned char chromaKeyBlue = 0;
662         layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
663
664         m_ipcModule.createMessage((char*)__FUNCTION__);
665         m_ipcModule.appendDouble(layer->getOpacity());
666         m_ipcModule.appendUint(src.x);
667         m_ipcModule.appendUint(src.y);
668         m_ipcModule.appendUint(src.width);
669         m_ipcModule.appendUint(src.height);
670         m_ipcModule.appendUint(layer->OriginalSourceWidth);
671         m_ipcModule.appendUint(layer->OriginalSourceHeight);
672         m_ipcModule.appendUint(dest.x);
673         m_ipcModule.appendUint(dest.y);
674         m_ipcModule.appendUint(dest.width);
675         m_ipcModule.appendUint(dest.height);
676         m_ipcModule.appendUint(orientation);
677         m_ipcModule.appendBool(layer->getVisibility());
678         m_ipcModule.appendUint(layer->getLayerType());
679         m_ipcModule.appendBool(layer->getChromaKeyEnabled());
680         m_ipcModule.appendUint(chromaKeyRed);
681         m_ipcModule.appendUint(chromaKeyGreen);
682         m_ipcModule.appendUint(chromaKeyBlue);
683         m_ipcModule.sendMessage();
684     }
685     else
686     {
687         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
688     }
689 }
690
691 void GenericCommunicator::CreateSurface()
692 {
693     uint handle = 0;
694     m_ipcModule.getUint(&handle);
695     uint width = 0;
696     m_ipcModule.getUint(&width);
697     uint height = 0;
698     m_ipcModule.getUint(&height);
699     uint pixelformat = 0;
700     m_ipcModule.getUint(&pixelformat);
701     PixelFormat pf = (PixelFormat) pixelformat;
702
703     //LOG_DEBUG("GenericCommunicator::CreateSurface","pixelformat: " << pixelformat);
704     uint id = GraphicalObject::INVALID_ID;
705     /* First of all create the surface */
706     t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
707     /* after that apply the native content */
708     status &= m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));    
709     if (status)
710     {
711         m_ipcModule.createMessage((char*)__FUNCTION__);
712         m_ipcModule.appendUint(id);
713         m_ipcModule.sendMessage();
714     }
715     else
716     {
717         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
718     }
719 }
720
721 void GenericCommunicator::CreateSurfaceFromId()
722 {
723     uint handle = 0;
724     m_ipcModule.getUint(&handle);
725     uint width = 0;
726     m_ipcModule.getUint(&width);
727     uint height = 0;
728     m_ipcModule.getUint(&height);
729     uint pixelformat = 0;
730     m_ipcModule.getUint(&pixelformat);
731     PixelFormat pf = (PixelFormat) pixelformat;
732
733     //LOG_DEBUG("GenericCommunicator::CreateSurface","pixelformat: " << pixelformat);
734     uint id = 0;
735     m_ipcModule.getUint(&id);
736
737     // First of all create the surface
738     t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
739     // after that apply the native content
740     status &= m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));    
741
742     if (status)
743     {
744         m_ipcModule.createMessage((char*)__FUNCTION__);
745         m_ipcModule.appendUint(id);
746         m_ipcModule.sendMessage();
747     }
748     else
749     {
750         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
751     }
752 }
753
754 void GenericCommunicator::InitializeSurface()
755 {
756     uint id = GraphicalObject::INVALID_ID;
757
758     t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
759     if (status)
760     {
761         m_ipcModule.createMessage((char*)__FUNCTION__);
762         m_ipcModule.appendUint(id);
763         m_ipcModule.sendMessage();
764     }
765     else
766     {
767         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
768     }
769 }
770
771 void GenericCommunicator::InitializeSurfaceFromId()
772 {
773     uint id = 0;
774     m_ipcModule.getUint(&id);
775     t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
776     if (status)
777     {
778         m_ipcModule.createMessage((char*)__FUNCTION__);
779         m_ipcModule.appendUint(id);
780         m_ipcModule.sendMessage();
781     }
782     else
783     {
784         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
785     }
786 }
787
788 void GenericCommunicator::SetSurfaceNativeContent()
789 {
790     uint id = 0;
791     m_ipcModule.getUint(&id);
792     uint handle = 0;
793     m_ipcModule.getUint(&handle);
794     uint width = 0;
795     m_ipcModule.getUint(&width);
796     uint height = 0;
797     m_ipcModule.getUint(&height);
798     uint pixelformat = 0;
799     m_ipcModule.getUint(&pixelformat);
800     PixelFormat pf = (PixelFormat) pixelformat;
801
802     t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));
803     if (status)
804     {
805         m_ipcModule.createMessage((char*)__FUNCTION__);
806         m_ipcModule.sendMessage();
807     }
808     else
809     {
810         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
811     }
812 }
813
814 void GenericCommunicator::RemoveSurfaceNativeContent()
815 {
816     uint id = 0;
817     m_ipcModule.getUint(&id);
818
819     t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(id));
820     if (status)
821     {
822         m_ipcModule.createMessage((char*)__FUNCTION__);
823         m_ipcModule.sendMessage();
824     }
825     else
826     {
827         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
828     }
829 }
830
831 void GenericCommunicator::RemoveSurface()
832 {
833     uint param = 0;
834     m_ipcModule.getUint(&param);
835     t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(param));
836     if (status)
837     {
838         m_ipcModule.createMessage((char*)__FUNCTION__);
839         m_ipcModule.sendMessage();
840     }
841     else
842     {
843         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
844     }
845 }
846
847 void GenericCommunicator::CreateLayer()
848 {
849     uint id = GraphicalObject::INVALID_ID;
850     // use resolution of default screen as default width and height of layers
851     uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
852     t_ilm_bool status = m_executor->execute(new LayerCreateCommand(resolution[0], resolution[1], &id));
853     if (status)
854     {
855         m_ipcModule.createMessage((char*)__FUNCTION__);
856         m_ipcModule.appendUint(id);
857         m_ipcModule.sendMessage();
858     }
859     else
860     {
861         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
862     }
863 }
864
865 void GenericCommunicator::CreateLayerFromId()
866 {
867     uint id = GraphicalObject::INVALID_ID;
868
869     m_ipcModule.getUint(&id);
870     // use resolution of default screen as default width and height of layers
871     uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
872     t_ilm_bool status = m_executor->execute(new LayerCreateCommand(resolution[0], resolution[1], &id));
873     if (status)
874     {
875         m_ipcModule.createMessage((char*)__FUNCTION__);
876         m_ipcModule.appendUint(id);
877         m_ipcModule.sendMessage();
878     }
879     else
880     {
881         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
882     }
883 }
884
885
886 void GenericCommunicator::CreateLayerWithDimension()
887 {
888     uint width = 0;
889     m_ipcModule.getUint(&width);
890     uint height = 0;
891     m_ipcModule.getUint(&height);
892
893     uint id = GraphicalObject::INVALID_ID;
894     t_ilm_bool status = m_executor->execute(new LayerCreateCommand(width, height, &id));
895     if (status)
896     {
897         m_ipcModule.createMessage((char*)__FUNCTION__);
898         m_ipcModule.appendUint(id);
899         m_ipcModule.sendMessage();
900     }
901     else
902     {
903         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
904     }
905 }
906
907 void GenericCommunicator::CreateLayerFromIdWithDimension()
908 {
909     uint id = GraphicalObject::INVALID_ID;
910
911     m_ipcModule.getUint(&id);
912     uint width = 0;
913     m_ipcModule.getUint(&width);
914     uint height = 0;
915     m_ipcModule.getUint(&height);
916     t_ilm_bool status = m_executor->execute(new LayerCreateCommand(width, height, &id));
917     if (status)
918     {
919         m_ipcModule.createMessage((char*)__FUNCTION__);
920         m_ipcModule.appendUint(id);
921         m_ipcModule.sendMessage();
922     }
923     else
924     {
925         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
926     }
927 }
928
929 void GenericCommunicator::RemoveLayer()
930 {
931     uint param = 0;
932     m_ipcModule.getUint(&param);
933     t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(param));
934     if (status)
935     {
936         m_ipcModule.createMessage((char*)__FUNCTION__);
937         m_ipcModule.sendMessage();
938     }
939     else
940     {
941         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
942     }
943 }
944
945 void GenericCommunicator::AddSurfaceToSurfaceGroup()
946 {
947     uint surfaceid = 0;
948     m_ipcModule.getUint(&surfaceid);
949     uint surfacegroupid = 0;
950     m_ipcModule.getUint(&surfacegroupid);
951
952     t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(surfacegroupid, surfaceid));
953     if (status)
954     {
955         m_ipcModule.createMessage((char*)__FUNCTION__);
956         m_ipcModule.sendMessage();
957     }
958     else
959     {
960         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
961     }
962 }
963
964 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup()
965 {
966     uint surfaceid = 0;
967     m_ipcModule.getUint(&surfaceid);
968     uint surfacegroupid = 0;
969     m_ipcModule.getUint(&surfacegroupid);
970
971     t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(surfacegroupid, surfaceid));
972     if (status)
973     {
974         m_ipcModule.createMessage((char*)__FUNCTION__);
975         m_ipcModule.sendMessage();
976     }
977     else
978     {
979         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
980     }
981 }
982
983 void GenericCommunicator::AddLayerToLayerGroup()
984 {
985     uint layerid = 0;
986     m_ipcModule.getUint(&layerid);
987     uint layergroupid = 0;
988     m_ipcModule.getUint(&layergroupid);
989
990     t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(layergroupid, layerid));
991     if (status)
992     {
993         m_ipcModule.createMessage((char*)__FUNCTION__);
994         m_ipcModule.sendMessage();
995     }
996     else
997     {
998         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
999     }
1000 }
1001
1002 void GenericCommunicator::RemoveLayerFromLayerGroup()
1003 {
1004     uint layerid = 0;
1005     m_ipcModule.getUint(&layerid);
1006     uint layergroupid = 0;
1007     m_ipcModule.getUint(&layergroupid);
1008
1009     t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(layergroupid, layerid));
1010     if (status)
1011     {
1012         m_ipcModule.createMessage((char*)__FUNCTION__);
1013         m_ipcModule.sendMessage();
1014     }
1015     else
1016     {
1017         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1018     }
1019 }
1020
1021 void GenericCommunicator::AddSurfaceToLayer()
1022 {
1023     uint surfaceid = 0;
1024     m_ipcModule.getUint(&surfaceid);
1025     uint layer = 0;
1026     m_ipcModule.getUint(&layer);
1027
1028     t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(layer, surfaceid));
1029     if (status)
1030     {
1031         m_ipcModule.createMessage((char*)__FUNCTION__);
1032         m_ipcModule.sendMessage();
1033     }
1034     else
1035     {
1036         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1037     }
1038 }
1039
1040 void GenericCommunicator::RemoveSurfaceFromLayer()
1041 {
1042     uint surfaceid = 0;
1043     m_ipcModule.getUint(&surfaceid);
1044     uint layerid = 0;
1045     m_ipcModule.getUint(&layerid);
1046
1047     t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(layerid, surfaceid));
1048     if (status)
1049     {
1050         m_ipcModule.createMessage((char*)__FUNCTION__);
1051         m_ipcModule.sendMessage();
1052     }
1053     else
1054     {
1055         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1056     }
1057 }
1058
1059 void GenericCommunicator::CreateSurfaceGroup()
1060 {
1061     uint newID = GraphicalObject::INVALID_ID;
1062
1063     t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1064     if (status)
1065     {
1066         m_ipcModule.createMessage((char*)__FUNCTION__);
1067         m_ipcModule.appendUint(newID);
1068         m_ipcModule.sendMessage();
1069     }
1070     else
1071     {
1072         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1073     }
1074 }
1075
1076 void GenericCommunicator::CreateSurfaceGroupFromId()
1077 {
1078     uint newID = GraphicalObject::INVALID_ID;
1079
1080     m_ipcModule.getUint(&newID);
1081
1082     t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1083     if (status)
1084     {
1085         m_ipcModule.createMessage((char*)__FUNCTION__);
1086         m_ipcModule.appendUint(newID);
1087         m_ipcModule.sendMessage();
1088     }
1089     else
1090     {
1091         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1092     }
1093 }
1094
1095 void GenericCommunicator::RemoveSurfaceGroup()
1096 {
1097     uint param = 0;
1098     m_ipcModule.getUint(&param);
1099
1100     t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(param));
1101     if (status)
1102     {
1103         m_ipcModule.createMessage((char*)__FUNCTION__);
1104         m_ipcModule.sendMessage();
1105     }
1106     else
1107     {
1108         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1109     }
1110 }
1111
1112 void GenericCommunicator::CreateLayerGroup()
1113 {
1114     uint newID = GraphicalObject::INVALID_ID;
1115
1116     t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1117     if (status)
1118     {
1119         m_ipcModule.createMessage((char*)__FUNCTION__);
1120         m_ipcModule.appendUint(newID);
1121         m_ipcModule.sendMessage();
1122     }
1123     else
1124     {
1125         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1126     }
1127 }
1128
1129 void GenericCommunicator::CreateLayerGroupFromId()
1130 {
1131     uint newID = GraphicalObject::INVALID_ID;
1132
1133     m_ipcModule.getUint(&newID);
1134
1135     t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1136     if (status)
1137     {
1138         m_ipcModule.createMessage((char*)__FUNCTION__);
1139         m_ipcModule.appendUint(newID);
1140         m_ipcModule.sendMessage();
1141     }
1142     else
1143     {
1144         m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1145     }
1146 }
1147
1148 void GenericCommunicator::RemoveLayerGroup()
1149 {
1150     uint param = 0;
1151     m_ipcModule.getUint(&param);
1152
1153     t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(param));
1154     if (status)
1155     {
1156         m_ipcModule.createMessage((char*)__FUNCTION__);
1157         m_ipcModule.sendMessage();
1158     }
1159     else
1160     {
1161         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1162     }
1163 }
1164
1165 void GenericCommunicator::SetSurfaceSourceRegion()
1166 {
1167     uint id = 0;
1168     m_ipcModule.getUint(&id);
1169     uint x = 0;
1170     m_ipcModule.getUint(&x);
1171     uint y = 0;
1172     m_ipcModule.getUint(&y);
1173     uint width = 0;
1174     m_ipcModule.getUint(&width);
1175     uint height = 0;
1176     m_ipcModule.getUint(&height);
1177
1178     t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(id, x, y, width, height));
1179     if (status)
1180     {
1181         m_ipcModule.createMessage((char*)__FUNCTION__);
1182         m_ipcModule.sendMessage();
1183     }
1184     else
1185     {
1186         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1187     }
1188 }
1189
1190 void GenericCommunicator::SetLayerSourceRegion()
1191 {
1192     uint id = 0;
1193     m_ipcModule.getUint(&id);
1194     uint x = 0;
1195     m_ipcModule.getUint(&x);
1196     uint y = 0;
1197     m_ipcModule.getUint(&y);
1198     uint width = 0;
1199     m_ipcModule.getUint(&width);
1200     uint height = 0;
1201     m_ipcModule.getUint(&height);
1202
1203     //LOG_DEBUG("DBUSC","new SetSourceRectangleCommand with arguments: " <<id <<" " << x <<" "<< y <<" "<< width <<" "<< height );
1204     t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(id, x, y, width, height));
1205     if (status)
1206     {
1207         m_ipcModule.createMessage((char*)__FUNCTION__);
1208         m_ipcModule.sendMessage();
1209     }
1210     else
1211     {
1212         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1213     }
1214 }
1215
1216 void GenericCommunicator::SetSurfaceDestinationRegion()
1217 {
1218     uint id = 0;
1219     m_ipcModule.getUint(&id);
1220     uint x = 0;
1221     m_ipcModule.getUint(&x);
1222     uint y = 0;
1223     m_ipcModule.getUint(&y);
1224     uint width = 0;
1225     m_ipcModule.getUint(&width);
1226     uint height = 0;
1227     m_ipcModule.getUint(&height);
1228
1229     t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(id, x, y, width, height));
1230     if (status)
1231     {
1232         m_ipcModule.createMessage((char*)__FUNCTION__);
1233         m_ipcModule.sendMessage();
1234     }
1235     else
1236     {
1237         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1238     }
1239 }
1240
1241 void GenericCommunicator::SetSurfacePosition()
1242 {
1243     uint id = 0;
1244     m_ipcModule.getUint(&id);
1245     uint x = 0;
1246     m_ipcModule.getUint(&x);
1247     uint y = 0;
1248     m_ipcModule.getUint(&y);
1249
1250     t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(id, x, y));
1251     if (status)
1252     {
1253         m_ipcModule.createMessage((char*)__FUNCTION__);
1254         m_ipcModule.sendMessage();
1255     }
1256     else
1257     {
1258         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1259     }
1260 }
1261
1262 void GenericCommunicator::GetSurfacePosition()
1263 {
1264     uint id = 0;
1265     m_ipcModule.getUint(&id);
1266     uint x = 0;
1267     uint y = 0;
1268
1269     t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(id, &x, &y));
1270     if (status)
1271     {
1272         m_ipcModule.createMessage((char*)__FUNCTION__);
1273         m_ipcModule.appendUint(x);
1274         m_ipcModule.appendUint(y);
1275         m_ipcModule.sendMessage();
1276     }
1277     else
1278     {
1279         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1280     }
1281 }
1282
1283 void GenericCommunicator::SetSurfaceDimension()
1284 {
1285     uint id = 0;
1286     m_ipcModule.getUint(&id);
1287     uint width = 0;
1288     m_ipcModule.getUint(&width);
1289     uint height = 0;
1290     m_ipcModule.getUint(&height);
1291
1292     t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(id, width, height));
1293     if (status)
1294     {
1295         m_ipcModule.createMessage((char*)__FUNCTION__);
1296         m_ipcModule.sendMessage();
1297     }
1298     else
1299     {
1300         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1301     }
1302 }
1303
1304 void GenericCommunicator::SetLayerDestinationRegion()
1305 {
1306     uint id = 0;
1307     m_ipcModule.getUint(&id);
1308     uint x = 0;
1309     m_ipcModule.getUint(&x);
1310     uint y = 0;
1311     m_ipcModule.getUint(&y);
1312     uint width = 0;
1313     m_ipcModule.getUint(&width);
1314     uint height = 0;
1315     m_ipcModule.getUint(&height);
1316
1317     t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(id, x, y, width, height));
1318     if (status)
1319     {
1320         m_ipcModule.createMessage((char*)__FUNCTION__);
1321         m_ipcModule.sendMessage();
1322     }
1323     else
1324     {
1325         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1326     }
1327 }
1328
1329 void GenericCommunicator::SetLayerPosition()
1330 {
1331     uint id = 0;
1332     m_ipcModule.getUint(&id);
1333     uint x = 0;
1334     m_ipcModule.getUint(&x);
1335     uint y = 0;
1336     m_ipcModule.getUint(&y);
1337
1338     t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(id, x, y));
1339     if (status)
1340     {
1341         m_ipcModule.createMessage((char*)__FUNCTION__);
1342         m_ipcModule.sendMessage();
1343     }
1344     else
1345     {
1346         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1347     }
1348 }
1349
1350 void GenericCommunicator::GetLayerPosition()
1351 {
1352     uint id = 0;
1353     m_ipcModule.getUint(&id);
1354     uint x = 0;
1355     uint y = 0;
1356
1357     t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(id, &x, &y));
1358     if (status)
1359     {
1360         m_ipcModule.createMessage((char*)__FUNCTION__);
1361         m_ipcModule.appendUint(x);
1362         m_ipcModule.appendUint(y);
1363         m_ipcModule.sendMessage();
1364     }
1365     else
1366     {
1367         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1368     }
1369 }
1370
1371 void GenericCommunicator::SetLayerDimension()
1372 {
1373     uint id = 0;
1374     m_ipcModule.getUint(&id);
1375     uint width = 0;
1376     m_ipcModule.getUint(&width);
1377     uint height = 0;
1378     m_ipcModule.getUint(&height);
1379
1380     t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(id, width, height));
1381     if (status)
1382     {
1383         m_ipcModule.createMessage((char*)__FUNCTION__);
1384         m_ipcModule.sendMessage();
1385     }
1386     else
1387     {
1388         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1389     }
1390 }
1391
1392 void GenericCommunicator::GetLayerDimension()
1393 {
1394     uint id = 0;
1395     m_ipcModule.getUint(&id);
1396     uint width = 0;
1397     uint height = 0;
1398
1399     t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(id, &width, &height));
1400     if (status)
1401     {
1402         m_ipcModule.createMessage((char*)__FUNCTION__);
1403         m_ipcModule.appendUint(width);
1404         m_ipcModule.appendUint(height);
1405         m_ipcModule.sendMessage();
1406     }
1407     else
1408     {
1409         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1410     }
1411 }
1412
1413 void GenericCommunicator::GetSurfaceDimension()
1414 {
1415     uint id = 0;
1416     m_ipcModule.getUint(&id);
1417     uint width = 0;
1418     uint height = 0;
1419
1420     t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(id, &width, &height));
1421     if (status)
1422     {
1423         m_ipcModule.createMessage((char*)__FUNCTION__);
1424         m_ipcModule.appendUint(width);
1425         m_ipcModule.appendUint(height);
1426         m_ipcModule.sendMessage();
1427     }
1428     else
1429     {
1430         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1431     }
1432 }
1433
1434 void GenericCommunicator::SetSurfaceOpacity()
1435 {
1436     uint id = 0;
1437     m_ipcModule.getUint(&id);
1438     double param = 0.0;
1439     m_ipcModule.getDouble(&param);
1440
1441     t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(id, param));
1442     if (status)
1443     {
1444         m_ipcModule.createMessage((char*)__FUNCTION__);
1445         m_ipcModule.sendMessage();
1446     }
1447     else
1448     {
1449         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1450     }
1451 }
1452
1453 void GenericCommunicator::SetLayerOpacity()
1454 {
1455     uint id = 0;
1456     m_ipcModule.getUint(&id);
1457     double param = 0.0;
1458     m_ipcModule.getDouble(&param);
1459
1460     t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(id, param));
1461     if (status)
1462     {
1463         m_ipcModule.createMessage((char*)__FUNCTION__);
1464         m_ipcModule.sendMessage();
1465     }
1466     else
1467     {
1468         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1469     }
1470 }
1471
1472 void GenericCommunicator::SetSurfacegroupOpacity()
1473 {
1474     uint id = 0;
1475     m_ipcModule.getUint(&id);
1476     double param = 0.0;
1477     m_ipcModule.getDouble(&param);
1478
1479     t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(id, param));
1480     if (status)
1481     {
1482         m_ipcModule.createMessage((char*)__FUNCTION__);
1483         m_ipcModule.sendMessage();
1484     }
1485     else
1486     {
1487         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1488     }
1489 }
1490
1491 void GenericCommunicator::SetLayergroupOpacity()
1492 {
1493     uint id = 0;
1494     m_ipcModule.getUint(&id);
1495     double param = 0.0;
1496     m_ipcModule.getDouble(&param);
1497
1498     t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(id, param));
1499     if (status)
1500     {
1501         m_ipcModule.createMessage((char*)__FUNCTION__);
1502         m_ipcModule.sendMessage();
1503     }
1504     else
1505     {
1506         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1507     }
1508 }
1509
1510 void GenericCommunicator::GetSurfaceOpacity()
1511 {
1512     uint id = 0;
1513     m_ipcModule.getUint(&id);
1514     double param = 0.0;
1515
1516     t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(id, &param));
1517     if (status)
1518     {
1519         m_ipcModule.createMessage((char*)__FUNCTION__);
1520         m_ipcModule.appendDouble(param);
1521         m_ipcModule.sendMessage();
1522     }
1523     else
1524     {
1525         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1526     }
1527 }
1528
1529 void GenericCommunicator::GetLayerOpacity()
1530 {
1531     uint id = 0;
1532     m_ipcModule.getUint(&id);
1533     double param = 0.0;
1534
1535     t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(id, &param));
1536     if (status)
1537     {
1538         m_ipcModule.createMessage((char*)__FUNCTION__);
1539         m_ipcModule.appendDouble(param);
1540         m_ipcModule.sendMessage();
1541     }
1542     else
1543     {
1544         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1545     }
1546 }
1547
1548 void GenericCommunicator::SetSurfaceOrientation()
1549 {
1550     uint id = 0;
1551     m_ipcModule.getUint(&id);
1552     uint param = 0;
1553     m_ipcModule.getUint(&param);
1554     OrientationType o = (OrientationType) param;
1555
1556     t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(id, o));
1557     if (status)
1558     {
1559         m_ipcModule.createMessage((char*)__FUNCTION__);
1560         m_ipcModule.sendMessage();
1561     }
1562     else
1563     {
1564         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1565     }
1566 }
1567
1568 void GenericCommunicator::GetSurfaceOrientation()
1569 {
1570     uint id = 0;
1571     m_ipcModule.getUint(&id);
1572     OrientationType o;
1573
1574     t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(id, &o));
1575     if (status)
1576     {
1577         m_ipcModule.createMessage((char*)__FUNCTION__);
1578         m_ipcModule.appendUint(o);
1579         m_ipcModule.sendMessage();
1580     }
1581     else
1582     {
1583         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1584     }
1585 }
1586
1587 void GenericCommunicator::SetLayerOrientation()
1588 {
1589     uint id = 0;
1590     m_ipcModule.getUint(&id);
1591     uint param = 0;
1592     m_ipcModule.getUint(&param);
1593     OrientationType o = (OrientationType) param;
1594
1595     t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(id, o));
1596     if (status)
1597     {
1598         m_ipcModule.createMessage((char*)__FUNCTION__);
1599         m_ipcModule.sendMessage();
1600     }
1601     else
1602     {
1603         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1604     }
1605 }
1606
1607 void GenericCommunicator::GetLayerOrientation()
1608 {
1609     uint id = 0;
1610     m_ipcModule.getUint(&id);
1611     OrientationType o;
1612
1613     t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(id, &o));
1614     if (status)
1615     {
1616         m_ipcModule.createMessage((char*)__FUNCTION__);
1617         m_ipcModule.appendUint(o);
1618         m_ipcModule.sendMessage();
1619     }
1620     else
1621     {
1622         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1623     }
1624 }
1625
1626 void GenericCommunicator::GetSurfacePixelformat()
1627 {
1628     uint id = 0;
1629     m_ipcModule.getUint(&id);
1630     PixelFormat param;
1631
1632     t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(id, &param));
1633     if (status)
1634     {
1635         m_ipcModule.createMessage((char*)__FUNCTION__);
1636         m_ipcModule.appendUint(param);
1637         m_ipcModule.sendMessage();
1638     }
1639     else
1640     {
1641         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1642     }
1643 }
1644
1645 void GenericCommunicator::SetSurfaceVisibility()
1646 {
1647     uint surfaceid = 0;
1648     m_ipcModule.getUint(&surfaceid);
1649     t_ilm_bool newVis = ILM_FALSE;
1650     m_ipcModule.getBool(&newVis);
1651
1652     t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(surfaceid, newVis));
1653     if (status)
1654     {
1655         m_ipcModule.createMessage((char*)__FUNCTION__);
1656         m_ipcModule.sendMessage();
1657     }
1658     else
1659     {
1660         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1661     }
1662 }
1663
1664 void GenericCommunicator::SetLayerVisibility()
1665 {
1666     uint layerid = 0;
1667     m_ipcModule.getUint(&layerid);
1668     t_ilm_bool myparam = ILM_FALSE;
1669     m_ipcModule.getBool(&myparam);
1670
1671     t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(layerid, myparam));
1672     if (status)
1673     {
1674         m_ipcModule.createMessage((char*)__FUNCTION__);
1675         m_ipcModule.sendMessage();
1676     }
1677     else
1678     {
1679         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1680     }
1681 }
1682
1683 void GenericCommunicator::GetSurfaceVisibility()
1684 {
1685     uint id = 0;
1686     m_ipcModule.getUint(&id);
1687     bool param;
1688
1689     t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(id, &param));
1690     if (status)
1691     {
1692         m_ipcModule.createMessage((char*)__FUNCTION__);
1693         //LOG_DEBUG("GenericCommunicator", "returning surfacevisibility: " << param);
1694         m_ipcModule.appendBool(param);
1695         m_ipcModule.sendMessage();
1696     }
1697     else
1698     {
1699         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1700     }
1701 }
1702
1703 void GenericCommunicator::GetLayerVisibility()
1704 {
1705     uint id = 0;
1706     m_ipcModule.getUint(&id);
1707     bool param;
1708
1709     t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(id, &param));
1710     if (status)
1711     {
1712         m_ipcModule.createMessage((char*)__FUNCTION__);
1713         m_ipcModule.appendBool(param);
1714         //LOG_DEBUG("GenericCommunicator", "returning layervisibility: " << param);
1715         m_ipcModule.sendMessage();
1716     }
1717     else
1718     {
1719         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1720     }
1721 }
1722
1723 void GenericCommunicator::SetSurfacegroupVisibility()
1724 {
1725     uint groupid = 0;
1726     m_ipcModule.getUint(&groupid);
1727     t_ilm_bool myparam = ILM_FALSE;
1728     m_ipcModule.getBool(&myparam);
1729
1730     t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(groupid, myparam));
1731     if (status)
1732     {
1733         m_ipcModule.createMessage((char*)__FUNCTION__);
1734         m_ipcModule.sendMessage();
1735     }
1736     else
1737     {
1738         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1739     }
1740 }
1741
1742 void GenericCommunicator::SetLayergroupVisibility()
1743 {
1744     uint groupid = 0;
1745     m_ipcModule.getUint(&groupid);
1746     t_ilm_bool myparam = ILM_FALSE;
1747     m_ipcModule.getBool(&myparam);
1748
1749     t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(groupid, myparam));
1750     if (status)
1751     {
1752         m_ipcModule.createMessage((char*)__FUNCTION__);
1753         m_ipcModule.sendMessage();
1754     }
1755     else
1756     {
1757         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1758     }
1759 }
1760
1761
1762 void GenericCommunicator::SetRenderOrderOfLayers()
1763 {
1764     uint* array = NULL;
1765     int length = 0;
1766
1767     m_ipcModule.getUintArray(&array, &length);
1768
1769     //LOG_DEBUG("GenericCommunicator","Renderorder: Got " << length << " ids.");
1770
1771     t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(array, length));
1772     if (status)
1773     {
1774         m_ipcModule.createMessage((char*)__FUNCTION__);
1775         m_ipcModule.sendMessage();
1776     }
1777     else
1778     {
1779         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1780     }
1781 }
1782
1783 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer()
1784 {
1785     uint* array = NULL;
1786     int length = 0;
1787
1788     uint layerid = 0;
1789     m_ipcModule.getUint(&layerid);
1790
1791     m_ipcModule.getUintArray(&array, &length);
1792
1793     t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(layerid, array, length));
1794     if (status)
1795     {
1796         m_ipcModule.createMessage((char*)__FUNCTION__);
1797         m_ipcModule.sendMessage();
1798     }
1799     else
1800     {
1801         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1802     }
1803 }
1804
1805 void GenericCommunicator::GetLayerType()
1806 {
1807     uint id = 0;
1808     m_ipcModule.getUint(&id);
1809     Layer* l = m_executor->getScene()->getLayer(id);
1810     if (l != NULL)
1811     {
1812         m_ipcModule.createMessage((char*)__FUNCTION__);
1813         m_ipcModule.appendUint(l->getLayerType());
1814         m_ipcModule.sendMessage();
1815     }
1816     else
1817     {
1818         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1819     }
1820 }
1821
1822 void GenericCommunicator::GetLayertypeCapabilities()
1823 {
1824     uint id = 0;
1825     m_ipcModule.getUint(&id);
1826     LayerType type = (LayerType) id;
1827     uint capabilities = m_executor->getLayerTypeCapabilities(type);
1828     //LOG_DEBUG("GenericCommunicator", "GetLayertypeCapabilities: returning capabilities:" << capabilities);
1829     m_ipcModule.createMessage((char*)__FUNCTION__);
1830     m_ipcModule.appendUint(capabilities);
1831     m_ipcModule.sendMessage();
1832 }
1833
1834 void GenericCommunicator::GetLayerCapabilities()
1835 {
1836     uint id = 0;
1837     m_ipcModule.getUint(&id);
1838     Layer* l = m_executor->getScene()->getLayer(id);
1839     if (l != NULL)
1840     {
1841         m_ipcModule.createMessage((char*)__FUNCTION__);
1842         m_ipcModule.appendUint(l->getCapabilities());
1843         m_ipcModule.sendMessage();
1844     }
1845     else
1846     {
1847         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1848     }
1849 }
1850
1851 void GenericCommunicator::FadeIn()
1852 {
1853     m_ipcModule.createMessage((char*)__FUNCTION__);
1854     m_ipcModule.sendMessage();
1855 }
1856
1857 void GenericCommunicator::SynchronizedFade()
1858 {
1859     m_ipcModule.createMessage((char*)__FUNCTION__);
1860     m_ipcModule.sendMessage();
1861 }
1862
1863 void GenericCommunicator::FadeOut()
1864 {
1865     m_ipcModule.createMessage((char*)__FUNCTION__);
1866     m_ipcModule.sendMessage();
1867 }
1868
1869 void GenericCommunicator::Exit()
1870 {
1871     t_ilm_bool status = m_executor->execute(new ExitCommand());
1872     if (status)
1873     {
1874         m_ipcModule.createMessage((char*)__FUNCTION__);
1875         m_ipcModule.sendMessage();
1876     }
1877     else
1878     {
1879         m_ipcModule.sendError(INVALID_ARGUMENT);
1880     }
1881 }
1882
1883 void GenericCommunicator::CommitChanges()
1884 {
1885     t_ilm_bool status = m_executor->execute(new CommitCommand());
1886     if (status)
1887     {
1888         m_ipcModule.createMessage((char*)__FUNCTION__);
1889         m_ipcModule.sendMessage();
1890     }
1891     else
1892     {
1893         m_ipcModule.sendError(INVALID_ARGUMENT);
1894     }
1895 }
1896
1897 void GenericCommunicator::CreateShader()
1898 {
1899     char vertname[1024];
1900     char fragname[1024];
1901     m_ipcModule.getString(vertname);
1902     m_ipcModule.getString(fragname);
1903     uint id = 0;
1904
1905     t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(vertname, fragname, &id));
1906     if (status)
1907     {
1908         m_ipcModule.createMessage((char*)__FUNCTION__);
1909         m_ipcModule.appendUint(id);
1910         m_ipcModule.sendMessage();
1911     }
1912     else
1913     {
1914         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1915     }
1916 }
1917
1918 void GenericCommunicator::DestroyShader()
1919 {
1920     uint shaderid = 0;
1921     m_ipcModule.getUint(&shaderid);
1922
1923     t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(shaderid));
1924     if (status)
1925     {
1926         m_ipcModule.createMessage((char*)__FUNCTION__);
1927         m_ipcModule.sendMessage();
1928     }
1929     else
1930     {
1931         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1932     }
1933 }
1934
1935 void GenericCommunicator::SetShader()
1936 {
1937     uint surfaceId = 0;
1938     uint shaderid = 0;
1939     m_ipcModule.getUint(&surfaceId);
1940     m_ipcModule.getUint(&shaderid);
1941
1942     t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(surfaceId, shaderid));
1943     if (status)
1944     {
1945         m_ipcModule.createMessage((char*)__FUNCTION__);
1946         m_ipcModule.sendMessage();
1947     }
1948     else
1949     {
1950         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1951     }
1952 }
1953
1954 void GenericCommunicator::SetUniforms()
1955 {
1956     uint id = 0;
1957     m_ipcModule.getUint(&id);
1958
1959     std::vector<string> uniforms;
1960
1961     // TODO
1962     //m_ipcModule.getStringArray(&uniforms);
1963
1964     t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(id, uniforms));
1965     if (status)
1966     {
1967         m_ipcModule.createMessage((char*)__FUNCTION__);
1968         m_ipcModule.sendMessage();
1969     }
1970     else
1971     {
1972         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1973     }
1974 }
1975
1976 void GenericCommunicator::SetKeyboardFocusOn()
1977 {
1978     uint surfaceId = 0;
1979
1980     m_ipcModule.getUint(&surfaceId);
1981
1982     t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(surfaceId));
1983     if (status)
1984     {
1985         m_ipcModule.createMessage((char*)__FUNCTION__);
1986         m_ipcModule.sendMessage();
1987     }
1988     else
1989     {
1990         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1991     }
1992 }
1993
1994
1995 void GenericCommunicator::GetKeyboardFocusSurfaceId()
1996 {
1997     uint surfaceId;
1998     
1999     t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(&surfaceId));
2000     if (status)
2001     {
2002         m_ipcModule.createMessage((char*)__FUNCTION__);
2003         m_ipcModule.appendUint(surfaceId);
2004         m_ipcModule.sendMessage();
2005     }
2006     else
2007     {
2008         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2009     }
2010     
2011     
2012 }
2013
2014
2015 void GenericCommunicator::UpdateInputEventAcceptanceOn()
2016 {
2017     uint surfaceId = 0;
2018         uint udevices = 0;
2019         InputDevice devices;
2020         t_ilm_bool accept;
2021
2022     m_ipcModule.getUint(&surfaceId);
2023     m_ipcModule.getUint(&udevices);
2024     m_ipcModule.getBool(&accept);
2025
2026     devices = (InputDevice) udevices;
2027     t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(surfaceId, devices, accept));
2028     if (status)
2029     {
2030         m_ipcModule.createMessage((char*)__FUNCTION__);
2031         m_ipcModule.sendMessage();
2032     }
2033     else
2034     {
2035         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2036     }
2037 }
2038
2039 void GenericCommunicator::SetSurfaceChromaKey()
2040 {
2041     uint* array = NULL;
2042     int length = 0;
2043     uint surfaceid = 0;
2044
2045     m_ipcModule.getUint(&surfaceid);
2046     m_ipcModule.getUintArray(&array, &length);
2047
2048     t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(surfaceid, array, length));
2049     if (status)
2050     {
2051         m_ipcModule.createMessage((char*)__FUNCTION__);
2052         m_ipcModule.sendMessage();
2053     }
2054     else
2055     {
2056         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2057     }
2058 }
2059
2060 void GenericCommunicator::SetLayerChromaKey()
2061 {
2062     uint* array = NULL;
2063     int length = 0;
2064     uint layerid = 0;
2065
2066     m_ipcModule.getUint(&layerid);
2067     m_ipcModule.getUintArray(&array, &length);
2068
2069     t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(layerid, array, length));
2070     if (status)
2071     {
2072         m_ipcModule.createMessage((char*)__FUNCTION__);
2073         m_ipcModule.sendMessage();
2074     }
2075     else
2076     {
2077         m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2078     }
2079 }
2080
2081 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
2082 {
2083     return new GenericCommunicator(executor);
2084 }
2085
2086 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)
2087 {
2088     delete p;
2089 }
2090