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);
253 void GenericCommunicator::stop()
255 LOG_INFO("GenericCommunicator","stopping");
261 m_ipcModule.destroy();
263 setHealth(HealthStopped);
266 void GenericCommunicator::process(int timeout_ms)
268 t_ilm_message message = m_ipcModule.receive(timeout_ms);
274 t_ilm_message_type messageType = m_ipcModule.getMessageType(message);
275 t_ilm_const_string name = m_ipcModule.getMessageName(message);
276 t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
280 case IpcMessageTypeCommand:
281 if (m_callBackTable.end() != m_callBackTable.find(name))
283 LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
284 << m_executor->getSenderName(senderHandle)
285 << "(" << m_executor->getSenderPid(senderHandle) << ")");
286 CallBackMethod method = m_callBackTable[name].function;
287 (this->*method)(message);
291 LOG_WARNING("GenericCommunicator", "Received unknown command " << name
292 << " from " << m_executor->getSenderName(senderHandle)
293 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
295 processNotificationQueue();
298 case IpcMessageTypeConnect:
299 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
300 << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
303 case IpcMessageTypeDisconnect:
304 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
305 << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
307 const LayerMap& layers = m_executor->getScene()->getAllLayers();
308 LayerMapConstIterator layerIter = layers.begin();
309 LayerMapConstIterator layerIterEnd = layers.end();
310 for (; layerIter != layerIterEnd; ++layerIter)
312 Layer* layer = layerIter->second;
313 layer->removeNotification(senderHandle);
316 const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
317 SurfaceMapConstIterator surfaceIter = surfaces.begin();
318 SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
319 for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
321 Surface* surface = surfaceIter->second;
322 surface->removeNotification(senderHandle);
327 case IpcMessageTypeError:
328 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
329 << m_executor->getSenderName(senderHandle)
330 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
333 case IpcMessageTypeShutdown:
334 case IpcMessageTypeNone:
338 LOG_DEBUG("GenericCommunicator", "Received unknown data from "
339 << m_executor->getSenderName(senderHandle)
340 << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
343 m_ipcModule.destroyMessage(message);
346 void GenericCommunicator::setdebug(bool onoff)
348 (void)onoff; // TODO: remove, only prevents warning
351 t_ilm_bool GenericCommunicator::threadMainLoop()
357 void GenericCommunicator::ServiceConnect(t_ilm_message message)
359 LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
361 t_ilm_message response;
362 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
364 unsigned int processId = 0;
365 char processName[1024];
366 m_ipcModule.getUint(message, &processId);
367 m_ipcModule.getString(message, processName);
369 m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
371 response = m_ipcModule.createResponse(message);
372 m_ipcModule.sendToClients(response, &clientHandle, 1);
373 m_ipcModule.destroyMessage(response);
376 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
378 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
380 t_ilm_message response;
381 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
383 m_executor->removeApplicationReference(clientHandle);
385 response = m_ipcModule.createResponse(message);
386 m_ipcModule.sendToClients(response, &clientHandle, 1);
387 m_ipcModule.destroyMessage(response);
390 void GenericCommunicator::Debug(t_ilm_message message)
392 t_ilm_message response;
393 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
394 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
395 t_ilm_bool param = ILM_FALSE;
396 m_ipcModule.getBool(message, ¶m);
398 t_ilm_bool status = m_executor->execute(new DebugCommand(clientPid, param));
401 response = m_ipcModule.createResponse(message);
405 response = m_ipcModule.createErrorResponse(message);
406 m_ipcModule.appendString(response, INVALID_ARGUMENT);
409 m_ipcModule.sendToClients(response, &clientHandle, 1);
410 m_ipcModule.destroyMessage(response);
413 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
415 t_ilm_message response;
416 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
418 m_ipcModule.getUint(message, &screenid);
419 uint* resolution = m_executor->getScreenResolution(screenid);
421 response = m_ipcModule.createResponse(message);
422 m_ipcModule.appendUint(response, resolution[0]);
423 m_ipcModule.appendUint(response, resolution[1]);
424 m_ipcModule.sendToClients(response, &clientHandle, 1);
425 m_ipcModule.destroyMessage(response);
428 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
430 t_ilm_message response;
431 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
433 m_ipcModule.getUint(message, &screenid);
434 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
435 response = m_ipcModule.createResponse(message);
436 m_ipcModule.appendUint(response, numberOfHardwareLayers);
437 m_ipcModule.sendToClients(response, &clientHandle, 1);
438 m_ipcModule.destroyMessage(response);
441 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
443 t_ilm_message response;
444 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
446 uint* IDs = m_executor->getScreenIDs(&length);
447 response = m_ipcModule.createResponse(message);
448 m_ipcModule.appendUintArray(response, IDs, length);
449 m_ipcModule.sendToClients(response, &clientHandle, 1);
450 m_ipcModule.destroyMessage(response);
453 void GenericCommunicator::ScreenShot(t_ilm_message message)
455 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
456 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
457 t_ilm_message response;
461 m_ipcModule.getUint(message, &screenid);
462 m_ipcModule.getString(message, filename);
464 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(clientPid, filename, screenid));
467 response = m_ipcModule.createResponse(message);
471 response = m_ipcModule.createErrorResponse(message);
472 m_ipcModule.appendString(response, INVALID_ARGUMENT);
475 m_ipcModule.sendToClients(response, &clientHandle, 1);
476 m_ipcModule.destroyMessage(response);
479 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
481 t_ilm_message response;
482 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
483 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
485 m_ipcModule.getString(message, filename);
487 m_ipcModule.getUint(message, &layerid);
489 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(clientPid, filename, layerid));
492 response = m_ipcModule.createResponse(message);
496 response = m_ipcModule.createErrorResponse(message);
497 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
500 m_ipcModule.sendToClients(response, &clientHandle, 1);
501 m_ipcModule.destroyMessage(response);
504 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
506 t_ilm_message response;
507 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
508 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
510 m_ipcModule.getString(message, filename);
512 m_ipcModule.getUint(message, &id);
513 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(clientPid, filename, id));
516 response = m_ipcModule.createResponse(message);
520 response = m_ipcModule.createErrorResponse(message);
521 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
524 m_ipcModule.sendToClients(response, &clientHandle, 1);
525 m_ipcModule.destroyMessage(response);
528 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
530 t_ilm_message response;
531 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
534 m_executor->getScene()->lockScene();
535 m_executor->getScene()->getLayerIDs(&length, &array);
536 m_executor->getScene()->unlockScene();
537 response = m_ipcModule.createResponse(message);
538 m_ipcModule.appendUintArray(response, array, length);
539 m_ipcModule.sendToClients(response, &clientHandle, 1);
540 m_ipcModule.destroyMessage(response);
543 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
545 t_ilm_message response;
546 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
548 m_ipcModule.getUint(message, &screenID);
552 m_executor->getScene()->lockScene();
553 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
554 m_executor->getScene()->unlockScene();
557 response = m_ipcModule.createResponse(message);
558 m_ipcModule.appendUintArray(response, array, length);
562 response = m_ipcModule.createErrorResponse(message);
563 m_ipcModule.appendString(response, INVALID_ARGUMENT);
566 m_ipcModule.sendToClients(response, &clientHandle, 1);
567 m_ipcModule.destroyMessage(response);
570 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
572 t_ilm_message response;
573 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
576 m_executor->getScene()->lockScene();
577 m_executor->getScene()->getSurfaceIDs(&length, &array);
578 m_executor->getScene()->unlockScene();
579 response = m_ipcModule.createResponse(message);
580 m_ipcModule.appendUintArray(response, array, length);
581 m_ipcModule.sendToClients(response, &clientHandle, 1);
582 m_ipcModule.destroyMessage(response);
585 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
587 t_ilm_message response;
588 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
591 m_executor->getScene()->lockScene();
592 m_executor->getScene()->getLayerGroupIDs(&length, &array);
593 m_executor->getScene()->unlockScene();
594 response = m_ipcModule.createResponse(message);
595 m_ipcModule.appendUintArray(response, array, length);
596 m_ipcModule.sendToClients(response, &clientHandle, 1);
597 m_ipcModule.destroyMessage(response);
600 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
602 t_ilm_message response;
603 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
606 m_executor->getScene()->lockScene();
607 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
608 m_executor->getScene()->unlockScene();
609 response = m_ipcModule.createResponse(message);
610 m_ipcModule.appendUintArray(response, array, length);
611 m_ipcModule.sendToClients(response, &clientHandle, 1);
612 m_ipcModule.destroyMessage(response);
615 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
617 t_ilm_message response;
618 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
620 m_ipcModule.getUint(message, &id);
621 m_executor->getScene()->lockScene();
622 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
625 std::list<Surface*> surfaces = sg->getList();
626 uint length = surfaces.size();
627 uint* array = new uint[length];
630 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
633 array[arrayPos] = s->getID();
636 m_executor->getScene()->unlockScene();
638 response = m_ipcModule.createResponse(message);
639 m_ipcModule.appendUintArray(response, array, length);
643 m_executor->getScene()->unlockScene();
644 response = m_ipcModule.createErrorResponse(message);
645 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
648 m_ipcModule.sendToClients(response, &clientHandle, 1);
649 m_ipcModule.destroyMessage(response);
652 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
654 t_ilm_message response;
655 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
657 m_ipcModule.getUint(message, &id);
658 m_executor->getScene()->lockScene();
659 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
662 std::list<Layer*> layers = sg->getList();
664 uint length = layers.size();
665 uint* array = new uint[length];
668 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
671 array[arrayPos] = l->getID();
674 m_executor->getScene()->unlockScene();
676 response = m_ipcModule.createResponse(message);
677 m_ipcModule.appendUintArray(response, array, length);
681 m_executor->getScene()->unlockScene();
682 response = m_ipcModule.createErrorResponse(message);
683 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
686 m_ipcModule.sendToClients(response, &clientHandle, 1);
687 m_ipcModule.destroyMessage(response);
690 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
692 t_ilm_message response;
693 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
695 m_ipcModule.getUint(message, &id);
696 m_executor->getScene()->lockScene();
697 Layer* layer = m_executor->getScene()->getLayer(id);
700 std::list<Surface*> surfaces = layer->getAllSurfaces();
702 uint length = surfaces.size();
703 uint* array = new uint[length];
706 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
709 array[arrayPos] = s->getID();
712 m_executor->getScene()->unlockScene();
714 response = m_ipcModule.createResponse(message);
715 m_ipcModule.appendUintArray(response, array, length);
719 m_executor->getScene()->unlockScene();
720 response = m_ipcModule.createErrorResponse(message);
721 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
724 m_ipcModule.sendToClients(response, &clientHandle, 1);
725 m_ipcModule.destroyMessage(response);
728 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
730 t_ilm_message response;
731 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
733 m_ipcModule.getUint(message, &id);
735 Surface* surface = m_executor->getScene()->getSurface(id);
738 Rectangle dest = surface->getDestinationRegion();
739 Rectangle src = surface->getSourceRegion();
740 OrientationType orientation = surface->getOrientation();
741 unsigned char chromaKeyRed = 0;
742 unsigned char chromaKeyGreen = 0;
743 unsigned char chromaKeyBlue = 0;
744 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
746 response = m_ipcModule.createResponse(message);
747 m_ipcModule.appendDouble(response, surface->getOpacity());
748 m_ipcModule.appendUint(response, src.x);
749 m_ipcModule.appendUint(response, src.y);
750 m_ipcModule.appendUint(response, src.width);
751 m_ipcModule.appendUint(response, src.height);
752 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
753 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
754 m_ipcModule.appendUint(response, dest.x);
755 m_ipcModule.appendUint(response, dest.y);
756 m_ipcModule.appendUint(response, dest.width);
757 m_ipcModule.appendUint(response, dest.height);
758 m_ipcModule.appendUint(response, orientation);
759 m_ipcModule.appendBool(response, surface->getVisibility());
760 m_ipcModule.appendUint(response, surface->frameCounter);
761 m_ipcModule.appendUint(response, surface->drawCounter);
762 m_ipcModule.appendUint(response, surface->updateCounter);
763 m_ipcModule.appendUint(response, surface->getPixelFormat());
764 m_ipcModule.appendUint(response, surface->getNativeContent());
765 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
766 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
767 m_ipcModule.appendUint(response, chromaKeyRed);
768 m_ipcModule.appendUint(response, chromaKeyGreen);
769 m_ipcModule.appendUint(response, chromaKeyBlue);
770 m_ipcModule.appendInt(response, surface->getCreatorPid());
774 response = m_ipcModule.createErrorResponse(message);
775 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
778 m_ipcModule.sendToClients(response, &clientHandle, 1);
779 m_ipcModule.destroyMessage(response);
782 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
784 t_ilm_message response;
785 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
787 m_ipcModule.getUint(message, &id);
789 Layer* layer = m_executor->getScene()->getLayer(id);
792 Rectangle dest = layer->getDestinationRegion();
793 Rectangle src = layer->getSourceRegion();
794 OrientationType orientation = layer->getOrientation();
795 unsigned char chromaKeyRed = 0;
796 unsigned char chromaKeyGreen = 0;
797 unsigned char chromaKeyBlue = 0;
798 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
800 response = m_ipcModule.createResponse(message);
801 m_ipcModule.appendDouble(response, layer->getOpacity());
802 m_ipcModule.appendUint(response, src.x);
803 m_ipcModule.appendUint(response, src.y);
804 m_ipcModule.appendUint(response, src.width);
805 m_ipcModule.appendUint(response, src.height);
806 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
807 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
808 m_ipcModule.appendUint(response, dest.x);
809 m_ipcModule.appendUint(response, dest.y);
810 m_ipcModule.appendUint(response, dest.width);
811 m_ipcModule.appendUint(response, dest.height);
812 m_ipcModule.appendUint(response, orientation);
813 m_ipcModule.appendBool(response, layer->getVisibility());
814 m_ipcModule.appendUint(response, layer->getLayerType());
815 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
816 m_ipcModule.appendUint(response, chromaKeyRed);
817 m_ipcModule.appendUint(response, chromaKeyGreen);
818 m_ipcModule.appendUint(response, chromaKeyBlue);
819 m_ipcModule.appendInt(response, layer->getCreatorPid());
823 response = m_ipcModule.createErrorResponse(message);
824 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
827 m_ipcModule.sendToClients(response, &clientHandle, 1);
828 m_ipcModule.destroyMessage(response);
831 void GenericCommunicator::CreateSurface(t_ilm_message message)
833 t_ilm_message response;
834 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
835 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
839 uint pixelformat = 0;
840 PixelFormat pf = PIXELFORMAT_UNKNOWN;
841 uint id = GraphicalObject::INVALID_ID;
843 m_ipcModule.getUint(message, &handle);
844 m_ipcModule.getUint(message, &width);
845 m_ipcModule.getUint(message, &height);
846 m_ipcModule.getUint(message, &pixelformat);
848 pf = (PixelFormat) pixelformat;
851 // First of all create the surface
852 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
854 // after that apply the native content
855 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
859 response = m_ipcModule.createResponse(message);
860 m_ipcModule.appendUint(response, id);
864 response = m_ipcModule.createErrorResponse(message);
865 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
868 m_ipcModule.sendToClients(response, &clientHandle, 1);
869 m_ipcModule.destroyMessage(response);
872 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
874 t_ilm_message response;
875 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
876 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
880 uint pixelformat = 0;
881 PixelFormat pf = PIXELFORMAT_UNKNOWN;
884 m_ipcModule.getUint(message, &handle);
885 m_ipcModule.getUint(message, &width);
886 m_ipcModule.getUint(message, &height);
887 m_ipcModule.getUint(message, &pixelformat);
888 m_ipcModule.getUint(message, &id);
890 pf = (PixelFormat) pixelformat;
892 // First of all create the surface
893 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
895 // after that apply the native content
896 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
900 response = m_ipcModule.createResponse(message);
901 m_ipcModule.appendUint(response, id);
905 response = m_ipcModule.createErrorResponse(message);
906 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
909 m_ipcModule.sendToClients(response, &clientHandle, 1);
910 m_ipcModule.destroyMessage(response);
913 void GenericCommunicator::InitializeSurface(t_ilm_message message)
915 t_ilm_message response;
916 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
917 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
918 uint id = GraphicalObject::INVALID_ID;
920 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
923 response = m_ipcModule.createResponse(message);
924 m_ipcModule.appendUint(response, id);
928 response = m_ipcModule.createErrorResponse(message);
929 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
932 m_ipcModule.sendToClients(response, &clientHandle, 1);
933 m_ipcModule.destroyMessage(response);
936 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
938 t_ilm_message response;
939 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
940 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
942 m_ipcModule.getUint(message, &id);
943 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
946 response = m_ipcModule.createResponse(message);
947 m_ipcModule.appendUint(response, id);
951 response = m_ipcModule.createErrorResponse(message);
952 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
955 m_ipcModule.sendToClients(response, &clientHandle, 1);
956 m_ipcModule.destroyMessage(response);
959 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
961 t_ilm_message response;
962 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
963 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
968 uint pixelformat = 0;
969 PixelFormat pf = PIXELFORMAT_UNKNOWN;
971 m_ipcModule.getUint(message, &id);
972 m_ipcModule.getUint(message, &handle);
973 m_ipcModule.getUint(message, &width);
974 m_ipcModule.getUint(message, &height);
975 m_ipcModule.getUint(message, &pixelformat);
977 pf = (PixelFormat) pixelformat;
979 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
982 response = m_ipcModule.createResponse(message);
986 response = m_ipcModule.createErrorResponse(message);
987 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
990 m_ipcModule.sendToClients(response, &clientHandle, 1);
991 m_ipcModule.destroyMessage(response);
994 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
996 t_ilm_message response;
997 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
998 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1000 m_ipcModule.getUint(message, &id);
1002 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(clientPid, id));
1005 response = m_ipcModule.createResponse(message);
1009 response = m_ipcModule.createErrorResponse(message);
1010 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1013 m_ipcModule.sendToClients(response, &clientHandle, 1);
1014 m_ipcModule.destroyMessage(response);
1017 void GenericCommunicator::RemoveSurface(t_ilm_message message)
1019 t_ilm_message response;
1020 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1021 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1023 m_ipcModule.getUint(message, ¶m);
1024 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(clientPid, param));
1027 response = m_ipcModule.createResponse(message);
1031 response = m_ipcModule.createErrorResponse(message);
1032 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1035 m_ipcModule.sendToClients(response, &clientHandle, 1);
1036 m_ipcModule.destroyMessage(response);
1039 void GenericCommunicator::CreateLayer(t_ilm_message message)
1041 t_ilm_message response;
1042 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1043 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1044 uint id = GraphicalObject::INVALID_ID;
1045 // use resolution of default screen as default width and height of layers
1046 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1047 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1050 response = m_ipcModule.createResponse(message);
1051 m_ipcModule.appendUint(response, id);
1055 response = m_ipcModule.createErrorResponse(message);
1056 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1059 m_ipcModule.sendToClients(response, &clientHandle, 1);
1060 m_ipcModule.destroyMessage(response);
1063 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
1065 t_ilm_message response;
1066 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1067 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1068 uint id = GraphicalObject::INVALID_ID;
1070 m_ipcModule.getUint(message, &id);
1071 // use resolution of default screen as default width and height of layers
1072 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1073 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1076 response = m_ipcModule.createResponse(message);
1077 m_ipcModule.appendUint(response, id);
1081 response = m_ipcModule.createErrorResponse(message);
1082 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1085 m_ipcModule.sendToClients(response, &clientHandle, 1);
1086 m_ipcModule.destroyMessage(response);
1090 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
1092 t_ilm_message response;
1093 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1094 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1096 m_ipcModule.getUint(message, &width);
1098 m_ipcModule.getUint(message, &height);
1100 uint id = GraphicalObject::INVALID_ID;
1101 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1104 response = m_ipcModule.createResponse(message);
1105 m_ipcModule.appendUint(response, id);
1109 response = m_ipcModule.createErrorResponse(message);
1110 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1113 m_ipcModule.sendToClients(response, &clientHandle, 1);
1114 m_ipcModule.destroyMessage(response);
1117 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1119 t_ilm_message response;
1120 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1121 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1122 uint id = GraphicalObject::INVALID_ID;
1125 t_ilm_bool status = ILM_FALSE;
1127 m_ipcModule.getUint(message, &id);
1128 m_ipcModule.getUint(message, &width);
1129 m_ipcModule.getUint(message, &height);
1131 status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1134 response = m_ipcModule.createResponse(message);
1135 m_ipcModule.appendUint(response, id);
1139 response = m_ipcModule.createErrorResponse(message);
1140 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1143 m_ipcModule.sendToClients(response, &clientHandle, 1);
1144 m_ipcModule.destroyMessage(response);
1147 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1149 t_ilm_message response;
1150 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1151 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1153 m_ipcModule.getUint(message, ¶m);
1154 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(clientPid, param));
1157 response = m_ipcModule.createResponse(message);
1161 response = m_ipcModule.createErrorResponse(message);
1162 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1165 m_ipcModule.sendToClients(response, &clientHandle, 1);
1166 m_ipcModule.destroyMessage(response);
1169 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1171 t_ilm_message response;
1172 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1173 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1175 uint surfacegroupid = 0;
1177 m_ipcModule.getUint(message, &surfaceid);
1178 m_ipcModule.getUint(message, &surfacegroupid);
1180 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1183 response = m_ipcModule.createResponse(message);
1187 response = m_ipcModule.createErrorResponse(message);
1188 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1191 m_ipcModule.sendToClients(response, &clientHandle, 1);
1192 m_ipcModule.destroyMessage(response);
1195 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1197 t_ilm_message response;
1198 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1199 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1201 uint surfacegroupid = 0;
1203 m_ipcModule.getUint(message, &surfaceid);
1204 m_ipcModule.getUint(message, &surfacegroupid);
1206 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1209 response = m_ipcModule.createResponse(message);
1213 response = m_ipcModule.createErrorResponse(message);
1214 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1217 m_ipcModule.sendToClients(response, &clientHandle, 1);
1218 m_ipcModule.destroyMessage(response);
1221 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1223 t_ilm_message response;
1224 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1225 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1227 uint layergroupid = 0;
1229 m_ipcModule.getUint(message, &layerid);
1230 m_ipcModule.getUint(message, &layergroupid);
1232 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
1235 response = m_ipcModule.createResponse(message);
1239 response = m_ipcModule.createErrorResponse(message);
1240 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1243 m_ipcModule.sendToClients(response, &clientHandle, 1);
1244 m_ipcModule.destroyMessage(response);
1247 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1249 t_ilm_message response;
1250 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1251 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1253 uint layergroupid = 0;
1255 m_ipcModule.getUint(message, &layerid);
1256 m_ipcModule.getUint(message, &layergroupid);
1258 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
1261 response = m_ipcModule.createResponse(message);
1265 response = m_ipcModule.createErrorResponse(message);
1266 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1269 m_ipcModule.sendToClients(response, &clientHandle, 1);
1270 m_ipcModule.destroyMessage(response);
1273 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1275 t_ilm_message response;
1276 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1277 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1281 m_ipcModule.getUint(message, &surfaceid);
1282 m_ipcModule.getUint(message, &layer);
1284 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(clientPid, layer, surfaceid));
1287 response = m_ipcModule.createResponse(message);
1291 response = m_ipcModule.createErrorResponse(message);
1292 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1295 m_ipcModule.sendToClients(response, &clientHandle, 1);
1296 m_ipcModule.destroyMessage(response);
1299 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1301 t_ilm_message response;
1302 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1303 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1306 m_ipcModule.getUint(message, &surfaceid);
1307 m_ipcModule.getUint(message, &layerid);
1309 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(clientPid, layerid, surfaceid));
1312 response = m_ipcModule.createResponse(message);
1316 response = m_ipcModule.createErrorResponse(message);
1317 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1320 m_ipcModule.sendToClients(response, &clientHandle, 1);
1321 m_ipcModule.destroyMessage(response);
1324 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1326 t_ilm_message response;
1327 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1328 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1329 uint newID = GraphicalObject::INVALID_ID;
1331 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1334 response = m_ipcModule.createResponse(message);
1335 m_ipcModule.appendUint(response, newID);
1339 response = m_ipcModule.createErrorResponse(message);
1340 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1343 m_ipcModule.sendToClients(response, &clientHandle, 1);
1344 m_ipcModule.destroyMessage(response);
1347 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1349 t_ilm_message response;
1350 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1351 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1352 uint newID = GraphicalObject::INVALID_ID;
1354 m_ipcModule.getUint(message, &newID);
1356 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1359 response = m_ipcModule.createResponse(message);
1360 m_ipcModule.appendUint(response, newID);
1364 response = m_ipcModule.createErrorResponse(message);
1365 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1368 m_ipcModule.sendToClients(response, &clientHandle, 1);
1369 m_ipcModule.destroyMessage(response);
1372 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1374 t_ilm_message response;
1375 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1376 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1378 m_ipcModule.getUint(message, ¶m);
1380 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
1383 response = m_ipcModule.createResponse(message);
1387 response = m_ipcModule.createErrorResponse(message);
1388 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1391 m_ipcModule.sendToClients(response, &clientHandle, 1);
1392 m_ipcModule.destroyMessage(response);
1395 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1397 t_ilm_message response;
1398 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1399 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1400 uint newID = GraphicalObject::INVALID_ID;
1402 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1405 response = m_ipcModule.createResponse(message);
1406 m_ipcModule.appendUint(response, newID);
1410 response = m_ipcModule.createErrorResponse(message);
1411 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1414 m_ipcModule.sendToClients(response, &clientHandle, 1);
1415 m_ipcModule.destroyMessage(response);
1418 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1420 t_ilm_message response;
1421 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1422 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1423 uint newID = GraphicalObject::INVALID_ID;
1425 m_ipcModule.getUint(message, &newID);
1427 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1430 response = m_ipcModule.createResponse(message);
1431 m_ipcModule.appendUint(response, newID);
1435 response = m_ipcModule.createErrorResponse(message);
1436 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1439 m_ipcModule.sendToClients(response, &clientHandle, 1);
1440 m_ipcModule.destroyMessage(response);
1443 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1445 t_ilm_message response;
1446 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1447 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1449 m_ipcModule.getUint(message, ¶m);
1451 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
1454 response = m_ipcModule.createResponse(message);
1458 response = m_ipcModule.createErrorResponse(message);
1459 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1462 m_ipcModule.sendToClients(response, &clientHandle, 1);
1463 m_ipcModule.destroyMessage(response);
1466 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1468 t_ilm_message response;
1469 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1470 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1477 m_ipcModule.getUint(message, &id);
1478 m_ipcModule.getUint(message, &x);
1479 m_ipcModule.getUint(message, &y);
1480 m_ipcModule.getUint(message, &width);
1481 m_ipcModule.getUint(message, &height);
1483 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1486 response = m_ipcModule.createResponse(message);
1490 response = m_ipcModule.createErrorResponse(message);
1491 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1494 m_ipcModule.sendToClients(response, &clientHandle, 1);
1495 m_ipcModule.destroyMessage(response);
1498 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1500 t_ilm_message response;
1501 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1502 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1509 m_ipcModule.getUint(message, &id);
1510 m_ipcModule.getUint(message, &x);
1511 m_ipcModule.getUint(message, &y);
1512 m_ipcModule.getUint(message, &width);
1513 m_ipcModule.getUint(message, &height);
1515 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1518 response = m_ipcModule.createResponse(message);
1522 response = m_ipcModule.createErrorResponse(message);
1523 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1526 m_ipcModule.sendToClients(response, &clientHandle, 1);
1527 m_ipcModule.destroyMessage(response);
1530 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1532 t_ilm_message response;
1533 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1534 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1541 m_ipcModule.getUint(message, &id);
1542 m_ipcModule.getUint(message, &x);
1543 m_ipcModule.getUint(message, &y);
1544 m_ipcModule.getUint(message, &width);
1545 m_ipcModule.getUint(message, &height);
1547 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1550 response = m_ipcModule.createResponse(message);
1554 response = m_ipcModule.createErrorResponse(message);
1555 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1558 m_ipcModule.sendToClients(response, &clientHandle, 1);
1559 m_ipcModule.destroyMessage(response);
1562 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1564 t_ilm_message response;
1565 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1566 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1571 m_ipcModule.getUint(message, &id);
1572 m_ipcModule.getUint(message, &x);
1573 m_ipcModule.getUint(message, &y);
1575 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(clientPid, id, x, y));
1578 response = m_ipcModule.createResponse(message);
1582 response = m_ipcModule.createErrorResponse(message);
1583 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1586 m_ipcModule.sendToClients(response, &clientHandle, 1);
1587 m_ipcModule.destroyMessage(response);
1590 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1592 t_ilm_message response;
1593 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1594 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1599 m_ipcModule.getUint(message, &id);
1601 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(clientPid, id, &x, &y));
1604 response = m_ipcModule.createResponse(message);
1605 m_ipcModule.appendUint(response, x);
1606 m_ipcModule.appendUint(response, y);
1610 response = m_ipcModule.createErrorResponse(message);
1611 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1614 m_ipcModule.sendToClients(response, &clientHandle, 1);
1615 m_ipcModule.destroyMessage(response);
1618 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1620 t_ilm_message response;
1621 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1622 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1627 m_ipcModule.getUint(message, &id);
1628 m_ipcModule.getUint(message, &width);
1629 m_ipcModule.getUint(message, &height);
1631 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(clientPid, id, width, height));
1634 response = m_ipcModule.createResponse(message);
1638 response = m_ipcModule.createErrorResponse(message);
1639 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1642 m_ipcModule.sendToClients(response, &clientHandle, 1);
1643 m_ipcModule.destroyMessage(response);
1646 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1648 t_ilm_message response;
1649 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1650 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1657 m_ipcModule.getUint(message, &id);
1658 m_ipcModule.getUint(message, &x);
1659 m_ipcModule.getUint(message, &y);
1660 m_ipcModule.getUint(message, &width);
1661 m_ipcModule.getUint(message, &height);
1663 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1666 response = m_ipcModule.createResponse(message);
1670 response = m_ipcModule.createErrorResponse(message);
1671 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1674 m_ipcModule.sendToClients(response, &clientHandle, 1);
1675 m_ipcModule.destroyMessage(response);
1678 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1680 t_ilm_message response;
1681 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1682 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1687 m_ipcModule.getUint(message, &id);
1688 m_ipcModule.getUint(message, &x);
1689 m_ipcModule.getUint(message, &y);
1691 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(clientPid, id, x, y));
1694 response = m_ipcModule.createResponse(message);
1698 response = m_ipcModule.createErrorResponse(message);
1699 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1702 m_ipcModule.sendToClients(response, &clientHandle, 1);
1703 m_ipcModule.destroyMessage(response);
1706 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1708 t_ilm_message response;
1709 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1710 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1715 m_ipcModule.getUint(message, &id);
1717 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(clientPid, id, &x, &y));
1720 response = m_ipcModule.createResponse(message);
1721 m_ipcModule.appendUint(response, x);
1722 m_ipcModule.appendUint(response, y);
1726 response = m_ipcModule.createErrorResponse(message);
1727 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1730 m_ipcModule.sendToClients(response, &clientHandle, 1);
1731 m_ipcModule.destroyMessage(response);
1734 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1736 t_ilm_message response;
1737 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1738 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1743 m_ipcModule.getUint(message, &id);
1744 m_ipcModule.getUint(message, &width);
1745 m_ipcModule.getUint(message, &height);
1747 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(clientPid, id, width, height));
1750 response = m_ipcModule.createResponse(message);
1754 response = m_ipcModule.createErrorResponse(message);
1755 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1758 m_ipcModule.sendToClients(response, &clientHandle, 1);
1759 m_ipcModule.destroyMessage(response);
1762 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1764 t_ilm_message response;
1765 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1766 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1771 m_ipcModule.getUint(message, &id);
1773 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(clientPid, id, &width, &height));
1776 response = m_ipcModule.createResponse(message);
1777 m_ipcModule.appendUint(response, width);
1778 m_ipcModule.appendUint(response, height);
1782 response = m_ipcModule.createErrorResponse(message);
1783 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1786 m_ipcModule.sendToClients(response, &clientHandle, 1);
1787 m_ipcModule.destroyMessage(response);
1790 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1792 t_ilm_message response;
1793 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1794 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1799 m_ipcModule.getUint(message, &id);
1801 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(clientPid, id, &width, &height));
1804 response = m_ipcModule.createResponse(message);
1805 m_ipcModule.appendUint(response, width);
1806 m_ipcModule.appendUint(response, height);
1810 response = m_ipcModule.createErrorResponse(message);
1811 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1814 m_ipcModule.sendToClients(response, &clientHandle, 1);
1815 m_ipcModule.destroyMessage(response);
1818 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1820 t_ilm_message response;
1821 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1822 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1826 m_ipcModule.getUint(message, &id);
1827 m_ipcModule.getDouble(message, ¶m);
1829 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(clientPid, id, param));
1832 response = m_ipcModule.createResponse(message);
1836 response = m_ipcModule.createErrorResponse(message);
1837 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1840 m_ipcModule.sendToClients(response, &clientHandle, 1);
1841 m_ipcModule.destroyMessage(response);
1844 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1846 t_ilm_message response;
1847 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1848 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1852 m_ipcModule.getUint(message, &id);
1853 m_ipcModule.getDouble(message, ¶m);
1855 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(clientPid, id, param));
1858 response = m_ipcModule.createResponse(message);
1862 response = m_ipcModule.createErrorResponse(message);
1863 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1866 m_ipcModule.sendToClients(response, &clientHandle, 1);
1867 m_ipcModule.destroyMessage(response);
1870 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1872 t_ilm_message response;
1873 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1874 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1878 m_ipcModule.getUint(message, &id);
1879 m_ipcModule.getDouble(message, ¶m);
1881 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
1884 response = m_ipcModule.createResponse(message);
1888 response = m_ipcModule.createErrorResponse(message);
1889 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1892 m_ipcModule.sendToClients(response, &clientHandle, 1);
1893 m_ipcModule.destroyMessage(response);
1896 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1898 t_ilm_message response;
1899 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1900 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1904 m_ipcModule.getUint(message, &id);
1905 m_ipcModule.getDouble(message, ¶m);
1907 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
1910 response = m_ipcModule.createResponse(message);
1914 response = m_ipcModule.createErrorResponse(message);
1915 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1918 m_ipcModule.sendToClients(response, &clientHandle, 1);
1919 m_ipcModule.destroyMessage(response);
1922 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1924 t_ilm_message response;
1925 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1926 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1930 m_ipcModule.getUint(message, &id);
1932 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(clientPid, id, ¶m));
1935 response = m_ipcModule.createResponse(message);
1936 m_ipcModule.appendDouble(response, param);
1940 response = m_ipcModule.createErrorResponse(message);
1941 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1944 m_ipcModule.sendToClients(response, &clientHandle, 1);
1945 m_ipcModule.destroyMessage(response);
1948 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1950 t_ilm_message response;
1951 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1952 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1956 m_ipcModule.getUint(message, &id);
1958 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(clientPid, id, ¶m));
1961 response = m_ipcModule.createResponse(message);
1962 m_ipcModule.appendDouble(response, param);
1966 response = m_ipcModule.createErrorResponse(message);
1967 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1970 m_ipcModule.sendToClients(response, &clientHandle, 1);
1971 m_ipcModule.destroyMessage(response);
1974 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1976 t_ilm_message response;
1977 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1978 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1981 OrientationType o = Zero;
1983 m_ipcModule.getUint(message, &id);
1984 m_ipcModule.getUint(message, ¶m);
1986 o = (OrientationType) param;
1988 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(clientPid, id, o));
1991 response = m_ipcModule.createResponse(message);
1995 response = m_ipcModule.createErrorResponse(message);
1996 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1999 m_ipcModule.sendToClients(response, &clientHandle, 1);
2000 m_ipcModule.destroyMessage(response);
2003 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
2005 t_ilm_message response;
2006 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2007 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2011 m_ipcModule.getUint(message, &id);
2013 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(clientPid, id, &o));
2016 response = m_ipcModule.createResponse(message);
2017 m_ipcModule.appendUint(response, o);
2021 response = m_ipcModule.createErrorResponse(message);
2022 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2025 m_ipcModule.sendToClients(response, &clientHandle, 1);
2026 m_ipcModule.destroyMessage(response);
2029 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
2031 t_ilm_message response;
2032 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2033 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2036 OrientationType o = Zero;
2038 m_ipcModule.getUint(message, &id);
2039 m_ipcModule.getUint(message, ¶m);
2041 o = (OrientationType) param;
2043 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(clientPid, id, o));
2046 response = m_ipcModule.createResponse(message);
2050 response = m_ipcModule.createErrorResponse(message);
2051 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2054 m_ipcModule.sendToClients(response, &clientHandle, 1);
2055 m_ipcModule.destroyMessage(response);
2058 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
2060 t_ilm_message response;
2061 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2062 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2066 m_ipcModule.getUint(message, &id);
2068 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(clientPid, id, &o));
2071 response = m_ipcModule.createResponse(message);
2072 m_ipcModule.appendUint(response, o);
2076 response = m_ipcModule.createErrorResponse(message);
2077 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2080 m_ipcModule.sendToClients(response, &clientHandle, 1);
2081 m_ipcModule.destroyMessage(response);
2084 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
2086 t_ilm_message response;
2087 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2088 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2090 PixelFormat pixelFormat;
2092 m_ipcModule.getUint(message, &id);
2094 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(clientPid, id, &pixelFormat));
2097 response = m_ipcModule.createResponse(message);
2098 m_ipcModule.appendUint(response, pixelFormat);
2102 response = m_ipcModule.createErrorResponse(message);
2103 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2106 m_ipcModule.sendToClients(response, &clientHandle, 1);
2107 m_ipcModule.destroyMessage(response);
2110 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
2112 t_ilm_message response;
2113 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2114 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2116 t_ilm_bool newVis = ILM_FALSE;
2118 m_ipcModule.getUint(message, &surfaceid);
2119 m_ipcModule.getBool(message, &newVis);
2121 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(clientPid, surfaceid, newVis));
2124 response = m_ipcModule.createResponse(message);
2128 response = m_ipcModule.createErrorResponse(message);
2129 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2132 m_ipcModule.sendToClients(response, &clientHandle, 1);
2133 m_ipcModule.destroyMessage(response);
2136 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
2138 t_ilm_message response;
2139 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2140 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2142 t_ilm_bool myparam = ILM_FALSE;
2144 m_ipcModule.getUint(message, &layerid);
2145 m_ipcModule.getBool(message, &myparam);
2147 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(clientPid, layerid, myparam));
2150 response = m_ipcModule.createResponse(message);
2154 response = m_ipcModule.createErrorResponse(message);
2155 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2158 m_ipcModule.sendToClients(response, &clientHandle, 1);
2159 m_ipcModule.destroyMessage(response);
2162 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
2164 t_ilm_message response;
2165 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2166 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2170 m_ipcModule.getUint(message, &id);
2172 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(clientPid, id, &visibility));
2175 response = m_ipcModule.createResponse(message);
2176 m_ipcModule.appendBool(response, visibility);
2180 response = m_ipcModule.createErrorResponse(message);
2181 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2184 m_ipcModule.sendToClients(response, &clientHandle, 1);
2185 m_ipcModule.destroyMessage(response);
2188 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
2190 t_ilm_message response;
2191 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2192 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2196 m_ipcModule.getUint(message, &id);
2198 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(clientPid, id, &visibility));
2201 response = m_ipcModule.createResponse(message);
2202 m_ipcModule.appendBool(response, visibility);
2206 response = m_ipcModule.createErrorResponse(message);
2207 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2210 m_ipcModule.sendToClients(response, &clientHandle, 1);
2211 m_ipcModule.destroyMessage(response);
2214 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
2216 t_ilm_message response;
2217 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2218 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2220 t_ilm_bool myparam = ILM_FALSE;
2222 m_ipcModule.getUint(message, &groupid);
2223 m_ipcModule.getBool(message, &myparam);
2225 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
2228 response = m_ipcModule.createResponse(message);
2232 response = m_ipcModule.createErrorResponse(message);
2233 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2236 m_ipcModule.sendToClients(response, &clientHandle, 1);
2237 m_ipcModule.destroyMessage(response);
2240 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
2242 t_ilm_message response;
2243 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2244 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2246 t_ilm_bool myparam = ILM_FALSE;
2248 m_ipcModule.getUint(message, &groupid);
2249 m_ipcModule.getBool(message, &myparam);
2251 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
2254 response = m_ipcModule.createResponse(message);
2258 response = m_ipcModule.createErrorResponse(message);
2259 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2262 m_ipcModule.sendToClients(response, &clientHandle, 1);
2263 m_ipcModule.destroyMessage(response);
2267 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
2269 t_ilm_message response;
2270 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2271 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2276 m_ipcModule.getUintArray(message, &array, &length);
2277 m_ipcModule.getUint(message, &screenID);
2279 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, screenID, array, length));
2282 response = m_ipcModule.createResponse(message);
2286 response = m_ipcModule.createErrorResponse(message);
2287 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2290 m_ipcModule.sendToClients(response, &clientHandle, 1);
2291 m_ipcModule.destroyMessage(response);
2294 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2296 t_ilm_message response;
2297 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2298 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2303 m_ipcModule.getUint(message, &layerid);
2304 m_ipcModule.getUintArray(message, &array, &length);
2306 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(clientPid, layerid, array, length));
2309 response = m_ipcModule.createResponse(message);
2313 response = m_ipcModule.createErrorResponse(message);
2314 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2317 m_ipcModule.sendToClients(response, &clientHandle, 1);
2318 m_ipcModule.destroyMessage(response);
2321 void GenericCommunicator::GetLayerType(t_ilm_message message)
2323 t_ilm_message response;
2324 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2326 m_ipcModule.getUint(message, &id);
2328 Layer* layer = m_executor->getScene()->getLayer(id);
2331 response = m_ipcModule.createResponse(message);
2332 m_ipcModule.appendUint(response, layer->getLayerType());
2336 response = m_ipcModule.createErrorResponse(message);
2337 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2340 m_ipcModule.sendToClients(response, &clientHandle, 1);
2341 m_ipcModule.destroyMessage(response);
2344 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2346 t_ilm_message response;
2347 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2349 LayerType type = Unknown;
2351 m_ipcModule.getUint(message, &id);
2353 type = (LayerType) id;
2355 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2356 response = m_ipcModule.createResponse(message);
2357 m_ipcModule.appendUint(response, capabilities);
2358 m_ipcModule.sendToClients(response, &clientHandle, 1);
2359 m_ipcModule.destroyMessage(response);
2362 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2364 t_ilm_message response;
2365 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2367 m_ipcModule.getUint(message, &id);
2369 Layer* layer = m_executor->getScene()->getLayer(id);
2372 response = m_ipcModule.createResponse(message);
2373 m_ipcModule.appendUint(response, layer->getCapabilities());
2377 response = m_ipcModule.createErrorResponse(message);
2378 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2381 m_ipcModule.sendToClients(response, &clientHandle, 1);
2382 m_ipcModule.destroyMessage(response);
2385 void GenericCommunicator::FadeIn(t_ilm_message message)
2387 t_ilm_message response;
2388 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2389 response = m_ipcModule.createErrorResponse(message);
2390 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2391 m_ipcModule.sendToClients(response, &clientHandle, 1);
2392 m_ipcModule.destroyMessage(response);
2395 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2397 t_ilm_message response;
2398 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2399 response = m_ipcModule.createErrorResponse(message);
2400 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2401 m_ipcModule.sendToClients(response, &clientHandle, 1);
2402 m_ipcModule.destroyMessage(response);
2405 void GenericCommunicator::FadeOut(t_ilm_message message)
2407 t_ilm_message response;
2408 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2409 response = m_ipcModule.createErrorResponse(message);
2410 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2411 m_ipcModule.sendToClients(response, &clientHandle, 1);
2412 m_ipcModule.destroyMessage(response);
2415 void GenericCommunicator::Exit(t_ilm_message message)
2417 t_ilm_message response;
2418 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2419 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2420 t_ilm_bool status = m_executor->execute(new ExitCommand(clientPid));
2423 response = m_ipcModule.createResponse(message);
2427 response = m_ipcModule.createErrorResponse(message);
2428 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2431 m_ipcModule.sendToClients(response, &clientHandle, 1);
2432 m_ipcModule.destroyMessage(response);
2435 void GenericCommunicator::CommitChanges(t_ilm_message message)
2437 t_ilm_message response;
2438 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2439 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2440 t_ilm_bool status = m_executor->execute(new CommitCommand(clientPid));
2443 response = m_ipcModule.createResponse(message);
2447 response = m_ipcModule.createErrorResponse(message);
2448 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2451 m_ipcModule.sendToClients(response, &clientHandle, 1);
2452 m_ipcModule.destroyMessage(response);
2455 void GenericCommunicator::CreateShader(t_ilm_message message)
2457 t_ilm_message response;
2458 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2459 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2460 char vertname[1024];
2461 char fragname[1024];
2464 m_ipcModule.getString(message, vertname);
2465 m_ipcModule.getString(message, fragname);
2467 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(clientPid, vertname, fragname, &id));
2470 response = m_ipcModule.createResponse(message);
2471 m_ipcModule.appendUint(response, id);
2475 response = m_ipcModule.createErrorResponse(message);
2476 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2479 m_ipcModule.sendToClients(response, &clientHandle, 1);
2480 m_ipcModule.destroyMessage(response);
2483 void GenericCommunicator::DestroyShader(t_ilm_message message)
2485 t_ilm_message response;
2486 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2487 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2490 m_ipcModule.getUint(message, &shaderid);
2492 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(clientPid, shaderid));
2495 response = m_ipcModule.createResponse(message);
2499 response = m_ipcModule.createErrorResponse(message);
2500 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2503 m_ipcModule.sendToClients(response, &clientHandle, 1);
2504 m_ipcModule.destroyMessage(response);
2507 void GenericCommunicator::SetShader(t_ilm_message message)
2509 t_ilm_message response;
2510 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2511 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2515 m_ipcModule.getUint(message, &surfaceId);
2516 m_ipcModule.getUint(message, &shaderid);
2518 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(clientPid, surfaceId, shaderid));
2521 response = m_ipcModule.createResponse(message);
2525 response = m_ipcModule.createErrorResponse(message);
2526 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2529 m_ipcModule.sendToClients(response, &clientHandle, 1);
2530 m_ipcModule.destroyMessage(response);
2533 void GenericCommunicator::SetUniforms(t_ilm_message message)
2535 t_ilm_message response;
2536 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2537 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2539 std::vector<string> uniforms;
2541 m_ipcModule.getUint(message, &id);
2544 //m_ipcModule.getStringArray(&uniforms);
2546 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(clientPid, id, uniforms));
2549 response = m_ipcModule.createResponse(message);
2553 response = m_ipcModule.createErrorResponse(message);
2554 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2557 m_ipcModule.sendToClients(response, &clientHandle, 1);
2558 m_ipcModule.destroyMessage(response);
2561 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2563 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2564 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2565 t_ilm_message response;
2568 m_ipcModule.getUint(message, &surfaceId);
2570 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(clientPid, surfaceId));
2573 response = m_ipcModule.createResponse(message);
2577 response = m_ipcModule.createErrorResponse(message);
2578 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2581 m_ipcModule.sendToClients(response, &clientHandle, 1);
2582 m_ipcModule.destroyMessage(response);
2586 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2588 t_ilm_message response;
2589 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2590 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2593 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(clientPid, &surfaceId));
2596 response = m_ipcModule.createResponse(message);
2597 m_ipcModule.appendUint(response, surfaceId);
2601 response = m_ipcModule.createErrorResponse(message);
2602 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2605 m_ipcModule.sendToClients(response, &clientHandle, 1);
2606 m_ipcModule.destroyMessage(response);
2610 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2612 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2613 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2614 t_ilm_message response;
2617 InputDevice devices;
2620 m_ipcModule.getUint(message, &surfaceId);
2621 m_ipcModule.getUint(message, &udevices);
2622 m_ipcModule.getBool(message, &accept);
2624 devices = (InputDevice) udevices;
2626 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(clientPid, surfaceId, devices, accept));
2629 response = m_ipcModule.createResponse(message);
2633 response = m_ipcModule.createErrorResponse(message);
2634 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2637 m_ipcModule.sendToClients(response, &clientHandle, 1);
2638 m_ipcModule.destroyMessage(response);
2641 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2643 t_ilm_message response;
2644 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2645 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2650 m_ipcModule.getUint(message, &surfaceid);
2651 m_ipcModule.getUintArray(message, &array, &length);
2653 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(clientPid, surfaceid, array, length));
2656 response = m_ipcModule.createResponse(message);
2660 response = m_ipcModule.createErrorResponse(message);
2661 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2664 m_ipcModule.sendToClients(response, &clientHandle, 1);
2665 m_ipcModule.destroyMessage(response);
2668 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2670 t_ilm_message response;
2671 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2672 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2677 m_ipcModule.getUint(message, &layerid);
2678 m_ipcModule.getUintArray(message, &array, &length);
2680 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(clientPid, layerid, array, length));
2683 response = m_ipcModule.createResponse(message);
2687 response = m_ipcModule.createErrorResponse(message);
2688 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2691 m_ipcModule.sendToClients(response, &clientHandle, 1);
2692 m_ipcModule.destroyMessage(response);
2695 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2697 t_ilm_message response;
2698 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2701 m_ipcModule.getUint(message, &layerid);
2703 Layer* layer = m_executor->getScene()->getLayer(layerid);
2706 layer->addNotification(clientHandle);
2707 response = m_ipcModule.createResponse(message);
2711 response = m_ipcModule.createErrorResponse(message);
2712 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2715 m_ipcModule.sendToClients(response, &clientHandle, 1);
2716 m_ipcModule.destroyMessage(response);
2719 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2721 t_ilm_message response;
2722 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2725 m_ipcModule.getUint(message, &surfaceid);
2727 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2730 surface->addNotification(clientHandle);
2731 response = m_ipcModule.createResponse(message);
2735 response = m_ipcModule.createErrorResponse(message);
2736 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2739 m_ipcModule.sendToClients(response, &clientHandle, 1);
2740 m_ipcModule.destroyMessage(response);
2743 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2745 t_ilm_message response;
2746 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2749 m_ipcModule.getUint(message, &layerid);
2751 Layer* layer = m_executor->getScene()->getLayer(layerid);
2754 layer->removeNotification(clientHandle);
2755 response = m_ipcModule.createResponse(message);
2759 response = m_ipcModule.createErrorResponse(message);
2760 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2763 m_ipcModule.sendToClients(response, &clientHandle, 1);
2764 m_ipcModule.destroyMessage(response);
2767 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2769 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2770 t_ilm_message response;
2773 m_ipcModule.getUint(message, &surfaceid);
2775 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2778 surface->removeNotification(clientHandle);
2779 response = m_ipcModule.createResponse(message);
2783 response = m_ipcModule.createErrorResponse(message);
2784 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2787 m_ipcModule.sendToClients(response, &clientHandle, 1);
2788 m_ipcModule.destroyMessage(response);
2791 void GenericCommunicator::processNotificationQueue()
2793 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2794 NotificationQueue::iterator iter = notificationQueue.begin();
2795 NotificationQueue::iterator end = notificationQueue.end();
2797 for (; iter != end; ++iter)
2799 GraphicalObject* object = iter->first;
2800 t_ilm_notification_mask mask = iter->second;
2801 sendNotification(object, mask);
2803 notificationQueue.clear();
2806 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2808 switch (object->type)
2812 Layer* layer = static_cast<Layer*>(object);
2815 ApplicationReferenceList& arl = layer->getNotificationClients();
2819 t_ilm_message notification;
2820 Rectangle dest = layer->getDestinationRegion();
2821 Rectangle src = layer->getSourceRegion();
2822 OrientationType orientation = layer->getOrientation();
2824 unsigned char chromaKeyRed = 0;
2825 unsigned char chromaKeyGreen = 0;
2826 unsigned char chromaKeyBlue = 0;
2827 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2829 std::stringstream notificationName;
2830 notificationName << "NotificationForLayer" << layer->getID();
2832 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2833 m_ipcModule.appendUint(notification, layer->getID());
2834 m_ipcModule.appendUint(notification, mask);
2836 m_ipcModule.appendDouble(notification, layer->getOpacity());
2837 m_ipcModule.appendUint(notification, src.x);
2838 m_ipcModule.appendUint(notification, src.y);
2839 m_ipcModule.appendUint(notification, src.width);
2840 m_ipcModule.appendUint(notification, src.height);
2841 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2842 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2843 m_ipcModule.appendUint(notification, dest.x);
2844 m_ipcModule.appendUint(notification, dest.y);
2845 m_ipcModule.appendUint(notification, dest.width);
2846 m_ipcModule.appendUint(notification, dest.height);
2847 m_ipcModule.appendUint(notification, orientation);
2848 m_ipcModule.appendBool(notification, layer->getVisibility());
2849 m_ipcModule.appendUint(notification, layer->getLayerType());
2850 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2851 m_ipcModule.appendUint(notification, chromaKeyRed);
2852 m_ipcModule.appendUint(notification, chromaKeyGreen);
2853 m_ipcModule.appendUint(notification, chromaKeyBlue);
2854 m_ipcModule.appendInt(notification, layer->getCreatorPid());
2856 int clientCount = arl.size();
2857 t_ilm_client_handle clientArray[256];
2859 ApplicationReferenceList::iterator iter = arl.begin();
2860 ApplicationReferenceList::iterator end = arl.end();
2862 for (int clientNumber = 0;
2863 iter != end, clientNumber < 256;
2864 ++iter, ++clientNumber)
2866 t_ilm_client_handle client = *iter;
2867 clientArray[clientNumber] = client;
2870 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2872 if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
2874 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2877 m_ipcModule.destroyMessage(notification);
2884 Surface* surface = static_cast<Surface*>(object);
2887 ApplicationReferenceList& arl = surface->getNotificationClients();
2891 t_ilm_message notification;
2892 std::stringstream notificationName;
2893 notificationName << "NotificationForSurface" << surface->getID();
2895 unsigned char chromaKeyRed = 0;
2896 unsigned char chromaKeyGreen = 0;
2897 unsigned char chromaKeyBlue = 0;
2898 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2900 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2901 m_ipcModule.appendUint(notification, surface->getID());
2902 m_ipcModule.appendUint(notification, mask);
2904 m_ipcModule.appendDouble(notification, surface->getOpacity());
2905 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2906 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2907 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2908 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2909 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2910 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2911 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2912 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2913 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2914 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2915 m_ipcModule.appendUint(notification, surface->getOrientation());
2916 m_ipcModule.appendBool(notification, surface->getVisibility());
2917 m_ipcModule.appendUint(notification, surface->frameCounter);
2918 m_ipcModule.appendUint(notification, surface->drawCounter);
2919 m_ipcModule.appendUint(notification, surface->updateCounter);
2920 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2921 m_ipcModule.appendUint(notification, surface->getNativeContent());
2922 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2923 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2924 m_ipcModule.appendUint(notification, chromaKeyRed);
2925 m_ipcModule.appendUint(notification, chromaKeyGreen);
2926 m_ipcModule.appendUint(notification, chromaKeyBlue);
2927 m_ipcModule.appendInt(notification, surface->getCreatorPid());
2929 int clientCount = arl.size();
2930 t_ilm_client_handle clients[256];
2932 ApplicationReferenceList::iterator iter = arl.begin();
2933 ApplicationReferenceList::iterator end = arl.end();
2935 for (int clientNumber = 0;
2936 iter != end, clientNumber < 256;
2937 ++iter, ++clientNumber)
2939 clients[clientNumber] = *iter;
2942 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2944 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2946 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2949 m_ipcModule.destroyMessage(notification);
2955 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2960 HealthCondition GenericCommunicator::getHealth()
2962 HealthCondition health = PluginBase::getHealth();
2963 if (0 != pthread_kill(mThreadId, 0))
2965 health = HealthDead;
2970 void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
2972 t_ilm_message response;
2973 OptimizationType optimizationId;
2974 OptimizationModeType optimizationMode;
2976 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2977 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2979 m_ipcModule.getUint(message,&o);
2980 optimizationId = (OptimizationType) o;
2981 m_ipcModule.getUint(message,&o);
2982 optimizationMode = (OptimizationModeType) o;
2984 t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
2987 response = m_ipcModule.createResponse(message);
2991 response = m_ipcModule.createErrorResponse(message);
2992 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
2994 m_ipcModule.sendToClients(response,&clientHandle,1);
2995 m_ipcModule.destroyMessage(response);
2998 void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
3000 t_ilm_message response;
3001 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
3002 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
3003 OptimizationType optimizationId;
3004 OptimizationModeType optimizationMode;
3007 m_ipcModule.getUint(message,&o);
3008 optimizationId = (OptimizationType)o;
3010 t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
3014 response = m_ipcModule.createResponse(message);
3015 m_ipcModule.appendUint(response,(unsigned int)optimizationMode);
3019 response = m_ipcModule.createErrorResponse(message);
3020 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3022 m_ipcModule.sendToClients(response,&clientHandle,1);
3023 m_ipcModule.destroyMessage(response);
3027 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
3029 return new GenericCommunicator(executor);
3032 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)