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* RESOURCE_ALREADY_INUSE = "Ressource already in use";
98 const char* INVALID_ARGUMENT = "Invalid argument";
99 const char* RESOURCE_NOT_FOUND = "Ressource not found";
100 const char* NOT_IMPLEMENTED = "Feature not implemented";
103 GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
104 : ICommunicator(executor)
105 , 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 },
197 { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
198 { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
199 { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
200 { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification }
203 int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
205 for (int index = 0; index < entryCount; ++index)
207 MethodTable* method = &manager_methods[index];
208 if (method->function)
210 m_callBackTable[method->name] = *method;
211 LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
215 memset(&m_ipcModule, 0, sizeof(m_ipcModule));
218 bool GenericCommunicator::start()
220 LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
222 if (!loadIpcModule(&m_ipcModule))
224 LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
227 LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
229 if (!m_ipcModule.initServiceMode())
231 LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
234 LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
236 m_running = ILM_TRUE;
241 void GenericCommunicator::stop()
243 LOG_INFO("GenericCommunicator","stopping");
247 m_ipcModule.destroy();
251 void GenericCommunicator::process(int timeout_ms)
253 t_ilm_message message = m_ipcModule.receive(timeout_ms);
259 t_ilm_message_type messageType = m_ipcModule.getMessageType(message);
260 t_ilm_const_string name = m_ipcModule.getMessageName(message);
261 t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
265 case IpcMessageTypeCommand:
266 if (m_callBackTable.end() != m_callBackTable.find(name))
268 LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
269 << m_executor->getSenderName(senderHandle)
270 << "(" << m_executor->getSenderPid(senderHandle) << ")");
271 CallBackMethod method = m_callBackTable[name].function;
272 (this->*method)(message);
276 LOG_WARNING("GenericCommunicator", "Received unknown command " << name
277 << " from " << m_executor->getSenderName(senderHandle)
278 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
280 processNotificationQueue();
283 case IpcMessageTypeConnect:
284 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
285 << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
288 case IpcMessageTypeDisconnect:
289 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
290 << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
292 const LayerMap& layers = m_executor->getScene()->getAllLayers();
293 LayerMapConstIterator layerIter = layers.begin();
294 LayerMapConstIterator layerIterEnd = layers.end();
295 for (; layerIter != layerIterEnd; ++layerIter)
297 Layer* layer = layerIter->second;
298 layer->removeNotification(senderHandle);
301 const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
302 SurfaceMapConstIterator surfaceIter = surfaces.begin();
303 SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
304 for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
306 Surface* surface = surfaceIter->second;
307 surface->removeNotification(senderHandle);
312 case IpcMessageTypeError:
313 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
314 << m_executor->getSenderName(senderHandle)
315 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
318 case IpcMessageTypeShutdown:
319 case IpcMessageTypeNone:
323 LOG_DEBUG("GenericCommunicator", "Received unknown data from "
324 << m_executor->getSenderName(senderHandle)
325 << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
328 m_ipcModule.destroyMessage(message);
331 void GenericCommunicator::setdebug(bool onoff)
333 (void)onoff; // TODO: remove, only prevents warning
336 void GenericCommunicator::ServiceConnect(t_ilm_message message)
338 LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
340 t_ilm_message response;
341 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
343 unsigned int processId = 0;
344 char processName[1024];
345 m_ipcModule.getUint(message, &processId);
346 m_ipcModule.getString(message, processName);
348 m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
350 response = m_ipcModule.createResponse(message);
351 m_ipcModule.sendToClients(response, &clientHandle, 1);
352 m_ipcModule.destroyMessage(response);
355 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
357 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
359 t_ilm_message response;
360 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
362 m_executor->removeApplicationReference(clientHandle);
364 response = m_ipcModule.createResponse(message);
365 m_ipcModule.sendToClients(response, &clientHandle, 1);
366 m_ipcModule.destroyMessage(response);
369 void GenericCommunicator::Debug(t_ilm_message message)
371 t_ilm_message response;
372 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
373 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
374 t_ilm_bool param = ILM_FALSE;
375 m_ipcModule.getBool(message, ¶m);
377 t_ilm_bool status = m_executor->execute(new DebugCommand(clientPid, param));
380 response = m_ipcModule.createResponse(message);
384 response = m_ipcModule.createErrorResponse(message);
385 m_ipcModule.appendString(response, INVALID_ARGUMENT);
388 m_ipcModule.sendToClients(response, &clientHandle, 1);
389 m_ipcModule.destroyMessage(response);
392 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
394 t_ilm_message response;
395 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
397 m_ipcModule.getUint(message, &screenid);
398 uint* resolution = m_executor->getScreenResolution(screenid);
400 response = m_ipcModule.createResponse(message);
401 m_ipcModule.appendUint(response, resolution[0]);
402 m_ipcModule.appendUint(response, resolution[1]);
403 m_ipcModule.sendToClients(response, &clientHandle, 1);
404 m_ipcModule.destroyMessage(response);
407 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
409 t_ilm_message response;
410 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
412 m_ipcModule.getUint(message, &screenid);
413 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
414 response = m_ipcModule.createResponse(message);
415 m_ipcModule.appendUint(response, numberOfHardwareLayers);
416 m_ipcModule.sendToClients(response, &clientHandle, 1);
417 m_ipcModule.destroyMessage(response);
420 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
422 t_ilm_message response;
423 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
425 uint* IDs = m_executor->getScreenIDs(&length);
426 response = m_ipcModule.createResponse(message);
427 m_ipcModule.appendUintArray(response, IDs, length);
428 m_ipcModule.sendToClients(response, &clientHandle, 1);
429 m_ipcModule.destroyMessage(response);
432 void GenericCommunicator::ScreenShot(t_ilm_message message)
434 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
435 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
436 t_ilm_message response;
440 m_ipcModule.getUint(message, &screenid);
441 m_ipcModule.getString(message, filename);
443 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(clientPid, filename, screenid));
446 response = m_ipcModule.createResponse(message);
450 response = m_ipcModule.createErrorResponse(message);
451 m_ipcModule.appendString(response, INVALID_ARGUMENT);
454 m_ipcModule.sendToClients(response, &clientHandle, 1);
455 m_ipcModule.destroyMessage(response);
458 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
460 t_ilm_message response;
461 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
462 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
464 m_ipcModule.getString(message, filename);
466 m_ipcModule.getUint(message, &layerid);
468 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(clientPid, filename, layerid));
471 response = m_ipcModule.createResponse(message);
475 response = m_ipcModule.createErrorResponse(message);
476 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
479 m_ipcModule.sendToClients(response, &clientHandle, 1);
480 m_ipcModule.destroyMessage(response);
483 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
485 t_ilm_message response;
486 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
487 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
489 m_ipcModule.getString(message, filename);
491 m_ipcModule.getUint(message, &id);
492 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(clientPid, filename, id));
495 response = m_ipcModule.createResponse(message);
499 response = m_ipcModule.createErrorResponse(message);
500 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
503 m_ipcModule.sendToClients(response, &clientHandle, 1);
504 m_ipcModule.destroyMessage(response);
507 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
509 t_ilm_message response;
510 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
513 m_executor->getScene()->lockScene();
514 m_executor->getScene()->getLayerIDs(&length, &array);
515 m_executor->getScene()->unlockScene();
516 response = m_ipcModule.createResponse(message);
517 m_ipcModule.appendUintArray(response, array, length);
518 m_ipcModule.sendToClients(response, &clientHandle, 1);
519 m_ipcModule.destroyMessage(response);
522 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
524 t_ilm_message response;
525 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
527 m_ipcModule.getUint(message, &screenID);
531 m_executor->getScene()->lockScene();
532 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
533 m_executor->getScene()->unlockScene();
536 response = m_ipcModule.createResponse(message);
537 m_ipcModule.appendUintArray(response, array, length);
541 response = m_ipcModule.createErrorResponse(message);
542 m_ipcModule.appendString(response, INVALID_ARGUMENT);
545 m_ipcModule.sendToClients(response, &clientHandle, 1);
546 m_ipcModule.destroyMessage(response);
549 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
551 t_ilm_message response;
552 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
555 m_executor->getScene()->lockScene();
556 m_executor->getScene()->getSurfaceIDs(&length, &array);
557 m_executor->getScene()->unlockScene();
558 response = m_ipcModule.createResponse(message);
559 m_ipcModule.appendUintArray(response, array, length);
560 m_ipcModule.sendToClients(response, &clientHandle, 1);
561 m_ipcModule.destroyMessage(response);
564 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
566 t_ilm_message response;
567 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
570 m_executor->getScene()->lockScene();
571 m_executor->getScene()->getLayerGroupIDs(&length, &array);
572 m_executor->getScene()->unlockScene();
573 response = m_ipcModule.createResponse(message);
574 m_ipcModule.appendUintArray(response, array, length);
575 m_ipcModule.sendToClients(response, &clientHandle, 1);
576 m_ipcModule.destroyMessage(response);
579 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
581 t_ilm_message response;
582 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
585 m_executor->getScene()->lockScene();
586 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
587 m_executor->getScene()->unlockScene();
588 response = m_ipcModule.createResponse(message);
589 m_ipcModule.appendUintArray(response, array, length);
590 m_ipcModule.sendToClients(response, &clientHandle, 1);
591 m_ipcModule.destroyMessage(response);
594 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
596 t_ilm_message response;
597 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
599 m_ipcModule.getUint(message, &id);
600 m_executor->getScene()->lockScene();
601 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
604 std::list<Surface*> surfaces = sg->getList();
605 uint length = surfaces.size();
606 uint* array = new uint[length];
609 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
612 array[arrayPos] = s->getID();
615 m_executor->getScene()->unlockScene();
617 response = m_ipcModule.createResponse(message);
618 m_ipcModule.appendUintArray(response, array, length);
622 m_executor->getScene()->unlockScene();
623 response = m_ipcModule.createErrorResponse(message);
624 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
627 m_ipcModule.sendToClients(response, &clientHandle, 1);
628 m_ipcModule.destroyMessage(response);
631 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
633 t_ilm_message response;
634 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
636 m_ipcModule.getUint(message, &id);
637 m_executor->getScene()->lockScene();
638 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
641 std::list<Layer*> layers = sg->getList();
643 uint length = layers.size();
644 uint* array = new uint[length];
647 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
650 array[arrayPos] = l->getID();
653 m_executor->getScene()->unlockScene();
655 response = m_ipcModule.createResponse(message);
656 m_ipcModule.appendUintArray(response, array, length);
660 m_executor->getScene()->unlockScene();
661 response = m_ipcModule.createErrorResponse(message);
662 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
665 m_ipcModule.sendToClients(response, &clientHandle, 1);
666 m_ipcModule.destroyMessage(response);
669 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
671 t_ilm_message response;
672 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
674 m_ipcModule.getUint(message, &id);
675 m_executor->getScene()->lockScene();
676 Layer* layer = m_executor->getScene()->getLayer(id);
679 std::list<Surface*> surfaces = layer->getAllSurfaces();
681 uint length = surfaces.size();
682 uint* array = new uint[length];
685 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
688 array[arrayPos] = s->getID();
691 m_executor->getScene()->unlockScene();
693 response = m_ipcModule.createResponse(message);
694 m_ipcModule.appendUintArray(response, array, length);
698 m_executor->getScene()->unlockScene();
699 response = m_ipcModule.createErrorResponse(message);
700 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
703 m_ipcModule.sendToClients(response, &clientHandle, 1);
704 m_ipcModule.destroyMessage(response);
707 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
709 t_ilm_message response;
710 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
712 m_ipcModule.getUint(message, &id);
714 Surface* surface = m_executor->getScene()->getSurface(id);
717 Rectangle dest = surface->getDestinationRegion();
718 Rectangle src = surface->getSourceRegion();
719 OrientationType orientation = surface->getOrientation();
720 unsigned char chromaKeyRed = 0;
721 unsigned char chromaKeyGreen = 0;
722 unsigned char chromaKeyBlue = 0;
723 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
725 response = m_ipcModule.createResponse(message);
726 m_ipcModule.appendDouble(response, surface->getOpacity());
727 m_ipcModule.appendUint(response, src.x);
728 m_ipcModule.appendUint(response, src.y);
729 m_ipcModule.appendUint(response, src.width);
730 m_ipcModule.appendUint(response, src.height);
731 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
732 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
733 m_ipcModule.appendUint(response, dest.x);
734 m_ipcModule.appendUint(response, dest.y);
735 m_ipcModule.appendUint(response, dest.width);
736 m_ipcModule.appendUint(response, dest.height);
737 m_ipcModule.appendUint(response, orientation);
738 m_ipcModule.appendBool(response, surface->getVisibility());
739 m_ipcModule.appendUint(response, surface->frameCounter);
740 m_ipcModule.appendUint(response, surface->drawCounter);
741 m_ipcModule.appendUint(response, surface->updateCounter);
742 m_ipcModule.appendUint(response, surface->getPixelFormat());
743 m_ipcModule.appendUint(response, surface->getNativeContent());
744 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
745 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
746 m_ipcModule.appendUint(response, chromaKeyRed);
747 m_ipcModule.appendUint(response, chromaKeyGreen);
748 m_ipcModule.appendUint(response, chromaKeyBlue);
749 m_ipcModule.appendInt(response, surface->getCreatorPid());
753 response = m_ipcModule.createErrorResponse(message);
754 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
757 m_ipcModule.sendToClients(response, &clientHandle, 1);
758 m_ipcModule.destroyMessage(response);
761 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
763 t_ilm_message response;
764 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
766 m_ipcModule.getUint(message, &id);
768 Layer* layer = m_executor->getScene()->getLayer(id);
771 Rectangle dest = layer->getDestinationRegion();
772 Rectangle src = layer->getSourceRegion();
773 OrientationType orientation = layer->getOrientation();
774 unsigned char chromaKeyRed = 0;
775 unsigned char chromaKeyGreen = 0;
776 unsigned char chromaKeyBlue = 0;
777 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
779 response = m_ipcModule.createResponse(message);
780 m_ipcModule.appendDouble(response, layer->getOpacity());
781 m_ipcModule.appendUint(response, src.x);
782 m_ipcModule.appendUint(response, src.y);
783 m_ipcModule.appendUint(response, src.width);
784 m_ipcModule.appendUint(response, src.height);
785 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
786 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
787 m_ipcModule.appendUint(response, dest.x);
788 m_ipcModule.appendUint(response, dest.y);
789 m_ipcModule.appendUint(response, dest.width);
790 m_ipcModule.appendUint(response, dest.height);
791 m_ipcModule.appendUint(response, orientation);
792 m_ipcModule.appendBool(response, layer->getVisibility());
793 m_ipcModule.appendUint(response, layer->getLayerType());
794 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
795 m_ipcModule.appendUint(response, chromaKeyRed);
796 m_ipcModule.appendUint(response, chromaKeyGreen);
797 m_ipcModule.appendUint(response, chromaKeyBlue);
798 m_ipcModule.appendInt(response, layer->getCreatorPid());
802 response = m_ipcModule.createErrorResponse(message);
803 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
806 m_ipcModule.sendToClients(response, &clientHandle, 1);
807 m_ipcModule.destroyMessage(response);
810 void GenericCommunicator::CreateSurface(t_ilm_message message)
812 t_ilm_message response;
813 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
814 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
818 uint pixelformat = 0;
819 PixelFormat pf = PIXELFORMAT_UNKNOWN;
820 uint id = GraphicalObject::INVALID_ID;
822 m_ipcModule.getUint(message, &handle);
823 m_ipcModule.getUint(message, &width);
824 m_ipcModule.getUint(message, &height);
825 m_ipcModule.getUint(message, &pixelformat);
827 pf = (PixelFormat) pixelformat;
830 // First of all create the surface
831 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
833 // after that apply the native content
834 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
838 response = m_ipcModule.createResponse(message);
839 m_ipcModule.appendUint(response, id);
843 response = m_ipcModule.createErrorResponse(message);
844 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
847 m_ipcModule.sendToClients(response, &clientHandle, 1);
848 m_ipcModule.destroyMessage(response);
851 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
853 t_ilm_message response;
854 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
855 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
859 uint pixelformat = 0;
860 PixelFormat pf = PIXELFORMAT_UNKNOWN;
863 m_ipcModule.getUint(message, &handle);
864 m_ipcModule.getUint(message, &width);
865 m_ipcModule.getUint(message, &height);
866 m_ipcModule.getUint(message, &pixelformat);
867 m_ipcModule.getUint(message, &id);
869 pf = (PixelFormat) pixelformat;
871 // First of all create the surface
872 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
874 // after that apply the native content
875 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
879 response = m_ipcModule.createResponse(message);
880 m_ipcModule.appendUint(response, id);
884 response = m_ipcModule.createErrorResponse(message);
885 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
888 m_ipcModule.sendToClients(response, &clientHandle, 1);
889 m_ipcModule.destroyMessage(response);
892 void GenericCommunicator::InitializeSurface(t_ilm_message message)
894 t_ilm_message response;
895 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
896 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
897 uint id = GraphicalObject::INVALID_ID;
899 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
902 response = m_ipcModule.createResponse(message);
903 m_ipcModule.appendUint(response, id);
907 response = m_ipcModule.createErrorResponse(message);
908 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
911 m_ipcModule.sendToClients(response, &clientHandle, 1);
912 m_ipcModule.destroyMessage(response);
915 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
917 t_ilm_message response;
918 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
919 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
921 m_ipcModule.getUint(message, &id);
922 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
925 response = m_ipcModule.createResponse(message);
926 m_ipcModule.appendUint(response, id);
930 response = m_ipcModule.createErrorResponse(message);
931 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
934 m_ipcModule.sendToClients(response, &clientHandle, 1);
935 m_ipcModule.destroyMessage(response);
938 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
940 t_ilm_message response;
941 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
942 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
947 uint pixelformat = 0;
948 PixelFormat pf = PIXELFORMAT_UNKNOWN;
950 m_ipcModule.getUint(message, &id);
951 m_ipcModule.getUint(message, &handle);
952 m_ipcModule.getUint(message, &width);
953 m_ipcModule.getUint(message, &height);
954 m_ipcModule.getUint(message, &pixelformat);
956 pf = (PixelFormat) pixelformat;
958 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
961 response = m_ipcModule.createResponse(message);
965 response = m_ipcModule.createErrorResponse(message);
966 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
969 m_ipcModule.sendToClients(response, &clientHandle, 1);
970 m_ipcModule.destroyMessage(response);
973 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
975 t_ilm_message response;
976 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
977 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
979 m_ipcModule.getUint(message, &id);
981 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(clientPid, id));
984 response = m_ipcModule.createResponse(message);
988 response = m_ipcModule.createErrorResponse(message);
989 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
992 m_ipcModule.sendToClients(response, &clientHandle, 1);
993 m_ipcModule.destroyMessage(response);
996 void GenericCommunicator::RemoveSurface(t_ilm_message message)
998 t_ilm_message response;
999 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1000 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1002 m_ipcModule.getUint(message, ¶m);
1003 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(clientPid, param));
1006 response = m_ipcModule.createResponse(message);
1010 response = m_ipcModule.createErrorResponse(message);
1011 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1014 m_ipcModule.sendToClients(response, &clientHandle, 1);
1015 m_ipcModule.destroyMessage(response);
1018 void GenericCommunicator::CreateLayer(t_ilm_message message)
1020 t_ilm_message response;
1021 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1022 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1023 uint id = GraphicalObject::INVALID_ID;
1024 // use resolution of default screen as default width and height of layers
1025 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1026 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1029 response = m_ipcModule.createResponse(message);
1030 m_ipcModule.appendUint(response, id);
1034 response = m_ipcModule.createErrorResponse(message);
1035 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1038 m_ipcModule.sendToClients(response, &clientHandle, 1);
1039 m_ipcModule.destroyMessage(response);
1042 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
1044 t_ilm_message response;
1045 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1046 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1047 uint id = GraphicalObject::INVALID_ID;
1049 m_ipcModule.getUint(message, &id);
1050 // use resolution of default screen as default width and height of layers
1051 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1052 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1055 response = m_ipcModule.createResponse(message);
1056 m_ipcModule.appendUint(response, id);
1060 response = m_ipcModule.createErrorResponse(message);
1061 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1064 m_ipcModule.sendToClients(response, &clientHandle, 1);
1065 m_ipcModule.destroyMessage(response);
1069 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
1071 t_ilm_message response;
1072 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1073 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1075 m_ipcModule.getUint(message, &width);
1077 m_ipcModule.getUint(message, &height);
1079 uint id = GraphicalObject::INVALID_ID;
1080 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1083 response = m_ipcModule.createResponse(message);
1084 m_ipcModule.appendUint(response, id);
1088 response = m_ipcModule.createErrorResponse(message);
1089 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1092 m_ipcModule.sendToClients(response, &clientHandle, 1);
1093 m_ipcModule.destroyMessage(response);
1096 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1098 t_ilm_message response;
1099 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1100 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1101 uint id = GraphicalObject::INVALID_ID;
1104 t_ilm_bool status = ILM_FALSE;
1106 m_ipcModule.getUint(message, &id);
1107 m_ipcModule.getUint(message, &width);
1108 m_ipcModule.getUint(message, &height);
1110 status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1113 response = m_ipcModule.createResponse(message);
1114 m_ipcModule.appendUint(response, id);
1118 response = m_ipcModule.createErrorResponse(message);
1119 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1122 m_ipcModule.sendToClients(response, &clientHandle, 1);
1123 m_ipcModule.destroyMessage(response);
1126 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1128 t_ilm_message response;
1129 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1130 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1132 m_ipcModule.getUint(message, ¶m);
1133 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(clientPid, param));
1136 response = m_ipcModule.createResponse(message);
1140 response = m_ipcModule.createErrorResponse(message);
1141 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1144 m_ipcModule.sendToClients(response, &clientHandle, 1);
1145 m_ipcModule.destroyMessage(response);
1148 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1150 t_ilm_message response;
1151 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1152 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1154 uint surfacegroupid = 0;
1156 m_ipcModule.getUint(message, &surfaceid);
1157 m_ipcModule.getUint(message, &surfacegroupid);
1159 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1162 response = m_ipcModule.createResponse(message);
1166 response = m_ipcModule.createErrorResponse(message);
1167 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1170 m_ipcModule.sendToClients(response, &clientHandle, 1);
1171 m_ipcModule.destroyMessage(response);
1174 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1176 t_ilm_message response;
1177 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1178 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1180 uint surfacegroupid = 0;
1182 m_ipcModule.getUint(message, &surfaceid);
1183 m_ipcModule.getUint(message, &surfacegroupid);
1185 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1188 response = m_ipcModule.createResponse(message);
1192 response = m_ipcModule.createErrorResponse(message);
1193 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1196 m_ipcModule.sendToClients(response, &clientHandle, 1);
1197 m_ipcModule.destroyMessage(response);
1200 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1202 t_ilm_message response;
1203 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1204 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1206 uint layergroupid = 0;
1208 m_ipcModule.getUint(message, &layerid);
1209 m_ipcModule.getUint(message, &layergroupid);
1211 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
1214 response = m_ipcModule.createResponse(message);
1218 response = m_ipcModule.createErrorResponse(message);
1219 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1222 m_ipcModule.sendToClients(response, &clientHandle, 1);
1223 m_ipcModule.destroyMessage(response);
1226 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1228 t_ilm_message response;
1229 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1230 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1232 uint layergroupid = 0;
1234 m_ipcModule.getUint(message, &layerid);
1235 m_ipcModule.getUint(message, &layergroupid);
1237 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
1240 response = m_ipcModule.createResponse(message);
1244 response = m_ipcModule.createErrorResponse(message);
1245 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1248 m_ipcModule.sendToClients(response, &clientHandle, 1);
1249 m_ipcModule.destroyMessage(response);
1252 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1254 t_ilm_message response;
1255 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1256 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1260 m_ipcModule.getUint(message, &surfaceid);
1261 m_ipcModule.getUint(message, &layer);
1263 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(clientPid, layer, surfaceid));
1266 response = m_ipcModule.createResponse(message);
1270 response = m_ipcModule.createErrorResponse(message);
1271 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1274 m_ipcModule.sendToClients(response, &clientHandle, 1);
1275 m_ipcModule.destroyMessage(response);
1278 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1280 t_ilm_message response;
1281 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1282 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1285 m_ipcModule.getUint(message, &surfaceid);
1286 m_ipcModule.getUint(message, &layerid);
1288 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(clientPid, layerid, surfaceid));
1291 response = m_ipcModule.createResponse(message);
1295 response = m_ipcModule.createErrorResponse(message);
1296 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1299 m_ipcModule.sendToClients(response, &clientHandle, 1);
1300 m_ipcModule.destroyMessage(response);
1303 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1305 t_ilm_message response;
1306 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1307 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1308 uint newID = GraphicalObject::INVALID_ID;
1310 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1313 response = m_ipcModule.createResponse(message);
1314 m_ipcModule.appendUint(response, newID);
1318 response = m_ipcModule.createErrorResponse(message);
1319 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1322 m_ipcModule.sendToClients(response, &clientHandle, 1);
1323 m_ipcModule.destroyMessage(response);
1326 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1328 t_ilm_message response;
1329 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1330 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1331 uint newID = GraphicalObject::INVALID_ID;
1333 m_ipcModule.getUint(message, &newID);
1335 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1338 response = m_ipcModule.createResponse(message);
1339 m_ipcModule.appendUint(response, newID);
1343 response = m_ipcModule.createErrorResponse(message);
1344 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1347 m_ipcModule.sendToClients(response, &clientHandle, 1);
1348 m_ipcModule.destroyMessage(response);
1351 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1353 t_ilm_message response;
1354 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1355 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1357 m_ipcModule.getUint(message, ¶m);
1359 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
1362 response = m_ipcModule.createResponse(message);
1366 response = m_ipcModule.createErrorResponse(message);
1367 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1370 m_ipcModule.sendToClients(response, &clientHandle, 1);
1371 m_ipcModule.destroyMessage(response);
1374 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1376 t_ilm_message response;
1377 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1378 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1379 uint newID = GraphicalObject::INVALID_ID;
1381 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1384 response = m_ipcModule.createResponse(message);
1385 m_ipcModule.appendUint(response, newID);
1389 response = m_ipcModule.createErrorResponse(message);
1390 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1393 m_ipcModule.sendToClients(response, &clientHandle, 1);
1394 m_ipcModule.destroyMessage(response);
1397 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1399 t_ilm_message response;
1400 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1401 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1402 uint newID = GraphicalObject::INVALID_ID;
1404 m_ipcModule.getUint(message, &newID);
1406 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1409 response = m_ipcModule.createResponse(message);
1410 m_ipcModule.appendUint(response, newID);
1414 response = m_ipcModule.createErrorResponse(message);
1415 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1418 m_ipcModule.sendToClients(response, &clientHandle, 1);
1419 m_ipcModule.destroyMessage(response);
1422 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1424 t_ilm_message response;
1425 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1426 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1428 m_ipcModule.getUint(message, ¶m);
1430 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
1433 response = m_ipcModule.createResponse(message);
1437 response = m_ipcModule.createErrorResponse(message);
1438 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1441 m_ipcModule.sendToClients(response, &clientHandle, 1);
1442 m_ipcModule.destroyMessage(response);
1445 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1447 t_ilm_message response;
1448 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1449 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1456 m_ipcModule.getUint(message, &id);
1457 m_ipcModule.getUint(message, &x);
1458 m_ipcModule.getUint(message, &y);
1459 m_ipcModule.getUint(message, &width);
1460 m_ipcModule.getUint(message, &height);
1462 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1465 response = m_ipcModule.createResponse(message);
1469 response = m_ipcModule.createErrorResponse(message);
1470 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1473 m_ipcModule.sendToClients(response, &clientHandle, 1);
1474 m_ipcModule.destroyMessage(response);
1477 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1479 t_ilm_message response;
1480 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1481 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1488 m_ipcModule.getUint(message, &id);
1489 m_ipcModule.getUint(message, &x);
1490 m_ipcModule.getUint(message, &y);
1491 m_ipcModule.getUint(message, &width);
1492 m_ipcModule.getUint(message, &height);
1494 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1497 response = m_ipcModule.createResponse(message);
1501 response = m_ipcModule.createErrorResponse(message);
1502 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1505 m_ipcModule.sendToClients(response, &clientHandle, 1);
1506 m_ipcModule.destroyMessage(response);
1509 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1511 t_ilm_message response;
1512 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1513 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1520 m_ipcModule.getUint(message, &id);
1521 m_ipcModule.getUint(message, &x);
1522 m_ipcModule.getUint(message, &y);
1523 m_ipcModule.getUint(message, &width);
1524 m_ipcModule.getUint(message, &height);
1526 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1529 response = m_ipcModule.createResponse(message);
1533 response = m_ipcModule.createErrorResponse(message);
1534 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1537 m_ipcModule.sendToClients(response, &clientHandle, 1);
1538 m_ipcModule.destroyMessage(response);
1541 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1543 t_ilm_message response;
1544 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1545 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1550 m_ipcModule.getUint(message, &id);
1551 m_ipcModule.getUint(message, &x);
1552 m_ipcModule.getUint(message, &y);
1554 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(clientPid, id, x, y));
1557 response = m_ipcModule.createResponse(message);
1561 response = m_ipcModule.createErrorResponse(message);
1562 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1565 m_ipcModule.sendToClients(response, &clientHandle, 1);
1566 m_ipcModule.destroyMessage(response);
1569 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1571 t_ilm_message response;
1572 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1573 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1578 m_ipcModule.getUint(message, &id);
1580 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(clientPid, id, &x, &y));
1583 response = m_ipcModule.createResponse(message);
1584 m_ipcModule.appendUint(response, x);
1585 m_ipcModule.appendUint(response, y);
1589 response = m_ipcModule.createErrorResponse(message);
1590 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1593 m_ipcModule.sendToClients(response, &clientHandle, 1);
1594 m_ipcModule.destroyMessage(response);
1597 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1599 t_ilm_message response;
1600 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1601 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1606 m_ipcModule.getUint(message, &id);
1607 m_ipcModule.getUint(message, &width);
1608 m_ipcModule.getUint(message, &height);
1610 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(clientPid, id, width, height));
1613 response = m_ipcModule.createResponse(message);
1617 response = m_ipcModule.createErrorResponse(message);
1618 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1621 m_ipcModule.sendToClients(response, &clientHandle, 1);
1622 m_ipcModule.destroyMessage(response);
1625 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1627 t_ilm_message response;
1628 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1629 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1636 m_ipcModule.getUint(message, &id);
1637 m_ipcModule.getUint(message, &x);
1638 m_ipcModule.getUint(message, &y);
1639 m_ipcModule.getUint(message, &width);
1640 m_ipcModule.getUint(message, &height);
1642 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1645 response = m_ipcModule.createResponse(message);
1649 response = m_ipcModule.createErrorResponse(message);
1650 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1653 m_ipcModule.sendToClients(response, &clientHandle, 1);
1654 m_ipcModule.destroyMessage(response);
1657 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1659 t_ilm_message response;
1660 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1661 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1666 m_ipcModule.getUint(message, &id);
1667 m_ipcModule.getUint(message, &x);
1668 m_ipcModule.getUint(message, &y);
1670 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(clientPid, id, x, y));
1673 response = m_ipcModule.createResponse(message);
1677 response = m_ipcModule.createErrorResponse(message);
1678 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1681 m_ipcModule.sendToClients(response, &clientHandle, 1);
1682 m_ipcModule.destroyMessage(response);
1685 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1687 t_ilm_message response;
1688 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1689 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1694 m_ipcModule.getUint(message, &id);
1696 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(clientPid, id, &x, &y));
1699 response = m_ipcModule.createResponse(message);
1700 m_ipcModule.appendUint(response, x);
1701 m_ipcModule.appendUint(response, y);
1705 response = m_ipcModule.createErrorResponse(message);
1706 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1709 m_ipcModule.sendToClients(response, &clientHandle, 1);
1710 m_ipcModule.destroyMessage(response);
1713 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1715 t_ilm_message response;
1716 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1717 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1722 m_ipcModule.getUint(message, &id);
1723 m_ipcModule.getUint(message, &width);
1724 m_ipcModule.getUint(message, &height);
1726 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(clientPid, id, width, height));
1729 response = m_ipcModule.createResponse(message);
1733 response = m_ipcModule.createErrorResponse(message);
1734 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1737 m_ipcModule.sendToClients(response, &clientHandle, 1);
1738 m_ipcModule.destroyMessage(response);
1741 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1743 t_ilm_message response;
1744 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1745 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1750 m_ipcModule.getUint(message, &id);
1752 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(clientPid, id, &width, &height));
1755 response = m_ipcModule.createResponse(message);
1756 m_ipcModule.appendUint(response, width);
1757 m_ipcModule.appendUint(response, height);
1761 response = m_ipcModule.createErrorResponse(message);
1762 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1765 m_ipcModule.sendToClients(response, &clientHandle, 1);
1766 m_ipcModule.destroyMessage(response);
1769 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1771 t_ilm_message response;
1772 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1773 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1778 m_ipcModule.getUint(message, &id);
1780 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(clientPid, id, &width, &height));
1783 response = m_ipcModule.createResponse(message);
1784 m_ipcModule.appendUint(response, width);
1785 m_ipcModule.appendUint(response, height);
1789 response = m_ipcModule.createErrorResponse(message);
1790 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1793 m_ipcModule.sendToClients(response, &clientHandle, 1);
1794 m_ipcModule.destroyMessage(response);
1797 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1799 t_ilm_message response;
1800 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1801 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1805 m_ipcModule.getUint(message, &id);
1806 m_ipcModule.getDouble(message, ¶m);
1808 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(clientPid, id, param));
1811 response = m_ipcModule.createResponse(message);
1815 response = m_ipcModule.createErrorResponse(message);
1816 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1819 m_ipcModule.sendToClients(response, &clientHandle, 1);
1820 m_ipcModule.destroyMessage(response);
1823 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1825 t_ilm_message response;
1826 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1827 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1831 m_ipcModule.getUint(message, &id);
1832 m_ipcModule.getDouble(message, ¶m);
1834 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(clientPid, id, param));
1837 response = m_ipcModule.createResponse(message);
1841 response = m_ipcModule.createErrorResponse(message);
1842 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1845 m_ipcModule.sendToClients(response, &clientHandle, 1);
1846 m_ipcModule.destroyMessage(response);
1849 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1851 t_ilm_message response;
1852 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1853 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1857 m_ipcModule.getUint(message, &id);
1858 m_ipcModule.getDouble(message, ¶m);
1860 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
1863 response = m_ipcModule.createResponse(message);
1867 response = m_ipcModule.createErrorResponse(message);
1868 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1871 m_ipcModule.sendToClients(response, &clientHandle, 1);
1872 m_ipcModule.destroyMessage(response);
1875 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1877 t_ilm_message response;
1878 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1879 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1883 m_ipcModule.getUint(message, &id);
1884 m_ipcModule.getDouble(message, ¶m);
1886 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
1889 response = m_ipcModule.createResponse(message);
1893 response = m_ipcModule.createErrorResponse(message);
1894 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1897 m_ipcModule.sendToClients(response, &clientHandle, 1);
1898 m_ipcModule.destroyMessage(response);
1901 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1903 t_ilm_message response;
1904 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1905 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1909 m_ipcModule.getUint(message, &id);
1911 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(clientPid, id, ¶m));
1914 response = m_ipcModule.createResponse(message);
1915 m_ipcModule.appendDouble(response, param);
1919 response = m_ipcModule.createErrorResponse(message);
1920 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1923 m_ipcModule.sendToClients(response, &clientHandle, 1);
1924 m_ipcModule.destroyMessage(response);
1927 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1929 t_ilm_message response;
1930 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1931 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1935 m_ipcModule.getUint(message, &id);
1937 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(clientPid, id, ¶m));
1940 response = m_ipcModule.createResponse(message);
1941 m_ipcModule.appendDouble(response, param);
1945 response = m_ipcModule.createErrorResponse(message);
1946 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1949 m_ipcModule.sendToClients(response, &clientHandle, 1);
1950 m_ipcModule.destroyMessage(response);
1953 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1955 t_ilm_message response;
1956 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1957 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1960 OrientationType o = Zero;
1962 m_ipcModule.getUint(message, &id);
1963 m_ipcModule.getUint(message, ¶m);
1965 o = (OrientationType) param;
1967 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(clientPid, id, o));
1970 response = m_ipcModule.createResponse(message);
1974 response = m_ipcModule.createErrorResponse(message);
1975 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1978 m_ipcModule.sendToClients(response, &clientHandle, 1);
1979 m_ipcModule.destroyMessage(response);
1982 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
1984 t_ilm_message response;
1985 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1986 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1990 m_ipcModule.getUint(message, &id);
1992 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(clientPid, id, &o));
1995 response = m_ipcModule.createResponse(message);
1996 m_ipcModule.appendUint(response, o);
2000 response = m_ipcModule.createErrorResponse(message);
2001 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2004 m_ipcModule.sendToClients(response, &clientHandle, 1);
2005 m_ipcModule.destroyMessage(response);
2008 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
2010 t_ilm_message response;
2011 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2012 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2015 OrientationType o = Zero;
2017 m_ipcModule.getUint(message, &id);
2018 m_ipcModule.getUint(message, ¶m);
2020 o = (OrientationType) param;
2022 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(clientPid, id, o));
2025 response = m_ipcModule.createResponse(message);
2029 response = m_ipcModule.createErrorResponse(message);
2030 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2033 m_ipcModule.sendToClients(response, &clientHandle, 1);
2034 m_ipcModule.destroyMessage(response);
2037 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
2039 t_ilm_message response;
2040 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2041 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2045 m_ipcModule.getUint(message, &id);
2047 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(clientPid, id, &o));
2050 response = m_ipcModule.createResponse(message);
2051 m_ipcModule.appendUint(response, o);
2055 response = m_ipcModule.createErrorResponse(message);
2056 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2059 m_ipcModule.sendToClients(response, &clientHandle, 1);
2060 m_ipcModule.destroyMessage(response);
2063 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
2065 t_ilm_message response;
2066 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2067 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2069 PixelFormat pixelFormat;
2071 m_ipcModule.getUint(message, &id);
2073 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(clientPid, id, &pixelFormat));
2076 response = m_ipcModule.createResponse(message);
2077 m_ipcModule.appendUint(response, pixelFormat);
2081 response = m_ipcModule.createErrorResponse(message);
2082 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2085 m_ipcModule.sendToClients(response, &clientHandle, 1);
2086 m_ipcModule.destroyMessage(response);
2089 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
2091 t_ilm_message response;
2092 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2093 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2095 t_ilm_bool newVis = ILM_FALSE;
2097 m_ipcModule.getUint(message, &surfaceid);
2098 m_ipcModule.getBool(message, &newVis);
2100 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(clientPid, surfaceid, newVis));
2103 response = m_ipcModule.createResponse(message);
2107 response = m_ipcModule.createErrorResponse(message);
2108 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2111 m_ipcModule.sendToClients(response, &clientHandle, 1);
2112 m_ipcModule.destroyMessage(response);
2115 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
2117 t_ilm_message response;
2118 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2119 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2121 t_ilm_bool myparam = ILM_FALSE;
2123 m_ipcModule.getUint(message, &layerid);
2124 m_ipcModule.getBool(message, &myparam);
2126 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(clientPid, layerid, myparam));
2129 response = m_ipcModule.createResponse(message);
2133 response = m_ipcModule.createErrorResponse(message);
2134 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2137 m_ipcModule.sendToClients(response, &clientHandle, 1);
2138 m_ipcModule.destroyMessage(response);
2141 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
2143 t_ilm_message response;
2144 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2145 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2149 m_ipcModule.getUint(message, &id);
2151 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(clientPid, id, &visibility));
2154 response = m_ipcModule.createResponse(message);
2155 m_ipcModule.appendBool(response, visibility);
2159 response = m_ipcModule.createErrorResponse(message);
2160 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2163 m_ipcModule.sendToClients(response, &clientHandle, 1);
2164 m_ipcModule.destroyMessage(response);
2167 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
2169 t_ilm_message response;
2170 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2171 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2175 m_ipcModule.getUint(message, &id);
2177 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(clientPid, id, &visibility));
2180 response = m_ipcModule.createResponse(message);
2181 m_ipcModule.appendBool(response, visibility);
2185 response = m_ipcModule.createErrorResponse(message);
2186 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2189 m_ipcModule.sendToClients(response, &clientHandle, 1);
2190 m_ipcModule.destroyMessage(response);
2193 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
2195 t_ilm_message response;
2196 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2197 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2199 t_ilm_bool myparam = ILM_FALSE;
2201 m_ipcModule.getUint(message, &groupid);
2202 m_ipcModule.getBool(message, &myparam);
2204 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
2207 response = m_ipcModule.createResponse(message);
2211 response = m_ipcModule.createErrorResponse(message);
2212 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2215 m_ipcModule.sendToClients(response, &clientHandle, 1);
2216 m_ipcModule.destroyMessage(response);
2219 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
2221 t_ilm_message response;
2222 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2223 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2225 t_ilm_bool myparam = ILM_FALSE;
2227 m_ipcModule.getUint(message, &groupid);
2228 m_ipcModule.getBool(message, &myparam);
2230 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
2233 response = m_ipcModule.createResponse(message);
2237 response = m_ipcModule.createErrorResponse(message);
2238 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2241 m_ipcModule.sendToClients(response, &clientHandle, 1);
2242 m_ipcModule.destroyMessage(response);
2246 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
2248 t_ilm_message response;
2249 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2250 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2254 m_ipcModule.getUintArray(message, &array, &length);
2256 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, array, length));
2259 response = m_ipcModule.createResponse(message);
2263 response = m_ipcModule.createErrorResponse(message);
2264 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2267 m_ipcModule.sendToClients(response, &clientHandle, 1);
2268 m_ipcModule.destroyMessage(response);
2271 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2273 t_ilm_message response;
2274 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2275 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2280 m_ipcModule.getUint(message, &layerid);
2281 m_ipcModule.getUintArray(message, &array, &length);
2283 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(clientPid, layerid, array, length));
2286 response = m_ipcModule.createResponse(message);
2290 response = m_ipcModule.createErrorResponse(message);
2291 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2294 m_ipcModule.sendToClients(response, &clientHandle, 1);
2295 m_ipcModule.destroyMessage(response);
2298 void GenericCommunicator::GetLayerType(t_ilm_message message)
2300 t_ilm_message response;
2301 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2303 m_ipcModule.getUint(message, &id);
2305 Layer* layer = m_executor->getScene()->getLayer(id);
2308 response = m_ipcModule.createResponse(message);
2309 m_ipcModule.appendUint(response, layer->getLayerType());
2313 response = m_ipcModule.createErrorResponse(message);
2314 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2317 m_ipcModule.sendToClients(response, &clientHandle, 1);
2318 m_ipcModule.destroyMessage(response);
2321 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2323 t_ilm_message response;
2324 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2326 LayerType type = Unknown;
2328 m_ipcModule.getUint(message, &id);
2330 type = (LayerType) id;
2332 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2333 response = m_ipcModule.createResponse(message);
2334 m_ipcModule.appendUint(response, capabilities);
2335 m_ipcModule.sendToClients(response, &clientHandle, 1);
2336 m_ipcModule.destroyMessage(response);
2339 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2341 t_ilm_message response;
2342 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2344 m_ipcModule.getUint(message, &id);
2346 Layer* layer = m_executor->getScene()->getLayer(id);
2349 response = m_ipcModule.createResponse(message);
2350 m_ipcModule.appendUint(response, layer->getCapabilities());
2354 response = m_ipcModule.createErrorResponse(message);
2355 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2358 m_ipcModule.sendToClients(response, &clientHandle, 1);
2359 m_ipcModule.destroyMessage(response);
2362 void GenericCommunicator::FadeIn(t_ilm_message message)
2364 t_ilm_message response;
2365 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2366 response = m_ipcModule.createErrorResponse(message);
2367 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2368 m_ipcModule.sendToClients(response, &clientHandle, 1);
2369 m_ipcModule.destroyMessage(response);
2372 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2374 t_ilm_message response;
2375 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2376 response = m_ipcModule.createErrorResponse(message);
2377 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2378 m_ipcModule.sendToClients(response, &clientHandle, 1);
2379 m_ipcModule.destroyMessage(response);
2382 void GenericCommunicator::FadeOut(t_ilm_message message)
2384 t_ilm_message response;
2385 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2386 response = m_ipcModule.createErrorResponse(message);
2387 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2388 m_ipcModule.sendToClients(response, &clientHandle, 1);
2389 m_ipcModule.destroyMessage(response);
2392 void GenericCommunicator::Exit(t_ilm_message message)
2394 t_ilm_message response;
2395 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2396 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2397 t_ilm_bool status = m_executor->execute(new ExitCommand(clientPid));
2400 response = m_ipcModule.createResponse(message);
2404 response = m_ipcModule.createErrorResponse(message);
2405 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2408 m_ipcModule.sendToClients(response, &clientHandle, 1);
2409 m_ipcModule.destroyMessage(response);
2412 void GenericCommunicator::CommitChanges(t_ilm_message message)
2414 t_ilm_message response;
2415 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2416 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2417 t_ilm_bool status = m_executor->execute(new CommitCommand(clientPid));
2420 response = m_ipcModule.createResponse(message);
2424 response = m_ipcModule.createErrorResponse(message);
2425 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2428 m_ipcModule.sendToClients(response, &clientHandle, 1);
2429 m_ipcModule.destroyMessage(response);
2432 void GenericCommunicator::CreateShader(t_ilm_message message)
2434 t_ilm_message response;
2435 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2436 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2437 char vertname[1024];
2438 char fragname[1024];
2441 m_ipcModule.getString(message, vertname);
2442 m_ipcModule.getString(message, fragname);
2444 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(clientPid, vertname, fragname, &id));
2447 response = m_ipcModule.createResponse(message);
2448 m_ipcModule.appendUint(response, id);
2452 response = m_ipcModule.createErrorResponse(message);
2453 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2456 m_ipcModule.sendToClients(response, &clientHandle, 1);
2457 m_ipcModule.destroyMessage(response);
2460 void GenericCommunicator::DestroyShader(t_ilm_message message)
2462 t_ilm_message response;
2463 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2464 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2467 m_ipcModule.getUint(message, &shaderid);
2469 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(clientPid, shaderid));
2472 response = m_ipcModule.createResponse(message);
2476 response = m_ipcModule.createErrorResponse(message);
2477 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2480 m_ipcModule.sendToClients(response, &clientHandle, 1);
2481 m_ipcModule.destroyMessage(response);
2484 void GenericCommunicator::SetShader(t_ilm_message message)
2486 t_ilm_message response;
2487 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2488 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2492 m_ipcModule.getUint(message, &surfaceId);
2493 m_ipcModule.getUint(message, &shaderid);
2495 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(clientPid, surfaceId, shaderid));
2498 response = m_ipcModule.createResponse(message);
2502 response = m_ipcModule.createErrorResponse(message);
2503 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2506 m_ipcModule.sendToClients(response, &clientHandle, 1);
2507 m_ipcModule.destroyMessage(response);
2510 void GenericCommunicator::SetUniforms(t_ilm_message message)
2512 t_ilm_message response;
2513 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2514 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2516 std::vector<string> uniforms;
2518 m_ipcModule.getUint(message, &id);
2521 //m_ipcModule.getStringArray(&uniforms);
2523 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(clientPid, id, uniforms));
2526 response = m_ipcModule.createResponse(message);
2530 response = m_ipcModule.createErrorResponse(message);
2531 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2534 m_ipcModule.sendToClients(response, &clientHandle, 1);
2535 m_ipcModule.destroyMessage(response);
2538 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2540 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2541 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2542 t_ilm_message response;
2545 m_ipcModule.getUint(message, &surfaceId);
2547 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(clientPid, surfaceId));
2550 response = m_ipcModule.createResponse(message);
2554 response = m_ipcModule.createErrorResponse(message);
2555 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2558 m_ipcModule.sendToClients(response, &clientHandle, 1);
2559 m_ipcModule.destroyMessage(response);
2563 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2565 t_ilm_message response;
2566 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2567 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2570 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(clientPid, &surfaceId));
2573 response = m_ipcModule.createResponse(message);
2574 m_ipcModule.appendUint(response, surfaceId);
2578 response = m_ipcModule.createErrorResponse(message);
2579 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2582 m_ipcModule.sendToClients(response, &clientHandle, 1);
2583 m_ipcModule.destroyMessage(response);
2587 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2589 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2590 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2591 t_ilm_message response;
2594 InputDevice devices;
2597 m_ipcModule.getUint(message, &surfaceId);
2598 m_ipcModule.getUint(message, &udevices);
2599 m_ipcModule.getBool(message, &accept);
2601 devices = (InputDevice) udevices;
2603 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(clientPid, surfaceId, devices, accept));
2606 response = m_ipcModule.createResponse(message);
2610 response = m_ipcModule.createErrorResponse(message);
2611 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2614 m_ipcModule.sendToClients(response, &clientHandle, 1);
2615 m_ipcModule.destroyMessage(response);
2618 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2620 t_ilm_message response;
2621 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2622 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2627 m_ipcModule.getUint(message, &surfaceid);
2628 m_ipcModule.getUintArray(message, &array, &length);
2630 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(clientPid, surfaceid, array, length));
2633 response = m_ipcModule.createResponse(message);
2637 response = m_ipcModule.createErrorResponse(message);
2638 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2641 m_ipcModule.sendToClients(response, &clientHandle, 1);
2642 m_ipcModule.destroyMessage(response);
2645 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2647 t_ilm_message response;
2648 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2649 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2654 m_ipcModule.getUint(message, &layerid);
2655 m_ipcModule.getUintArray(message, &array, &length);
2657 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(clientPid, layerid, array, length));
2660 response = m_ipcModule.createResponse(message);
2664 response = m_ipcModule.createErrorResponse(message);
2665 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2668 m_ipcModule.sendToClients(response, &clientHandle, 1);
2669 m_ipcModule.destroyMessage(response);
2672 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2674 t_ilm_message response;
2675 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2678 m_ipcModule.getUint(message, &layerid);
2680 Layer* layer = m_executor->getScene()->getLayer(layerid);
2683 layer->addNotification(clientHandle);
2684 response = m_ipcModule.createResponse(message);
2688 response = m_ipcModule.createErrorResponse(message);
2689 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2692 m_ipcModule.sendToClients(response, &clientHandle, 1);
2693 m_ipcModule.destroyMessage(response);
2696 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2698 t_ilm_message response;
2699 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2702 m_ipcModule.getUint(message, &surfaceid);
2704 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2707 surface->addNotification(clientHandle);
2708 response = m_ipcModule.createResponse(message);
2712 response = m_ipcModule.createErrorResponse(message);
2713 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2716 m_ipcModule.sendToClients(response, &clientHandle, 1);
2717 m_ipcModule.destroyMessage(response);
2720 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2722 t_ilm_message response;
2723 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2726 m_ipcModule.getUint(message, &layerid);
2728 Layer* layer = m_executor->getScene()->getLayer(layerid);
2731 layer->removeNotification(clientHandle);
2732 response = m_ipcModule.createResponse(message);
2736 response = m_ipcModule.createErrorResponse(message);
2737 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2740 m_ipcModule.sendToClients(response, &clientHandle, 1);
2741 m_ipcModule.destroyMessage(response);
2744 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2746 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2747 t_ilm_message response;
2750 m_ipcModule.getUint(message, &surfaceid);
2752 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2755 surface->removeNotification(clientHandle);
2756 response = m_ipcModule.createResponse(message);
2760 response = m_ipcModule.createErrorResponse(message);
2761 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2764 m_ipcModule.sendToClients(response, &clientHandle, 1);
2765 m_ipcModule.destroyMessage(response);
2768 void GenericCommunicator::processNotificationQueue()
2770 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2771 NotificationQueue::iterator iter = notificationQueue.begin();
2772 NotificationQueue::iterator end = notificationQueue.end();
2774 for (; iter != end; ++iter)
2776 GraphicalObject* object = iter->first;
2777 t_ilm_notification_mask mask = iter->second;
2778 sendNotification(object, mask);
2780 notificationQueue.clear();
2783 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2785 switch (object->type)
2789 Layer* layer = static_cast<Layer*>(object);
2792 ApplicationReferenceList& arl = layer->getNotificationClients();
2796 t_ilm_message notification;
2797 Rectangle dest = layer->getDestinationRegion();
2798 Rectangle src = layer->getSourceRegion();
2799 OrientationType orientation = layer->getOrientation();
2801 unsigned char chromaKeyRed = 0;
2802 unsigned char chromaKeyGreen = 0;
2803 unsigned char chromaKeyBlue = 0;
2804 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2806 std::stringstream notificationName;
2807 notificationName << "NotificationForLayer" << layer->getID();
2809 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2810 m_ipcModule.appendUint(notification, layer->getID());
2811 m_ipcModule.appendUint(notification, mask);
2813 m_ipcModule.appendDouble(notification, layer->getOpacity());
2814 m_ipcModule.appendUint(notification, src.x);
2815 m_ipcModule.appendUint(notification, src.y);
2816 m_ipcModule.appendUint(notification, src.width);
2817 m_ipcModule.appendUint(notification, src.height);
2818 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2819 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2820 m_ipcModule.appendUint(notification, dest.x);
2821 m_ipcModule.appendUint(notification, dest.y);
2822 m_ipcModule.appendUint(notification, dest.width);
2823 m_ipcModule.appendUint(notification, dest.height);
2824 m_ipcModule.appendUint(notification, orientation);
2825 m_ipcModule.appendBool(notification, layer->getVisibility());
2826 m_ipcModule.appendUint(notification, layer->getLayerType());
2827 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2828 m_ipcModule.appendUint(notification, chromaKeyRed);
2829 m_ipcModule.appendUint(notification, chromaKeyGreen);
2830 m_ipcModule.appendUint(notification, chromaKeyBlue);
2831 m_ipcModule.appendInt(notification, layer->getCreatorPid());
2833 int clientCount = arl.size();
2834 t_ilm_client_handle clientArray[256];
2836 ApplicationReferenceList::iterator iter = arl.begin();
2837 ApplicationReferenceList::iterator end = arl.end();
2839 for (int clientNumber = 0;
2840 iter != end, clientNumber < 256;
2841 ++iter, ++clientNumber)
2843 t_ilm_client_handle client = *iter;
2844 clientArray[clientNumber] = client;
2847 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2849 if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
2851 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2854 m_ipcModule.destroyMessage(notification);
2861 Surface* surface = static_cast<Surface*>(object);
2864 ApplicationReferenceList& arl = surface->getNotificationClients();
2868 t_ilm_message notification;
2869 std::stringstream notificationName;
2870 notificationName << "NotificationForSurface" << surface->getID();
2872 unsigned char chromaKeyRed = 0;
2873 unsigned char chromaKeyGreen = 0;
2874 unsigned char chromaKeyBlue = 0;
2875 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2877 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2878 m_ipcModule.appendUint(notification, surface->getID());
2879 m_ipcModule.appendUint(notification, mask);
2881 m_ipcModule.appendDouble(notification, surface->getOpacity());
2882 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2883 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2884 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2885 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2886 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2887 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2888 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2889 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2890 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2891 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2892 m_ipcModule.appendUint(notification, surface->getOrientation());
2893 m_ipcModule.appendBool(notification, surface->getVisibility());
2894 m_ipcModule.appendUint(notification, surface->frameCounter);
2895 m_ipcModule.appendUint(notification, surface->drawCounter);
2896 m_ipcModule.appendUint(notification, surface->updateCounter);
2897 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2898 m_ipcModule.appendUint(notification, surface->getNativeContent());
2899 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2900 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2901 m_ipcModule.appendUint(notification, chromaKeyRed);
2902 m_ipcModule.appendUint(notification, chromaKeyGreen);
2903 m_ipcModule.appendUint(notification, chromaKeyBlue);
2904 m_ipcModule.appendInt(notification, surface->getCreatorPid());
2906 int clientCount = arl.size();
2907 t_ilm_client_handle clients[256];
2909 ApplicationReferenceList::iterator iter = arl.begin();
2910 ApplicationReferenceList::iterator end = arl.end();
2912 for (int clientNumber = 0;
2913 iter != end, clientNumber < 256;
2914 ++iter, ++clientNumber)
2916 clients[clientNumber] = *iter;
2919 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2921 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2923 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2926 m_ipcModule.destroyMessage(notification);
2932 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2937 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
2939 return new GenericCommunicator(executor);
2942 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)