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