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"
87 #include "SetOptimizationModeCommand.h"
88 #include "GetOptimizationModeCommand.h"
98 #define DEFAULT_SCREEN 0
100 const char* RESOURCE_ALREADY_INUSE = "Ressource already in use";
101 const char* INVALID_ARGUMENT = "Invalid argument";
102 const char* RESOURCE_NOT_FOUND = "Ressource not found";
103 const char* NOT_IMPLEMENTED = "Feature not implemented";
106 GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
107 : ICommunicator(executor)
108 , m_running(ILM_FALSE)
110 MethodTable manager_methods[] =
112 { "ServiceConnect", &GenericCommunicator::ServiceConnect },
113 { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
114 { "Debug", &GenericCommunicator::Debug },
115 { "ScreenShot", &GenericCommunicator::ScreenShot },
116 { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
117 { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
118 { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
119 { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
120 { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
121 { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
122 { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
123 { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
124 { "ListAllLayerGroupIDS", &GenericCommunicator::ListAllLayerGroupIDS },
125 { "ListAllSurfaceGroupIDS", &GenericCommunicator::ListAllSurfaceGroupIDS },
126 { "ListSurfacesOfSurfacegroup", &GenericCommunicator::ListSurfacesOfSurfacegroup },
127 { "ListLayersOfLayergroup", &GenericCommunicator::ListLayersOfLayergroup },
128 { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
129 { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
130 { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
131 { "CreateSurface", &GenericCommunicator::CreateSurface },
132 { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
133 { "InitializeSurface", &GenericCommunicator::InitializeSurface },
134 { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
135 { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
136 { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
137 { "RemoveSurface", &GenericCommunicator::RemoveSurface },
138 { "CreateLayer", &GenericCommunicator::CreateLayer },
139 { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
140 { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
141 { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
142 { "RemoveLayer", &GenericCommunicator::RemoveLayer },
143 { "AddSurfaceToSurfaceGroup", &GenericCommunicator::AddSurfaceToSurfaceGroup },
144 { "RemoveSurfaceFromSurfaceGroup", &GenericCommunicator::RemoveSurfaceFromSurfaceGroup },
145 { "AddLayerToLayerGroup", &GenericCommunicator::AddLayerToLayerGroup },
146 { "RemoveLayerFromLayerGroup", &GenericCommunicator::RemoveLayerFromLayerGroup },
147 { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
148 { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
149 { "CreateSurfaceGroup", &GenericCommunicator::CreateSurfaceGroup },
150 { "CreateSurfaceGroupFromId", &GenericCommunicator::CreateSurfaceGroupFromId },
151 { "RemoveSurfaceGroup", &GenericCommunicator::RemoveSurfaceGroup },
152 { "CreateLayerGroup", &GenericCommunicator::CreateLayerGroup },
153 { "CreateLayerGroupFromId", &GenericCommunicator::CreateLayerGroupFromId },
154 { "RemoveLayerGroup", &GenericCommunicator::RemoveLayerGroup },
155 { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
156 { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
157 { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
158 { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
159 { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
160 { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
161 { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
162 { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
163 { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
164 { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
165 { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
166 { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
167 { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
168 { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
169 { "SetSurfacegroupOpacity", &GenericCommunicator::SetSurfacegroupOpacity },
170 { "SetLayergroupOpacity", &GenericCommunicator::SetLayergroupOpacity },
171 { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
172 { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
173 { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
174 { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
175 { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
176 { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
177 { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
178 { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
179 { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
180 { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
181 { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
182 { "SetSurfacegroupVisibility", &GenericCommunicator::SetSurfacegroupVisibility },
183 { "SetLayergroupVisibility", &GenericCommunicator::SetLayergroupVisibility },
184 { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
185 { "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
186 { "GetLayerType", &GenericCommunicator::GetLayerType },
187 { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
188 { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
189 { "Exit", &GenericCommunicator::Exit },
190 { "CommitChanges", &GenericCommunicator::CommitChanges },
191 { "CreateShader", &GenericCommunicator::CreateShader },
192 { "DestroyShader", &GenericCommunicator::DestroyShader },
193 { "SetShader", &GenericCommunicator::SetShader },
194 { "SetUniforms", &GenericCommunicator::SetUniforms },
195 { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
196 { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
197 { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
198 { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
199 { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
200 { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
201 { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
202 { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
203 { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification },
204 { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode },
205 { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode }
208 int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
210 for (int index = 0; index < entryCount; ++index)
212 MethodTable* method = &manager_methods[index];
213 if (method->function)
215 m_callBackTable[method->name] = *method;
216 LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
220 memset(&m_ipcModule, 0, sizeof(m_ipcModule));
222 mThreadId = pthread_self();
225 bool GenericCommunicator::start()
227 LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
229 if (!loadIpcModule(&m_ipcModule))
231 LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
234 LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
236 if (!m_ipcModule.initServiceMode())
238 LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
241 LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
243 m_running = ILM_TRUE;
244 setHealth(HealthRunning);
249 void GenericCommunicator::stop()
251 LOG_INFO("GenericCommunicator","stopping");
255 m_ipcModule.destroy();
257 setHealth(HealthStopped);
260 void GenericCommunicator::process(int timeout_ms)
262 t_ilm_message message = m_ipcModule.receive(timeout_ms);
268 t_ilm_message_type messageType = m_ipcModule.getMessageType(message);
269 t_ilm_const_string name = m_ipcModule.getMessageName(message);
270 t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
274 case IpcMessageTypeCommand:
275 if (m_callBackTable.end() != m_callBackTable.find(name))
277 LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
278 << m_executor->getSenderName(senderHandle)
279 << "(" << m_executor->getSenderPid(senderHandle) << ")");
280 CallBackMethod method = m_callBackTable[name].function;
281 (this->*method)(message);
285 LOG_WARNING("GenericCommunicator", "Received unknown command " << name
286 << " from " << m_executor->getSenderName(senderHandle)
287 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
289 processNotificationQueue();
292 case IpcMessageTypeConnect:
293 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
294 << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
297 case IpcMessageTypeDisconnect:
298 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
299 << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
301 const LayerMap& layers = m_executor->getScene()->getAllLayers();
302 LayerMapConstIterator layerIter = layers.begin();
303 LayerMapConstIterator layerIterEnd = layers.end();
304 for (; layerIter != layerIterEnd; ++layerIter)
306 Layer* layer = layerIter->second;
307 layer->removeNotification(senderHandle);
310 const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
311 SurfaceMapConstIterator surfaceIter = surfaces.begin();
312 SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
313 for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
315 Surface* surface = surfaceIter->second;
316 surface->removeNotification(senderHandle);
321 case IpcMessageTypeError:
322 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
323 << m_executor->getSenderName(senderHandle)
324 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
327 case IpcMessageTypeShutdown:
328 case IpcMessageTypeNone:
332 LOG_DEBUG("GenericCommunicator", "Received unknown data from "
333 << m_executor->getSenderName(senderHandle)
334 << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
337 m_ipcModule.destroyMessage(message);
340 void GenericCommunicator::setdebug(bool onoff)
342 (void)onoff; // TODO: remove, only prevents warning
345 void GenericCommunicator::ServiceConnect(t_ilm_message message)
347 LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
349 t_ilm_message response;
350 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
352 unsigned int processId = 0;
353 char processName[1024];
354 m_ipcModule.getUint(message, &processId);
355 m_ipcModule.getString(message, processName);
357 m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
359 response = m_ipcModule.createResponse(message);
360 m_ipcModule.sendToClients(response, &clientHandle, 1);
361 m_ipcModule.destroyMessage(response);
364 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
366 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
368 t_ilm_message response;
369 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
371 m_executor->removeApplicationReference(clientHandle);
373 response = m_ipcModule.createResponse(message);
374 m_ipcModule.sendToClients(response, &clientHandle, 1);
375 m_ipcModule.destroyMessage(response);
378 void GenericCommunicator::Debug(t_ilm_message message)
380 t_ilm_message response;
381 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
382 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
383 t_ilm_bool param = ILM_FALSE;
384 m_ipcModule.getBool(message, ¶m);
386 t_ilm_bool status = m_executor->execute(new DebugCommand(clientPid, param));
389 response = m_ipcModule.createResponse(message);
393 response = m_ipcModule.createErrorResponse(message);
394 m_ipcModule.appendString(response, INVALID_ARGUMENT);
397 m_ipcModule.sendToClients(response, &clientHandle, 1);
398 m_ipcModule.destroyMessage(response);
401 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
403 t_ilm_message response;
404 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
406 m_ipcModule.getUint(message, &screenid);
407 uint* resolution = m_executor->getScreenResolution(screenid);
409 response = m_ipcModule.createResponse(message);
410 m_ipcModule.appendUint(response, resolution[0]);
411 m_ipcModule.appendUint(response, resolution[1]);
412 m_ipcModule.sendToClients(response, &clientHandle, 1);
413 m_ipcModule.destroyMessage(response);
416 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
418 t_ilm_message response;
419 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
421 m_ipcModule.getUint(message, &screenid);
422 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
423 response = m_ipcModule.createResponse(message);
424 m_ipcModule.appendUint(response, numberOfHardwareLayers);
425 m_ipcModule.sendToClients(response, &clientHandle, 1);
426 m_ipcModule.destroyMessage(response);
429 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
431 t_ilm_message response;
432 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
434 uint* IDs = m_executor->getScreenIDs(&length);
435 response = m_ipcModule.createResponse(message);
436 m_ipcModule.appendUintArray(response, IDs, length);
437 m_ipcModule.sendToClients(response, &clientHandle, 1);
438 m_ipcModule.destroyMessage(response);
441 void GenericCommunicator::ScreenShot(t_ilm_message message)
443 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
444 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
445 t_ilm_message response;
449 m_ipcModule.getUint(message, &screenid);
450 m_ipcModule.getString(message, filename);
452 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(clientPid, filename, screenid));
455 response = m_ipcModule.createResponse(message);
459 response = m_ipcModule.createErrorResponse(message);
460 m_ipcModule.appendString(response, INVALID_ARGUMENT);
463 m_ipcModule.sendToClients(response, &clientHandle, 1);
464 m_ipcModule.destroyMessage(response);
467 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
469 t_ilm_message response;
470 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
471 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
473 m_ipcModule.getString(message, filename);
475 m_ipcModule.getUint(message, &layerid);
477 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(clientPid, filename, layerid));
480 response = m_ipcModule.createResponse(message);
484 response = m_ipcModule.createErrorResponse(message);
485 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
488 m_ipcModule.sendToClients(response, &clientHandle, 1);
489 m_ipcModule.destroyMessage(response);
492 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
494 t_ilm_message response;
495 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
496 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
498 m_ipcModule.getString(message, filename);
500 m_ipcModule.getUint(message, &id);
501 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(clientPid, filename, id));
504 response = m_ipcModule.createResponse(message);
508 response = m_ipcModule.createErrorResponse(message);
509 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
512 m_ipcModule.sendToClients(response, &clientHandle, 1);
513 m_ipcModule.destroyMessage(response);
516 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
518 t_ilm_message response;
519 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
522 m_executor->getScene()->lockScene();
523 m_executor->getScene()->getLayerIDs(&length, &array);
524 m_executor->getScene()->unlockScene();
525 response = m_ipcModule.createResponse(message);
526 m_ipcModule.appendUintArray(response, array, length);
527 m_ipcModule.sendToClients(response, &clientHandle, 1);
528 m_ipcModule.destroyMessage(response);
531 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
533 t_ilm_message response;
534 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
536 m_ipcModule.getUint(message, &screenID);
540 m_executor->getScene()->lockScene();
541 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
542 m_executor->getScene()->unlockScene();
545 response = m_ipcModule.createResponse(message);
546 m_ipcModule.appendUintArray(response, array, length);
550 response = m_ipcModule.createErrorResponse(message);
551 m_ipcModule.appendString(response, INVALID_ARGUMENT);
554 m_ipcModule.sendToClients(response, &clientHandle, 1);
555 m_ipcModule.destroyMessage(response);
558 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
560 t_ilm_message response;
561 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
564 m_executor->getScene()->lockScene();
565 m_executor->getScene()->getSurfaceIDs(&length, &array);
566 m_executor->getScene()->unlockScene();
567 response = m_ipcModule.createResponse(message);
568 m_ipcModule.appendUintArray(response, array, length);
569 m_ipcModule.sendToClients(response, &clientHandle, 1);
570 m_ipcModule.destroyMessage(response);
573 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
575 t_ilm_message response;
576 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
579 m_executor->getScene()->lockScene();
580 m_executor->getScene()->getLayerGroupIDs(&length, &array);
581 m_executor->getScene()->unlockScene();
582 response = m_ipcModule.createResponse(message);
583 m_ipcModule.appendUintArray(response, array, length);
584 m_ipcModule.sendToClients(response, &clientHandle, 1);
585 m_ipcModule.destroyMessage(response);
588 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
590 t_ilm_message response;
591 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
594 m_executor->getScene()->lockScene();
595 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
596 m_executor->getScene()->unlockScene();
597 response = m_ipcModule.createResponse(message);
598 m_ipcModule.appendUintArray(response, array, length);
599 m_ipcModule.sendToClients(response, &clientHandle, 1);
600 m_ipcModule.destroyMessage(response);
603 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
605 t_ilm_message response;
606 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
608 m_ipcModule.getUint(message, &id);
609 m_executor->getScene()->lockScene();
610 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
613 std::list<Surface*> surfaces = sg->getList();
614 uint length = surfaces.size();
615 uint* array = new uint[length];
618 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
621 array[arrayPos] = s->getID();
624 m_executor->getScene()->unlockScene();
626 response = m_ipcModule.createResponse(message);
627 m_ipcModule.appendUintArray(response, array, length);
631 m_executor->getScene()->unlockScene();
632 response = m_ipcModule.createErrorResponse(message);
633 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
636 m_ipcModule.sendToClients(response, &clientHandle, 1);
637 m_ipcModule.destroyMessage(response);
640 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
642 t_ilm_message response;
643 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
645 m_ipcModule.getUint(message, &id);
646 m_executor->getScene()->lockScene();
647 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
650 std::list<Layer*> layers = sg->getList();
652 uint length = layers.size();
653 uint* array = new uint[length];
656 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
659 array[arrayPos] = l->getID();
662 m_executor->getScene()->unlockScene();
664 response = m_ipcModule.createResponse(message);
665 m_ipcModule.appendUintArray(response, array, length);
669 m_executor->getScene()->unlockScene();
670 response = m_ipcModule.createErrorResponse(message);
671 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
674 m_ipcModule.sendToClients(response, &clientHandle, 1);
675 m_ipcModule.destroyMessage(response);
678 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
680 t_ilm_message response;
681 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
683 m_ipcModule.getUint(message, &id);
684 m_executor->getScene()->lockScene();
685 Layer* layer = m_executor->getScene()->getLayer(id);
688 std::list<Surface*> surfaces = layer->getAllSurfaces();
690 uint length = surfaces.size();
691 uint* array = new uint[length];
694 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
697 array[arrayPos] = s->getID();
700 m_executor->getScene()->unlockScene();
702 response = m_ipcModule.createResponse(message);
703 m_ipcModule.appendUintArray(response, array, length);
707 m_executor->getScene()->unlockScene();
708 response = m_ipcModule.createErrorResponse(message);
709 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
712 m_ipcModule.sendToClients(response, &clientHandle, 1);
713 m_ipcModule.destroyMessage(response);
716 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
718 t_ilm_message response;
719 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
721 m_ipcModule.getUint(message, &id);
723 Surface* surface = m_executor->getScene()->getSurface(id);
726 Rectangle dest = surface->getDestinationRegion();
727 Rectangle src = surface->getSourceRegion();
728 OrientationType orientation = surface->getOrientation();
729 unsigned char chromaKeyRed = 0;
730 unsigned char chromaKeyGreen = 0;
731 unsigned char chromaKeyBlue = 0;
732 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
734 response = m_ipcModule.createResponse(message);
735 m_ipcModule.appendDouble(response, surface->getOpacity());
736 m_ipcModule.appendUint(response, src.x);
737 m_ipcModule.appendUint(response, src.y);
738 m_ipcModule.appendUint(response, src.width);
739 m_ipcModule.appendUint(response, src.height);
740 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
741 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
742 m_ipcModule.appendUint(response, dest.x);
743 m_ipcModule.appendUint(response, dest.y);
744 m_ipcModule.appendUint(response, dest.width);
745 m_ipcModule.appendUint(response, dest.height);
746 m_ipcModule.appendUint(response, orientation);
747 m_ipcModule.appendBool(response, surface->getVisibility());
748 m_ipcModule.appendUint(response, surface->frameCounter);
749 m_ipcModule.appendUint(response, surface->drawCounter);
750 m_ipcModule.appendUint(response, surface->updateCounter);
751 m_ipcModule.appendUint(response, surface->getPixelFormat());
752 m_ipcModule.appendUint(response, surface->getNativeContent());
753 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
754 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
755 m_ipcModule.appendUint(response, chromaKeyRed);
756 m_ipcModule.appendUint(response, chromaKeyGreen);
757 m_ipcModule.appendUint(response, chromaKeyBlue);
758 m_ipcModule.appendInt(response, surface->getCreatorPid());
762 response = m_ipcModule.createErrorResponse(message);
763 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
766 m_ipcModule.sendToClients(response, &clientHandle, 1);
767 m_ipcModule.destroyMessage(response);
770 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
772 t_ilm_message response;
773 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
775 m_ipcModule.getUint(message, &id);
777 Layer* layer = m_executor->getScene()->getLayer(id);
780 Rectangle dest = layer->getDestinationRegion();
781 Rectangle src = layer->getSourceRegion();
782 OrientationType orientation = layer->getOrientation();
783 unsigned char chromaKeyRed = 0;
784 unsigned char chromaKeyGreen = 0;
785 unsigned char chromaKeyBlue = 0;
786 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
788 response = m_ipcModule.createResponse(message);
789 m_ipcModule.appendDouble(response, layer->getOpacity());
790 m_ipcModule.appendUint(response, src.x);
791 m_ipcModule.appendUint(response, src.y);
792 m_ipcModule.appendUint(response, src.width);
793 m_ipcModule.appendUint(response, src.height);
794 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
795 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
796 m_ipcModule.appendUint(response, dest.x);
797 m_ipcModule.appendUint(response, dest.y);
798 m_ipcModule.appendUint(response, dest.width);
799 m_ipcModule.appendUint(response, dest.height);
800 m_ipcModule.appendUint(response, orientation);
801 m_ipcModule.appendBool(response, layer->getVisibility());
802 m_ipcModule.appendUint(response, layer->getLayerType());
803 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
804 m_ipcModule.appendUint(response, chromaKeyRed);
805 m_ipcModule.appendUint(response, chromaKeyGreen);
806 m_ipcModule.appendUint(response, chromaKeyBlue);
807 m_ipcModule.appendInt(response, layer->getCreatorPid());
811 response = m_ipcModule.createErrorResponse(message);
812 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
815 m_ipcModule.sendToClients(response, &clientHandle, 1);
816 m_ipcModule.destroyMessage(response);
819 void GenericCommunicator::CreateSurface(t_ilm_message message)
821 t_ilm_message response;
822 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
823 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
827 uint pixelformat = 0;
828 PixelFormat pf = PIXELFORMAT_UNKNOWN;
829 uint id = GraphicalObject::INVALID_ID;
831 m_ipcModule.getUint(message, &handle);
832 m_ipcModule.getUint(message, &width);
833 m_ipcModule.getUint(message, &height);
834 m_ipcModule.getUint(message, &pixelformat);
836 pf = (PixelFormat) pixelformat;
839 // First of all create the surface
840 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
842 // after that apply the native content
843 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
847 response = m_ipcModule.createResponse(message);
848 m_ipcModule.appendUint(response, id);
852 response = m_ipcModule.createErrorResponse(message);
853 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
856 m_ipcModule.sendToClients(response, &clientHandle, 1);
857 m_ipcModule.destroyMessage(response);
860 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
862 t_ilm_message response;
863 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
864 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
868 uint pixelformat = 0;
869 PixelFormat pf = PIXELFORMAT_UNKNOWN;
872 m_ipcModule.getUint(message, &handle);
873 m_ipcModule.getUint(message, &width);
874 m_ipcModule.getUint(message, &height);
875 m_ipcModule.getUint(message, &pixelformat);
876 m_ipcModule.getUint(message, &id);
878 pf = (PixelFormat) pixelformat;
880 // First of all create the surface
881 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
883 // after that apply the native content
884 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
888 response = m_ipcModule.createResponse(message);
889 m_ipcModule.appendUint(response, id);
893 response = m_ipcModule.createErrorResponse(message);
894 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
897 m_ipcModule.sendToClients(response, &clientHandle, 1);
898 m_ipcModule.destroyMessage(response);
901 void GenericCommunicator::InitializeSurface(t_ilm_message message)
903 t_ilm_message response;
904 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
905 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
906 uint id = GraphicalObject::INVALID_ID;
908 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
911 response = m_ipcModule.createResponse(message);
912 m_ipcModule.appendUint(response, id);
916 response = m_ipcModule.createErrorResponse(message);
917 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
920 m_ipcModule.sendToClients(response, &clientHandle, 1);
921 m_ipcModule.destroyMessage(response);
924 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
926 t_ilm_message response;
927 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
928 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
930 m_ipcModule.getUint(message, &id);
931 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
934 response = m_ipcModule.createResponse(message);
935 m_ipcModule.appendUint(response, id);
939 response = m_ipcModule.createErrorResponse(message);
940 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
943 m_ipcModule.sendToClients(response, &clientHandle, 1);
944 m_ipcModule.destroyMessage(response);
947 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
949 t_ilm_message response;
950 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
951 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
956 uint pixelformat = 0;
957 PixelFormat pf = PIXELFORMAT_UNKNOWN;
959 m_ipcModule.getUint(message, &id);
960 m_ipcModule.getUint(message, &handle);
961 m_ipcModule.getUint(message, &width);
962 m_ipcModule.getUint(message, &height);
963 m_ipcModule.getUint(message, &pixelformat);
965 pf = (PixelFormat) pixelformat;
967 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
970 response = m_ipcModule.createResponse(message);
974 response = m_ipcModule.createErrorResponse(message);
975 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
978 m_ipcModule.sendToClients(response, &clientHandle, 1);
979 m_ipcModule.destroyMessage(response);
982 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
984 t_ilm_message response;
985 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
986 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
988 m_ipcModule.getUint(message, &id);
990 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(clientPid, id));
993 response = m_ipcModule.createResponse(message);
997 response = m_ipcModule.createErrorResponse(message);
998 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1001 m_ipcModule.sendToClients(response, &clientHandle, 1);
1002 m_ipcModule.destroyMessage(response);
1005 void GenericCommunicator::RemoveSurface(t_ilm_message message)
1007 t_ilm_message response;
1008 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1009 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1011 m_ipcModule.getUint(message, ¶m);
1012 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(clientPid, param));
1015 response = m_ipcModule.createResponse(message);
1019 response = m_ipcModule.createErrorResponse(message);
1020 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1023 m_ipcModule.sendToClients(response, &clientHandle, 1);
1024 m_ipcModule.destroyMessage(response);
1027 void GenericCommunicator::CreateLayer(t_ilm_message message)
1029 t_ilm_message response;
1030 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1031 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1032 uint id = GraphicalObject::INVALID_ID;
1033 // use resolution of default screen as default width and height of layers
1034 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1035 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1038 response = m_ipcModule.createResponse(message);
1039 m_ipcModule.appendUint(response, id);
1043 response = m_ipcModule.createErrorResponse(message);
1044 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1047 m_ipcModule.sendToClients(response, &clientHandle, 1);
1048 m_ipcModule.destroyMessage(response);
1051 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
1053 t_ilm_message response;
1054 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1055 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1056 uint id = GraphicalObject::INVALID_ID;
1058 m_ipcModule.getUint(message, &id);
1059 // use resolution of default screen as default width and height of layers
1060 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1061 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1064 response = m_ipcModule.createResponse(message);
1065 m_ipcModule.appendUint(response, id);
1069 response = m_ipcModule.createErrorResponse(message);
1070 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1073 m_ipcModule.sendToClients(response, &clientHandle, 1);
1074 m_ipcModule.destroyMessage(response);
1078 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
1080 t_ilm_message response;
1081 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1082 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1084 m_ipcModule.getUint(message, &width);
1086 m_ipcModule.getUint(message, &height);
1088 uint id = GraphicalObject::INVALID_ID;
1089 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1092 response = m_ipcModule.createResponse(message);
1093 m_ipcModule.appendUint(response, id);
1097 response = m_ipcModule.createErrorResponse(message);
1098 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1101 m_ipcModule.sendToClients(response, &clientHandle, 1);
1102 m_ipcModule.destroyMessage(response);
1105 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1107 t_ilm_message response;
1108 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1109 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1110 uint id = GraphicalObject::INVALID_ID;
1113 t_ilm_bool status = ILM_FALSE;
1115 m_ipcModule.getUint(message, &id);
1116 m_ipcModule.getUint(message, &width);
1117 m_ipcModule.getUint(message, &height);
1119 status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1122 response = m_ipcModule.createResponse(message);
1123 m_ipcModule.appendUint(response, id);
1127 response = m_ipcModule.createErrorResponse(message);
1128 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1131 m_ipcModule.sendToClients(response, &clientHandle, 1);
1132 m_ipcModule.destroyMessage(response);
1135 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1137 t_ilm_message response;
1138 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1139 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1141 m_ipcModule.getUint(message, ¶m);
1142 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(clientPid, param));
1145 response = m_ipcModule.createResponse(message);
1149 response = m_ipcModule.createErrorResponse(message);
1150 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1153 m_ipcModule.sendToClients(response, &clientHandle, 1);
1154 m_ipcModule.destroyMessage(response);
1157 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1159 t_ilm_message response;
1160 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1161 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1163 uint surfacegroupid = 0;
1165 m_ipcModule.getUint(message, &surfaceid);
1166 m_ipcModule.getUint(message, &surfacegroupid);
1168 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1171 response = m_ipcModule.createResponse(message);
1175 response = m_ipcModule.createErrorResponse(message);
1176 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1179 m_ipcModule.sendToClients(response, &clientHandle, 1);
1180 m_ipcModule.destroyMessage(response);
1183 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1185 t_ilm_message response;
1186 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1187 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1189 uint surfacegroupid = 0;
1191 m_ipcModule.getUint(message, &surfaceid);
1192 m_ipcModule.getUint(message, &surfacegroupid);
1194 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1197 response = m_ipcModule.createResponse(message);
1201 response = m_ipcModule.createErrorResponse(message);
1202 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1205 m_ipcModule.sendToClients(response, &clientHandle, 1);
1206 m_ipcModule.destroyMessage(response);
1209 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1211 t_ilm_message response;
1212 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1213 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1215 uint layergroupid = 0;
1217 m_ipcModule.getUint(message, &layerid);
1218 m_ipcModule.getUint(message, &layergroupid);
1220 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
1223 response = m_ipcModule.createResponse(message);
1227 response = m_ipcModule.createErrorResponse(message);
1228 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1231 m_ipcModule.sendToClients(response, &clientHandle, 1);
1232 m_ipcModule.destroyMessage(response);
1235 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1237 t_ilm_message response;
1238 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1239 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1241 uint layergroupid = 0;
1243 m_ipcModule.getUint(message, &layerid);
1244 m_ipcModule.getUint(message, &layergroupid);
1246 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
1249 response = m_ipcModule.createResponse(message);
1253 response = m_ipcModule.createErrorResponse(message);
1254 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1257 m_ipcModule.sendToClients(response, &clientHandle, 1);
1258 m_ipcModule.destroyMessage(response);
1261 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1263 t_ilm_message response;
1264 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1265 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1269 m_ipcModule.getUint(message, &surfaceid);
1270 m_ipcModule.getUint(message, &layer);
1272 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(clientPid, layer, surfaceid));
1275 response = m_ipcModule.createResponse(message);
1279 response = m_ipcModule.createErrorResponse(message);
1280 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1283 m_ipcModule.sendToClients(response, &clientHandle, 1);
1284 m_ipcModule.destroyMessage(response);
1287 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1289 t_ilm_message response;
1290 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1291 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1294 m_ipcModule.getUint(message, &surfaceid);
1295 m_ipcModule.getUint(message, &layerid);
1297 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(clientPid, layerid, surfaceid));
1300 response = m_ipcModule.createResponse(message);
1304 response = m_ipcModule.createErrorResponse(message);
1305 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1308 m_ipcModule.sendToClients(response, &clientHandle, 1);
1309 m_ipcModule.destroyMessage(response);
1312 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1314 t_ilm_message response;
1315 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1316 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1317 uint newID = GraphicalObject::INVALID_ID;
1319 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1322 response = m_ipcModule.createResponse(message);
1323 m_ipcModule.appendUint(response, newID);
1327 response = m_ipcModule.createErrorResponse(message);
1328 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1331 m_ipcModule.sendToClients(response, &clientHandle, 1);
1332 m_ipcModule.destroyMessage(response);
1335 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1337 t_ilm_message response;
1338 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1339 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1340 uint newID = GraphicalObject::INVALID_ID;
1342 m_ipcModule.getUint(message, &newID);
1344 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1347 response = m_ipcModule.createResponse(message);
1348 m_ipcModule.appendUint(response, newID);
1352 response = m_ipcModule.createErrorResponse(message);
1353 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1356 m_ipcModule.sendToClients(response, &clientHandle, 1);
1357 m_ipcModule.destroyMessage(response);
1360 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1362 t_ilm_message response;
1363 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1364 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1366 m_ipcModule.getUint(message, ¶m);
1368 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
1371 response = m_ipcModule.createResponse(message);
1375 response = m_ipcModule.createErrorResponse(message);
1376 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1379 m_ipcModule.sendToClients(response, &clientHandle, 1);
1380 m_ipcModule.destroyMessage(response);
1383 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1385 t_ilm_message response;
1386 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1387 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1388 uint newID = GraphicalObject::INVALID_ID;
1390 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1393 response = m_ipcModule.createResponse(message);
1394 m_ipcModule.appendUint(response, newID);
1398 response = m_ipcModule.createErrorResponse(message);
1399 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1402 m_ipcModule.sendToClients(response, &clientHandle, 1);
1403 m_ipcModule.destroyMessage(response);
1406 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1408 t_ilm_message response;
1409 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1410 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1411 uint newID = GraphicalObject::INVALID_ID;
1413 m_ipcModule.getUint(message, &newID);
1415 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1418 response = m_ipcModule.createResponse(message);
1419 m_ipcModule.appendUint(response, newID);
1423 response = m_ipcModule.createErrorResponse(message);
1424 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1427 m_ipcModule.sendToClients(response, &clientHandle, 1);
1428 m_ipcModule.destroyMessage(response);
1431 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1433 t_ilm_message response;
1434 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1435 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1437 m_ipcModule.getUint(message, ¶m);
1439 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
1442 response = m_ipcModule.createResponse(message);
1446 response = m_ipcModule.createErrorResponse(message);
1447 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1450 m_ipcModule.sendToClients(response, &clientHandle, 1);
1451 m_ipcModule.destroyMessage(response);
1454 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1456 t_ilm_message response;
1457 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1458 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1465 m_ipcModule.getUint(message, &id);
1466 m_ipcModule.getUint(message, &x);
1467 m_ipcModule.getUint(message, &y);
1468 m_ipcModule.getUint(message, &width);
1469 m_ipcModule.getUint(message, &height);
1471 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1474 response = m_ipcModule.createResponse(message);
1478 response = m_ipcModule.createErrorResponse(message);
1479 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1482 m_ipcModule.sendToClients(response, &clientHandle, 1);
1483 m_ipcModule.destroyMessage(response);
1486 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1488 t_ilm_message response;
1489 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1490 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1497 m_ipcModule.getUint(message, &id);
1498 m_ipcModule.getUint(message, &x);
1499 m_ipcModule.getUint(message, &y);
1500 m_ipcModule.getUint(message, &width);
1501 m_ipcModule.getUint(message, &height);
1503 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1506 response = m_ipcModule.createResponse(message);
1510 response = m_ipcModule.createErrorResponse(message);
1511 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1514 m_ipcModule.sendToClients(response, &clientHandle, 1);
1515 m_ipcModule.destroyMessage(response);
1518 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1520 t_ilm_message response;
1521 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1522 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1529 m_ipcModule.getUint(message, &id);
1530 m_ipcModule.getUint(message, &x);
1531 m_ipcModule.getUint(message, &y);
1532 m_ipcModule.getUint(message, &width);
1533 m_ipcModule.getUint(message, &height);
1535 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1538 response = m_ipcModule.createResponse(message);
1542 response = m_ipcModule.createErrorResponse(message);
1543 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1546 m_ipcModule.sendToClients(response, &clientHandle, 1);
1547 m_ipcModule.destroyMessage(response);
1550 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1552 t_ilm_message response;
1553 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1554 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1559 m_ipcModule.getUint(message, &id);
1560 m_ipcModule.getUint(message, &x);
1561 m_ipcModule.getUint(message, &y);
1563 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(clientPid, id, x, y));
1566 response = m_ipcModule.createResponse(message);
1570 response = m_ipcModule.createErrorResponse(message);
1571 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1574 m_ipcModule.sendToClients(response, &clientHandle, 1);
1575 m_ipcModule.destroyMessage(response);
1578 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1580 t_ilm_message response;
1581 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1582 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1587 m_ipcModule.getUint(message, &id);
1589 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(clientPid, id, &x, &y));
1592 response = m_ipcModule.createResponse(message);
1593 m_ipcModule.appendUint(response, x);
1594 m_ipcModule.appendUint(response, y);
1598 response = m_ipcModule.createErrorResponse(message);
1599 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1602 m_ipcModule.sendToClients(response, &clientHandle, 1);
1603 m_ipcModule.destroyMessage(response);
1606 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1608 t_ilm_message response;
1609 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1610 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1615 m_ipcModule.getUint(message, &id);
1616 m_ipcModule.getUint(message, &width);
1617 m_ipcModule.getUint(message, &height);
1619 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(clientPid, id, width, height));
1622 response = m_ipcModule.createResponse(message);
1626 response = m_ipcModule.createErrorResponse(message);
1627 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1630 m_ipcModule.sendToClients(response, &clientHandle, 1);
1631 m_ipcModule.destroyMessage(response);
1634 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1636 t_ilm_message response;
1637 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1638 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1645 m_ipcModule.getUint(message, &id);
1646 m_ipcModule.getUint(message, &x);
1647 m_ipcModule.getUint(message, &y);
1648 m_ipcModule.getUint(message, &width);
1649 m_ipcModule.getUint(message, &height);
1651 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1654 response = m_ipcModule.createResponse(message);
1658 response = m_ipcModule.createErrorResponse(message);
1659 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1662 m_ipcModule.sendToClients(response, &clientHandle, 1);
1663 m_ipcModule.destroyMessage(response);
1666 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1668 t_ilm_message response;
1669 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1670 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1675 m_ipcModule.getUint(message, &id);
1676 m_ipcModule.getUint(message, &x);
1677 m_ipcModule.getUint(message, &y);
1679 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(clientPid, id, x, y));
1682 response = m_ipcModule.createResponse(message);
1686 response = m_ipcModule.createErrorResponse(message);
1687 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1690 m_ipcModule.sendToClients(response, &clientHandle, 1);
1691 m_ipcModule.destroyMessage(response);
1694 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1696 t_ilm_message response;
1697 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1698 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1703 m_ipcModule.getUint(message, &id);
1705 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(clientPid, id, &x, &y));
1708 response = m_ipcModule.createResponse(message);
1709 m_ipcModule.appendUint(response, x);
1710 m_ipcModule.appendUint(response, y);
1714 response = m_ipcModule.createErrorResponse(message);
1715 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1718 m_ipcModule.sendToClients(response, &clientHandle, 1);
1719 m_ipcModule.destroyMessage(response);
1722 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1724 t_ilm_message response;
1725 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1726 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1731 m_ipcModule.getUint(message, &id);
1732 m_ipcModule.getUint(message, &width);
1733 m_ipcModule.getUint(message, &height);
1735 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(clientPid, id, width, height));
1738 response = m_ipcModule.createResponse(message);
1742 response = m_ipcModule.createErrorResponse(message);
1743 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1746 m_ipcModule.sendToClients(response, &clientHandle, 1);
1747 m_ipcModule.destroyMessage(response);
1750 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1752 t_ilm_message response;
1753 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1754 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1759 m_ipcModule.getUint(message, &id);
1761 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(clientPid, id, &width, &height));
1764 response = m_ipcModule.createResponse(message);
1765 m_ipcModule.appendUint(response, width);
1766 m_ipcModule.appendUint(response, height);
1770 response = m_ipcModule.createErrorResponse(message);
1771 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1774 m_ipcModule.sendToClients(response, &clientHandle, 1);
1775 m_ipcModule.destroyMessage(response);
1778 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1780 t_ilm_message response;
1781 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1782 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1787 m_ipcModule.getUint(message, &id);
1789 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(clientPid, id, &width, &height));
1792 response = m_ipcModule.createResponse(message);
1793 m_ipcModule.appendUint(response, width);
1794 m_ipcModule.appendUint(response, height);
1798 response = m_ipcModule.createErrorResponse(message);
1799 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1802 m_ipcModule.sendToClients(response, &clientHandle, 1);
1803 m_ipcModule.destroyMessage(response);
1806 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1808 t_ilm_message response;
1809 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1810 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1814 m_ipcModule.getUint(message, &id);
1815 m_ipcModule.getDouble(message, ¶m);
1817 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(clientPid, id, param));
1820 response = m_ipcModule.createResponse(message);
1824 response = m_ipcModule.createErrorResponse(message);
1825 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1828 m_ipcModule.sendToClients(response, &clientHandle, 1);
1829 m_ipcModule.destroyMessage(response);
1832 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1834 t_ilm_message response;
1835 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1836 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1840 m_ipcModule.getUint(message, &id);
1841 m_ipcModule.getDouble(message, ¶m);
1843 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(clientPid, id, param));
1846 response = m_ipcModule.createResponse(message);
1850 response = m_ipcModule.createErrorResponse(message);
1851 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1854 m_ipcModule.sendToClients(response, &clientHandle, 1);
1855 m_ipcModule.destroyMessage(response);
1858 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1860 t_ilm_message response;
1861 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1862 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1866 m_ipcModule.getUint(message, &id);
1867 m_ipcModule.getDouble(message, ¶m);
1869 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
1872 response = m_ipcModule.createResponse(message);
1876 response = m_ipcModule.createErrorResponse(message);
1877 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1880 m_ipcModule.sendToClients(response, &clientHandle, 1);
1881 m_ipcModule.destroyMessage(response);
1884 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1886 t_ilm_message response;
1887 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1888 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1892 m_ipcModule.getUint(message, &id);
1893 m_ipcModule.getDouble(message, ¶m);
1895 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
1898 response = m_ipcModule.createResponse(message);
1902 response = m_ipcModule.createErrorResponse(message);
1903 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1906 m_ipcModule.sendToClients(response, &clientHandle, 1);
1907 m_ipcModule.destroyMessage(response);
1910 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1912 t_ilm_message response;
1913 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1914 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1918 m_ipcModule.getUint(message, &id);
1920 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(clientPid, id, ¶m));
1923 response = m_ipcModule.createResponse(message);
1924 m_ipcModule.appendDouble(response, param);
1928 response = m_ipcModule.createErrorResponse(message);
1929 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1932 m_ipcModule.sendToClients(response, &clientHandle, 1);
1933 m_ipcModule.destroyMessage(response);
1936 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1938 t_ilm_message response;
1939 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1940 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1944 m_ipcModule.getUint(message, &id);
1946 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(clientPid, id, ¶m));
1949 response = m_ipcModule.createResponse(message);
1950 m_ipcModule.appendDouble(response, param);
1954 response = m_ipcModule.createErrorResponse(message);
1955 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1958 m_ipcModule.sendToClients(response, &clientHandle, 1);
1959 m_ipcModule.destroyMessage(response);
1962 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1964 t_ilm_message response;
1965 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1966 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1969 OrientationType o = Zero;
1971 m_ipcModule.getUint(message, &id);
1972 m_ipcModule.getUint(message, ¶m);
1974 o = (OrientationType) param;
1976 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(clientPid, id, o));
1979 response = m_ipcModule.createResponse(message);
1983 response = m_ipcModule.createErrorResponse(message);
1984 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1987 m_ipcModule.sendToClients(response, &clientHandle, 1);
1988 m_ipcModule.destroyMessage(response);
1991 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
1993 t_ilm_message response;
1994 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1995 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1999 m_ipcModule.getUint(message, &id);
2001 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(clientPid, id, &o));
2004 response = m_ipcModule.createResponse(message);
2005 m_ipcModule.appendUint(response, o);
2009 response = m_ipcModule.createErrorResponse(message);
2010 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2013 m_ipcModule.sendToClients(response, &clientHandle, 1);
2014 m_ipcModule.destroyMessage(response);
2017 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
2019 t_ilm_message response;
2020 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2021 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2024 OrientationType o = Zero;
2026 m_ipcModule.getUint(message, &id);
2027 m_ipcModule.getUint(message, ¶m);
2029 o = (OrientationType) param;
2031 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(clientPid, id, o));
2034 response = m_ipcModule.createResponse(message);
2038 response = m_ipcModule.createErrorResponse(message);
2039 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2042 m_ipcModule.sendToClients(response, &clientHandle, 1);
2043 m_ipcModule.destroyMessage(response);
2046 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
2048 t_ilm_message response;
2049 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2050 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2054 m_ipcModule.getUint(message, &id);
2056 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(clientPid, id, &o));
2059 response = m_ipcModule.createResponse(message);
2060 m_ipcModule.appendUint(response, o);
2064 response = m_ipcModule.createErrorResponse(message);
2065 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2068 m_ipcModule.sendToClients(response, &clientHandle, 1);
2069 m_ipcModule.destroyMessage(response);
2072 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
2074 t_ilm_message response;
2075 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2076 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2078 PixelFormat pixelFormat;
2080 m_ipcModule.getUint(message, &id);
2082 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(clientPid, id, &pixelFormat));
2085 response = m_ipcModule.createResponse(message);
2086 m_ipcModule.appendUint(response, pixelFormat);
2090 response = m_ipcModule.createErrorResponse(message);
2091 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2094 m_ipcModule.sendToClients(response, &clientHandle, 1);
2095 m_ipcModule.destroyMessage(response);
2098 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
2100 t_ilm_message response;
2101 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2102 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2104 t_ilm_bool newVis = ILM_FALSE;
2106 m_ipcModule.getUint(message, &surfaceid);
2107 m_ipcModule.getBool(message, &newVis);
2109 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(clientPid, surfaceid, newVis));
2112 response = m_ipcModule.createResponse(message);
2116 response = m_ipcModule.createErrorResponse(message);
2117 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2120 m_ipcModule.sendToClients(response, &clientHandle, 1);
2121 m_ipcModule.destroyMessage(response);
2124 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
2126 t_ilm_message response;
2127 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2128 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2130 t_ilm_bool myparam = ILM_FALSE;
2132 m_ipcModule.getUint(message, &layerid);
2133 m_ipcModule.getBool(message, &myparam);
2135 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(clientPid, layerid, myparam));
2138 response = m_ipcModule.createResponse(message);
2142 response = m_ipcModule.createErrorResponse(message);
2143 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2146 m_ipcModule.sendToClients(response, &clientHandle, 1);
2147 m_ipcModule.destroyMessage(response);
2150 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
2152 t_ilm_message response;
2153 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2154 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2158 m_ipcModule.getUint(message, &id);
2160 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(clientPid, id, &visibility));
2163 response = m_ipcModule.createResponse(message);
2164 m_ipcModule.appendBool(response, visibility);
2168 response = m_ipcModule.createErrorResponse(message);
2169 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2172 m_ipcModule.sendToClients(response, &clientHandle, 1);
2173 m_ipcModule.destroyMessage(response);
2176 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
2178 t_ilm_message response;
2179 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2180 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2184 m_ipcModule.getUint(message, &id);
2186 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(clientPid, id, &visibility));
2189 response = m_ipcModule.createResponse(message);
2190 m_ipcModule.appendBool(response, visibility);
2194 response = m_ipcModule.createErrorResponse(message);
2195 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2198 m_ipcModule.sendToClients(response, &clientHandle, 1);
2199 m_ipcModule.destroyMessage(response);
2202 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
2204 t_ilm_message response;
2205 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2206 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2208 t_ilm_bool myparam = ILM_FALSE;
2210 m_ipcModule.getUint(message, &groupid);
2211 m_ipcModule.getBool(message, &myparam);
2213 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
2216 response = m_ipcModule.createResponse(message);
2220 response = m_ipcModule.createErrorResponse(message);
2221 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2224 m_ipcModule.sendToClients(response, &clientHandle, 1);
2225 m_ipcModule.destroyMessage(response);
2228 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
2230 t_ilm_message response;
2231 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2232 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2234 t_ilm_bool myparam = ILM_FALSE;
2236 m_ipcModule.getUint(message, &groupid);
2237 m_ipcModule.getBool(message, &myparam);
2239 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
2242 response = m_ipcModule.createResponse(message);
2246 response = m_ipcModule.createErrorResponse(message);
2247 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2250 m_ipcModule.sendToClients(response, &clientHandle, 1);
2251 m_ipcModule.destroyMessage(response);
2255 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
2257 t_ilm_message response;
2258 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2259 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2264 m_ipcModule.getUintArray(message, &array, &length);
2265 m_ipcModule.getUint(message, &screenID);
2267 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, screenID, array, length));
2270 response = m_ipcModule.createResponse(message);
2274 response = m_ipcModule.createErrorResponse(message);
2275 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2278 m_ipcModule.sendToClients(response, &clientHandle, 1);
2279 m_ipcModule.destroyMessage(response);
2282 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2284 t_ilm_message response;
2285 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2286 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2291 m_ipcModule.getUint(message, &layerid);
2292 m_ipcModule.getUintArray(message, &array, &length);
2294 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(clientPid, layerid, array, length));
2297 response = m_ipcModule.createResponse(message);
2301 response = m_ipcModule.createErrorResponse(message);
2302 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2305 m_ipcModule.sendToClients(response, &clientHandle, 1);
2306 m_ipcModule.destroyMessage(response);
2309 void GenericCommunicator::GetLayerType(t_ilm_message message)
2311 t_ilm_message response;
2312 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2314 m_ipcModule.getUint(message, &id);
2316 Layer* layer = m_executor->getScene()->getLayer(id);
2319 response = m_ipcModule.createResponse(message);
2320 m_ipcModule.appendUint(response, layer->getLayerType());
2324 response = m_ipcModule.createErrorResponse(message);
2325 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2328 m_ipcModule.sendToClients(response, &clientHandle, 1);
2329 m_ipcModule.destroyMessage(response);
2332 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2334 t_ilm_message response;
2335 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2337 LayerType type = Unknown;
2339 m_ipcModule.getUint(message, &id);
2341 type = (LayerType) id;
2343 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2344 response = m_ipcModule.createResponse(message);
2345 m_ipcModule.appendUint(response, capabilities);
2346 m_ipcModule.sendToClients(response, &clientHandle, 1);
2347 m_ipcModule.destroyMessage(response);
2350 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2352 t_ilm_message response;
2353 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2355 m_ipcModule.getUint(message, &id);
2357 Layer* layer = m_executor->getScene()->getLayer(id);
2360 response = m_ipcModule.createResponse(message);
2361 m_ipcModule.appendUint(response, layer->getCapabilities());
2365 response = m_ipcModule.createErrorResponse(message);
2366 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2369 m_ipcModule.sendToClients(response, &clientHandle, 1);
2370 m_ipcModule.destroyMessage(response);
2373 void GenericCommunicator::FadeIn(t_ilm_message message)
2375 t_ilm_message response;
2376 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2377 response = m_ipcModule.createErrorResponse(message);
2378 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2379 m_ipcModule.sendToClients(response, &clientHandle, 1);
2380 m_ipcModule.destroyMessage(response);
2383 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2385 t_ilm_message response;
2386 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2387 response = m_ipcModule.createErrorResponse(message);
2388 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2389 m_ipcModule.sendToClients(response, &clientHandle, 1);
2390 m_ipcModule.destroyMessage(response);
2393 void GenericCommunicator::FadeOut(t_ilm_message message)
2395 t_ilm_message response;
2396 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2397 response = m_ipcModule.createErrorResponse(message);
2398 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2399 m_ipcModule.sendToClients(response, &clientHandle, 1);
2400 m_ipcModule.destroyMessage(response);
2403 void GenericCommunicator::Exit(t_ilm_message message)
2405 t_ilm_message response;
2406 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2407 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2408 t_ilm_bool status = m_executor->execute(new ExitCommand(clientPid));
2411 response = m_ipcModule.createResponse(message);
2415 response = m_ipcModule.createErrorResponse(message);
2416 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2419 m_ipcModule.sendToClients(response, &clientHandle, 1);
2420 m_ipcModule.destroyMessage(response);
2423 void GenericCommunicator::CommitChanges(t_ilm_message message)
2425 t_ilm_message response;
2426 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2427 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2428 t_ilm_bool status = m_executor->execute(new CommitCommand(clientPid));
2431 response = m_ipcModule.createResponse(message);
2435 response = m_ipcModule.createErrorResponse(message);
2436 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2439 m_ipcModule.sendToClients(response, &clientHandle, 1);
2440 m_ipcModule.destroyMessage(response);
2443 void GenericCommunicator::CreateShader(t_ilm_message message)
2445 t_ilm_message response;
2446 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2447 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2448 char vertname[1024];
2449 char fragname[1024];
2452 m_ipcModule.getString(message, vertname);
2453 m_ipcModule.getString(message, fragname);
2455 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(clientPid, vertname, fragname, &id));
2458 response = m_ipcModule.createResponse(message);
2459 m_ipcModule.appendUint(response, id);
2463 response = m_ipcModule.createErrorResponse(message);
2464 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2467 m_ipcModule.sendToClients(response, &clientHandle, 1);
2468 m_ipcModule.destroyMessage(response);
2471 void GenericCommunicator::DestroyShader(t_ilm_message message)
2473 t_ilm_message response;
2474 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2475 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2478 m_ipcModule.getUint(message, &shaderid);
2480 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(clientPid, shaderid));
2483 response = m_ipcModule.createResponse(message);
2487 response = m_ipcModule.createErrorResponse(message);
2488 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2491 m_ipcModule.sendToClients(response, &clientHandle, 1);
2492 m_ipcModule.destroyMessage(response);
2495 void GenericCommunicator::SetShader(t_ilm_message message)
2497 t_ilm_message response;
2498 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2499 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2503 m_ipcModule.getUint(message, &surfaceId);
2504 m_ipcModule.getUint(message, &shaderid);
2506 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(clientPid, surfaceId, shaderid));
2509 response = m_ipcModule.createResponse(message);
2513 response = m_ipcModule.createErrorResponse(message);
2514 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2517 m_ipcModule.sendToClients(response, &clientHandle, 1);
2518 m_ipcModule.destroyMessage(response);
2521 void GenericCommunicator::SetUniforms(t_ilm_message message)
2523 t_ilm_message response;
2524 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2525 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2527 std::vector<string> uniforms;
2529 m_ipcModule.getUint(message, &id);
2532 //m_ipcModule.getStringArray(&uniforms);
2534 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(clientPid, id, uniforms));
2537 response = m_ipcModule.createResponse(message);
2541 response = m_ipcModule.createErrorResponse(message);
2542 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2545 m_ipcModule.sendToClients(response, &clientHandle, 1);
2546 m_ipcModule.destroyMessage(response);
2549 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2551 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2552 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2553 t_ilm_message response;
2556 m_ipcModule.getUint(message, &surfaceId);
2558 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(clientPid, surfaceId));
2561 response = m_ipcModule.createResponse(message);
2565 response = m_ipcModule.createErrorResponse(message);
2566 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2569 m_ipcModule.sendToClients(response, &clientHandle, 1);
2570 m_ipcModule.destroyMessage(response);
2574 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2576 t_ilm_message response;
2577 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2578 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2581 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(clientPid, &surfaceId));
2584 response = m_ipcModule.createResponse(message);
2585 m_ipcModule.appendUint(response, surfaceId);
2589 response = m_ipcModule.createErrorResponse(message);
2590 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2593 m_ipcModule.sendToClients(response, &clientHandle, 1);
2594 m_ipcModule.destroyMessage(response);
2598 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2600 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2601 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2602 t_ilm_message response;
2605 InputDevice devices;
2608 m_ipcModule.getUint(message, &surfaceId);
2609 m_ipcModule.getUint(message, &udevices);
2610 m_ipcModule.getBool(message, &accept);
2612 devices = (InputDevice) udevices;
2614 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(clientPid, surfaceId, devices, accept));
2617 response = m_ipcModule.createResponse(message);
2621 response = m_ipcModule.createErrorResponse(message);
2622 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2625 m_ipcModule.sendToClients(response, &clientHandle, 1);
2626 m_ipcModule.destroyMessage(response);
2629 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2631 t_ilm_message response;
2632 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2633 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2638 m_ipcModule.getUint(message, &surfaceid);
2639 m_ipcModule.getUintArray(message, &array, &length);
2641 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(clientPid, surfaceid, array, length));
2644 response = m_ipcModule.createResponse(message);
2648 response = m_ipcModule.createErrorResponse(message);
2649 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2652 m_ipcModule.sendToClients(response, &clientHandle, 1);
2653 m_ipcModule.destroyMessage(response);
2656 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2658 t_ilm_message response;
2659 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2660 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2665 m_ipcModule.getUint(message, &layerid);
2666 m_ipcModule.getUintArray(message, &array, &length);
2668 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(clientPid, layerid, array, length));
2671 response = m_ipcModule.createResponse(message);
2675 response = m_ipcModule.createErrorResponse(message);
2676 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2679 m_ipcModule.sendToClients(response, &clientHandle, 1);
2680 m_ipcModule.destroyMessage(response);
2683 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2685 t_ilm_message response;
2686 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2689 m_ipcModule.getUint(message, &layerid);
2691 Layer* layer = m_executor->getScene()->getLayer(layerid);
2694 layer->addNotification(clientHandle);
2695 response = m_ipcModule.createResponse(message);
2699 response = m_ipcModule.createErrorResponse(message);
2700 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2703 m_ipcModule.sendToClients(response, &clientHandle, 1);
2704 m_ipcModule.destroyMessage(response);
2707 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2709 t_ilm_message response;
2710 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2713 m_ipcModule.getUint(message, &surfaceid);
2715 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2718 surface->addNotification(clientHandle);
2719 response = m_ipcModule.createResponse(message);
2723 response = m_ipcModule.createErrorResponse(message);
2724 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2727 m_ipcModule.sendToClients(response, &clientHandle, 1);
2728 m_ipcModule.destroyMessage(response);
2731 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2733 t_ilm_message response;
2734 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2737 m_ipcModule.getUint(message, &layerid);
2739 Layer* layer = m_executor->getScene()->getLayer(layerid);
2742 layer->removeNotification(clientHandle);
2743 response = m_ipcModule.createResponse(message);
2747 response = m_ipcModule.createErrorResponse(message);
2748 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2751 m_ipcModule.sendToClients(response, &clientHandle, 1);
2752 m_ipcModule.destroyMessage(response);
2755 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2757 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2758 t_ilm_message response;
2761 m_ipcModule.getUint(message, &surfaceid);
2763 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2766 surface->removeNotification(clientHandle);
2767 response = m_ipcModule.createResponse(message);
2771 response = m_ipcModule.createErrorResponse(message);
2772 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2775 m_ipcModule.sendToClients(response, &clientHandle, 1);
2776 m_ipcModule.destroyMessage(response);
2779 void GenericCommunicator::processNotificationQueue()
2781 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2782 NotificationQueue::iterator iter = notificationQueue.begin();
2783 NotificationQueue::iterator end = notificationQueue.end();
2785 for (; iter != end; ++iter)
2787 GraphicalObject* object = iter->first;
2788 t_ilm_notification_mask mask = iter->second;
2789 sendNotification(object, mask);
2791 notificationQueue.clear();
2794 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2796 switch (object->type)
2800 Layer* layer = static_cast<Layer*>(object);
2803 ApplicationReferenceList& arl = layer->getNotificationClients();
2807 t_ilm_message notification;
2808 Rectangle dest = layer->getDestinationRegion();
2809 Rectangle src = layer->getSourceRegion();
2810 OrientationType orientation = layer->getOrientation();
2812 unsigned char chromaKeyRed = 0;
2813 unsigned char chromaKeyGreen = 0;
2814 unsigned char chromaKeyBlue = 0;
2815 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2817 std::stringstream notificationName;
2818 notificationName << "NotificationForLayer" << layer->getID();
2820 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2821 m_ipcModule.appendUint(notification, layer->getID());
2822 m_ipcModule.appendUint(notification, mask);
2824 m_ipcModule.appendDouble(notification, layer->getOpacity());
2825 m_ipcModule.appendUint(notification, src.x);
2826 m_ipcModule.appendUint(notification, src.y);
2827 m_ipcModule.appendUint(notification, src.width);
2828 m_ipcModule.appendUint(notification, src.height);
2829 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2830 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2831 m_ipcModule.appendUint(notification, dest.x);
2832 m_ipcModule.appendUint(notification, dest.y);
2833 m_ipcModule.appendUint(notification, dest.width);
2834 m_ipcModule.appendUint(notification, dest.height);
2835 m_ipcModule.appendUint(notification, orientation);
2836 m_ipcModule.appendBool(notification, layer->getVisibility());
2837 m_ipcModule.appendUint(notification, layer->getLayerType());
2838 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2839 m_ipcModule.appendUint(notification, chromaKeyRed);
2840 m_ipcModule.appendUint(notification, chromaKeyGreen);
2841 m_ipcModule.appendUint(notification, chromaKeyBlue);
2842 m_ipcModule.appendInt(notification, layer->getCreatorPid());
2844 int clientCount = arl.size();
2845 t_ilm_client_handle clientArray[256];
2847 ApplicationReferenceList::iterator iter = arl.begin();
2848 ApplicationReferenceList::iterator end = arl.end();
2850 for (int clientNumber = 0;
2851 iter != end, clientNumber < 256;
2852 ++iter, ++clientNumber)
2854 t_ilm_client_handle client = *iter;
2855 clientArray[clientNumber] = client;
2858 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2860 if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
2862 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2865 m_ipcModule.destroyMessage(notification);
2872 Surface* surface = static_cast<Surface*>(object);
2875 ApplicationReferenceList& arl = surface->getNotificationClients();
2879 t_ilm_message notification;
2880 std::stringstream notificationName;
2881 notificationName << "NotificationForSurface" << surface->getID();
2883 unsigned char chromaKeyRed = 0;
2884 unsigned char chromaKeyGreen = 0;
2885 unsigned char chromaKeyBlue = 0;
2886 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2888 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2889 m_ipcModule.appendUint(notification, surface->getID());
2890 m_ipcModule.appendUint(notification, mask);
2892 m_ipcModule.appendDouble(notification, surface->getOpacity());
2893 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2894 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2895 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2896 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2897 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2898 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2899 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2900 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2901 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2902 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2903 m_ipcModule.appendUint(notification, surface->getOrientation());
2904 m_ipcModule.appendBool(notification, surface->getVisibility());
2905 m_ipcModule.appendUint(notification, surface->frameCounter);
2906 m_ipcModule.appendUint(notification, surface->drawCounter);
2907 m_ipcModule.appendUint(notification, surface->updateCounter);
2908 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2909 m_ipcModule.appendUint(notification, surface->getNativeContent());
2910 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2911 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2912 m_ipcModule.appendUint(notification, chromaKeyRed);
2913 m_ipcModule.appendUint(notification, chromaKeyGreen);
2914 m_ipcModule.appendUint(notification, chromaKeyBlue);
2915 m_ipcModule.appendInt(notification, surface->getCreatorPid());
2917 int clientCount = arl.size();
2918 t_ilm_client_handle clients[256];
2920 ApplicationReferenceList::iterator iter = arl.begin();
2921 ApplicationReferenceList::iterator end = arl.end();
2923 for (int clientNumber = 0;
2924 iter != end, clientNumber < 256;
2925 ++iter, ++clientNumber)
2927 clients[clientNumber] = *iter;
2930 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2932 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2934 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2937 m_ipcModule.destroyMessage(notification);
2943 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2948 HealthCondition GenericCommunicator::getHealth()
2950 HealthCondition health = PluginBase::getHealth();
2951 if (0 != pthread_kill(mThreadId, 0))
2953 health = HealthDead;
2958 void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
2960 t_ilm_message response;
2961 OptimizationType optimizationId;
2962 OptimizationModeType optimizationMode;
2964 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2965 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2967 m_ipcModule.getUint(message,&o);
2968 optimizationId = (OptimizationType) o;
2969 m_ipcModule.getUint(message,&o);
2970 optimizationMode = (OptimizationModeType) o;
2972 t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
2975 response = m_ipcModule.createResponse(message);
2979 response = m_ipcModule.createErrorResponse(message);
2980 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
2982 m_ipcModule.sendToClients(response,&clientHandle,1);
2983 m_ipcModule.destroyMessage(response);
2986 void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
2988 t_ilm_message response;
2989 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2990 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2991 OptimizationType optimizationId;
2992 OptimizationModeType optimizationMode;
2995 m_ipcModule.getUint(message,&o);
2996 optimizationId = (OptimizationType)o;
2998 t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
3002 response = m_ipcModule.createResponse(message);
3003 m_ipcModule.appendUint(response,(unsigned int)optimizationMode);
3007 response = m_ipcModule.createErrorResponse(message);
3008 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3010 m_ipcModule.sendToClients(response,&clientHandle,1);
3011 m_ipcModule.destroyMessage(response);
3015 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
3017 return new GenericCommunicator(executor);
3020 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)