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 t_ilm_message response;
367 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
369 unsigned int processId = 0;
370 char processName[1024];
371 m_ipcModule.getUint(message, &processId);
372 m_ipcModule.getString(message, processName);
374 m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
376 LOG_DEBUG("GenericCommunicator", "ServiceConnect called from "
377 << m_executor->getSenderName(clientHandle)
378 << "(" << m_executor->getSenderPid(clientHandle) << ")");
380 response = m_ipcModule.createResponse(message);
381 m_ipcModule.sendToClients(response, &clientHandle, 1);
382 m_ipcModule.destroyMessage(response);
385 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
387 t_ilm_message response;
388 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
390 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called from "
391 << m_executor->getSenderName(clientHandle)
392 << "(" << m_executor->getSenderPid(clientHandle) << ")");
394 m_executor->removeApplicationReference(clientHandle);
396 response = m_ipcModule.createResponse(message);
397 m_ipcModule.sendToClients(response, &clientHandle, 1);
398 m_ipcModule.destroyMessage(response);
401 void GenericCommunicator::Debug(t_ilm_message message)
403 t_ilm_message response;
404 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
405 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
406 t_ilm_bool param = ILM_FALSE;
407 m_ipcModule.getBool(message, ¶m);
409 t_ilm_bool status = m_executor->execute(new DebugCommand(clientPid, param));
412 response = m_ipcModule.createResponse(message);
416 response = m_ipcModule.createErrorResponse(message);
417 m_ipcModule.appendString(response, INVALID_ARGUMENT);
420 m_ipcModule.sendToClients(response, &clientHandle, 1);
421 m_ipcModule.destroyMessage(response);
424 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
426 t_ilm_message response;
427 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
429 m_ipcModule.getUint(message, &screenid);
430 uint* resolution = m_executor->getScreenResolution(screenid);
432 response = m_ipcModule.createResponse(message);
433 m_ipcModule.appendUint(response, resolution[0]);
434 m_ipcModule.appendUint(response, resolution[1]);
435 m_ipcModule.sendToClients(response, &clientHandle, 1);
436 m_ipcModule.destroyMessage(response);
439 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
441 t_ilm_message response;
442 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
444 m_ipcModule.getUint(message, &screenid);
445 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
446 response = m_ipcModule.createResponse(message);
447 m_ipcModule.appendUint(response, numberOfHardwareLayers);
448 m_ipcModule.sendToClients(response, &clientHandle, 1);
449 m_ipcModule.destroyMessage(response);
452 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
454 t_ilm_message response;
455 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
457 uint* IDs = m_executor->getScreenIDs(&length);
458 response = m_ipcModule.createResponse(message);
459 m_ipcModule.appendUintArray(response, IDs, length);
460 m_ipcModule.sendToClients(response, &clientHandle, 1);
461 m_ipcModule.destroyMessage(response);
464 void GenericCommunicator::ScreenShot(t_ilm_message message)
466 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
467 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
468 t_ilm_message response;
472 m_ipcModule.getUint(message, &screenid);
473 m_ipcModule.getString(message, filename);
475 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(clientPid, filename, screenid));
478 response = m_ipcModule.createResponse(message);
482 response = m_ipcModule.createErrorResponse(message);
483 m_ipcModule.appendString(response, INVALID_ARGUMENT);
486 m_ipcModule.sendToClients(response, &clientHandle, 1);
487 m_ipcModule.destroyMessage(response);
490 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
492 t_ilm_message response;
493 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
494 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
496 m_ipcModule.getString(message, filename);
498 m_ipcModule.getUint(message, &layerid);
500 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(clientPid, filename, layerid));
503 response = m_ipcModule.createResponse(message);
507 response = m_ipcModule.createErrorResponse(message);
508 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
511 m_ipcModule.sendToClients(response, &clientHandle, 1);
512 m_ipcModule.destroyMessage(response);
515 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
517 t_ilm_message response;
518 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
519 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
521 m_ipcModule.getString(message, filename);
523 m_ipcModule.getUint(message, &id);
524 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(clientPid, filename, id));
527 response = m_ipcModule.createResponse(message);
531 response = m_ipcModule.createErrorResponse(message);
532 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
535 m_ipcModule.sendToClients(response, &clientHandle, 1);
536 m_ipcModule.destroyMessage(response);
539 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
541 t_ilm_message response;
542 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
545 m_executor->getScene()->lockScene();
546 m_executor->getScene()->getLayerIDs(&length, &array);
547 m_executor->getScene()->unlockScene();
548 response = m_ipcModule.createResponse(message);
549 m_ipcModule.appendUintArray(response, array, length);
550 m_ipcModule.sendToClients(response, &clientHandle, 1);
551 m_ipcModule.destroyMessage(response);
554 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
556 t_ilm_message response;
557 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
559 m_ipcModule.getUint(message, &screenID);
563 m_executor->getScene()->lockScene();
564 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
565 m_executor->getScene()->unlockScene();
568 response = m_ipcModule.createResponse(message);
569 m_ipcModule.appendUintArray(response, array, length);
573 response = m_ipcModule.createErrorResponse(message);
574 m_ipcModule.appendString(response, INVALID_ARGUMENT);
577 m_ipcModule.sendToClients(response, &clientHandle, 1);
578 m_ipcModule.destroyMessage(response);
581 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
583 t_ilm_message response;
584 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
587 m_executor->getScene()->lockScene();
588 m_executor->getScene()->getSurfaceIDs(&length, &array);
589 m_executor->getScene()->unlockScene();
590 response = m_ipcModule.createResponse(message);
591 m_ipcModule.appendUintArray(response, array, length);
592 m_ipcModule.sendToClients(response, &clientHandle, 1);
593 m_ipcModule.destroyMessage(response);
596 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
598 t_ilm_message response;
599 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
602 m_executor->getScene()->lockScene();
603 m_executor->getScene()->getLayerGroupIDs(&length, &array);
604 m_executor->getScene()->unlockScene();
605 response = m_ipcModule.createResponse(message);
606 m_ipcModule.appendUintArray(response, array, length);
607 m_ipcModule.sendToClients(response, &clientHandle, 1);
608 m_ipcModule.destroyMessage(response);
611 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
613 t_ilm_message response;
614 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
617 m_executor->getScene()->lockScene();
618 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
619 m_executor->getScene()->unlockScene();
620 response = m_ipcModule.createResponse(message);
621 m_ipcModule.appendUintArray(response, array, length);
622 m_ipcModule.sendToClients(response, &clientHandle, 1);
623 m_ipcModule.destroyMessage(response);
626 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
628 t_ilm_message response;
629 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
631 m_ipcModule.getUint(message, &id);
632 m_executor->getScene()->lockScene();
633 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
636 std::list<Surface*> surfaces = sg->getList();
637 uint length = surfaces.size();
638 uint* array = new uint[length];
641 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
644 array[arrayPos] = s->getID();
647 m_executor->getScene()->unlockScene();
649 response = m_ipcModule.createResponse(message);
650 m_ipcModule.appendUintArray(response, array, length);
654 m_executor->getScene()->unlockScene();
655 response = m_ipcModule.createErrorResponse(message);
656 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
659 m_ipcModule.sendToClients(response, &clientHandle, 1);
660 m_ipcModule.destroyMessage(response);
663 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
665 t_ilm_message response;
666 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
668 m_ipcModule.getUint(message, &id);
669 m_executor->getScene()->lockScene();
670 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
673 std::list<Layer*> layers = sg->getList();
675 uint length = layers.size();
676 uint* array = new uint[length];
679 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
682 array[arrayPos] = l->getID();
685 m_executor->getScene()->unlockScene();
687 response = m_ipcModule.createResponse(message);
688 m_ipcModule.appendUintArray(response, array, length);
692 m_executor->getScene()->unlockScene();
693 response = m_ipcModule.createErrorResponse(message);
694 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
697 m_ipcModule.sendToClients(response, &clientHandle, 1);
698 m_ipcModule.destroyMessage(response);
701 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
703 t_ilm_message response;
704 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
706 m_ipcModule.getUint(message, &id);
707 m_executor->getScene()->lockScene();
708 Layer* layer = m_executor->getScene()->getLayer(id);
711 std::list<Surface*> surfaces = layer->getAllSurfaces();
713 uint length = surfaces.size();
714 uint* array = new uint[length];
717 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
720 array[arrayPos] = s->getID();
723 m_executor->getScene()->unlockScene();
725 response = m_ipcModule.createResponse(message);
726 m_ipcModule.appendUintArray(response, array, length);
730 m_executor->getScene()->unlockScene();
731 response = m_ipcModule.createErrorResponse(message);
732 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
735 m_ipcModule.sendToClients(response, &clientHandle, 1);
736 m_ipcModule.destroyMessage(response);
739 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
741 t_ilm_message response;
742 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
744 m_ipcModule.getUint(message, &id);
746 Surface* surface = m_executor->getScene()->getSurface(id);
749 Rectangle dest = surface->getDestinationRegion();
750 Rectangle src = surface->getSourceRegion();
751 OrientationType orientation = surface->getOrientation();
752 unsigned char chromaKeyRed = 0;
753 unsigned char chromaKeyGreen = 0;
754 unsigned char chromaKeyBlue = 0;
755 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
757 response = m_ipcModule.createResponse(message);
758 m_ipcModule.appendDouble(response, surface->getOpacity());
759 m_ipcModule.appendUint(response, src.x);
760 m_ipcModule.appendUint(response, src.y);
761 m_ipcModule.appendUint(response, src.width);
762 m_ipcModule.appendUint(response, src.height);
763 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
764 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
765 m_ipcModule.appendUint(response, dest.x);
766 m_ipcModule.appendUint(response, dest.y);
767 m_ipcModule.appendUint(response, dest.width);
768 m_ipcModule.appendUint(response, dest.height);
769 m_ipcModule.appendUint(response, orientation);
770 m_ipcModule.appendBool(response, surface->getVisibility());
771 m_ipcModule.appendUint(response, surface->frameCounter);
772 m_ipcModule.appendUint(response, surface->drawCounter);
773 m_ipcModule.appendUint(response, surface->updateCounter);
774 m_ipcModule.appendUint(response, surface->getPixelFormat());
775 m_ipcModule.appendUint(response, surface->getNativeContent());
776 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
777 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
778 m_ipcModule.appendUint(response, chromaKeyRed);
779 m_ipcModule.appendUint(response, chromaKeyGreen);
780 m_ipcModule.appendUint(response, chromaKeyBlue);
781 m_ipcModule.appendInt(response, surface->getCreatorPid());
785 response = m_ipcModule.createErrorResponse(message);
786 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
789 m_ipcModule.sendToClients(response, &clientHandle, 1);
790 m_ipcModule.destroyMessage(response);
793 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
795 t_ilm_message response;
796 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
798 m_ipcModule.getUint(message, &id);
800 Layer* layer = m_executor->getScene()->getLayer(id);
803 Rectangle dest = layer->getDestinationRegion();
804 Rectangle src = layer->getSourceRegion();
805 OrientationType orientation = layer->getOrientation();
806 unsigned char chromaKeyRed = 0;
807 unsigned char chromaKeyGreen = 0;
808 unsigned char chromaKeyBlue = 0;
809 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
811 response = m_ipcModule.createResponse(message);
812 m_ipcModule.appendDouble(response, layer->getOpacity());
813 m_ipcModule.appendUint(response, src.x);
814 m_ipcModule.appendUint(response, src.y);
815 m_ipcModule.appendUint(response, src.width);
816 m_ipcModule.appendUint(response, src.height);
817 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
818 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
819 m_ipcModule.appendUint(response, dest.x);
820 m_ipcModule.appendUint(response, dest.y);
821 m_ipcModule.appendUint(response, dest.width);
822 m_ipcModule.appendUint(response, dest.height);
823 m_ipcModule.appendUint(response, orientation);
824 m_ipcModule.appendBool(response, layer->getVisibility());
825 m_ipcModule.appendUint(response, layer->getLayerType());
826 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
827 m_ipcModule.appendUint(response, chromaKeyRed);
828 m_ipcModule.appendUint(response, chromaKeyGreen);
829 m_ipcModule.appendUint(response, chromaKeyBlue);
830 m_ipcModule.appendInt(response, layer->getCreatorPid());
834 response = m_ipcModule.createErrorResponse(message);
835 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
838 m_ipcModule.sendToClients(response, &clientHandle, 1);
839 m_ipcModule.destroyMessage(response);
842 void GenericCommunicator::CreateSurface(t_ilm_message message)
844 t_ilm_message response;
845 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
846 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
850 uint pixelformat = 0;
851 PixelFormat pf = PIXELFORMAT_UNKNOWN;
852 uint id = GraphicalObject::INVALID_ID;
854 m_ipcModule.getUint(message, &handle);
855 m_ipcModule.getUint(message, &width);
856 m_ipcModule.getUint(message, &height);
857 m_ipcModule.getUint(message, &pixelformat);
859 pf = (PixelFormat) pixelformat;
862 // First of all create the surface
863 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
865 // after that apply the native content
866 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
870 response = m_ipcModule.createResponse(message);
871 m_ipcModule.appendUint(response, id);
875 response = m_ipcModule.createErrorResponse(message);
876 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
879 m_ipcModule.sendToClients(response, &clientHandle, 1);
880 m_ipcModule.destroyMessage(response);
883 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
885 t_ilm_message response;
886 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
887 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
891 uint pixelformat = 0;
892 PixelFormat pf = PIXELFORMAT_UNKNOWN;
895 m_ipcModule.getUint(message, &handle);
896 m_ipcModule.getUint(message, &width);
897 m_ipcModule.getUint(message, &height);
898 m_ipcModule.getUint(message, &pixelformat);
899 m_ipcModule.getUint(message, &id);
901 pf = (PixelFormat) pixelformat;
903 // First of all create the surface
904 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
906 // after that apply the native content
907 status &= m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
911 response = m_ipcModule.createResponse(message);
912 m_ipcModule.appendUint(response, id);
916 response = m_ipcModule.createErrorResponse(message);
917 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
920 m_ipcModule.sendToClients(response, &clientHandle, 1);
921 m_ipcModule.destroyMessage(response);
924 void GenericCommunicator::InitializeSurface(t_ilm_message message)
926 t_ilm_message response;
927 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
928 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
929 uint id = GraphicalObject::INVALID_ID;
931 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
934 response = m_ipcModule.createResponse(message);
935 m_ipcModule.appendUint(response, id);
939 response = m_ipcModule.createErrorResponse(message);
940 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
943 m_ipcModule.sendToClients(response, &clientHandle, 1);
944 m_ipcModule.destroyMessage(response);
947 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
949 t_ilm_message response;
950 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
951 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
953 m_ipcModule.getUint(message, &id);
954 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
957 response = m_ipcModule.createResponse(message);
958 m_ipcModule.appendUint(response, id);
962 response = m_ipcModule.createErrorResponse(message);
963 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
966 m_ipcModule.sendToClients(response, &clientHandle, 1);
967 m_ipcModule.destroyMessage(response);
970 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
972 t_ilm_message response;
973 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
974 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
979 uint pixelformat = 0;
980 PixelFormat pf = PIXELFORMAT_UNKNOWN;
982 m_ipcModule.getUint(message, &id);
983 m_ipcModule.getUint(message, &handle);
984 m_ipcModule.getUint(message, &width);
985 m_ipcModule.getUint(message, &height);
986 m_ipcModule.getUint(message, &pixelformat);
988 pf = (PixelFormat) pixelformat;
990 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(clientPid, id, handle, pf, width, height));
993 response = m_ipcModule.createResponse(message);
997 response = m_ipcModule.createErrorResponse(message);
998 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1001 m_ipcModule.sendToClients(response, &clientHandle, 1);
1002 m_ipcModule.destroyMessage(response);
1005 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
1007 t_ilm_message response;
1008 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1009 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1011 m_ipcModule.getUint(message, &id);
1013 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(clientPid, id));
1016 response = m_ipcModule.createResponse(message);
1020 response = m_ipcModule.createErrorResponse(message);
1021 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1024 m_ipcModule.sendToClients(response, &clientHandle, 1);
1025 m_ipcModule.destroyMessage(response);
1028 void GenericCommunicator::RemoveSurface(t_ilm_message message)
1030 t_ilm_message response;
1031 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1032 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1034 m_ipcModule.getUint(message, ¶m);
1035 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(clientPid, param));
1038 response = m_ipcModule.createResponse(message);
1042 response = m_ipcModule.createErrorResponse(message);
1043 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1046 m_ipcModule.sendToClients(response, &clientHandle, 1);
1047 m_ipcModule.destroyMessage(response);
1050 void GenericCommunicator::CreateLayer(t_ilm_message message)
1052 t_ilm_message response;
1053 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1054 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1055 uint id = GraphicalObject::INVALID_ID;
1056 // use resolution of default screen as default width and height of layers
1057 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1058 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1061 response = m_ipcModule.createResponse(message);
1062 m_ipcModule.appendUint(response, id);
1066 response = m_ipcModule.createErrorResponse(message);
1067 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1070 m_ipcModule.sendToClients(response, &clientHandle, 1);
1071 m_ipcModule.destroyMessage(response);
1074 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
1076 t_ilm_message response;
1077 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1078 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1079 uint id = GraphicalObject::INVALID_ID;
1081 m_ipcModule.getUint(message, &id);
1082 // use resolution of default screen as default width and height of layers
1083 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
1084 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, resolution[0], resolution[1], &id));
1087 response = m_ipcModule.createResponse(message);
1088 m_ipcModule.appendUint(response, id);
1092 response = m_ipcModule.createErrorResponse(message);
1093 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1096 m_ipcModule.sendToClients(response, &clientHandle, 1);
1097 m_ipcModule.destroyMessage(response);
1101 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
1103 t_ilm_message response;
1104 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1105 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1107 m_ipcModule.getUint(message, &width);
1109 m_ipcModule.getUint(message, &height);
1111 uint id = GraphicalObject::INVALID_ID;
1112 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1115 response = m_ipcModule.createResponse(message);
1116 m_ipcModule.appendUint(response, id);
1120 response = m_ipcModule.createErrorResponse(message);
1121 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1124 m_ipcModule.sendToClients(response, &clientHandle, 1);
1125 m_ipcModule.destroyMessage(response);
1128 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1130 t_ilm_message response;
1131 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1132 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1133 uint id = GraphicalObject::INVALID_ID;
1136 t_ilm_bool status = ILM_FALSE;
1138 m_ipcModule.getUint(message, &id);
1139 m_ipcModule.getUint(message, &width);
1140 m_ipcModule.getUint(message, &height);
1142 status = m_executor->execute(new LayerCreateCommand(clientPid, width, height, &id));
1145 response = m_ipcModule.createResponse(message);
1146 m_ipcModule.appendUint(response, id);
1150 response = m_ipcModule.createErrorResponse(message);
1151 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1154 m_ipcModule.sendToClients(response, &clientHandle, 1);
1155 m_ipcModule.destroyMessage(response);
1158 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1160 t_ilm_message response;
1161 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1162 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1164 m_ipcModule.getUint(message, ¶m);
1165 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(clientPid, param));
1168 response = m_ipcModule.createResponse(message);
1172 response = m_ipcModule.createErrorResponse(message);
1173 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1176 m_ipcModule.sendToClients(response, &clientHandle, 1);
1177 m_ipcModule.destroyMessage(response);
1180 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1182 t_ilm_message response;
1183 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1184 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1186 uint surfacegroupid = 0;
1188 m_ipcModule.getUint(message, &surfaceid);
1189 m_ipcModule.getUint(message, &surfacegroupid);
1191 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1194 response = m_ipcModule.createResponse(message);
1198 response = m_ipcModule.createErrorResponse(message);
1199 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1202 m_ipcModule.sendToClients(response, &clientHandle, 1);
1203 m_ipcModule.destroyMessage(response);
1206 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1208 t_ilm_message response;
1209 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1210 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1212 uint surfacegroupid = 0;
1214 m_ipcModule.getUint(message, &surfaceid);
1215 m_ipcModule.getUint(message, &surfacegroupid);
1217 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
1220 response = m_ipcModule.createResponse(message);
1224 response = m_ipcModule.createErrorResponse(message);
1225 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1228 m_ipcModule.sendToClients(response, &clientHandle, 1);
1229 m_ipcModule.destroyMessage(response);
1232 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1234 t_ilm_message response;
1235 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1236 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1238 uint layergroupid = 0;
1240 m_ipcModule.getUint(message, &layerid);
1241 m_ipcModule.getUint(message, &layergroupid);
1243 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
1246 response = m_ipcModule.createResponse(message);
1250 response = m_ipcModule.createErrorResponse(message);
1251 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1254 m_ipcModule.sendToClients(response, &clientHandle, 1);
1255 m_ipcModule.destroyMessage(response);
1258 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1260 t_ilm_message response;
1261 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1262 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1264 uint layergroupid = 0;
1266 m_ipcModule.getUint(message, &layerid);
1267 m_ipcModule.getUint(message, &layergroupid);
1269 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
1272 response = m_ipcModule.createResponse(message);
1276 response = m_ipcModule.createErrorResponse(message);
1277 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1280 m_ipcModule.sendToClients(response, &clientHandle, 1);
1281 m_ipcModule.destroyMessage(response);
1284 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1286 t_ilm_message response;
1287 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1288 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1292 m_ipcModule.getUint(message, &surfaceid);
1293 m_ipcModule.getUint(message, &layer);
1295 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(clientPid, layer, surfaceid));
1298 response = m_ipcModule.createResponse(message);
1302 response = m_ipcModule.createErrorResponse(message);
1303 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1306 m_ipcModule.sendToClients(response, &clientHandle, 1);
1307 m_ipcModule.destroyMessage(response);
1310 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1312 t_ilm_message response;
1313 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1314 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1317 m_ipcModule.getUint(message, &surfaceid);
1318 m_ipcModule.getUint(message, &layerid);
1320 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(clientPid, layerid, surfaceid));
1323 response = m_ipcModule.createResponse(message);
1327 response = m_ipcModule.createErrorResponse(message);
1328 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1331 m_ipcModule.sendToClients(response, &clientHandle, 1);
1332 m_ipcModule.destroyMessage(response);
1335 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1337 t_ilm_message response;
1338 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1339 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1340 uint newID = GraphicalObject::INVALID_ID;
1342 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1345 response = m_ipcModule.createResponse(message);
1346 m_ipcModule.appendUint(response, newID);
1350 response = m_ipcModule.createErrorResponse(message);
1351 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1354 m_ipcModule.sendToClients(response, &clientHandle, 1);
1355 m_ipcModule.destroyMessage(response);
1358 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1360 t_ilm_message response;
1361 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1362 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1363 uint newID = GraphicalObject::INVALID_ID;
1365 m_ipcModule.getUint(message, &newID);
1367 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
1370 response = m_ipcModule.createResponse(message);
1371 m_ipcModule.appendUint(response, newID);
1375 response = m_ipcModule.createErrorResponse(message);
1376 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1379 m_ipcModule.sendToClients(response, &clientHandle, 1);
1380 m_ipcModule.destroyMessage(response);
1383 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1385 t_ilm_message response;
1386 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1387 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1389 m_ipcModule.getUint(message, ¶m);
1391 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
1394 response = m_ipcModule.createResponse(message);
1398 response = m_ipcModule.createErrorResponse(message);
1399 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1402 m_ipcModule.sendToClients(response, &clientHandle, 1);
1403 m_ipcModule.destroyMessage(response);
1406 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1408 t_ilm_message response;
1409 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1410 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1411 uint newID = GraphicalObject::INVALID_ID;
1413 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1416 response = m_ipcModule.createResponse(message);
1417 m_ipcModule.appendUint(response, newID);
1421 response = m_ipcModule.createErrorResponse(message);
1422 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1425 m_ipcModule.sendToClients(response, &clientHandle, 1);
1426 m_ipcModule.destroyMessage(response);
1429 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1431 t_ilm_message response;
1432 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1433 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1434 uint newID = GraphicalObject::INVALID_ID;
1436 m_ipcModule.getUint(message, &newID);
1438 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
1441 response = m_ipcModule.createResponse(message);
1442 m_ipcModule.appendUint(response, newID);
1446 response = m_ipcModule.createErrorResponse(message);
1447 m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1450 m_ipcModule.sendToClients(response, &clientHandle, 1);
1451 m_ipcModule.destroyMessage(response);
1454 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1456 t_ilm_message response;
1457 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1458 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1460 m_ipcModule.getUint(message, ¶m);
1462 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
1465 response = m_ipcModule.createResponse(message);
1469 response = m_ipcModule.createErrorResponse(message);
1470 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1473 m_ipcModule.sendToClients(response, &clientHandle, 1);
1474 m_ipcModule.destroyMessage(response);
1477 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1479 t_ilm_message response;
1480 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1481 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1488 m_ipcModule.getUint(message, &id);
1489 m_ipcModule.getUint(message, &x);
1490 m_ipcModule.getUint(message, &y);
1491 m_ipcModule.getUint(message, &width);
1492 m_ipcModule.getUint(message, &height);
1494 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1497 response = m_ipcModule.createResponse(message);
1501 response = m_ipcModule.createErrorResponse(message);
1502 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1505 m_ipcModule.sendToClients(response, &clientHandle, 1);
1506 m_ipcModule.destroyMessage(response);
1509 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1511 t_ilm_message response;
1512 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1513 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1520 m_ipcModule.getUint(message, &id);
1521 m_ipcModule.getUint(message, &x);
1522 m_ipcModule.getUint(message, &y);
1523 m_ipcModule.getUint(message, &width);
1524 m_ipcModule.getUint(message, &height);
1526 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(clientPid, id, x, y, width, height));
1529 response = m_ipcModule.createResponse(message);
1533 response = m_ipcModule.createErrorResponse(message);
1534 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1537 m_ipcModule.sendToClients(response, &clientHandle, 1);
1538 m_ipcModule.destroyMessage(response);
1541 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1543 t_ilm_message response;
1544 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1545 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1552 m_ipcModule.getUint(message, &id);
1553 m_ipcModule.getUint(message, &x);
1554 m_ipcModule.getUint(message, &y);
1555 m_ipcModule.getUint(message, &width);
1556 m_ipcModule.getUint(message, &height);
1558 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1561 response = m_ipcModule.createResponse(message);
1565 response = m_ipcModule.createErrorResponse(message);
1566 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1569 m_ipcModule.sendToClients(response, &clientHandle, 1);
1570 m_ipcModule.destroyMessage(response);
1573 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1575 t_ilm_message response;
1576 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1577 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1582 m_ipcModule.getUint(message, &id);
1583 m_ipcModule.getUint(message, &x);
1584 m_ipcModule.getUint(message, &y);
1586 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(clientPid, id, x, y));
1589 response = m_ipcModule.createResponse(message);
1593 response = m_ipcModule.createErrorResponse(message);
1594 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1597 m_ipcModule.sendToClients(response, &clientHandle, 1);
1598 m_ipcModule.destroyMessage(response);
1601 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1603 t_ilm_message response;
1604 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1605 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1610 m_ipcModule.getUint(message, &id);
1612 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(clientPid, id, &x, &y));
1615 response = m_ipcModule.createResponse(message);
1616 m_ipcModule.appendUint(response, x);
1617 m_ipcModule.appendUint(response, y);
1621 response = m_ipcModule.createErrorResponse(message);
1622 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1625 m_ipcModule.sendToClients(response, &clientHandle, 1);
1626 m_ipcModule.destroyMessage(response);
1629 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1631 t_ilm_message response;
1632 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1633 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1638 m_ipcModule.getUint(message, &id);
1639 m_ipcModule.getUint(message, &width);
1640 m_ipcModule.getUint(message, &height);
1642 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(clientPid, id, width, height));
1645 response = m_ipcModule.createResponse(message);
1649 response = m_ipcModule.createErrorResponse(message);
1650 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1653 m_ipcModule.sendToClients(response, &clientHandle, 1);
1654 m_ipcModule.destroyMessage(response);
1657 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1659 t_ilm_message response;
1660 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1661 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1668 m_ipcModule.getUint(message, &id);
1669 m_ipcModule.getUint(message, &x);
1670 m_ipcModule.getUint(message, &y);
1671 m_ipcModule.getUint(message, &width);
1672 m_ipcModule.getUint(message, &height);
1674 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(clientPid, id, x, y, width, height));
1677 response = m_ipcModule.createResponse(message);
1681 response = m_ipcModule.createErrorResponse(message);
1682 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1685 m_ipcModule.sendToClients(response, &clientHandle, 1);
1686 m_ipcModule.destroyMessage(response);
1689 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1691 t_ilm_message response;
1692 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1693 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1698 m_ipcModule.getUint(message, &id);
1699 m_ipcModule.getUint(message, &x);
1700 m_ipcModule.getUint(message, &y);
1702 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(clientPid, id, x, y));
1705 response = m_ipcModule.createResponse(message);
1709 response = m_ipcModule.createErrorResponse(message);
1710 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1713 m_ipcModule.sendToClients(response, &clientHandle, 1);
1714 m_ipcModule.destroyMessage(response);
1717 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1719 t_ilm_message response;
1720 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1721 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1726 m_ipcModule.getUint(message, &id);
1728 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(clientPid, id, &x, &y));
1731 response = m_ipcModule.createResponse(message);
1732 m_ipcModule.appendUint(response, x);
1733 m_ipcModule.appendUint(response, y);
1737 response = m_ipcModule.createErrorResponse(message);
1738 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1741 m_ipcModule.sendToClients(response, &clientHandle, 1);
1742 m_ipcModule.destroyMessage(response);
1745 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1747 t_ilm_message response;
1748 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1749 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1754 m_ipcModule.getUint(message, &id);
1755 m_ipcModule.getUint(message, &width);
1756 m_ipcModule.getUint(message, &height);
1758 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(clientPid, id, width, height));
1761 response = m_ipcModule.createResponse(message);
1765 response = m_ipcModule.createErrorResponse(message);
1766 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1769 m_ipcModule.sendToClients(response, &clientHandle, 1);
1770 m_ipcModule.destroyMessage(response);
1773 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1775 t_ilm_message response;
1776 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1777 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1782 m_ipcModule.getUint(message, &id);
1784 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(clientPid, id, &width, &height));
1787 response = m_ipcModule.createResponse(message);
1788 m_ipcModule.appendUint(response, width);
1789 m_ipcModule.appendUint(response, height);
1793 response = m_ipcModule.createErrorResponse(message);
1794 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1797 m_ipcModule.sendToClients(response, &clientHandle, 1);
1798 m_ipcModule.destroyMessage(response);
1801 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1803 t_ilm_message response;
1804 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1805 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1810 m_ipcModule.getUint(message, &id);
1812 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(clientPid, id, &width, &height));
1815 response = m_ipcModule.createResponse(message);
1816 m_ipcModule.appendUint(response, width);
1817 m_ipcModule.appendUint(response, height);
1821 response = m_ipcModule.createErrorResponse(message);
1822 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1825 m_ipcModule.sendToClients(response, &clientHandle, 1);
1826 m_ipcModule.destroyMessage(response);
1829 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1831 t_ilm_message response;
1832 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1833 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1837 m_ipcModule.getUint(message, &id);
1838 m_ipcModule.getDouble(message, ¶m);
1840 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(clientPid, id, param));
1843 response = m_ipcModule.createResponse(message);
1847 response = m_ipcModule.createErrorResponse(message);
1848 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1851 m_ipcModule.sendToClients(response, &clientHandle, 1);
1852 m_ipcModule.destroyMessage(response);
1855 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1857 t_ilm_message response;
1858 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1859 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1863 m_ipcModule.getUint(message, &id);
1864 m_ipcModule.getDouble(message, ¶m);
1866 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(clientPid, id, param));
1869 response = m_ipcModule.createResponse(message);
1873 response = m_ipcModule.createErrorResponse(message);
1874 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1877 m_ipcModule.sendToClients(response, &clientHandle, 1);
1878 m_ipcModule.destroyMessage(response);
1881 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1883 t_ilm_message response;
1884 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1885 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1889 m_ipcModule.getUint(message, &id);
1890 m_ipcModule.getDouble(message, ¶m);
1892 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
1895 response = m_ipcModule.createResponse(message);
1899 response = m_ipcModule.createErrorResponse(message);
1900 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1903 m_ipcModule.sendToClients(response, &clientHandle, 1);
1904 m_ipcModule.destroyMessage(response);
1907 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1909 t_ilm_message response;
1910 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1911 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1915 m_ipcModule.getUint(message, &id);
1916 m_ipcModule.getDouble(message, ¶m);
1918 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
1921 response = m_ipcModule.createResponse(message);
1925 response = m_ipcModule.createErrorResponse(message);
1926 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1929 m_ipcModule.sendToClients(response, &clientHandle, 1);
1930 m_ipcModule.destroyMessage(response);
1933 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1935 t_ilm_message response;
1936 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1937 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1941 m_ipcModule.getUint(message, &id);
1943 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(clientPid, id, ¶m));
1946 response = m_ipcModule.createResponse(message);
1947 m_ipcModule.appendDouble(response, param);
1951 response = m_ipcModule.createErrorResponse(message);
1952 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1955 m_ipcModule.sendToClients(response, &clientHandle, 1);
1956 m_ipcModule.destroyMessage(response);
1959 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1961 t_ilm_message response;
1962 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1963 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1967 m_ipcModule.getUint(message, &id);
1969 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(clientPid, id, ¶m));
1972 response = m_ipcModule.createResponse(message);
1973 m_ipcModule.appendDouble(response, param);
1977 response = m_ipcModule.createErrorResponse(message);
1978 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1981 m_ipcModule.sendToClients(response, &clientHandle, 1);
1982 m_ipcModule.destroyMessage(response);
1985 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1987 t_ilm_message response;
1988 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1989 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
1992 OrientationType o = Zero;
1994 m_ipcModule.getUint(message, &id);
1995 m_ipcModule.getUint(message, ¶m);
1997 o = (OrientationType) param;
1999 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(clientPid, id, o));
2002 response = m_ipcModule.createResponse(message);
2006 response = m_ipcModule.createErrorResponse(message);
2007 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2010 m_ipcModule.sendToClients(response, &clientHandle, 1);
2011 m_ipcModule.destroyMessage(response);
2014 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
2016 t_ilm_message response;
2017 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2018 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2022 m_ipcModule.getUint(message, &id);
2024 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(clientPid, id, &o));
2027 response = m_ipcModule.createResponse(message);
2028 m_ipcModule.appendUint(response, o);
2032 response = m_ipcModule.createErrorResponse(message);
2033 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2036 m_ipcModule.sendToClients(response, &clientHandle, 1);
2037 m_ipcModule.destroyMessage(response);
2040 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
2042 t_ilm_message response;
2043 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2044 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2047 OrientationType o = Zero;
2049 m_ipcModule.getUint(message, &id);
2050 m_ipcModule.getUint(message, ¶m);
2052 o = (OrientationType) param;
2054 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(clientPid, id, o));
2057 response = m_ipcModule.createResponse(message);
2061 response = m_ipcModule.createErrorResponse(message);
2062 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2065 m_ipcModule.sendToClients(response, &clientHandle, 1);
2066 m_ipcModule.destroyMessage(response);
2069 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
2071 t_ilm_message response;
2072 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2073 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2077 m_ipcModule.getUint(message, &id);
2079 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(clientPid, id, &o));
2082 response = m_ipcModule.createResponse(message);
2083 m_ipcModule.appendUint(response, o);
2087 response = m_ipcModule.createErrorResponse(message);
2088 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2091 m_ipcModule.sendToClients(response, &clientHandle, 1);
2092 m_ipcModule.destroyMessage(response);
2095 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
2097 t_ilm_message response;
2098 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2099 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2101 PixelFormat pixelFormat;
2103 m_ipcModule.getUint(message, &id);
2105 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(clientPid, id, &pixelFormat));
2108 response = m_ipcModule.createResponse(message);
2109 m_ipcModule.appendUint(response, pixelFormat);
2113 response = m_ipcModule.createErrorResponse(message);
2114 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2117 m_ipcModule.sendToClients(response, &clientHandle, 1);
2118 m_ipcModule.destroyMessage(response);
2121 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
2123 t_ilm_message response;
2124 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2125 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2127 t_ilm_bool newVis = ILM_FALSE;
2129 m_ipcModule.getUint(message, &surfaceid);
2130 m_ipcModule.getBool(message, &newVis);
2132 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(clientPid, surfaceid, newVis));
2135 response = m_ipcModule.createResponse(message);
2139 response = m_ipcModule.createErrorResponse(message);
2140 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2143 m_ipcModule.sendToClients(response, &clientHandle, 1);
2144 m_ipcModule.destroyMessage(response);
2147 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
2149 t_ilm_message response;
2150 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2151 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2153 t_ilm_bool myparam = ILM_FALSE;
2155 m_ipcModule.getUint(message, &layerid);
2156 m_ipcModule.getBool(message, &myparam);
2158 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(clientPid, layerid, myparam));
2161 response = m_ipcModule.createResponse(message);
2165 response = m_ipcModule.createErrorResponse(message);
2166 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2169 m_ipcModule.sendToClients(response, &clientHandle, 1);
2170 m_ipcModule.destroyMessage(response);
2173 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
2175 t_ilm_message response;
2176 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2177 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2181 m_ipcModule.getUint(message, &id);
2183 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(clientPid, id, &visibility));
2186 response = m_ipcModule.createResponse(message);
2187 m_ipcModule.appendBool(response, visibility);
2191 response = m_ipcModule.createErrorResponse(message);
2192 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2195 m_ipcModule.sendToClients(response, &clientHandle, 1);
2196 m_ipcModule.destroyMessage(response);
2199 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
2201 t_ilm_message response;
2202 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2203 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2207 m_ipcModule.getUint(message, &id);
2209 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(clientPid, id, &visibility));
2212 response = m_ipcModule.createResponse(message);
2213 m_ipcModule.appendBool(response, visibility);
2217 response = m_ipcModule.createErrorResponse(message);
2218 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2221 m_ipcModule.sendToClients(response, &clientHandle, 1);
2222 m_ipcModule.destroyMessage(response);
2225 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
2227 t_ilm_message response;
2228 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2229 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2231 t_ilm_bool myparam = ILM_FALSE;
2233 m_ipcModule.getUint(message, &groupid);
2234 m_ipcModule.getBool(message, &myparam);
2236 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
2239 response = m_ipcModule.createResponse(message);
2243 response = m_ipcModule.createErrorResponse(message);
2244 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2247 m_ipcModule.sendToClients(response, &clientHandle, 1);
2248 m_ipcModule.destroyMessage(response);
2251 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
2253 t_ilm_message response;
2254 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2255 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2257 t_ilm_bool myparam = ILM_FALSE;
2259 m_ipcModule.getUint(message, &groupid);
2260 m_ipcModule.getBool(message, &myparam);
2262 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
2265 response = m_ipcModule.createResponse(message);
2269 response = m_ipcModule.createErrorResponse(message);
2270 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2273 m_ipcModule.sendToClients(response, &clientHandle, 1);
2274 m_ipcModule.destroyMessage(response);
2278 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
2280 t_ilm_message response;
2281 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2282 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2287 m_ipcModule.getUintArray(message, &array, &length);
2288 m_ipcModule.getUint(message, &screenID);
2290 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, screenID, array, length));
2293 response = m_ipcModule.createResponse(message);
2297 response = m_ipcModule.createErrorResponse(message);
2298 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2301 m_ipcModule.sendToClients(response, &clientHandle, 1);
2302 m_ipcModule.destroyMessage(response);
2305 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2307 t_ilm_message response;
2308 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2309 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2314 m_ipcModule.getUint(message, &layerid);
2315 m_ipcModule.getUintArray(message, &array, &length);
2317 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(clientPid, layerid, array, length));
2320 response = m_ipcModule.createResponse(message);
2324 response = m_ipcModule.createErrorResponse(message);
2325 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2328 m_ipcModule.sendToClients(response, &clientHandle, 1);
2329 m_ipcModule.destroyMessage(response);
2332 void GenericCommunicator::GetLayerType(t_ilm_message message)
2334 t_ilm_message response;
2335 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2337 m_ipcModule.getUint(message, &id);
2339 Layer* layer = m_executor->getScene()->getLayer(id);
2342 response = m_ipcModule.createResponse(message);
2343 m_ipcModule.appendUint(response, layer->getLayerType());
2347 response = m_ipcModule.createErrorResponse(message);
2348 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2351 m_ipcModule.sendToClients(response, &clientHandle, 1);
2352 m_ipcModule.destroyMessage(response);
2355 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2357 t_ilm_message response;
2358 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2360 LayerType type = Unknown;
2362 m_ipcModule.getUint(message, &id);
2364 type = (LayerType) id;
2366 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2367 response = m_ipcModule.createResponse(message);
2368 m_ipcModule.appendUint(response, capabilities);
2369 m_ipcModule.sendToClients(response, &clientHandle, 1);
2370 m_ipcModule.destroyMessage(response);
2373 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2375 t_ilm_message response;
2376 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2378 m_ipcModule.getUint(message, &id);
2380 Layer* layer = m_executor->getScene()->getLayer(id);
2383 response = m_ipcModule.createResponse(message);
2384 m_ipcModule.appendUint(response, layer->getCapabilities());
2388 response = m_ipcModule.createErrorResponse(message);
2389 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2392 m_ipcModule.sendToClients(response, &clientHandle, 1);
2393 m_ipcModule.destroyMessage(response);
2396 void GenericCommunicator::FadeIn(t_ilm_message message)
2398 t_ilm_message response;
2399 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2400 response = m_ipcModule.createErrorResponse(message);
2401 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2402 m_ipcModule.sendToClients(response, &clientHandle, 1);
2403 m_ipcModule.destroyMessage(response);
2406 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2408 t_ilm_message response;
2409 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2410 response = m_ipcModule.createErrorResponse(message);
2411 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2412 m_ipcModule.sendToClients(response, &clientHandle, 1);
2413 m_ipcModule.destroyMessage(response);
2416 void GenericCommunicator::FadeOut(t_ilm_message message)
2418 t_ilm_message response;
2419 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2420 response = m_ipcModule.createErrorResponse(message);
2421 m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2422 m_ipcModule.sendToClients(response, &clientHandle, 1);
2423 m_ipcModule.destroyMessage(response);
2426 void GenericCommunicator::Exit(t_ilm_message message)
2428 t_ilm_message response;
2429 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2430 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2431 t_ilm_bool status = m_executor->execute(new ExitCommand(clientPid));
2434 response = m_ipcModule.createResponse(message);
2438 response = m_ipcModule.createErrorResponse(message);
2439 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2442 m_ipcModule.sendToClients(response, &clientHandle, 1);
2443 m_ipcModule.destroyMessage(response);
2446 void GenericCommunicator::CommitChanges(t_ilm_message message)
2448 t_ilm_message response;
2449 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2450 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2451 t_ilm_bool status = m_executor->execute(new CommitCommand(clientPid));
2454 response = m_ipcModule.createResponse(message);
2458 response = m_ipcModule.createErrorResponse(message);
2459 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2462 m_ipcModule.sendToClients(response, &clientHandle, 1);
2463 m_ipcModule.destroyMessage(response);
2466 void GenericCommunicator::CreateShader(t_ilm_message message)
2468 t_ilm_message response;
2469 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2470 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2471 char vertname[1024];
2472 char fragname[1024];
2475 m_ipcModule.getString(message, vertname);
2476 m_ipcModule.getString(message, fragname);
2478 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(clientPid, vertname, fragname, &id));
2481 response = m_ipcModule.createResponse(message);
2482 m_ipcModule.appendUint(response, id);
2486 response = m_ipcModule.createErrorResponse(message);
2487 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2490 m_ipcModule.sendToClients(response, &clientHandle, 1);
2491 m_ipcModule.destroyMessage(response);
2494 void GenericCommunicator::DestroyShader(t_ilm_message message)
2496 t_ilm_message response;
2497 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2498 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2501 m_ipcModule.getUint(message, &shaderid);
2503 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(clientPid, shaderid));
2506 response = m_ipcModule.createResponse(message);
2510 response = m_ipcModule.createErrorResponse(message);
2511 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2514 m_ipcModule.sendToClients(response, &clientHandle, 1);
2515 m_ipcModule.destroyMessage(response);
2518 void GenericCommunicator::SetShader(t_ilm_message message)
2520 t_ilm_message response;
2521 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2522 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2526 m_ipcModule.getUint(message, &surfaceId);
2527 m_ipcModule.getUint(message, &shaderid);
2529 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(clientPid, surfaceId, shaderid));
2532 response = m_ipcModule.createResponse(message);
2536 response = m_ipcModule.createErrorResponse(message);
2537 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2540 m_ipcModule.sendToClients(response, &clientHandle, 1);
2541 m_ipcModule.destroyMessage(response);
2544 void GenericCommunicator::SetUniforms(t_ilm_message message)
2546 t_ilm_message response;
2547 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2548 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2550 std::vector<string> uniforms;
2552 m_ipcModule.getUint(message, &id);
2555 //m_ipcModule.getStringArray(&uniforms);
2557 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(clientPid, id, uniforms));
2560 response = m_ipcModule.createResponse(message);
2564 response = m_ipcModule.createErrorResponse(message);
2565 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2568 m_ipcModule.sendToClients(response, &clientHandle, 1);
2569 m_ipcModule.destroyMessage(response);
2572 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2574 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2575 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2576 t_ilm_message response;
2579 m_ipcModule.getUint(message, &surfaceId);
2581 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(clientPid, surfaceId));
2584 response = m_ipcModule.createResponse(message);
2588 response = m_ipcModule.createErrorResponse(message);
2589 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2592 m_ipcModule.sendToClients(response, &clientHandle, 1);
2593 m_ipcModule.destroyMessage(response);
2597 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2599 t_ilm_message response;
2600 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2601 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2604 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(clientPid, &surfaceId));
2607 response = m_ipcModule.createResponse(message);
2608 m_ipcModule.appendUint(response, surfaceId);
2612 response = m_ipcModule.createErrorResponse(message);
2613 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2616 m_ipcModule.sendToClients(response, &clientHandle, 1);
2617 m_ipcModule.destroyMessage(response);
2621 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2623 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2624 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2625 t_ilm_message response;
2628 InputDevice devices;
2631 m_ipcModule.getUint(message, &surfaceId);
2632 m_ipcModule.getUint(message, &udevices);
2633 m_ipcModule.getBool(message, &accept);
2635 devices = (InputDevice) udevices;
2637 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(clientPid, surfaceId, devices, accept));
2640 response = m_ipcModule.createResponse(message);
2644 response = m_ipcModule.createErrorResponse(message);
2645 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2648 m_ipcModule.sendToClients(response, &clientHandle, 1);
2649 m_ipcModule.destroyMessage(response);
2652 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2654 t_ilm_message response;
2655 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2656 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2661 m_ipcModule.getUint(message, &surfaceid);
2662 m_ipcModule.getUintArray(message, &array, &length);
2664 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(clientPid, surfaceid, array, length));
2667 response = m_ipcModule.createResponse(message);
2671 response = m_ipcModule.createErrorResponse(message);
2672 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2675 m_ipcModule.sendToClients(response, &clientHandle, 1);
2676 m_ipcModule.destroyMessage(response);
2679 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2681 t_ilm_message response;
2682 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2683 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2688 m_ipcModule.getUint(message, &layerid);
2689 m_ipcModule.getUintArray(message, &array, &length);
2691 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(clientPid, layerid, array, length));
2694 response = m_ipcModule.createResponse(message);
2698 response = m_ipcModule.createErrorResponse(message);
2699 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2702 m_ipcModule.sendToClients(response, &clientHandle, 1);
2703 m_ipcModule.destroyMessage(response);
2706 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2708 t_ilm_message response;
2709 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2712 m_ipcModule.getUint(message, &layerid);
2714 Layer* layer = m_executor->getScene()->getLayer(layerid);
2717 layer->addNotification(clientHandle);
2718 response = m_ipcModule.createResponse(message);
2722 response = m_ipcModule.createErrorResponse(message);
2723 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2726 m_ipcModule.sendToClients(response, &clientHandle, 1);
2727 m_ipcModule.destroyMessage(response);
2730 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2732 t_ilm_message response;
2733 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2736 m_ipcModule.getUint(message, &surfaceid);
2738 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2741 surface->addNotification(clientHandle);
2742 response = m_ipcModule.createResponse(message);
2746 response = m_ipcModule.createErrorResponse(message);
2747 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2750 m_ipcModule.sendToClients(response, &clientHandle, 1);
2751 m_ipcModule.destroyMessage(response);
2754 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2756 t_ilm_message response;
2757 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2760 m_ipcModule.getUint(message, &layerid);
2762 Layer* layer = m_executor->getScene()->getLayer(layerid);
2765 layer->removeNotification(clientHandle);
2766 response = m_ipcModule.createResponse(message);
2770 response = m_ipcModule.createErrorResponse(message);
2771 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2774 m_ipcModule.sendToClients(response, &clientHandle, 1);
2775 m_ipcModule.destroyMessage(response);
2778 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2780 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2781 t_ilm_message response;
2784 m_ipcModule.getUint(message, &surfaceid);
2786 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2789 surface->removeNotification(clientHandle);
2790 response = m_ipcModule.createResponse(message);
2794 response = m_ipcModule.createErrorResponse(message);
2795 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2798 m_ipcModule.sendToClients(response, &clientHandle, 1);
2799 m_ipcModule.destroyMessage(response);
2802 void GenericCommunicator::processNotificationQueue()
2804 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2805 NotificationQueue::iterator iter = notificationQueue.begin();
2806 NotificationQueue::iterator end = notificationQueue.end();
2808 for (; iter != end; ++iter)
2810 GraphicalObject* object = iter->first;
2811 t_ilm_notification_mask mask = iter->second;
2812 sendNotification(object, mask);
2814 notificationQueue.clear();
2817 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2819 switch (object->type)
2823 Layer* layer = static_cast<Layer*>(object);
2826 ApplicationReferenceList& arl = layer->getNotificationClients();
2830 t_ilm_message notification;
2831 Rectangle dest = layer->getDestinationRegion();
2832 Rectangle src = layer->getSourceRegion();
2833 OrientationType orientation = layer->getOrientation();
2835 unsigned char chromaKeyRed = 0;
2836 unsigned char chromaKeyGreen = 0;
2837 unsigned char chromaKeyBlue = 0;
2838 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2840 std::stringstream notificationName;
2841 notificationName << "NotificationForLayer" << layer->getID();
2843 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2844 m_ipcModule.appendUint(notification, layer->getID());
2845 m_ipcModule.appendUint(notification, mask);
2847 m_ipcModule.appendDouble(notification, layer->getOpacity());
2848 m_ipcModule.appendUint(notification, src.x);
2849 m_ipcModule.appendUint(notification, src.y);
2850 m_ipcModule.appendUint(notification, src.width);
2851 m_ipcModule.appendUint(notification, src.height);
2852 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2853 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2854 m_ipcModule.appendUint(notification, dest.x);
2855 m_ipcModule.appendUint(notification, dest.y);
2856 m_ipcModule.appendUint(notification, dest.width);
2857 m_ipcModule.appendUint(notification, dest.height);
2858 m_ipcModule.appendUint(notification, orientation);
2859 m_ipcModule.appendBool(notification, layer->getVisibility());
2860 m_ipcModule.appendUint(notification, layer->getLayerType());
2861 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2862 m_ipcModule.appendUint(notification, chromaKeyRed);
2863 m_ipcModule.appendUint(notification, chromaKeyGreen);
2864 m_ipcModule.appendUint(notification, chromaKeyBlue);
2865 m_ipcModule.appendInt(notification, layer->getCreatorPid());
2867 int clientCount = arl.size();
2868 t_ilm_client_handle clientArray[256];
2870 ApplicationReferenceList::iterator iter = arl.begin();
2871 ApplicationReferenceList::iterator end = arl.end();
2873 for (int clientNumber = 0;
2874 iter != end, clientNumber < 256;
2875 ++iter, ++clientNumber)
2877 t_ilm_client_handle client = *iter;
2878 clientArray[clientNumber] = client;
2881 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2883 if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
2885 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2888 m_ipcModule.destroyMessage(notification);
2895 Surface* surface = static_cast<Surface*>(object);
2898 ApplicationReferenceList& arl = surface->getNotificationClients();
2902 t_ilm_message notification;
2903 std::stringstream notificationName;
2904 notificationName << "NotificationForSurface" << surface->getID();
2906 unsigned char chromaKeyRed = 0;
2907 unsigned char chromaKeyGreen = 0;
2908 unsigned char chromaKeyBlue = 0;
2909 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2911 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2912 m_ipcModule.appendUint(notification, surface->getID());
2913 m_ipcModule.appendUint(notification, mask);
2915 m_ipcModule.appendDouble(notification, surface->getOpacity());
2916 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2917 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2918 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2919 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2920 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2921 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2922 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2923 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2924 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2925 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2926 m_ipcModule.appendUint(notification, surface->getOrientation());
2927 m_ipcModule.appendBool(notification, surface->getVisibility());
2928 m_ipcModule.appendUint(notification, surface->frameCounter);
2929 m_ipcModule.appendUint(notification, surface->drawCounter);
2930 m_ipcModule.appendUint(notification, surface->updateCounter);
2931 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2932 m_ipcModule.appendUint(notification, surface->getNativeContent());
2933 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2934 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2935 m_ipcModule.appendUint(notification, chromaKeyRed);
2936 m_ipcModule.appendUint(notification, chromaKeyGreen);
2937 m_ipcModule.appendUint(notification, chromaKeyBlue);
2938 m_ipcModule.appendInt(notification, surface->getCreatorPid());
2940 int clientCount = arl.size();
2941 t_ilm_client_handle clients[256];
2943 ApplicationReferenceList::iterator iter = arl.begin();
2944 ApplicationReferenceList::iterator end = arl.end();
2946 for (int clientNumber = 0;
2947 iter != end, clientNumber < 256;
2948 ++iter, ++clientNumber)
2950 clients[clientNumber] = *iter;
2953 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2955 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2957 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2960 m_ipcModule.destroyMessage(notification);
2966 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2971 HealthCondition GenericCommunicator::pluginGetHealth()
2973 HealthCondition health = PluginBase::pluginGetHealth();
2974 if (0 != pthread_kill(mThreadId, 0))
2976 health = HealthDead;
2981 void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
2983 t_ilm_message response;
2984 OptimizationType optimizationId;
2985 OptimizationModeType optimizationMode;
2987 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2988 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
2990 m_ipcModule.getUint(message,&o);
2991 optimizationId = (OptimizationType) o;
2992 m_ipcModule.getUint(message,&o);
2993 optimizationMode = (OptimizationModeType) o;
2995 t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
2998 response = m_ipcModule.createResponse(message);
3002 response = m_ipcModule.createErrorResponse(message);
3003 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3005 m_ipcModule.sendToClients(response,&clientHandle,1);
3006 m_ipcModule.destroyMessage(response);
3009 void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
3011 t_ilm_message response;
3012 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
3013 t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
3014 OptimizationType optimizationId;
3015 OptimizationModeType optimizationMode;
3018 m_ipcModule.getUint(message,&o);
3019 optimizationId = (OptimizationType)o;
3021 t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
3025 response = m_ipcModule.createResponse(message);
3026 m_ipcModule.appendUint(response,(unsigned int)optimizationMode);
3030 response = m_ipcModule.createErrorResponse(message);
3031 m_ipcModule.appendString(response,RESOURCE_NOT_FOUND);
3033 m_ipcModule.sendToClients(response,&clientHandle,1);
3034 m_ipcModule.destroyMessage(response);
3038 DECLARE_LAYERMANAGEMENT_PLUGIN(GenericCommunicator)