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"
23 #include "Configuration.h"
25 #include "ICommandExecutor.h"
26 #include "CommitCommand.h"
27 #include "LayerCreateCommand.h"
28 #include "LayergroupCreateCommand.h"
29 #include "SurfaceCreateCommand.h"
30 #include "SurfacegroupCreateCommand.h"
31 #include "SurfaceGetDimensionCommand.h"
32 #include "LayerGetDimensionCommand.h"
33 #include "SurfaceGetOpacityCommand.h"
34 #include "LayerGetOpacityCommand.h"
35 #include "SurfaceGetPixelformatCommand.h"
36 #include "LayerGetVisibilityCommand.h"
37 #include "SurfaceGetVisibilityCommand.h"
38 #include "LayerAddSurfaceCommand.h"
39 #include "LayerRemoveSurfaceCommand.h"
40 #include "LayerRemoveCommand.h"
41 #include "SurfaceRemoveCommand.h"
42 #include "LayergroupRemoveCommand.h"
43 #include "SurfacegroupRemoveCommand.h"
44 #include "SurfaceGetOrientationCommand.h"
45 #include "LayerGetOrientationCommand.h"
46 #include "LayergroupAddLayerCommand.h"
47 #include "LayergroupRemoveLayerCommand.h"
48 #include "LayerSetDestinationRectangleCommand.h"
49 #include "SurfaceSetDestinationRectangleCommand.h"
50 #include "LayerSetOpacityCommand.h"
51 #include "LayergroupSetOpacityCommand.h"
52 #include "SurfaceSetOpacityCommand.h"
53 #include "SurfacegroupSetOpacityCommand.h"
54 #include "LayerSetSourceRectangleCommand.h"
55 #include "SurfaceSetSourceRectangleCommand.h"
56 #include "LayerSetOrientationCommand.h"
57 #include "SurfaceSetOrientationCommand.h"
58 #include "SurfacegroupAddSurfaceCommand.h"
59 #include "SurfacegroupRemoveSurfaceCommand.h"
60 #include "LayerSetVisibilityCommand.h"
61 #include "SurfaceSetVisibilityCommand.h"
62 #include "LayergroupSetVisibilityCommand.h"
63 #include "SurfacegroupSetVisibilityCommand.h"
64 #include "DebugCommand.h"
65 #include "ExitCommand.h"
66 #include "ScreenSetRenderOrderCommand.h"
67 #include "LayerSetRenderOrderCommand.h"
68 #include "LayerSetDimensionCommand.h"
69 #include "SurfaceSetDimensionCommand.h"
70 #include "LayerSetPositionCommand.h"
71 #include "SurfaceSetPositionCommand.h"
72 #include "LayerGetPositionCommand.h"
73 #include "SurfaceGetPositionCommand.h"
74 #include "ShaderCreateCommand.h"
75 #include "ShaderDestroyCommand.h"
76 #include "SurfaceSetShaderCommand.h"
77 #include "ShaderSetUniformsCommand.h"
78 #include "ScreenDumpCommand.h"
79 #include "LayerDumpCommand.h"
80 #include "SurfaceDumpCommand.h"
81 #include "SurfaceSetNativeContentCommand.h"
82 #include "SurfaceRemoveNativeContentCommand.h"
83 #include "SurfaceSetKeyboardFocusCommand.h"
84 #include "SurfaceGetKeyboardFocusCommand.h"
85 #include "SurfaceUpdateInputEventAcceptance.h"
86 #include "SurfaceSetChromaKeyCommand.h"
87 #include "LayerSetChromaKeyCommand.h"
88 #include "SetOptimizationModeCommand.h"
89 #include "GetOptimizationModeCommand.h"
99 #define DEFAULT_SCREEN 0
101 const char* RESOURCE_ALREADY_INUSE = "Ressource already in use";
102 const char* INVALID_ARGUMENT = "Invalid argument";
103 const char* RESOURCE_NOT_FOUND = "Ressource not found";
104 const char* NOT_IMPLEMENTED = "Feature not implemented";
107 GenericCommunicator::GenericCommunicator(ICommandExecutor& executor, Configuration& config)
108 : ICommunicator(&executor)
109 , PluginBase(executor, config, Communicator_Api_v1)
110 , m_running(ILM_FALSE)
112 MethodTable manager_methods[] =
114 { "ServiceConnect", &GenericCommunicator::ServiceConnect },
115 { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
116 { "Debug", &GenericCommunicator::Debug },
117 { "ScreenShot", &GenericCommunicator::ScreenShot },
118 { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
119 { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
120 { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
121 { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
122 { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
123 { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
124 { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
125 { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
126 { "ListAllLayerGroupIDS", &GenericCommunicator::ListAllLayerGroupIDS },
127 { "ListAllSurfaceGroupIDS", &GenericCommunicator::ListAllSurfaceGroupIDS },
128 { "ListSurfacesOfSurfacegroup", &GenericCommunicator::ListSurfacesOfSurfacegroup },
129 { "ListLayersOfLayergroup", &GenericCommunicator::ListLayersOfLayergroup },
130 { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
131 { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
132 { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
133 { "CreateSurface", &GenericCommunicator::CreateSurface },
134 { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
135 { "InitializeSurface", &GenericCommunicator::InitializeSurface },
136 { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
137 { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
138 { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
139 { "RemoveSurface", &GenericCommunicator::RemoveSurface },
140 { "CreateLayer", &GenericCommunicator::CreateLayer },
141 { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
142 { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
143 { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
144 { "RemoveLayer", &GenericCommunicator::RemoveLayer },
145 { "AddSurfaceToSurfaceGroup", &GenericCommunicator::AddSurfaceToSurfaceGroup },
146 { "RemoveSurfaceFromSurfaceGroup", &GenericCommunicator::RemoveSurfaceFromSurfaceGroup },
147 { "AddLayerToLayerGroup", &GenericCommunicator::AddLayerToLayerGroup },
148 { "RemoveLayerFromLayerGroup", &GenericCommunicator::RemoveLayerFromLayerGroup },
149 { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
150 { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
151 { "CreateSurfaceGroup", &GenericCommunicator::CreateSurfaceGroup },
152 { "CreateSurfaceGroupFromId", &GenericCommunicator::CreateSurfaceGroupFromId },
153 { "RemoveSurfaceGroup", &GenericCommunicator::RemoveSurfaceGroup },
154 { "CreateLayerGroup", &GenericCommunicator::CreateLayerGroup },
155 { "CreateLayerGroupFromId", &GenericCommunicator::CreateLayerGroupFromId },
156 { "RemoveLayerGroup", &GenericCommunicator::RemoveLayerGroup },
157 { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
158 { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
159 { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
160 { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
161 { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
162 { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
163 { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
164 { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
165 { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
166 { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
167 { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
168 { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
169 { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
170 { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
171 { "SetSurfacegroupOpacity", &GenericCommunicator::SetSurfacegroupOpacity },
172 { "SetLayergroupOpacity", &GenericCommunicator::SetLayergroupOpacity },
173 { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
174 { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
175 { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
176 { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
177 { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
178 { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
179 { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
180 { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
181 { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
182 { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
183 { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
184 { "SetSurfacegroupVisibility", &GenericCommunicator::SetSurfacegroupVisibility },
185 { "SetLayergroupVisibility", &GenericCommunicator::SetLayergroupVisibility },
186 { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
187 { "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
188 { "GetLayerType", &GenericCommunicator::GetLayerType },
189 { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
190 { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
191 { "Exit", &GenericCommunicator::Exit },
192 { "CommitChanges", &GenericCommunicator::CommitChanges },
193 { "CreateShader", &GenericCommunicator::CreateShader },
194 { "DestroyShader", &GenericCommunicator::DestroyShader },
195 { "SetShader", &GenericCommunicator::SetShader },
196 { "SetUniforms", &GenericCommunicator::SetUniforms },
197 { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
198 { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
199 { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
200 { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
201 { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
202 { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
203 { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
204 { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
205 { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification },
206 { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode },
207 { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode }
210 int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
212 for (int index = 0; index < entryCount; ++index)
214 MethodTable* method = &manager_methods[index];
215 if (method->function)
217 m_callBackTable[method->name] = *method;
218 LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
222 memset(&m_ipcModule, 0, sizeof(m_ipcModule));
224 mThreadId = pthread_self();
227 bool GenericCommunicator::start()
229 LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
231 if (!loadIpcModule(&m_ipcModule))
233 LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
236 LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
238 if (!m_ipcModule.initServiceMode())
240 LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
243 LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
245 m_running = ILM_TRUE;
246 pluginSetHealth(HealthRunning);
255 void GenericCommunicator::stop()
257 LOG_INFO("GenericCommunicator","stopping");
263 m_ipcModule.destroy();
265 pluginSetHealth(HealthStopped);
268 void GenericCommunicator::process(int timeout_ms)
270 t_ilm_message message = m_ipcModule.receive(timeout_ms);
276 t_ilm_message_type messageType = m_ipcModule.getMessageType(message);
277 t_ilm_const_string name = m_ipcModule.getMessageName(message);
278 t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
282 case IpcMessageTypeCommand:
283 if (m_callBackTable.end() != m_callBackTable.find(name))
285 LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
286 << m_executor->getSenderName(senderHandle)
287 << "(" << m_executor->getSenderPid(senderHandle) << ")");
288 CallBackMethod method = m_callBackTable[name].function;
289 (this->*method)(message);
293 LOG_WARNING("GenericCommunicator", "Received unknown command " << name
294 << " from " << m_executor->getSenderName(senderHandle)
295 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
297 processNotificationQueue();
300 case IpcMessageTypeConnect:
301 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
302 << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
305 case IpcMessageTypeDisconnect:
306 LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
307 << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
309 const LayerMap& layers = m_executor->getScene()->getAllLayers();
310 LayerMapConstIterator layerIter = layers.begin();
311 LayerMapConstIterator layerIterEnd = layers.end();
312 for (; layerIter != layerIterEnd; ++layerIter)
314 Layer* layer = layerIter->second;
315 layer->removeNotification(senderHandle);
318 const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
319 SurfaceMapConstIterator surfaceIter = surfaces.begin();
320 SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
321 for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
323 Surface* surface = surfaceIter->second;
324 surface->removeNotification(senderHandle);
329 case IpcMessageTypeError:
330 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
331 << m_executor->getSenderName(senderHandle)
332 << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
335 case IpcMessageTypeShutdown:
336 case IpcMessageTypeNone:
340 LOG_DEBUG("GenericCommunicator", "Received unknown data from "
341 << m_executor->getSenderName(senderHandle)
342 << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
345 m_ipcModule.destroyMessage(message);
348 void GenericCommunicator::setdebug(bool onoff)
350 (void)onoff; // TODO: remove, only prevents warning
353 t_ilm_bool GenericCommunicator::threadMainLoop()
359 t_ilm_const_string GenericCommunicator::pluginGetName() const
361 return "GenericCommunicator";
364 void GenericCommunicator::ServiceConnect(t_ilm_message message)
366 LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
368 t_ilm_message response;
369 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
371 unsigned int processId = 0;
372 char processName[1024];
373 m_ipcModule.getUint(message, &processId);
374 m_ipcModule.getString(message, processName);
376 m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
378 response = m_ipcModule.createResponse(message);
379 m_ipcModule.sendToClients(response, &clientHandle, 1);
380 m_ipcModule.destroyMessage(response);
383 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
385 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
387 t_ilm_message response;
388 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
390 m_executor->removeApplicationReference(clientHandle);
392 response = m_ipcModule.createResponse(message);
393 m_ipcModule.sendToClients(response, &clientHandle, 1);
394 m_ipcModule.destroyMessage(response);
397 void GenericCommunicator::Debug(t_ilm_message message)
399 t_ilm_message response;
400 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
401 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
402 t_ilm_bool param = ILM_FALSE;
403 m_ipcModule.getBool(message, ¶m);
405 t_ilm_bool status = m_executor->execute(new DebugCommand(clientPid, param));
408 response = m_ipcModule.createResponse(message);
412 response = m_ipcModule.createErrorResponse(message);
413 m_ipcModule.appendString(response, INVALID_ARGUMENT);
416 m_ipcModule.sendToClients(response, &clientHandle, 1);
417 m_ipcModule.destroyMessage(response);
420 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
422 t_ilm_message response;
423 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
425 m_ipcModule.getUint(message, &screenid);
426 uint* resolution = m_executor->getScreenResolution(screenid);
428 response = m_ipcModule.createResponse(message);
429 m_ipcModule.appendUint(response, resolution[0]);
430 m_ipcModule.appendUint(response, resolution[1]);
431 m_ipcModule.sendToClients(response, &clientHandle, 1);
432 m_ipcModule.destroyMessage(response);
435 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
437 t_ilm_message response;
438 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
440 m_ipcModule.getUint(message, &screenid);
441 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
442 response = m_ipcModule.createResponse(message);
443 m_ipcModule.appendUint(response, numberOfHardwareLayers);
444 m_ipcModule.sendToClients(response, &clientHandle, 1);
445 m_ipcModule.destroyMessage(response);
448 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
450 t_ilm_message response;
451 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
453 uint* IDs = m_executor->getScreenIDs(&length);
454 response = m_ipcModule.createResponse(message);
455 m_ipcModule.appendUintArray(response, IDs, length);
456 m_ipcModule.sendToClients(response, &clientHandle, 1);
457 m_ipcModule.destroyMessage(response);
460 void GenericCommunicator::ScreenShot(t_ilm_message message)
462 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
463 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
464 t_ilm_message response;
468 m_ipcModule.getUint(message, &screenid);
469 m_ipcModule.getString(message, filename);
471 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(clientPid, filename, screenid));
474 response = m_ipcModule.createResponse(message);
478 response = m_ipcModule.createErrorResponse(message);
479 m_ipcModule.appendString(response, INVALID_ARGUMENT);
482 m_ipcModule.sendToClients(response, &clientHandle, 1);
483 m_ipcModule.destroyMessage(response);
486 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
488 t_ilm_message response;
489 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
490 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
492 m_ipcModule.getString(message, filename);
494 m_ipcModule.getUint(message, &layerid);
496 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(clientPid, filename, layerid));
499 response = m_ipcModule.createResponse(message);
503 response = m_ipcModule.createErrorResponse(message);
504 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
507 m_ipcModule.sendToClients(response, &clientHandle, 1);
508 m_ipcModule.destroyMessage(response);
511 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
513 t_ilm_message response;
514 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
515 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
517 m_ipcModule.getString(message, filename);
519 m_ipcModule.getUint(message, &id);
520 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(clientPid, filename, id));
523 response = m_ipcModule.createResponse(message);
527 response = m_ipcModule.createErrorResponse(message);
528 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
531 m_ipcModule.sendToClients(response, &clientHandle, 1);
532 m_ipcModule.destroyMessage(response);
535 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
537 t_ilm_message response;
538 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
541 m_executor->getScene()->lockScene();
542 m_executor->getScene()->getLayerIDs(&length, &array);
543 m_executor->getScene()->unlockScene();
544 response = m_ipcModule.createResponse(message);
545 m_ipcModule.appendUintArray(response, array, length);
546 m_ipcModule.sendToClients(response, &clientHandle, 1);
547 m_ipcModule.destroyMessage(response);
550 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
552 t_ilm_message response;
553 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
555 m_ipcModule.getUint(message, &screenID);
559 m_executor->getScene()->lockScene();
560 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
561 m_executor->getScene()->unlockScene();
564 response = m_ipcModule.createResponse(message);
565 m_ipcModule.appendUintArray(response, array, length);
569 response = m_ipcModule.createErrorResponse(message);
570 m_ipcModule.appendString(response, INVALID_ARGUMENT);
573 m_ipcModule.sendToClients(response, &clientHandle, 1);
574 m_ipcModule.destroyMessage(response);
577 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
579 t_ilm_message response;
580 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
583 m_executor->getScene()->lockScene();
584 m_executor->getScene()->getSurfaceIDs(&length, &array);
585 m_executor->getScene()->unlockScene();
586 response = m_ipcModule.createResponse(message);
587 m_ipcModule.appendUintArray(response, array, length);
588 m_ipcModule.sendToClients(response, &clientHandle, 1);
589 m_ipcModule.destroyMessage(response);
592 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
594 t_ilm_message response;
595 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
598 m_executor->getScene()->lockScene();
599 m_executor->getScene()->getLayerGroupIDs(&length, &array);
600 m_executor->getScene()->unlockScene();
601 response = m_ipcModule.createResponse(message);
602 m_ipcModule.appendUintArray(response, array, length);
603 m_ipcModule.sendToClients(response, &clientHandle, 1);
604 m_ipcModule.destroyMessage(response);
607 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
609 t_ilm_message response;
610 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
613 m_executor->getScene()->lockScene();
614 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
615 m_executor->getScene()->unlockScene();
616 response = m_ipcModule.createResponse(message);
617 m_ipcModule.appendUintArray(response, array, length);
618 m_ipcModule.sendToClients(response, &clientHandle, 1);
619 m_ipcModule.destroyMessage(response);
622 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
624 t_ilm_message response;
625 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
627 m_ipcModule.getUint(message, &id);
628 m_executor->getScene()->lockScene();
629 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
632 std::list<Surface*> surfaces = sg->getList();
633 uint length = surfaces.size();
634 uint* array = new uint[length];
637 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
640 array[arrayPos] = s->getID();
643 m_executor->getScene()->unlockScene();
645 response = m_ipcModule.createResponse(message);
646 m_ipcModule.appendUintArray(response, array, length);
650 m_executor->getScene()->unlockScene();
651 response = m_ipcModule.createErrorResponse(message);
652 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
655 m_ipcModule.sendToClients(response, &clientHandle, 1);
656 m_ipcModule.destroyMessage(response);
659 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
661 t_ilm_message response;
662 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
664 m_ipcModule.getUint(message, &id);
665 m_executor->getScene()->lockScene();
666 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
669 std::list<Layer*> layers = sg->getList();
671 uint length = layers.size();
672 uint* array = new uint[length];
675 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
678 array[arrayPos] = l->getID();
681 m_executor->getScene()->unlockScene();
683 response = m_ipcModule.createResponse(message);
684 m_ipcModule.appendUintArray(response, array, length);
688 m_executor->getScene()->unlockScene();
689 response = m_ipcModule.createErrorResponse(message);
690 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
693 m_ipcModule.sendToClients(response, &clientHandle, 1);
694 m_ipcModule.destroyMessage(response);
697 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
699 t_ilm_message response;
700 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
702 m_ipcModule.getUint(message, &id);
703 m_executor->getScene()->lockScene();
704 Layer* layer = m_executor->getScene()->getLayer(id);
707 std::list<Surface*> surfaces = layer->getAllSurfaces();
709 uint length = surfaces.size();
710 uint* array = new uint[length];
713 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
716 array[arrayPos] = s->getID();
719 m_executor->getScene()->unlockScene();
721 response = m_ipcModule.createResponse(message);
722 m_ipcModule.appendUintArray(response, array, length);
726 m_executor->getScene()->unlockScene();
727 response = m_ipcModule.createErrorResponse(message);
728 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
731 m_ipcModule.sendToClients(response, &clientHandle, 1);
732 m_ipcModule.destroyMessage(response);
735 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
737 t_ilm_message response;
738 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
740 m_ipcModule.getUint(message, &id);
742 Surface* surface = m_executor->getScene()->getSurface(id);
745 Rectangle dest = surface->getDestinationRegion();
746 Rectangle src = surface->getSourceRegion();
747 OrientationType orientation = surface->getOrientation();
748 unsigned char chromaKeyRed = 0;
749 unsigned char chromaKeyGreen = 0;
750 unsigned char chromaKeyBlue = 0;
751 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
753 response = m_ipcModule.createResponse(message);
754 m_ipcModule.appendDouble(response, surface->getOpacity());
755 m_ipcModule.appendUint(response, src.x);
756 m_ipcModule.appendUint(response, src.y);
757 m_ipcModule.appendUint(response, src.width);
758 m_ipcModule.appendUint(response, src.height);
759 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
760 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
761 m_ipcModule.appendUint(response, dest.x);
762 m_ipcModule.appendUint(response, dest.y);
763 m_ipcModule.appendUint(response, dest.width);
764 m_ipcModule.appendUint(response, dest.height);
765 m_ipcModule.appendUint(response, orientation);
766 m_ipcModule.appendBool(response, surface->getVisibility());
767 m_ipcModule.appendUint(response, surface->frameCounter);
768 m_ipcModule.appendUint(response, surface->drawCounter);
769 m_ipcModule.appendUint(response, surface->updateCounter);
770 m_ipcModule.appendUint(response, surface->getPixelFormat());
771 m_ipcModule.appendUint(response, surface->getNativeContent());
772 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
773 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
774 m_ipcModule.appendUint(response, chromaKeyRed);
775 m_ipcModule.appendUint(response, chromaKeyGreen);
776 m_ipcModule.appendUint(response, chromaKeyBlue);
777 m_ipcModule.appendInt(response, surface->getCreatorPid());
781 response = m_ipcModule.createErrorResponse(message);
782 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
785 m_ipcModule.sendToClients(response, &clientHandle, 1);
786 m_ipcModule.destroyMessage(response);
789 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
791 t_ilm_message response;
792 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
794 m_ipcModule.getUint(message, &id);
796 Layer* layer = m_executor->getScene()->getLayer(id);
799 Rectangle dest = layer->getDestinationRegion();
800 Rectangle src = layer->getSourceRegion();
801 OrientationType orientation = layer->getOrientation();
802 unsigned char chromaKeyRed = 0;
803 unsigned char chromaKeyGreen = 0;
804 unsigned char chromaKeyBlue = 0;
805 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
807 response = m_ipcModule.createResponse(message);
808 m_ipcModule.appendDouble(response, layer->getOpacity());
809 m_ipcModule.appendUint(response, src.x);
810 m_ipcModule.appendUint(response, src.y);
811 m_ipcModule.appendUint(response, src.width);
812 m_ipcModule.appendUint(response, src.height);
813 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
814 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
815 m_ipcModule.appendUint(response, dest.x);
816 m_ipcModule.appendUint(response, dest.y);
817 m_ipcModule.appendUint(response, dest.width);
818 m_ipcModule.appendUint(response, dest.height);
819 m_ipcModule.appendUint(response, orientation);
820 m_ipcModule.appendBool(response, layer->getVisibility());
821 m_ipcModule.appendUint(response, layer->getLayerType());
822 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
823 m_ipcModule.appendUint(response, chromaKeyRed);
824 m_ipcModule.appendUint(response, chromaKeyGreen);
825 m_ipcModule.appendUint(response, chromaKeyBlue);
826 m_ipcModule.appendInt(response, layer->getCreatorPid());
830 response = m_ipcModule.createErrorResponse(message);
831 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
834 m_ipcModule.sendToClients(response, &clientHandle, 1);
835 m_ipcModule.destroyMessage(response);
838 void GenericCommunicator::CreateSurface(t_ilm_message message)
840 t_ilm_message response;
841 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
842 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
846 uint pixelformat = 0;
847 PixelFormat pf = PIXELFORMAT_UNKNOWN;
848 uint id = GraphicalObject::INVALID_ID;
850 m_ipcModule.getUint(message, &handle);
851 m_ipcModule.getUint(message, &width);
852 m_ipcModule.getUint(message, &height);
853 m_ipcModule.getUint(message, &pixelformat);
855 pf = (PixelFormat) pixelformat;
858 // First of all create the surface
859 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
861 // after that apply the native content
862 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
866 response = m_ipcModule.createResponse(message);
867 m_ipcModule.appendUint(response, id);
871 response = m_ipcModule.createErrorResponse(message);
872 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
875 m_ipcModule.sendToClients(response, &clientHandle, 1);
876 m_ipcModule.destroyMessage(response);
879 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
881 t_ilm_message response;
882 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
883 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
887 uint pixelformat = 0;
888 PixelFormat pf = PIXELFORMAT_UNKNOWN;
891 m_ipcModule.getUint(message, &handle);
892 m_ipcModule.getUint(message, &width);
893 m_ipcModule.getUint(message, &height);
894 m_ipcModule.getUint(message, &pixelformat);
895 m_ipcModule.getUint(message, &id);
897 pf = (PixelFormat) pixelformat;
899 // First of all create the surface
900 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
902 // after that apply the native content
903 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
907 response = m_ipcModule.createResponse(message);
908 m_ipcModule.appendUint(response, id);
912 response = m_ipcModule.createErrorResponse(message);
913 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
916 m_ipcModule.sendToClients(response, &clientHandle, 1);
917 m_ipcModule.destroyMessage(response);
920 void GenericCommunicator::InitializeSurface(t_ilm_message message)
922 t_ilm_message response;
923 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
924 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
925 uint id = GraphicalObject::INVALID_ID;
927 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
930 response = m_ipcModule.createResponse(message);
931 m_ipcModule.appendUint(response, id);
935 response = m_ipcModule.createErrorResponse(message);
936 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
939 m_ipcModule.sendToClients(response, &clientHandle, 1);
940 m_ipcModule.destroyMessage(response);
943 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
945 t_ilm_message response;
946 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
947 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
949 m_ipcModule.getUint(message, &id);
950 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
953 response = m_ipcModule.createResponse(message);
954 m_ipcModule.appendUint(response, id);
958 response = m_ipcModule.createErrorResponse(message);
959 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
962 m_ipcModule.sendToClients(response, &clientHandle, 1);
963 m_ipcModule.destroyMessage(response);
966 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
968 t_ilm_message response;
969 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
970 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
975 uint pixelformat = 0;
976 PixelFormat pf = PIXELFORMAT_UNKNOWN;
978 m_ipcModule.getUint(message, &id);
979 m_ipcModule.getUint(message, &handle);
980 m_ipcModule.getUint(message, &width);
981 m_ipcModule.getUint(message, &height);
982 m_ipcModule.getUint(message, &pixelformat);
984 pf = (PixelFormat) pixelformat;
986 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
989 response = m_ipcModule.createResponse(message);
993 response = m_ipcModule.createErrorResponse(message);
994 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
997 m_ipcModule.sendToClients(response, &clientHandle, 1);
998 m_ipcModule.destroyMessage(response);
1001 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
1003 t_ilm_message response;
1004 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1005 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1007 m_ipcModule.getUint(message, &id);
1009 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(clientPid, id));
1012 response = m_ipcModule.createResponse(message);
1016 response = m_ipcModule.createErrorResponse(message);
1017 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1020 m_ipcModule.sendToClients(response, &clientHandle, 1);
1021 m_ipcModule.destroyMessage(response);
1024 void GenericCommunicator::RemoveSurface(t_ilm_message message)
1026 t_ilm_message response;
1027 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1028 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1030 m_ipcModule.getUint(message, ¶m);
1031 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(clientPid, param));
1034 response = m_ipcModule.createResponse(message);
1038 response = m_ipcModule.createErrorResponse(message);
1039 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1042 m_ipcModule.sendToClients(response, &clientHandle, 1);
1043 m_ipcModule.destroyMessage(response);
1046 void GenericCommunicator::CreateLayer(t_ilm_message message)
1048 t_ilm_message response;
1049 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1050 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1051 uint id = GraphicalObject::INVALID_ID;
1052 // use resolution of default screen as default width and height of layers
1053 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1054 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1057 response = m_ipcModule.createResponse(message);
1058 m_ipcModule.appendUint(response, id);
1062 response = m_ipcModule.createErrorResponse(message);
1063 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1066 m_ipcModule.sendToClients(response, &clientHandle, 1);
1067 m_ipcModule.destroyMessage(response);
1070 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
1072 t_ilm_message response;
1073 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1074 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1075 uint id = GraphicalObject::INVALID_ID;
1077 m_ipcModule.getUint(message, &id);
1078 // use resolution of default screen as default width and height of layers
1079 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1080 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1083 response = m_ipcModule.createResponse(message);
1084 m_ipcModule.appendUint(response, id);
1088 response = m_ipcModule.createErrorResponse(message);
1089 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1092 m_ipcModule.sendToClients(response, &clientHandle, 1);
1093 m_ipcModule.destroyMessage(response);
1097 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
1099 t_ilm_message response;
1100 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1101 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1103 m_ipcModule.getUint(message, &width);
1105 m_ipcModule.getUint(message, &height);
1107 uint id = GraphicalObject::INVALID_ID;
1108 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1111 response = m_ipcModule.createResponse(message);
1112 m_ipcModule.appendUint(response, id);
1116 response = m_ipcModule.createErrorResponse(message);
1117 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1120 m_ipcModule.sendToClients(response, &clientHandle, 1);
1121 m_ipcModule.destroyMessage(response);
1124 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1126 t_ilm_message response;
1127 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1128 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1129 uint id = GraphicalObject::INVALID_ID;
1132 t_ilm_bool status = ILM_FALSE;
1134 m_ipcModule.getUint(message, &id);
1135 m_ipcModule.getUint(message, &width);
1136 m_ipcModule.getUint(message, &height);
1138 status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1141 response = m_ipcModule.createResponse(message);
1142 m_ipcModule.appendUint(response, id);
1146 response = m_ipcModule.createErrorResponse(message);
1147 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1150 m_ipcModule.sendToClients(response, &clientHandle, 1);
1151 m_ipcModule.destroyMessage(response);
1154 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1156 t_ilm_message response;
1157 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1158 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1160 m_ipcModule.getUint(message, ¶m);
1161 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(clientPid, param));
1164 response = m_ipcModule.createResponse(message);
1168 response = m_ipcModule.createErrorResponse(message);
1169 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1172 m_ipcModule.sendToClients(response, &clientHandle, 1);
1173 m_ipcModule.destroyMessage(response);
1176 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1178 t_ilm_message response;
1179 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1180 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1182 uint surfacegroupid = 0;
1184 m_ipcModule.getUint(message, &surfaceid);
1185 m_ipcModule.getUint(message, &surfacegroupid);
1187 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1190 response = m_ipcModule.createResponse(message);
1194 response = m_ipcModule.createErrorResponse(message);
1195 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1198 m_ipcModule.sendToClients(response, &clientHandle, 1);
1199 m_ipcModule.destroyMessage(response);
1202 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1204 t_ilm_message response;
1205 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1206 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1208 uint surfacegroupid = 0;
1210 m_ipcModule.getUint(message, &surfaceid);
1211 m_ipcModule.getUint(message, &surfacegroupid);
1213 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1216 response = m_ipcModule.createResponse(message);
1220 response = m_ipcModule.createErrorResponse(message);
1221 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1224 m_ipcModule.sendToClients(response, &clientHandle, 1);
1225 m_ipcModule.destroyMessage(response);
1228 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1230 t_ilm_message response;
1231 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1232 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1234 uint layergroupid = 0;
1236 m_ipcModule.getUint(message, &layerid);
1237 m_ipcModule.getUint(message, &layergroupid);
1239 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
1242 response = m_ipcModule.createResponse(message);
1246 response = m_ipcModule.createErrorResponse(message);
1247 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1250 m_ipcModule.sendToClients(response, &clientHandle, 1);
1251 m_ipcModule.destroyMessage(response);
1254 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1256 t_ilm_message response;
1257 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1258 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1260 uint layergroupid = 0;
1262 m_ipcModule.getUint(message, &layerid);
1263 m_ipcModule.getUint(message, &layergroupid);
1265 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
1268 response = m_ipcModule.createResponse(message);
1272 response = m_ipcModule.createErrorResponse(message);
1273 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1276 m_ipcModule.sendToClients(response, &clientHandle, 1);
1277 m_ipcModule.destroyMessage(response);
1280 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1282 t_ilm_message response;
1283 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1284 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1288 m_ipcModule.getUint(message, &surfaceid);
1289 m_ipcModule.getUint(message, &layer);
1291 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(clientPid, layer, surfaceid));
1294 response = m_ipcModule.createResponse(message);
1298 response = m_ipcModule.createErrorResponse(message);
1299 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1302 m_ipcModule.sendToClients(response, &clientHandle, 1);
1303 m_ipcModule.destroyMessage(response);
1306 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1308 t_ilm_message response;
1309 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1310 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1313 m_ipcModule.getUint(message, &surfaceid);
1314 m_ipcModule.getUint(message, &layerid);
1316 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(clientPid, layerid, surfaceid));
1319 response = m_ipcModule.createResponse(message);
1323 response = m_ipcModule.createErrorResponse(message);
1324 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1327 m_ipcModule.sendToClients(response, &clientHandle, 1);
1328 m_ipcModule.destroyMessage(response);
1331 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1333 t_ilm_message response;
1334 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1335 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1336 uint newID = GraphicalObject::INVALID_ID;
1338 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1341 response = m_ipcModule.createResponse(message);
1342 m_ipcModule.appendUint(response, newID);
1346 response = m_ipcModule.createErrorResponse(message);
1347 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1350 m_ipcModule.sendToClients(response, &clientHandle, 1);
1351 m_ipcModule.destroyMessage(response);
1354 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1356 t_ilm_message response;
1357 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1358 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1359 uint newID = GraphicalObject::INVALID_ID;
1361 m_ipcModule.getUint(message, &newID);
1363 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1366 response = m_ipcModule.createResponse(message);
1367 m_ipcModule.appendUint(response, newID);
1371 response = m_ipcModule.createErrorResponse(message);
1372 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1375 m_ipcModule.sendToClients(response, &clientHandle, 1);
1376 m_ipcModule.destroyMessage(response);
1379 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1381 t_ilm_message response;
1382 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1383 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1385 m_ipcModule.getUint(message, ¶m);
1387 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
1390 response = m_ipcModule.createResponse(message);
1394 response = m_ipcModule.createErrorResponse(message);
1395 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1398 m_ipcModule.sendToClients(response, &clientHandle, 1);
1399 m_ipcModule.destroyMessage(response);
1402 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1404 t_ilm_message response;
1405 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1406 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1407 uint newID = GraphicalObject::INVALID_ID;
1409 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1412 response = m_ipcModule.createResponse(message);
1413 m_ipcModule.appendUint(response, newID);
1417 response = m_ipcModule.createErrorResponse(message);
1418 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1421 m_ipcModule.sendToClients(response, &clientHandle, 1);
1422 m_ipcModule.destroyMessage(response);
1425 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1427 t_ilm_message response;
1428 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1429 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1430 uint newID = GraphicalObject::INVALID_ID;
1432 m_ipcModule.getUint(message, &newID);
1434 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1437 response = m_ipcModule.createResponse(message);
1438 m_ipcModule.appendUint(response, newID);
1442 response = m_ipcModule.createErrorResponse(message);
1443 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1446 m_ipcModule.sendToClients(response, &clientHandle, 1);
1447 m_ipcModule.destroyMessage(response);
1450 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1452 t_ilm_message response;
1453 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1454 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1456 m_ipcModule.getUint(message, ¶m);
1458 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
1461 response = m_ipcModule.createResponse(message);
1465 response = m_ipcModule.createErrorResponse(message);
1466 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1469 m_ipcModule.sendToClients(response, &clientHandle, 1);
1470 m_ipcModule.destroyMessage(response);
1473 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1475 t_ilm_message response;
1476 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1477 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1484 m_ipcModule.getUint(message, &id);
1485 m_ipcModule.getUint(message, &x);
1486 m_ipcModule.getUint(message, &y);
1487 m_ipcModule.getUint(message, &width);
1488 m_ipcModule.getUint(message, &height);
1490 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1493 response = m_ipcModule.createResponse(message);
1497 response = m_ipcModule.createErrorResponse(message);
1498 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1501 m_ipcModule.sendToClients(response, &clientHandle, 1);
1502 m_ipcModule.destroyMessage(response);
1505 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1507 t_ilm_message response;
1508 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1509 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1516 m_ipcModule.getUint(message, &id);
1517 m_ipcModule.getUint(message, &x);
1518 m_ipcModule.getUint(message, &y);
1519 m_ipcModule.getUint(message, &width);
1520 m_ipcModule.getUint(message, &height);
1522 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1525 response = m_ipcModule.createResponse(message);
1529 response = m_ipcModule.createErrorResponse(message);
1530 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1533 m_ipcModule.sendToClients(response, &clientHandle, 1);
1534 m_ipcModule.destroyMessage(response);
1537 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1539 t_ilm_message response;
1540 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1541 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1548 m_ipcModule.getUint(message, &id);
1549 m_ipcModule.getUint(message, &x);
1550 m_ipcModule.getUint(message, &y);
1551 m_ipcModule.getUint(message, &width);
1552 m_ipcModule.getUint(message, &height);
1554 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1557 response = m_ipcModule.createResponse(message);
1561 response = m_ipcModule.createErrorResponse(message);
1562 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1565 m_ipcModule.sendToClients(response, &clientHandle, 1);
1566 m_ipcModule.destroyMessage(response);
1569 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1571 t_ilm_message response;
1572 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1573 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1578 m_ipcModule.getUint(message, &id);
1579 m_ipcModule.getUint(message, &x);
1580 m_ipcModule.getUint(message, &y);
1582 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(clientPid, id, x, y));
1585 response = m_ipcModule.createResponse(message);
1589 response = m_ipcModule.createErrorResponse(message);
1590 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1593 m_ipcModule.sendToClients(response, &clientHandle, 1);
1594 m_ipcModule.destroyMessage(response);
1597 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1599 t_ilm_message response;
1600 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1601 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1606 m_ipcModule.getUint(message, &id);
1608 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(clientPid, id, &x, &y));
1611 response = m_ipcModule.createResponse(message);
1612 m_ipcModule.appendUint(response, x);
1613 m_ipcModule.appendUint(response, y);
1617 response = m_ipcModule.createErrorResponse(message);
1618 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1621 m_ipcModule.sendToClients(response, &clientHandle, 1);
1622 m_ipcModule.destroyMessage(response);
1625 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1627 t_ilm_message response;
1628 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1629 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1634 m_ipcModule.getUint(message, &id);
1635 m_ipcModule.getUint(message, &width);
1636 m_ipcModule.getUint(message, &height);
1638 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(clientPid, id, width, height));
1641 response = m_ipcModule.createResponse(message);
1645 response = m_ipcModule.createErrorResponse(message);
1646 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1649 m_ipcModule.sendToClients(response, &clientHandle, 1);
1650 m_ipcModule.destroyMessage(response);
1653 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1655 t_ilm_message response;
1656 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1657 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1664 m_ipcModule.getUint(message, &id);
1665 m_ipcModule.getUint(message, &x);
1666 m_ipcModule.getUint(message, &y);
1667 m_ipcModule.getUint(message, &width);
1668 m_ipcModule.getUint(message, &height);
1670 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1673 response = m_ipcModule.createResponse(message);
1677 response = m_ipcModule.createErrorResponse(message);
1678 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1681 m_ipcModule.sendToClients(response, &clientHandle, 1);
1682 m_ipcModule.destroyMessage(response);
1685 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1687 t_ilm_message response;
1688 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1689 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1694 m_ipcModule.getUint(message, &id);
1695 m_ipcModule.getUint(message, &x);
1696 m_ipcModule.getUint(message, &y);
1698 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(clientPid, id, x, y));
1701 response = m_ipcModule.createResponse(message);
1705 response = m_ipcModule.createErrorResponse(message);
1706 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1709 m_ipcModule.sendToClients(response, &clientHandle, 1);
1710 m_ipcModule.destroyMessage(response);
1713 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1715 t_ilm_message response;
1716 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1717 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1722 m_ipcModule.getUint(message, &id);
1724 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(clientPid, id, &x, &y));
1727 response = m_ipcModule.createResponse(message);
1728 m_ipcModule.appendUint(response, x);
1729 m_ipcModule.appendUint(response, y);
1733 response = m_ipcModule.createErrorResponse(message);
1734 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1737 m_ipcModule.sendToClients(response, &clientHandle, 1);
1738 m_ipcModule.destroyMessage(response);
1741 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1743 t_ilm_message response;
1744 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1745 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1750 m_ipcModule.getUint(message, &id);
1751 m_ipcModule.getUint(message, &width);
1752 m_ipcModule.getUint(message, &height);
1754 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(clientPid, id, width, height));
1757 response = m_ipcModule.createResponse(message);
1761 response = m_ipcModule.createErrorResponse(message);
1762 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1765 m_ipcModule.sendToClients(response, &clientHandle, 1);
1766 m_ipcModule.destroyMessage(response);
1769 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1771 t_ilm_message response;
1772 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1773 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1778 m_ipcModule.getUint(message, &id);
1780 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(clientPid, id, &width, &height));
1783 response = m_ipcModule.createResponse(message);
1784 m_ipcModule.appendUint(response, width);
1785 m_ipcModule.appendUint(response, height);
1789 response = m_ipcModule.createErrorResponse(message);
1790 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1793 m_ipcModule.sendToClients(response, &clientHandle, 1);
1794 m_ipcModule.destroyMessage(response);
1797 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1799 t_ilm_message response;
1800 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1801 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1806 m_ipcModule.getUint(message, &id);
1808 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(clientPid, id, &width, &height));
1811 response = m_ipcModule.createResponse(message);
1812 m_ipcModule.appendUint(response, width);
1813 m_ipcModule.appendUint(response, height);
1817 response = m_ipcModule.createErrorResponse(message);
1818 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1821 m_ipcModule.sendToClients(response, &clientHandle, 1);
1822 m_ipcModule.destroyMessage(response);
1825 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1827 t_ilm_message response;
1828 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1829 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1833 m_ipcModule.getUint(message, &id);
1834 m_ipcModule.getDouble(message, ¶m);
1836 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(clientPid, id, param));
1839 response = m_ipcModule.createResponse(message);
1843 response = m_ipcModule.createErrorResponse(message);
1844 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1847 m_ipcModule.sendToClients(response, &clientHandle, 1);
1848 m_ipcModule.destroyMessage(response);
1851 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1853 t_ilm_message response;
1854 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1855 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1859 m_ipcModule.getUint(message, &id);
1860 m_ipcModule.getDouble(message, ¶m);
1862 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(clientPid, id, param));
1865 response = m_ipcModule.createResponse(message);
1869 response = m_ipcModule.createErrorResponse(message);
1870 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1873 m_ipcModule.sendToClients(response, &clientHandle, 1);
1874 m_ipcModule.destroyMessage(response);
1877 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1879 t_ilm_message response;
1880 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1881 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1885 m_ipcModule.getUint(message, &id);
1886 m_ipcModule.getDouble(message, ¶m);
1888 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
1891 response = m_ipcModule.createResponse(message);
1895 response = m_ipcModule.createErrorResponse(message);
1896 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1899 m_ipcModule.sendToClients(response, &clientHandle, 1);
1900 m_ipcModule.destroyMessage(response);
1903 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1905 t_ilm_message response;
1906 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1907 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1911 m_ipcModule.getUint(message, &id);
1912 m_ipcModule.getDouble(message, ¶m);
1914 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
1917 response = m_ipcModule.createResponse(message);
1921 response = m_ipcModule.createErrorResponse(message);
1922 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1925 m_ipcModule.sendToClients(response, &clientHandle, 1);
1926 m_ipcModule.destroyMessage(response);
1929 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1931 t_ilm_message response;
1932 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1933 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1937 m_ipcModule.getUint(message, &id);
1939 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(clientPid, id, ¶m));
1942 response = m_ipcModule.createResponse(message);
1943 m_ipcModule.appendDouble(response, param);
1947 response = m_ipcModule.createErrorResponse(message);
1948 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1951 m_ipcModule.sendToClients(response, &clientHandle, 1);
1952 m_ipcModule.destroyMessage(response);
1955 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1957 t_ilm_message response;
1958 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1959 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1963 m_ipcModule.getUint(message, &id);
1965 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(clientPid, id, ¶m));
1968 response = m_ipcModule.createResponse(message);
1969 m_ipcModule.appendDouble(response, param);
1973 response = m_ipcModule.createErrorResponse(message);
1974 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1977 m_ipcModule.sendToClients(response, &clientHandle, 1);
1978 m_ipcModule.destroyMessage(response);
1981 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1983 t_ilm_message response;
1984 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1985 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1988 OrientationType o = Zero;
1990 m_ipcModule.getUint(message, &id);
1991 m_ipcModule.getUint(message, ¶m);
1993 o = (OrientationType) param;
1995 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(clientPid, id, o));
1998 response = m_ipcModule.createResponse(message);
2002 response = m_ipcModule.createErrorResponse(message);
2003 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2006 m_ipcModule.sendToClients(response, &clientHandle, 1);
2007 m_ipcModule.destroyMessage(response);
2010 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
2012 t_ilm_message response;
2013 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2014 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2018 m_ipcModule.getUint(message, &id);
2020 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(clientPid, id, &o));
2023 response = m_ipcModule.createResponse(message);
2024 m_ipcModule.appendUint(response, o);
2028 response = m_ipcModule.createErrorResponse(message);
2029 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2032 m_ipcModule.sendToClients(response, &clientHandle, 1);
2033 m_ipcModule.destroyMessage(response);
2036 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
2038 t_ilm_message response;
2039 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2040 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2043 OrientationType o = Zero;
2045 m_ipcModule.getUint(message, &id);
2046 m_ipcModule.getUint(message, ¶m);
2048 o = (OrientationType) param;
2050 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(clientPid, id, o));
2053 response = m_ipcModule.createResponse(message);
2057 response = m_ipcModule.createErrorResponse(message);
2058 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2061 m_ipcModule.sendToClients(response, &clientHandle, 1);
2062 m_ipcModule.destroyMessage(response);
2065 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
2067 t_ilm_message response;
2068 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2069 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2073 m_ipcModule.getUint(message, &id);
2075 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(clientPid, id, &o));
2078 response = m_ipcModule.createResponse(message);
2079 m_ipcModule.appendUint(response, o);
2083 response = m_ipcModule.createErrorResponse(message);
2084 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2087 m_ipcModule.sendToClients(response, &clientHandle, 1);
2088 m_ipcModule.destroyMessage(response);
2091 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
2093 t_ilm_message response;
2094 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2095 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2097 PixelFormat pixelFormat;
2099 m_ipcModule.getUint(message, &id);
2101 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(clientPid, id, &pixelFormat));
2104 response = m_ipcModule.createResponse(message);
2105 m_ipcModule.appendUint(response, pixelFormat);
2109 response = m_ipcModule.createErrorResponse(message);
2110 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2113 m_ipcModule.sendToClients(response, &clientHandle, 1);
2114 m_ipcModule.destroyMessage(response);
2117 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
2119 t_ilm_message response;
2120 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2121 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2123 t_ilm_bool newVis = ILM_FALSE;
2125 m_ipcModule.getUint(message, &surfaceid);
2126 m_ipcModule.getBool(message, &newVis);
2128 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(clientPid, surfaceid, newVis));
2131 response = m_ipcModule.createResponse(message);
2135 response = m_ipcModule.createErrorResponse(message);
2136 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2139 m_ipcModule.sendToClients(response, &clientHandle, 1);
2140 m_ipcModule.destroyMessage(response);
2143 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
2145 t_ilm_message response;
2146 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2147 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2149 t_ilm_bool myparam = ILM_FALSE;
2151 m_ipcModule.getUint(message, &layerid);
2152 m_ipcModule.getBool(message, &myparam);
2154 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(clientPid, layerid, myparam));
2157 response = m_ipcModule.createResponse(message);
2161 response = m_ipcModule.createErrorResponse(message);
2162 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2165 m_ipcModule.sendToClients(response, &clientHandle, 1);
2166 m_ipcModule.destroyMessage(response);
2169 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
2171 t_ilm_message response;
2172 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2173 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2177 m_ipcModule.getUint(message, &id);
2179 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(clientPid, id, &visibility));
2182 response = m_ipcModule.createResponse(message);
2183 m_ipcModule.appendBool(response, visibility);
2187 response = m_ipcModule.createErrorResponse(message);
2188 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2191 m_ipcModule.sendToClients(response, &clientHandle, 1);
2192 m_ipcModule.destroyMessage(response);
2195 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
2197 t_ilm_message response;
2198 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2199 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2203 m_ipcModule.getUint(message, &id);
2205 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(clientPid, id, &visibility));
2208 response = m_ipcModule.createResponse(message);
2209 m_ipcModule.appendBool(response, visibility);
2213 response = m_ipcModule.createErrorResponse(message);
2214 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2217 m_ipcModule.sendToClients(response, &clientHandle, 1);
2218 m_ipcModule.destroyMessage(response);
2221 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
2223 t_ilm_message response;
2224 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2225 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2227 t_ilm_bool myparam = ILM_FALSE;
2229 m_ipcModule.getUint(message, &groupid);
2230 m_ipcModule.getBool(message, &myparam);
2232 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
2235 response = m_ipcModule.createResponse(message);
2239 response = m_ipcModule.createErrorResponse(message);
2240 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2243 m_ipcModule.sendToClients(response, &clientHandle, 1);
2244 m_ipcModule.destroyMessage(response);
2247 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
2249 t_ilm_message response;
2250 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2251 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2253 t_ilm_bool myparam = ILM_FALSE;
2255 m_ipcModule.getUint(message, &groupid);
2256 m_ipcModule.getBool(message, &myparam);
2258 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
2261 response = m_ipcModule.createResponse(message);
2265 response = m_ipcModule.createErrorResponse(message);
2266 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2269 m_ipcModule.sendToClients(response, &clientHandle, 1);
2270 m_ipcModule.destroyMessage(response);
2274 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
2276 t_ilm_message response;
2277 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2278 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2283 m_ipcModule.getUintArray(message, &array, &length);
2284 m_ipcModule.getUint(message, &screenID);
2286 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, screenID, array, length));
2289 response = m_ipcModule.createResponse(message);
2293 response = m_ipcModule.createErrorResponse(message);
2294 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2297 m_ipcModule.sendToClients(response, &clientHandle, 1);
2298 m_ipcModule.destroyMessage(response);
2301 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2303 t_ilm_message response;
2304 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2305 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2310 m_ipcModule.getUint(message, &layerid);
2311 m_ipcModule.getUintArray(message, &array, &length);
2313 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(clientPid, layerid, array, length));
2316 response = m_ipcModule.createResponse(message);
2320 response = m_ipcModule.createErrorResponse(message);
2321 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2324 m_ipcModule.sendToClients(response, &clientHandle, 1);
2325 m_ipcModule.destroyMessage(response);
2328 void GenericCommunicator::GetLayerType(t_ilm_message message)
2330 t_ilm_message response;
2331 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2333 m_ipcModule.getUint(message, &id);
2335 Layer* layer = m_executor->getScene()->getLayer(id);
2338 response = m_ipcModule.createResponse(message);
2339 m_ipcModule.appendUint(response, layer->getLayerType());
2343 response = m_ipcModule.createErrorResponse(message);
2344 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2347 m_ipcModule.sendToClients(response, &clientHandle, 1);
2348 m_ipcModule.destroyMessage(response);
2351 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2353 t_ilm_message response;
2354 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2356 LayerType type = Unknown;
2358 m_ipcModule.getUint(message, &id);
2360 type = (LayerType) id;
2362 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2363 response = m_ipcModule.createResponse(message);
2364 m_ipcModule.appendUint(response, capabilities);
2365 m_ipcModule.sendToClients(response, &clientHandle, 1);
2366 m_ipcModule.destroyMessage(response);
2369 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2371 t_ilm_message response;
2372 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2374 m_ipcModule.getUint(message, &id);
2376 Layer* layer = m_executor->getScene()->getLayer(id);
2379 response = m_ipcModule.createResponse(message);
2380 m_ipcModule.appendUint(response, layer->getCapabilities());
2384 response = m_ipcModule.createErrorResponse(message);
2385 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2388 m_ipcModule.sendToClients(response, &clientHandle, 1);
2389 m_ipcModule.destroyMessage(response);
2392 void GenericCommunicator::FadeIn(t_ilm_message message)
2394 t_ilm_message response;
2395 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2396 response = m_ipcModule.createErrorResponse(message);
2397 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2398 m_ipcModule.sendToClients(response, &clientHandle, 1);
2399 m_ipcModule.destroyMessage(response);
2402 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2404 t_ilm_message response;
2405 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2406 response = m_ipcModule.createErrorResponse(message);
2407 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2408 m_ipcModule.sendToClients(response, &clientHandle, 1);
2409 m_ipcModule.destroyMessage(response);
2412 void GenericCommunicator::FadeOut(t_ilm_message message)
2414 t_ilm_message response;
2415 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2416 response = m_ipcModule.createErrorResponse(message);
2417 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2418 m_ipcModule.sendToClients(response, &clientHandle, 1);
2419 m_ipcModule.destroyMessage(response);
2422 void GenericCommunicator::Exit(t_ilm_message message)
2424 t_ilm_message response;
2425 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2426 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2427 t_ilm_bool status = m_executor->execute(new ExitCommand(clientPid));
2430 response = m_ipcModule.createResponse(message);
2434 response = m_ipcModule.createErrorResponse(message);
2435 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2438 m_ipcModule.sendToClients(response, &clientHandle, 1);
2439 m_ipcModule.destroyMessage(response);
2442 void GenericCommunicator::CommitChanges(t_ilm_message message)
2444 t_ilm_message response;
2445 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2446 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2447 t_ilm_bool status = m_executor->execute(new CommitCommand(clientPid));
2450 response = m_ipcModule.createResponse(message);
2454 response = m_ipcModule.createErrorResponse(message);
2455 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2458 m_ipcModule.sendToClients(response, &clientHandle, 1);
2459 m_ipcModule.destroyMessage(response);
2462 void GenericCommunicator::CreateShader(t_ilm_message message)
2464 t_ilm_message response;
2465 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2466 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2467 char vertname[1024];
2468 char fragname[1024];
2471 m_ipcModule.getString(message, vertname);
2472 m_ipcModule.getString(message, fragname);
2474 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(clientPid, vertname, fragname, &id));
2477 response = m_ipcModule.createResponse(message);
2478 m_ipcModule.appendUint(response, id);
2482 response = m_ipcModule.createErrorResponse(message);
2483 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2486 m_ipcModule.sendToClients(response, &clientHandle, 1);
2487 m_ipcModule.destroyMessage(response);
2490 void GenericCommunicator::DestroyShader(t_ilm_message message)
2492 t_ilm_message response;
2493 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2494 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2497 m_ipcModule.getUint(message, &shaderid);
2499 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(clientPid, shaderid));
2502 response = m_ipcModule.createResponse(message);
2506 response = m_ipcModule.createErrorResponse(message);
2507 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2510 m_ipcModule.sendToClients(response, &clientHandle, 1);
2511 m_ipcModule.destroyMessage(response);
2514 void GenericCommunicator::SetShader(t_ilm_message message)
2516 t_ilm_message response;
2517 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2518 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2522 m_ipcModule.getUint(message, &surfaceId);
2523 m_ipcModule.getUint(message, &shaderid);
2525 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(clientPid, surfaceId, shaderid));
2528 response = m_ipcModule.createResponse(message);
2532 response = m_ipcModule.createErrorResponse(message);
2533 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2536 m_ipcModule.sendToClients(response, &clientHandle, 1);
2537 m_ipcModule.destroyMessage(response);
2540 void GenericCommunicator::SetUniforms(t_ilm_message message)
2542 t_ilm_message response;
2543 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2544 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2546 std::vector<string> uniforms;
2548 m_ipcModule.getUint(message, &id);
2551 //m_ipcModule.getStringArray(&uniforms);
2553 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(clientPid, id, uniforms));
2556 response = m_ipcModule.createResponse(message);
2560 response = m_ipcModule.createErrorResponse(message);
2561 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2564 m_ipcModule.sendToClients(response, &clientHandle, 1);
2565 m_ipcModule.destroyMessage(response);
2568 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2570 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2571 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2572 t_ilm_message response;
2575 m_ipcModule.getUint(message, &surfaceId);
2577 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(clientPid, surfaceId));
2580 response = m_ipcModule.createResponse(message);
2584 response = m_ipcModule.createErrorResponse(message);
2585 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2588 m_ipcModule.sendToClients(response, &clientHandle, 1);
2589 m_ipcModule.destroyMessage(response);
2593 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2595 t_ilm_message response;
2596 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2597 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2600 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(clientPid, &surfaceId));
2603 response = m_ipcModule.createResponse(message);
2604 m_ipcModule.appendUint(response, surfaceId);
2608 response = m_ipcModule.createErrorResponse(message);
2609 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2612 m_ipcModule.sendToClients(response, &clientHandle, 1);
2613 m_ipcModule.destroyMessage(response);
2617 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2619 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2620 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2621 t_ilm_message response;
2624 InputDevice devices;
2627 m_ipcModule.getUint(message, &surfaceId);
2628 m_ipcModule.getUint(message, &udevices);
2629 m_ipcModule.getBool(message, &accept);
2631 devices = (InputDevice) udevices;
2633 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(clientPid, surfaceId, devices, accept));
2636 response = m_ipcModule.createResponse(message);
2640 response = m_ipcModule.createErrorResponse(message);
2641 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2644 m_ipcModule.sendToClients(response, &clientHandle, 1);
2645 m_ipcModule.destroyMessage(response);
2648 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2650 t_ilm_message response;
2651 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2652 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2657 m_ipcModule.getUint(message, &surfaceid);
2658 m_ipcModule.getUintArray(message, &array, &length);
2660 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(clientPid, surfaceid, array, length));
2663 response = m_ipcModule.createResponse(message);
2667 response = m_ipcModule.createErrorResponse(message);
2668 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2671 m_ipcModule.sendToClients(response, &clientHandle, 1);
2672 m_ipcModule.destroyMessage(response);
2675 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2677 t_ilm_message response;
2678 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2679 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2684 m_ipcModule.getUint(message, &layerid);
2685 m_ipcModule.getUintArray(message, &array, &length);
2687 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(clientPid, layerid, array, length));
2690 response = m_ipcModule.createResponse(message);
2694 response = m_ipcModule.createErrorResponse(message);
2695 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2698 m_ipcModule.sendToClients(response, &clientHandle, 1);
2699 m_ipcModule.destroyMessage(response);
2702 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2704 t_ilm_message response;
2705 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2708 m_ipcModule.getUint(message, &layerid);
2710 Layer* layer = m_executor->getScene()->getLayer(layerid);
2713 layer->addNotification(clientHandle);
2714 response = m_ipcModule.createResponse(message);
2718 response = m_ipcModule.createErrorResponse(message);
2719 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2722 m_ipcModule.sendToClients(response, &clientHandle, 1);
2723 m_ipcModule.destroyMessage(response);
2726 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2728 t_ilm_message response;
2729 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2732 m_ipcModule.getUint(message, &surfaceid);
2734 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2737 surface->addNotification(clientHandle);
2738 response = m_ipcModule.createResponse(message);
2742 response = m_ipcModule.createErrorResponse(message);
2743 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2746 m_ipcModule.sendToClients(response, &clientHandle, 1);
2747 m_ipcModule.destroyMessage(response);
2750 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2752 t_ilm_message response;
2753 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2756 m_ipcModule.getUint(message, &layerid);
2758 Layer* layer = m_executor->getScene()->getLayer(layerid);
2761 layer->removeNotification(clientHandle);
2762 response = m_ipcModule.createResponse(message);
2766 response = m_ipcModule.createErrorResponse(message);
2767 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2770 m_ipcModule.sendToClients(response, &clientHandle, 1);
2771 m_ipcModule.destroyMessage(response);
2774 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2776 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2777 t_ilm_message response;
2780 m_ipcModule.getUint(message, &surfaceid);
2782 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2785 surface->removeNotification(clientHandle);
2786 response = m_ipcModule.createResponse(message);
2790 response = m_ipcModule.createErrorResponse(message);
2791 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2794 m_ipcModule.sendToClients(response, &clientHandle, 1);
2795 m_ipcModule.destroyMessage(response);
2798 void GenericCommunicator::processNotificationQueue()
2800 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2801 NotificationQueue::iterator iter = notificationQueue.begin();
2802 NotificationQueue::iterator end = notificationQueue.end();
2804 for (; iter != end; ++iter)
2806 GraphicalObject* object = iter->first;
2807 t_ilm_notification_mask mask = iter->second;
2808 sendNotification(object, mask);
2810 notificationQueue.clear();
2813 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2815 switch (object->type)
2819 Layer* layer = static_cast<Layer*>(object);
2822 ApplicationReferenceList& arl = layer->getNotificationClients();
2826 t_ilm_message notification;
2827 Rectangle dest = layer->getDestinationRegion();
2828 Rectangle src = layer->getSourceRegion();
2829 OrientationType orientation = layer->getOrientation();
2831 unsigned char chromaKeyRed = 0;
2832 unsigned char chromaKeyGreen = 0;
2833 unsigned char chromaKeyBlue = 0;
2834 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2836 std::stringstream notificationName;
2837 notificationName << "NotificationForLayer" << layer->getID();
2839 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2840 m_ipcModule.appendUint(notification, layer->getID());
2841 m_ipcModule.appendUint(notification, mask);
2843 m_ipcModule.appendDouble(notification, layer->getOpacity());
2844 m_ipcModule.appendUint(notification, src.x);
2845 m_ipcModule.appendUint(notification, src.y);
2846 m_ipcModule.appendUint(notification, src.width);
2847 m_ipcModule.appendUint(notification, src.height);
2848 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2849 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2850 m_ipcModule.appendUint(notification, dest.x);
2851 m_ipcModule.appendUint(notification, dest.y);
2852 m_ipcModule.appendUint(notification, dest.width);
2853 m_ipcModule.appendUint(notification, dest.height);
2854 m_ipcModule.appendUint(notification, orientation);
2855 m_ipcModule.appendBool(notification, layer->getVisibility());
2856 m_ipcModule.appendUint(notification, layer->getLayerType());
2857 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2858 m_ipcModule.appendUint(notification, chromaKeyRed);
2859 m_ipcModule.appendUint(notification, chromaKeyGreen);
2860 m_ipcModule.appendUint(notification, chromaKeyBlue);
2861 m_ipcModule.appendInt(notification, layer->getCreatorPid());
2863 int clientCount = arl.size();
2864 t_ilm_client_handle clientArray[256];
2866 ApplicationReferenceList::iterator iter = arl.begin();
2867 ApplicationReferenceList::iterator end = arl.end();
2869 for (int clientNumber = 0;
2870 iter != end, clientNumber < 256;
2871 ++iter, ++clientNumber)
2873 t_ilm_client_handle client = *iter;
2874 clientArray[clientNumber] = client;
2877 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2879 if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
2881 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2884 m_ipcModule.destroyMessage(notification);
2891 Surface* surface = static_cast<Surface*>(object);
2894 ApplicationReferenceList& arl = surface->getNotificationClients();
2898 t_ilm_message notification;
2899 std::stringstream notificationName;
2900 notificationName << "NotificationForSurface" << surface->getID();
2902 unsigned char chromaKeyRed = 0;
2903 unsigned char chromaKeyGreen = 0;
2904 unsigned char chromaKeyBlue = 0;
2905 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2907 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2908 m_ipcModule.appendUint(notification, surface->getID());
2909 m_ipcModule.appendUint(notification, mask);
2911 m_ipcModule.appendDouble(notification, surface->getOpacity());
2912 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2913 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2914 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2915 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2916 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2917 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2918 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2919 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2920 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2921 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2922 m_ipcModule.appendUint(notification, surface->getOrientation());
2923 m_ipcModule.appendBool(notification, surface->getVisibility());
2924 m_ipcModule.appendUint(notification, surface->frameCounter);
2925 m_ipcModule.appendUint(notification, surface->drawCounter);
2926 m_ipcModule.appendUint(notification, surface->updateCounter);
2927 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2928 m_ipcModule.appendUint(notification, surface->getNativeContent());
2929 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2930 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2931 m_ipcModule.appendUint(notification, chromaKeyRed);
2932 m_ipcModule.appendUint(notification, chromaKeyGreen);
2933 m_ipcModule.appendUint(notification, chromaKeyBlue);
2934 m_ipcModule.appendInt(notification, surface->getCreatorPid());
2936 int clientCount = arl.size();
2937 t_ilm_client_handle clients[256];
2939 ApplicationReferenceList::iterator iter = arl.begin();
2940 ApplicationReferenceList::iterator end = arl.end();
2942 for (int clientNumber = 0;
2943 iter != end, clientNumber < 256;
2944 ++iter, ++clientNumber)
2946 clients[clientNumber] = *iter;
2949 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2951 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2953 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2956 m_ipcModule.destroyMessage(notification);
2962 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2967 HealthCondition GenericCommunicator::pluginGetHealth()
2969 HealthCondition health = PluginBase::pluginGetHealth();
2970 if (0 != pthread_kill(mThreadId, 0))
2972 health = HealthDead;
2977 void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
2979 t_ilm_message response;
2980 OptimizationType optimizationId;
2981 OptimizationModeType optimizationMode;
2983 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2984 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2986 m_ipcModule.getUint(message,&o);
2987 optimizationId = (OptimizationType) o;
2988 m_ipcModule.getUint(message,&o);
2989 optimizationMode = (OptimizationModeType) o;
2991 t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
2994 response = m_ipcModule.createResponse(message);
2998 response = m_ipcModule.createErrorResponse(message);
2999 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3001 m_ipcModule.sendToClients(response,&clientHandle,1);
3002 m_ipcModule.destroyMessage(response);
3005 void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
3007 t_ilm_message response;
3008 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
3009 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
3010 OptimizationType optimizationId;
3011 OptimizationModeType optimizationMode;
3014 m_ipcModule.getUint(message,&o);
3015 optimizationId = (OptimizationType)o;
3017 t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
3021 response = m_ipcModule.createResponse(message);
3022 m_ipcModule.appendUint(response,(unsigned int)optimizationMode);
3026 response = m_ipcModule.createErrorResponse(message);
3027 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3029 m_ipcModule.sendToClients(response,&clientHandle,1);
3030 m_ipcModule.destroyMessage(response);
3034 DECLARE_LAYERMANAGEMENT_PLUGIN(GenericCommunicator)