1 /***************************************************************************
2 * Copyright 2012 BMW Car IT GmbH
3 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ****************************************************************************/
20 #include "GenericCommunicator.h"
21 #include "ilm_types.h"
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"
95 #define DEFAULT_SCREEN 0
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";
102 GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
103 : ICommunicator(executor)
104 , m_running(ILM_FALSE)
107 MethodTable manager_methods[] =
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 },
199 int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
201 for (int index = 0; index < entryCount; ++index)
203 MethodTable* method = &manager_methods[index];
204 if (method->function)
206 m_callBackTable[method->name] = *method;
207 LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
212 bool GenericCommunicator::start()
214 LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
216 if (!loadIpcModule(&m_ipcModule))
218 LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
221 LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
223 if (!m_ipcModule.init(ILM_FALSE))
225 LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
228 LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
230 m_running = ILM_TRUE;
235 void GenericCommunicator::stop()
237 LOG_INFO("GenericCommunicator","stopping");
241 m_ipcModule.destroy();
245 void GenericCommunicator::process(int timeout_ms)
247 enum IpcMessageType messageType = m_ipcModule.receiveMessage(timeout_ms);
249 t_ilm_const_string name = m_ipcModule.getMessageName();
250 t_ilm_const_string sender = m_ipcModule.getSenderName();
254 case IpcMessageTypeCommand:
255 if (m_callBackTable.end() != m_callBackTable.find(name))
257 LOG_DEBUG("GenericCommunicator", "Received command " << name << " from " << sender);
258 CallBackMethod method = m_callBackTable[name].function;
263 LOG_WARNING("GenericCommunicator", "Received unknown command " << name << " from " << sender);
267 case IpcMessageTypeDisconnect:
268 LOG_DEBUG("GenericCommunicator", "Received message " << name
269 << " (type=disconnect" << ", sender=" << sender << ")");
273 case IpcMessageTypeNotification:
274 LOG_DEBUG("GenericCommunicator", "Received message " << name
275 << " (type=notification" << ", sender=" << sender << ")");
278 case IpcMessageTypeError:
279 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from " << sender);
282 case IpcMessageTypeNone:
286 LOG_DEBUG("GenericCommunicator", "Received unknown data from " << sender);
289 m_ipcModule.destroyMessage();
292 void GenericCommunicator::setdebug(bool onoff)
294 (void)onoff; // TODO: remove, only prevents warning
297 void GenericCommunicator::ServiceConnect()
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();
308 void GenericCommunicator::ServiceDisconnect()
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();
315 ApplicationReferenceMapIterator iter = refmap->find(ownerHash);
316 ApplicationReferenceMapIterator iterEnd = refmap->end();
318 for (; iter != iterEnd; ++iter)
320 IApplicationReference* registeredApp = (*iter).second;
321 m_executor->removeApplicationReference(registeredApp);
324 m_ipcModule.createMessage((char*)__FUNCTION__);
325 m_ipcModule.sendMessage();
328 void GenericCommunicator::Debug()
330 t_ilm_bool param = ILM_FALSE;
331 m_ipcModule.getBool(¶m);
333 t_ilm_bool status = m_executor->execute(new DebugCommand(param));
336 m_ipcModule.createMessage((char*)__FUNCTION__);
337 m_ipcModule.sendMessage();
341 m_ipcModule.sendError(INVALID_ARGUMENT);
345 void GenericCommunicator::GetScreenResolution()
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();
356 void GenericCommunicator::GetNumberOfHardwareLayers()
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();
366 void GenericCommunicator::GetScreenIDs()
369 uint* IDs = m_executor->getScreenIDs(&length);
370 m_ipcModule.createMessage((char*)__FUNCTION__);
371 m_ipcModule.appendUintArray(IDs, length);
372 m_ipcModule.sendMessage();
375 void GenericCommunicator::ScreenShot()
378 m_ipcModule.getUint(&screenid);
380 m_ipcModule.getString(filename);
382 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(filename, screenid));
385 m_ipcModule.createMessage((char*)__FUNCTION__);
386 m_ipcModule.sendMessage();
390 m_ipcModule.sendError(INVALID_ARGUMENT);
394 void GenericCommunicator::ScreenShotOfLayer()
397 m_ipcModule.getString(filename);
399 m_ipcModule.getUint(&layerid);
401 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(filename, layerid));
404 m_ipcModule.createMessage((char*)__FUNCTION__);
405 m_ipcModule.sendMessage();
409 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
413 void GenericCommunicator::ScreenShotOfSurface()
416 m_ipcModule.getString(filename);
418 m_ipcModule.getUint(&id);
419 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(filename, id));
422 m_ipcModule.createMessage((char*)__FUNCTION__);
423 m_ipcModule.sendMessage();
427 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
431 void GenericCommunicator::ListAllLayerIDS()
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();
443 void GenericCommunicator::ListAllLayerIDsOnScreen()
446 m_ipcModule.getUint(&screenID);
450 m_executor->getScene()->lockScene();
451 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
454 m_ipcModule.createMessage((char*)__FUNCTION__);
455 m_ipcModule.appendUintArray(array, length);
456 m_ipcModule.sendMessage();
460 m_ipcModule.sendError(INVALID_ARGUMENT);
462 m_executor->getScene()->unlockScene();
465 void GenericCommunicator::ListAllSurfaceIDS()
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();
477 void GenericCommunicator::ListAllLayerGroupIDS()
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();
489 void GenericCommunicator::ListAllSurfaceGroupIDS()
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();
501 void GenericCommunicator::ListSurfacesOfSurfacegroup()
504 m_ipcModule.getUint(&id);
505 m_executor->getScene()->lockScene();
506 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
509 std::list<Surface*> surfaces = sg->getList();
510 uint length = surfaces.size();
511 uint* array = new uint[length];
513 m_ipcModule.createMessage((char*)__FUNCTION__);
515 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
518 array[arrayPos] = s->getID();
522 m_ipcModule.appendUintArray(array, length);
524 m_ipcModule.sendMessage();
525 m_executor->getScene()->unlockScene();
529 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
533 void GenericCommunicator::ListLayersOfLayergroup()
536 m_ipcModule.getUint(&id);
537 m_executor->getScene()->lockScene();
538 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
541 std::list<Layer*> layers = sg->getList();
543 uint length = layers.size();
544 uint* array = new uint[length];
547 m_ipcModule.createMessage((char*)__FUNCTION__);
548 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
551 array[arrayPos] = l->getID();
555 m_ipcModule.appendUintArray(array, length);
557 m_ipcModule.sendMessage();
558 m_executor->getScene()->unlockScene();
562 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
566 void GenericCommunicator::ListSurfaceofLayer()
569 m_ipcModule.getUint(&id);
570 m_executor->getScene()->lockScene();
571 Layer* layer = m_executor->getScene()->getLayer(id);
574 std::list<Surface*> surfaces = layer->getAllSurfaces();
576 uint length = surfaces.size();
577 uint* array = new uint[length];
580 m_ipcModule.createMessage((char*)__FUNCTION__);
582 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
585 array[arrayPos] = s->getID();
589 m_ipcModule.appendUintArray(array, length);
591 m_ipcModule.sendMessage();
595 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
597 m_executor->getScene()->unlockScene();
600 void GenericCommunicator::GetPropertiesOfSurface()
603 m_ipcModule.getUint(&id);
605 Surface* surface = m_executor->getScene()->getSurface(id);
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);
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();
644 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
648 void GenericCommunicator::GetPropertiesOfLayer()
651 m_ipcModule.getUint(&id);
653 Layer* layer = m_executor->getScene()->getLayer(id);
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);
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();
687 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
691 void GenericCommunicator::CreateSurface()
694 m_ipcModule.getUint(&handle);
696 m_ipcModule.getUint(&width);
698 m_ipcModule.getUint(&height);
699 uint pixelformat = 0;
700 m_ipcModule.getUint(&pixelformat);
701 PixelFormat pf = (PixelFormat) pixelformat;
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));
711 m_ipcModule.createMessage((char*)__FUNCTION__);
712 m_ipcModule.appendUint(id);
713 m_ipcModule.sendMessage();
717 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
721 void GenericCommunicator::CreateSurfaceFromId()
724 m_ipcModule.getUint(&handle);
726 m_ipcModule.getUint(&width);
728 m_ipcModule.getUint(&height);
729 uint pixelformat = 0;
730 m_ipcModule.getUint(&pixelformat);
731 PixelFormat pf = (PixelFormat) pixelformat;
733 //LOG_DEBUG("GenericCommunicator::CreateSurface","pixelformat: " << pixelformat);
735 m_ipcModule.getUint(&id);
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));
744 m_ipcModule.createMessage((char*)__FUNCTION__);
745 m_ipcModule.appendUint(id);
746 m_ipcModule.sendMessage();
750 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
754 void GenericCommunicator::InitializeSurface()
756 uint id = GraphicalObject::INVALID_ID;
758 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
761 m_ipcModule.createMessage((char*)__FUNCTION__);
762 m_ipcModule.appendUint(id);
763 m_ipcModule.sendMessage();
767 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
771 void GenericCommunicator::InitializeSurfaceFromId()
774 m_ipcModule.getUint(&id);
775 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
778 m_ipcModule.createMessage((char*)__FUNCTION__);
779 m_ipcModule.appendUint(id);
780 m_ipcModule.sendMessage();
784 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
788 void GenericCommunicator::SetSurfaceNativeContent()
791 m_ipcModule.getUint(&id);
793 m_ipcModule.getUint(&handle);
795 m_ipcModule.getUint(&width);
797 m_ipcModule.getUint(&height);
798 uint pixelformat = 0;
799 m_ipcModule.getUint(&pixelformat);
800 PixelFormat pf = (PixelFormat) pixelformat;
802 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));
805 m_ipcModule.createMessage((char*)__FUNCTION__);
806 m_ipcModule.sendMessage();
810 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
814 void GenericCommunicator::RemoveSurfaceNativeContent()
817 m_ipcModule.getUint(&id);
819 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(id));
822 m_ipcModule.createMessage((char*)__FUNCTION__);
823 m_ipcModule.sendMessage();
827 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
831 void GenericCommunicator::RemoveSurface()
834 m_ipcModule.getUint(¶m);
835 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(param));
838 m_ipcModule.createMessage((char*)__FUNCTION__);
839 m_ipcModule.sendMessage();
843 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
847 void GenericCommunicator::CreateLayer()
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));
855 m_ipcModule.createMessage((char*)__FUNCTION__);
856 m_ipcModule.appendUint(id);
857 m_ipcModule.sendMessage();
861 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
865 void GenericCommunicator::CreateLayerFromId()
867 uint id = GraphicalObject::INVALID_ID;
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));
875 m_ipcModule.createMessage((char*)__FUNCTION__);
876 m_ipcModule.appendUint(id);
877 m_ipcModule.sendMessage();
881 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
886 void GenericCommunicator::CreateLayerWithDimension()
889 m_ipcModule.getUint(&width);
891 m_ipcModule.getUint(&height);
893 uint id = GraphicalObject::INVALID_ID;
894 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(width, height, &id));
897 m_ipcModule.createMessage((char*)__FUNCTION__);
898 m_ipcModule.appendUint(id);
899 m_ipcModule.sendMessage();
903 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
907 void GenericCommunicator::CreateLayerFromIdWithDimension()
909 uint id = GraphicalObject::INVALID_ID;
911 m_ipcModule.getUint(&id);
913 m_ipcModule.getUint(&width);
915 m_ipcModule.getUint(&height);
916 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(width, height, &id));
919 m_ipcModule.createMessage((char*)__FUNCTION__);
920 m_ipcModule.appendUint(id);
921 m_ipcModule.sendMessage();
925 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
929 void GenericCommunicator::RemoveLayer()
932 m_ipcModule.getUint(¶m);
933 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(param));
936 m_ipcModule.createMessage((char*)__FUNCTION__);
937 m_ipcModule.sendMessage();
941 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
945 void GenericCommunicator::AddSurfaceToSurfaceGroup()
948 m_ipcModule.getUint(&surfaceid);
949 uint surfacegroupid = 0;
950 m_ipcModule.getUint(&surfacegroupid);
952 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(surfacegroupid, surfaceid));
955 m_ipcModule.createMessage((char*)__FUNCTION__);
956 m_ipcModule.sendMessage();
960 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
964 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup()
967 m_ipcModule.getUint(&surfaceid);
968 uint surfacegroupid = 0;
969 m_ipcModule.getUint(&surfacegroupid);
971 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(surfacegroupid, surfaceid));
974 m_ipcModule.createMessage((char*)__FUNCTION__);
975 m_ipcModule.sendMessage();
979 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
983 void GenericCommunicator::AddLayerToLayerGroup()
986 m_ipcModule.getUint(&layerid);
987 uint layergroupid = 0;
988 m_ipcModule.getUint(&layergroupid);
990 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(layergroupid, layerid));
993 m_ipcModule.createMessage((char*)__FUNCTION__);
994 m_ipcModule.sendMessage();
998 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1002 void GenericCommunicator::RemoveLayerFromLayerGroup()
1005 m_ipcModule.getUint(&layerid);
1006 uint layergroupid = 0;
1007 m_ipcModule.getUint(&layergroupid);
1009 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(layergroupid, layerid));
1012 m_ipcModule.createMessage((char*)__FUNCTION__);
1013 m_ipcModule.sendMessage();
1017 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1021 void GenericCommunicator::AddSurfaceToLayer()
1024 m_ipcModule.getUint(&surfaceid);
1026 m_ipcModule.getUint(&layer);
1028 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(layer, surfaceid));
1031 m_ipcModule.createMessage((char*)__FUNCTION__);
1032 m_ipcModule.sendMessage();
1036 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1040 void GenericCommunicator::RemoveSurfaceFromLayer()
1043 m_ipcModule.getUint(&surfaceid);
1045 m_ipcModule.getUint(&layerid);
1047 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(layerid, surfaceid));
1050 m_ipcModule.createMessage((char*)__FUNCTION__);
1051 m_ipcModule.sendMessage();
1055 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1059 void GenericCommunicator::CreateSurfaceGroup()
1061 uint newID = GraphicalObject::INVALID_ID;
1063 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1066 m_ipcModule.createMessage((char*)__FUNCTION__);
1067 m_ipcModule.appendUint(newID);
1068 m_ipcModule.sendMessage();
1072 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1076 void GenericCommunicator::CreateSurfaceGroupFromId()
1078 uint newID = GraphicalObject::INVALID_ID;
1080 m_ipcModule.getUint(&newID);
1082 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1085 m_ipcModule.createMessage((char*)__FUNCTION__);
1086 m_ipcModule.appendUint(newID);
1087 m_ipcModule.sendMessage();
1091 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1095 void GenericCommunicator::RemoveSurfaceGroup()
1098 m_ipcModule.getUint(¶m);
1100 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(param));
1103 m_ipcModule.createMessage((char*)__FUNCTION__);
1104 m_ipcModule.sendMessage();
1108 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1112 void GenericCommunicator::CreateLayerGroup()
1114 uint newID = GraphicalObject::INVALID_ID;
1116 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1119 m_ipcModule.createMessage((char*)__FUNCTION__);
1120 m_ipcModule.appendUint(newID);
1121 m_ipcModule.sendMessage();
1125 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1129 void GenericCommunicator::CreateLayerGroupFromId()
1131 uint newID = GraphicalObject::INVALID_ID;
1133 m_ipcModule.getUint(&newID);
1135 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1138 m_ipcModule.createMessage((char*)__FUNCTION__);
1139 m_ipcModule.appendUint(newID);
1140 m_ipcModule.sendMessage();
1144 m_ipcModule.sendError(RESSOURCE_ALREADY_INUSE);
1148 void GenericCommunicator::RemoveLayerGroup()
1151 m_ipcModule.getUint(¶m);
1153 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(param));
1156 m_ipcModule.createMessage((char*)__FUNCTION__);
1157 m_ipcModule.sendMessage();
1161 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1165 void GenericCommunicator::SetSurfaceSourceRegion()
1168 m_ipcModule.getUint(&id);
1170 m_ipcModule.getUint(&x);
1172 m_ipcModule.getUint(&y);
1174 m_ipcModule.getUint(&width);
1176 m_ipcModule.getUint(&height);
1178 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(id, x, y, width, height));
1181 m_ipcModule.createMessage((char*)__FUNCTION__);
1182 m_ipcModule.sendMessage();
1186 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1190 void GenericCommunicator::SetLayerSourceRegion()
1193 m_ipcModule.getUint(&id);
1195 m_ipcModule.getUint(&x);
1197 m_ipcModule.getUint(&y);
1199 m_ipcModule.getUint(&width);
1201 m_ipcModule.getUint(&height);
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));
1207 m_ipcModule.createMessage((char*)__FUNCTION__);
1208 m_ipcModule.sendMessage();
1212 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1216 void GenericCommunicator::SetSurfaceDestinationRegion()
1219 m_ipcModule.getUint(&id);
1221 m_ipcModule.getUint(&x);
1223 m_ipcModule.getUint(&y);
1225 m_ipcModule.getUint(&width);
1227 m_ipcModule.getUint(&height);
1229 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(id, x, y, width, height));
1232 m_ipcModule.createMessage((char*)__FUNCTION__);
1233 m_ipcModule.sendMessage();
1237 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1241 void GenericCommunicator::SetSurfacePosition()
1244 m_ipcModule.getUint(&id);
1246 m_ipcModule.getUint(&x);
1248 m_ipcModule.getUint(&y);
1250 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(id, x, y));
1253 m_ipcModule.createMessage((char*)__FUNCTION__);
1254 m_ipcModule.sendMessage();
1258 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1262 void GenericCommunicator::GetSurfacePosition()
1265 m_ipcModule.getUint(&id);
1269 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(id, &x, &y));
1272 m_ipcModule.createMessage((char*)__FUNCTION__);
1273 m_ipcModule.appendUint(x);
1274 m_ipcModule.appendUint(y);
1275 m_ipcModule.sendMessage();
1279 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1283 void GenericCommunicator::SetSurfaceDimension()
1286 m_ipcModule.getUint(&id);
1288 m_ipcModule.getUint(&width);
1290 m_ipcModule.getUint(&height);
1292 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(id, width, height));
1295 m_ipcModule.createMessage((char*)__FUNCTION__);
1296 m_ipcModule.sendMessage();
1300 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1304 void GenericCommunicator::SetLayerDestinationRegion()
1307 m_ipcModule.getUint(&id);
1309 m_ipcModule.getUint(&x);
1311 m_ipcModule.getUint(&y);
1313 m_ipcModule.getUint(&width);
1315 m_ipcModule.getUint(&height);
1317 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(id, x, y, width, height));
1320 m_ipcModule.createMessage((char*)__FUNCTION__);
1321 m_ipcModule.sendMessage();
1325 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1329 void GenericCommunicator::SetLayerPosition()
1332 m_ipcModule.getUint(&id);
1334 m_ipcModule.getUint(&x);
1336 m_ipcModule.getUint(&y);
1338 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(id, x, y));
1341 m_ipcModule.createMessage((char*)__FUNCTION__);
1342 m_ipcModule.sendMessage();
1346 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1350 void GenericCommunicator::GetLayerPosition()
1353 m_ipcModule.getUint(&id);
1357 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(id, &x, &y));
1360 m_ipcModule.createMessage((char*)__FUNCTION__);
1361 m_ipcModule.appendUint(x);
1362 m_ipcModule.appendUint(y);
1363 m_ipcModule.sendMessage();
1367 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1371 void GenericCommunicator::SetLayerDimension()
1374 m_ipcModule.getUint(&id);
1376 m_ipcModule.getUint(&width);
1378 m_ipcModule.getUint(&height);
1380 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(id, width, height));
1383 m_ipcModule.createMessage((char*)__FUNCTION__);
1384 m_ipcModule.sendMessage();
1388 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1392 void GenericCommunicator::GetLayerDimension()
1395 m_ipcModule.getUint(&id);
1399 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(id, &width, &height));
1402 m_ipcModule.createMessage((char*)__FUNCTION__);
1403 m_ipcModule.appendUint(width);
1404 m_ipcModule.appendUint(height);
1405 m_ipcModule.sendMessage();
1409 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1413 void GenericCommunicator::GetSurfaceDimension()
1416 m_ipcModule.getUint(&id);
1420 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(id, &width, &height));
1423 m_ipcModule.createMessage((char*)__FUNCTION__);
1424 m_ipcModule.appendUint(width);
1425 m_ipcModule.appendUint(height);
1426 m_ipcModule.sendMessage();
1430 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1434 void GenericCommunicator::SetSurfaceOpacity()
1437 m_ipcModule.getUint(&id);
1439 m_ipcModule.getDouble(¶m);
1441 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(id, param));
1444 m_ipcModule.createMessage((char*)__FUNCTION__);
1445 m_ipcModule.sendMessage();
1449 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1453 void GenericCommunicator::SetLayerOpacity()
1456 m_ipcModule.getUint(&id);
1458 m_ipcModule.getDouble(¶m);
1460 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(id, param));
1463 m_ipcModule.createMessage((char*)__FUNCTION__);
1464 m_ipcModule.sendMessage();
1468 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1472 void GenericCommunicator::SetSurfacegroupOpacity()
1475 m_ipcModule.getUint(&id);
1477 m_ipcModule.getDouble(¶m);
1479 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(id, param));
1482 m_ipcModule.createMessage((char*)__FUNCTION__);
1483 m_ipcModule.sendMessage();
1487 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1491 void GenericCommunicator::SetLayergroupOpacity()
1494 m_ipcModule.getUint(&id);
1496 m_ipcModule.getDouble(¶m);
1498 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(id, param));
1501 m_ipcModule.createMessage((char*)__FUNCTION__);
1502 m_ipcModule.sendMessage();
1506 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1510 void GenericCommunicator::GetSurfaceOpacity()
1513 m_ipcModule.getUint(&id);
1516 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(id, ¶m));
1519 m_ipcModule.createMessage((char*)__FUNCTION__);
1520 m_ipcModule.appendDouble(param);
1521 m_ipcModule.sendMessage();
1525 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1529 void GenericCommunicator::GetLayerOpacity()
1532 m_ipcModule.getUint(&id);
1535 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(id, ¶m));
1538 m_ipcModule.createMessage((char*)__FUNCTION__);
1539 m_ipcModule.appendDouble(param);
1540 m_ipcModule.sendMessage();
1544 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1548 void GenericCommunicator::SetSurfaceOrientation()
1551 m_ipcModule.getUint(&id);
1553 m_ipcModule.getUint(¶m);
1554 OrientationType o = (OrientationType) param;
1556 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(id, o));
1559 m_ipcModule.createMessage((char*)__FUNCTION__);
1560 m_ipcModule.sendMessage();
1564 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1568 void GenericCommunicator::GetSurfaceOrientation()
1571 m_ipcModule.getUint(&id);
1574 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(id, &o));
1577 m_ipcModule.createMessage((char*)__FUNCTION__);
1578 m_ipcModule.appendUint(o);
1579 m_ipcModule.sendMessage();
1583 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1587 void GenericCommunicator::SetLayerOrientation()
1590 m_ipcModule.getUint(&id);
1592 m_ipcModule.getUint(¶m);
1593 OrientationType o = (OrientationType) param;
1595 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(id, o));
1598 m_ipcModule.createMessage((char*)__FUNCTION__);
1599 m_ipcModule.sendMessage();
1603 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1607 void GenericCommunicator::GetLayerOrientation()
1610 m_ipcModule.getUint(&id);
1613 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(id, &o));
1616 m_ipcModule.createMessage((char*)__FUNCTION__);
1617 m_ipcModule.appendUint(o);
1618 m_ipcModule.sendMessage();
1622 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1626 void GenericCommunicator::GetSurfacePixelformat()
1629 m_ipcModule.getUint(&id);
1632 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(id, ¶m));
1635 m_ipcModule.createMessage((char*)__FUNCTION__);
1636 m_ipcModule.appendUint(param);
1637 m_ipcModule.sendMessage();
1641 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1645 void GenericCommunicator::SetSurfaceVisibility()
1648 m_ipcModule.getUint(&surfaceid);
1649 t_ilm_bool newVis = ILM_FALSE;
1650 m_ipcModule.getBool(&newVis);
1652 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(surfaceid, newVis));
1655 m_ipcModule.createMessage((char*)__FUNCTION__);
1656 m_ipcModule.sendMessage();
1660 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1664 void GenericCommunicator::SetLayerVisibility()
1667 m_ipcModule.getUint(&layerid);
1668 t_ilm_bool myparam = ILM_FALSE;
1669 m_ipcModule.getBool(&myparam);
1671 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(layerid, myparam));
1674 m_ipcModule.createMessage((char*)__FUNCTION__);
1675 m_ipcModule.sendMessage();
1679 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1683 void GenericCommunicator::GetSurfaceVisibility()
1686 m_ipcModule.getUint(&id);
1689 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(id, ¶m));
1692 m_ipcModule.createMessage((char*)__FUNCTION__);
1693 //LOG_DEBUG("GenericCommunicator", "returning surfacevisibility: " << param);
1694 m_ipcModule.appendBool(param);
1695 m_ipcModule.sendMessage();
1699 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1703 void GenericCommunicator::GetLayerVisibility()
1706 m_ipcModule.getUint(&id);
1709 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(id, ¶m));
1712 m_ipcModule.createMessage((char*)__FUNCTION__);
1713 m_ipcModule.appendBool(param);
1714 //LOG_DEBUG("GenericCommunicator", "returning layervisibility: " << param);
1715 m_ipcModule.sendMessage();
1719 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1723 void GenericCommunicator::SetSurfacegroupVisibility()
1726 m_ipcModule.getUint(&groupid);
1727 t_ilm_bool myparam = ILM_FALSE;
1728 m_ipcModule.getBool(&myparam);
1730 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(groupid, myparam));
1733 m_ipcModule.createMessage((char*)__FUNCTION__);
1734 m_ipcModule.sendMessage();
1738 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1742 void GenericCommunicator::SetLayergroupVisibility()
1745 m_ipcModule.getUint(&groupid);
1746 t_ilm_bool myparam = ILM_FALSE;
1747 m_ipcModule.getBool(&myparam);
1749 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(groupid, myparam));
1752 m_ipcModule.createMessage((char*)__FUNCTION__);
1753 m_ipcModule.sendMessage();
1757 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1762 void GenericCommunicator::SetRenderOrderOfLayers()
1767 m_ipcModule.getUintArray(&array, &length);
1769 //LOG_DEBUG("GenericCommunicator","Renderorder: Got " << length << " ids.");
1771 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(array, length));
1774 m_ipcModule.createMessage((char*)__FUNCTION__);
1775 m_ipcModule.sendMessage();
1779 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1783 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer()
1789 m_ipcModule.getUint(&layerid);
1791 m_ipcModule.getUintArray(&array, &length);
1793 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(layerid, array, length));
1796 m_ipcModule.createMessage((char*)__FUNCTION__);
1797 m_ipcModule.sendMessage();
1801 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1805 void GenericCommunicator::GetLayerType()
1808 m_ipcModule.getUint(&id);
1809 Layer* l = m_executor->getScene()->getLayer(id);
1812 m_ipcModule.createMessage((char*)__FUNCTION__);
1813 m_ipcModule.appendUint(l->getLayerType());
1814 m_ipcModule.sendMessage();
1818 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1822 void GenericCommunicator::GetLayertypeCapabilities()
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();
1834 void GenericCommunicator::GetLayerCapabilities()
1837 m_ipcModule.getUint(&id);
1838 Layer* l = m_executor->getScene()->getLayer(id);
1841 m_ipcModule.createMessage((char*)__FUNCTION__);
1842 m_ipcModule.appendUint(l->getCapabilities());
1843 m_ipcModule.sendMessage();
1847 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1851 void GenericCommunicator::FadeIn()
1853 m_ipcModule.createMessage((char*)__FUNCTION__);
1854 m_ipcModule.sendMessage();
1857 void GenericCommunicator::SynchronizedFade()
1859 m_ipcModule.createMessage((char*)__FUNCTION__);
1860 m_ipcModule.sendMessage();
1863 void GenericCommunicator::FadeOut()
1865 m_ipcModule.createMessage((char*)__FUNCTION__);
1866 m_ipcModule.sendMessage();
1869 void GenericCommunicator::Exit()
1871 t_ilm_bool status = m_executor->execute(new ExitCommand());
1874 m_ipcModule.createMessage((char*)__FUNCTION__);
1875 m_ipcModule.sendMessage();
1879 m_ipcModule.sendError(INVALID_ARGUMENT);
1883 void GenericCommunicator::CommitChanges()
1885 t_ilm_bool status = m_executor->execute(new CommitCommand());
1888 m_ipcModule.createMessage((char*)__FUNCTION__);
1889 m_ipcModule.sendMessage();
1893 m_ipcModule.sendError(INVALID_ARGUMENT);
1897 void GenericCommunicator::CreateShader()
1899 char vertname[1024];
1900 char fragname[1024];
1901 m_ipcModule.getString(vertname);
1902 m_ipcModule.getString(fragname);
1905 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(vertname, fragname, &id));
1908 m_ipcModule.createMessage((char*)__FUNCTION__);
1909 m_ipcModule.appendUint(id);
1910 m_ipcModule.sendMessage();
1914 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1918 void GenericCommunicator::DestroyShader()
1921 m_ipcModule.getUint(&shaderid);
1923 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(shaderid));
1926 m_ipcModule.createMessage((char*)__FUNCTION__);
1927 m_ipcModule.sendMessage();
1931 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1935 void GenericCommunicator::SetShader()
1939 m_ipcModule.getUint(&surfaceId);
1940 m_ipcModule.getUint(&shaderid);
1942 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(surfaceId, shaderid));
1945 m_ipcModule.createMessage((char*)__FUNCTION__);
1946 m_ipcModule.sendMessage();
1950 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1954 void GenericCommunicator::SetUniforms()
1957 m_ipcModule.getUint(&id);
1959 std::vector<string> uniforms;
1962 //m_ipcModule.getStringArray(&uniforms);
1964 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(id, uniforms));
1967 m_ipcModule.createMessage((char*)__FUNCTION__);
1968 m_ipcModule.sendMessage();
1972 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1976 void GenericCommunicator::SetKeyboardFocusOn()
1980 m_ipcModule.getUint(&surfaceId);
1982 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(surfaceId));
1985 m_ipcModule.createMessage((char*)__FUNCTION__);
1986 m_ipcModule.sendMessage();
1990 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
1995 void GenericCommunicator::GetKeyboardFocusSurfaceId()
1999 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(&surfaceId));
2002 m_ipcModule.createMessage((char*)__FUNCTION__);
2003 m_ipcModule.appendUint(surfaceId);
2004 m_ipcModule.sendMessage();
2008 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2015 void GenericCommunicator::UpdateInputEventAcceptanceOn()
2019 InputDevice devices;
2022 m_ipcModule.getUint(&surfaceId);
2023 m_ipcModule.getUint(&udevices);
2024 m_ipcModule.getBool(&accept);
2026 devices = (InputDevice) udevices;
2027 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(surfaceId, devices, accept));
2030 m_ipcModule.createMessage((char*)__FUNCTION__);
2031 m_ipcModule.sendMessage();
2035 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2039 void GenericCommunicator::SetSurfaceChromaKey()
2045 m_ipcModule.getUint(&surfaceid);
2046 m_ipcModule.getUintArray(&array, &length);
2048 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(surfaceid, array, length));
2051 m_ipcModule.createMessage((char*)__FUNCTION__);
2052 m_ipcModule.sendMessage();
2056 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2060 void GenericCommunicator::SetLayerChromaKey()
2066 m_ipcModule.getUint(&layerid);
2067 m_ipcModule.getUintArray(&array, &length);
2069 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(layerid, array, length));
2072 m_ipcModule.createMessage((char*)__FUNCTION__);
2073 m_ipcModule.sendMessage();
2077 m_ipcModule.sendError(RESSOURCE_NOT_FOUND);
2081 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
2083 return new GenericCommunicator(executor);
2086 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)