1 /***************************************************************************
2 * Copyright 2012 BMW Car IT GmbH
3 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ****************************************************************************/
20 #include "GenericCommunicator.h"
21 #include "ilm_types.h"
24 #include "ICommandExecutor.h"
25 #include "CommitCommand.h"
26 #include "LayerCreateCommand.h"
27 #include "LayergroupCreateCommand.h"
28 #include "SurfaceCreateCommand.h"
29 #include "SurfacegroupCreateCommand.h"
30 #include "SurfaceGetDimensionCommand.h"
31 #include "LayerGetDimensionCommand.h"
32 #include "SurfaceGetOpacityCommand.h"
33 #include "LayerGetOpacityCommand.h"
34 #include "SurfaceGetPixelformatCommand.h"
35 #include "LayerGetVisibilityCommand.h"
36 #include "SurfaceGetVisibilityCommand.h"
37 #include "LayerAddSurfaceCommand.h"
38 #include "LayerRemoveSurfaceCommand.h"
39 #include "LayerRemoveCommand.h"
40 #include "SurfaceRemoveCommand.h"
41 #include "LayergroupRemoveCommand.h"
42 #include "SurfacegroupRemoveCommand.h"
43 #include "SurfaceGetOrientationCommand.h"
44 #include "LayerGetOrientationCommand.h"
45 #include "LayergroupAddLayerCommand.h"
46 #include "LayergroupRemoveLayerCommand.h"
47 #include "LayerSetDestinationRectangleCommand.h"
48 #include "SurfaceSetDestinationRectangleCommand.h"
49 #include "LayerSetOpacityCommand.h"
50 #include "LayergroupSetOpacityCommand.h"
51 #include "SurfaceSetOpacityCommand.h"
52 #include "SurfacegroupSetOpacityCommand.h"
53 #include "LayerSetSourceRectangleCommand.h"
54 #include "SurfaceSetSourceRectangleCommand.h"
55 #include "LayerSetOrientationCommand.h"
56 #include "SurfaceSetOrientationCommand.h"
57 #include "SurfacegroupAddSurfaceCommand.h"
58 #include "SurfacegroupRemoveSurfaceCommand.h"
59 #include "LayerSetVisibilityCommand.h"
60 #include "SurfaceSetVisibilityCommand.h"
61 #include "LayergroupSetVisibilityCommand.h"
62 #include "SurfacegroupSetVisibilityCommand.h"
63 #include "DebugCommand.h"
64 #include "ExitCommand.h"
65 #include "ScreenSetRenderOrderCommand.h"
66 #include "LayerSetRenderOrderCommand.h"
67 #include "LayerSetDimensionCommand.h"
68 #include "SurfaceSetDimensionCommand.h"
69 #include "LayerSetPositionCommand.h"
70 #include "SurfaceSetPositionCommand.h"
71 #include "LayerGetPositionCommand.h"
72 #include "SurfaceGetPositionCommand.h"
73 #include "ShaderCreateCommand.h"
74 #include "ShaderDestroyCommand.h"
75 #include "SurfaceSetShaderCommand.h"
76 #include "ShaderSetUniformsCommand.h"
77 #include "ScreenDumpCommand.h"
78 #include "LayerDumpCommand.h"
79 #include "SurfaceDumpCommand.h"
80 #include "SurfaceSetNativeContentCommand.h"
81 #include "SurfaceRemoveNativeContentCommand.h"
82 #include "SurfaceSetKeyboardFocusCommand.h"
83 #include "SurfaceGetKeyboardFocusCommand.h"
84 #include "SurfaceUpdateInputEventAcceptance.h"
85 #include "SurfaceSetChromaKeyCommand.h"
86 #include "LayerSetChromaKeyCommand.h"
95 #define DEFAULT_SCREEN 0
97 const char* RESOURCE_ALREADY_INUSE = "Ressource already in use";
98 const char* INVALID_ARGUMENT = "Invalid argument";
99 const char* RESOURCE_NOT_FOUND = "Ressource not found";
100 const char* NOT_IMPLEMENTED = "Feature not implemented";
103 GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
104 : ICommunicator(executor)
105 , m_running(ILM_FALSE)
107 MethodTable manager_methods[] =
109 { "ServiceConnect", &GenericCommunicator::ServiceConnect },
110 { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
111 { "Debug", &GenericCommunicator::Debug },
112 { "ScreenShot", &GenericCommunicator::ScreenShot },
113 { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
114 { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
115 { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
116 { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
117 { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
118 { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
119 { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
120 { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
121 { "ListAllLayerGroupIDS", &GenericCommunicator::ListAllLayerGroupIDS },
122 { "ListAllSurfaceGroupIDS", &GenericCommunicator::ListAllSurfaceGroupIDS },
123 { "ListSurfacesOfSurfacegroup", &GenericCommunicator::ListSurfacesOfSurfacegroup },
124 { "ListLayersOfLayergroup", &GenericCommunicator::ListLayersOfLayergroup },
125 { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
126 { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
127 { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
128 { "CreateSurface", &GenericCommunicator::CreateSurface },
129 { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
130 { "InitializeSurface", &GenericCommunicator::InitializeSurface },
131 { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
132 { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
133 { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
134 { "RemoveSurface", &GenericCommunicator::RemoveSurface },
135 { "CreateLayer", &GenericCommunicator::CreateLayer },
136 { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
137 { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
138 { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
139 { "RemoveLayer", &GenericCommunicator::RemoveLayer },
140 { "AddSurfaceToSurfaceGroup", &GenericCommunicator::AddSurfaceToSurfaceGroup },
141 { "RemoveSurfaceFromSurfaceGroup", &GenericCommunicator::RemoveSurfaceFromSurfaceGroup },
142 { "AddLayerToLayerGroup", &GenericCommunicator::AddLayerToLayerGroup },
143 { "RemoveLayerFromLayerGroup", &GenericCommunicator::RemoveLayerFromLayerGroup },
144 { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
145 { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
146 { "CreateSurfaceGroup", &GenericCommunicator::CreateSurfaceGroup },
147 { "CreateSurfaceGroupFromId", &GenericCommunicator::CreateSurfaceGroupFromId },
148 { "RemoveSurfaceGroup", &GenericCommunicator::RemoveSurfaceGroup },
149 { "CreateLayerGroup", &GenericCommunicator::CreateLayerGroup },
150 { "CreateLayerGroupFromId", &GenericCommunicator::CreateLayerGroupFromId },
151 { "RemoveLayerGroup", &GenericCommunicator::RemoveLayerGroup },
152 { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
153 { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
154 { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
155 { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
156 { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
157 { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
158 { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
159 { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
160 { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
161 { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
162 { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
163 { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
164 { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
165 { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
166 { "SetSurfacegroupOpacity", &GenericCommunicator::SetSurfacegroupOpacity },
167 { "SetLayergroupOpacity", &GenericCommunicator::SetLayergroupOpacity },
168 { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
169 { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
170 { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
171 { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
172 { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
173 { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
174 { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
175 { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
176 { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
177 { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
178 { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
179 { "SetSurfacegroupVisibility", &GenericCommunicator::SetSurfacegroupVisibility },
180 { "SetLayergroupVisibility", &GenericCommunicator::SetLayergroupVisibility },
181 { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
182 { "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
183 { "GetLayerType", &GenericCommunicator::GetLayerType },
184 { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
185 { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
186 { "Exit", &GenericCommunicator::Exit },
187 { "CommitChanges", &GenericCommunicator::CommitChanges },
188 { "CreateShader", &GenericCommunicator::CreateShader },
189 { "DestroyShader", &GenericCommunicator::DestroyShader },
190 { "SetShader", &GenericCommunicator::SetShader },
191 { "SetUniforms", &GenericCommunicator::SetUniforms },
192 { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
193 { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
194 { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
195 { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
196 { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
197 { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
198 { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
199 { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
200 { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification }
203 int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
205 for (int index = 0; index < entryCount; ++index)
207 MethodTable* method = &manager_methods[index];
208 if (method->function)
210 m_callBackTable[method->name] = *method;
211 LOG_DEBUG("GenericCommunicator", "registered callback for " << method->name);
215 memset(&m_ipcModule, 0, sizeof(m_ipcModule));
218 bool GenericCommunicator::start()
220 LOG_DEBUG("GenericCommunicator", "Starting up IpcModules.");
222 if (!loadIpcModule(&m_ipcModule))
224 LOG_ERROR("GenericCommunicator", "Loading IpcModule failed.");
227 LOG_DEBUG("GenericCommunicator", "Loading IpcModule success.");
229 if (!m_ipcModule.initServiceMode())
231 LOG_ERROR("GenericCommunicator", "Initializing IpcModule failed.");
234 LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
236 m_running = ILM_TRUE;
241 void GenericCommunicator::stop()
243 LOG_INFO("GenericCommunicator","stopping");
247 m_ipcModule.destroy();
251 void GenericCommunicator::process(int timeout_ms)
253 t_ilm_message message = m_ipcModule.receive(timeout_ms);
259 t_ilm_message_type messageType = m_ipcModule.getMessageType(message);
260 t_ilm_const_string name = m_ipcModule.getMessageName(message);
261 t_ilm_const_string sender = m_ipcModule.getSenderName(message);
262 t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
266 case IpcMessageTypeCommand:
267 if (m_callBackTable.end() != m_callBackTable.find(name))
269 LOG_DEBUG("GenericCommunicator", "Received command " << name << " from " << sender);
270 CallBackMethod method = m_callBackTable[name].function;
271 (this->*method)(message);
275 LOG_WARNING("GenericCommunicator", "Received unknown command " << name << " from " << sender);
277 processNotificationQueue();
280 case IpcMessageTypeConnect:
281 LOG_DEBUG("GenericCommunicator", "client " << sender << " connected");
284 case IpcMessageTypeDisconnect:
285 LOG_DEBUG("GenericCommunicator", "client " << sender << " disconnected");
287 const LayerMap& layers = m_executor->getScene()->getAllLayers();
288 LayerMapConstIterator layerIter = layers.begin();
289 LayerMapConstIterator layerIterEnd = layers.end();
290 for (; layerIter != layerIterEnd; ++layerIter)
292 Layer* layer = layerIter->second;
293 layer->removeNotification(senderHandle);
296 const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
297 SurfaceMapConstIterator surfaceIter = surfaces.begin();
298 SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
299 for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
301 Surface* surface = surfaceIter->second;
302 surface->removeNotification(senderHandle);
307 case IpcMessageTypeError:
308 LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from " << sender);
311 case IpcMessageTypeShutdown:
312 case IpcMessageTypeNone:
316 LOG_DEBUG("GenericCommunicator", "Received unknown data from "
317 << sender << "(Message type: " << messageType << ")");
320 m_ipcModule.destroyMessage(message);
323 void GenericCommunicator::setdebug(bool onoff)
325 (void)onoff; // TODO: remove, only prevents warning
328 void GenericCommunicator::ServiceConnect(t_ilm_message message)
330 LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
332 t_ilm_message response;
333 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
334 u_int32_t processId = 0;
336 m_ipcModule.getUint(message, &processId);
337 char* owner = strdup(m_ipcModule.getSenderName(message));
339 m_executor->addApplicationReference(new IApplicationReference(owner,processId));
341 response = m_ipcModule.createResponse(message);
342 m_ipcModule.sendToClients(response, &clientHandle, 1);
343 m_ipcModule.destroyMessage(response);
346 void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
348 LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
350 t_ilm_message response;
351 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
352 char* owner = strdup(m_ipcModule.getSenderName(message));
353 long int ownerHash = IApplicationReference::generateApplicationHash(owner);
354 ApplicationReferenceMap* refmap = m_executor->getApplicationReferenceMap();
356 ApplicationReferenceMapIterator iter = refmap->find(ownerHash);
357 ApplicationReferenceMapIterator iterEnd = refmap->end();
359 for (; iter != iterEnd; ++iter)
361 IApplicationReference* registeredApp = (*iter).second;
362 m_executor->removeApplicationReference(registeredApp);
365 response = m_ipcModule.createResponse(message);
366 m_ipcModule.sendToClients(response, &clientHandle, 1);
367 m_ipcModule.destroyMessage(response);
370 void GenericCommunicator::Debug(t_ilm_message message)
372 t_ilm_message response;
373 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
374 t_ilm_bool param = ILM_FALSE;
375 m_ipcModule.getBool(message, ¶m);
377 t_ilm_bool status = m_executor->execute(new DebugCommand(param));
380 response = m_ipcModule.createResponse(message);
384 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
387 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
390 void GenericCommunicator::GetScreenResolution(t_ilm_message message)
392 t_ilm_message response;
393 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
395 m_ipcModule.getUint(message, &screenid);
396 uint* resolution = m_executor->getScreenResolution(screenid);
398 response = m_ipcModule.createResponse(message);
399 m_ipcModule.appendUint(response, resolution[0]);
400 m_ipcModule.appendUint(response, resolution[1]);
401 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
404 void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
406 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
408 m_ipcModule.getUint(message, &screenid);
409 uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(screenid);
410 response = m_ipcModule.createResponse(message);
411 m_ipcModule.appendUint(response, numberOfHardwareLayers);
412 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
415 void GenericCommunicator::GetScreenIDs(t_ilm_message message)
417 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
419 uint* IDs = m_executor->getScreenIDs(&length);
420 response = m_ipcModule.createResponse(message);
421 m_ipcModule.appendUintArray(response, IDs, length);
422 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
425 void GenericCommunicator::ScreenShot(t_ilm_message message)
427 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
428 t_ilm_message response;
432 m_ipcModule.getUint(message, &screenid);
433 m_ipcModule.getString(message, filename);
435 t_ilm_bool status = m_executor->execute(new ScreenDumpCommand(filename, screenid));
438 response = m_ipcModule.createResponse(message);
442 response = m_ipcModule.createErrorResponse(message);
443 m_ipcModule.appendString(response, INVALID_ARGUMENT);
446 m_ipcModule.sendToClients(response, &clientHandle, 1);
447 m_ipcModule.destroyMessage(response);
450 void GenericCommunicator::ScreenShotOfLayer(t_ilm_message message)
452 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
454 m_ipcModule.getString(message, filename);
456 m_ipcModule.getUint(message, &layerid);
458 t_ilm_bool status = m_executor->execute(new LayerDumpCommand(filename, layerid));
461 response = m_ipcModule.createResponse(message);
465 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
468 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
471 void GenericCommunicator::ScreenShotOfSurface(t_ilm_message message)
473 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
475 m_ipcModule.getString(message, filename);
477 m_ipcModule.getUint(message, &id);
478 t_ilm_bool status = m_executor->execute(new SurfaceDumpCommand(filename, id));
481 response = m_ipcModule.createResponse(message);
485 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
488 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
491 void GenericCommunicator::ListAllLayerIDS(t_ilm_message message)
493 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
496 m_executor->getScene()->lockScene();
497 m_executor->getScene()->getLayerIDs(&length, &array);
498 m_executor->getScene()->unlockScene();
499 response = m_ipcModule.createResponse(message);
500 m_ipcModule.appendUintArray(response, array, length);
501 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
504 void GenericCommunicator::ListAllLayerIDsOnScreen(t_ilm_message message)
506 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
508 m_ipcModule.getUint(message, &screenID);
512 m_executor->getScene()->lockScene();
513 t_ilm_bool status = m_executor->getScene()->getLayerIDsOfScreen(screenID, &length, &array);
514 m_executor->getScene()->unlockScene();
517 response = m_ipcModule.createResponse(message);
518 m_ipcModule.appendUintArray(response, array, length);
522 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
525 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
528 void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
530 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
533 m_executor->getScene()->lockScene();
534 m_executor->getScene()->getSurfaceIDs(&length, &array);
535 m_executor->getScene()->unlockScene();
536 response = m_ipcModule.createResponse(message);
537 m_ipcModule.appendUintArray(response, array, length);
538 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
541 void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
543 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
546 m_executor->getScene()->lockScene();
547 m_executor->getScene()->getLayerGroupIDs(&length, &array);
548 m_executor->getScene()->unlockScene();
549 response = m_ipcModule.createResponse(message);
550 m_ipcModule.appendUintArray(response, array, length);
551 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
554 void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
556 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
559 m_executor->getScene()->lockScene();
560 m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
561 m_executor->getScene()->unlockScene();
562 response = m_ipcModule.createResponse(message);
563 m_ipcModule.appendUintArray(response, array, length);
564 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
567 void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
569 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
571 m_ipcModule.getUint(message, &id);
572 m_executor->getScene()->lockScene();
573 SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
576 std::list<Surface*> surfaces = sg->getList();
577 uint length = surfaces.size();
578 uint* array = new uint[length];
581 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
584 array[arrayPos] = s->getID();
587 m_executor->getScene()->unlockScene();
589 response = m_ipcModule.createResponse(message);
590 m_ipcModule.appendUintArray(response, array, length);
594 m_executor->getScene()->unlockScene();
595 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
598 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
601 void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
603 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
605 m_ipcModule.getUint(message, &id);
606 m_executor->getScene()->lockScene();
607 LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
610 std::list<Layer*> layers = sg->getList();
612 uint length = layers.size();
613 uint* array = new uint[length];
616 for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
619 array[arrayPos] = l->getID();
622 m_executor->getScene()->unlockScene();
624 response = m_ipcModule.createResponse(message);
625 m_ipcModule.appendUintArray(response, array, length);
629 m_executor->getScene()->unlockScene();
630 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
633 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
636 void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
638 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
640 m_ipcModule.getUint(message, &id);
641 m_executor->getScene()->lockScene();
642 Layer* layer = m_executor->getScene()->getLayer(id);
645 std::list<Surface*> surfaces = layer->getAllSurfaces();
647 uint length = surfaces.size();
648 uint* array = new uint[length];
651 for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
654 array[arrayPos] = s->getID();
657 m_executor->getScene()->unlockScene();
659 response = m_ipcModule.createResponse(message);
660 m_ipcModule.appendUintArray(response, array, length);
664 m_executor->getScene()->unlockScene();
665 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
668 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
671 void GenericCommunicator::GetPropertiesOfSurface(t_ilm_message message)
673 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
675 m_ipcModule.getUint(message, &id);
677 Surface* surface = m_executor->getScene()->getSurface(id);
680 Rectangle dest = surface->getDestinationRegion();
681 Rectangle src = surface->getSourceRegion();
682 OrientationType orientation = surface->getOrientation();
683 unsigned char chromaKeyRed = 0;
684 unsigned char chromaKeyGreen = 0;
685 unsigned char chromaKeyBlue = 0;
686 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
688 response = m_ipcModule.createResponse(message);
689 m_ipcModule.appendDouble(response, surface->getOpacity());
690 m_ipcModule.appendUint(response, src.x);
691 m_ipcModule.appendUint(response, src.y);
692 m_ipcModule.appendUint(response, src.width);
693 m_ipcModule.appendUint(response, src.height);
694 m_ipcModule.appendUint(response, surface->OriginalSourceWidth);
695 m_ipcModule.appendUint(response, surface->OriginalSourceHeight);
696 m_ipcModule.appendUint(response, dest.x);
697 m_ipcModule.appendUint(response, dest.y);
698 m_ipcModule.appendUint(response, dest.width);
699 m_ipcModule.appendUint(response, dest.height);
700 m_ipcModule.appendUint(response, orientation);
701 m_ipcModule.appendBool(response, surface->getVisibility());
702 m_ipcModule.appendUint(response, surface->frameCounter);
703 m_ipcModule.appendUint(response, surface->drawCounter);
704 m_ipcModule.appendUint(response, surface->updateCounter);
705 m_ipcModule.appendUint(response, surface->getPixelFormat());
706 m_ipcModule.appendUint(response, surface->getNativeContent());
707 m_ipcModule.appendUint(response, surface->getInputEventAcceptanceOnDevices());
708 m_ipcModule.appendBool(response, surface->getChromaKeyEnabled());
709 m_ipcModule.appendUint(response, chromaKeyRed);
710 m_ipcModule.appendUint(response, chromaKeyGreen);
711 m_ipcModule.appendUint(response, chromaKeyBlue);
715 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
718 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
721 void GenericCommunicator::GetPropertiesOfLayer(t_ilm_message message)
723 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
725 m_ipcModule.getUint(message, &id);
727 Layer* layer = m_executor->getScene()->getLayer(id);
730 Rectangle dest = layer->getDestinationRegion();
731 Rectangle src = layer->getSourceRegion();
732 OrientationType orientation = layer->getOrientation();
733 unsigned char chromaKeyRed = 0;
734 unsigned char chromaKeyGreen = 0;
735 unsigned char chromaKeyBlue = 0;
736 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
738 response = m_ipcModule.createResponse(message);
739 m_ipcModule.appendDouble(response, layer->getOpacity());
740 m_ipcModule.appendUint(response, src.x);
741 m_ipcModule.appendUint(response, src.y);
742 m_ipcModule.appendUint(response, src.width);
743 m_ipcModule.appendUint(response, src.height);
744 m_ipcModule.appendUint(response, layer->OriginalSourceWidth);
745 m_ipcModule.appendUint(response, layer->OriginalSourceHeight);
746 m_ipcModule.appendUint(response, dest.x);
747 m_ipcModule.appendUint(response, dest.y);
748 m_ipcModule.appendUint(response, dest.width);
749 m_ipcModule.appendUint(response, dest.height);
750 m_ipcModule.appendUint(response, orientation);
751 m_ipcModule.appendBool(response, layer->getVisibility());
752 m_ipcModule.appendUint(response, layer->getLayerType());
753 m_ipcModule.appendBool(response, layer->getChromaKeyEnabled());
754 m_ipcModule.appendUint(response, chromaKeyRed);
755 m_ipcModule.appendUint(response, chromaKeyGreen);
756 m_ipcModule.appendUint(response, chromaKeyBlue);
760 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
763 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
766 void GenericCommunicator::CreateSurface(t_ilm_message message)
768 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
772 uint pixelformat = 0;
773 PixelFormat pf = PIXELFORMAT_UNKNOWN;
774 uint id = GraphicalObject::INVALID_ID;
776 m_ipcModule.getUint(message, &handle);
777 m_ipcModule.getUint(message, &width);
778 m_ipcModule.getUint(message, &height);
779 m_ipcModule.getUint(message, &pixelformat);
781 pf = (PixelFormat) pixelformat;
784 // First of all create the surface
785 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
787 // after that apply the native content
788 status &= m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));
792 response = m_ipcModule.createResponse(message);
793 m_ipcModule.appendUint(response, id);
797 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
800 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
803 void GenericCommunicator::CreateSurfaceFromId(t_ilm_message message)
805 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
809 uint pixelformat = 0;
810 PixelFormat pf = PIXELFORMAT_UNKNOWN;
813 m_ipcModule.getUint(message, &handle);
814 m_ipcModule.getUint(message, &width);
815 m_ipcModule.getUint(message, &height);
816 m_ipcModule.getUint(message, &pixelformat);
817 m_ipcModule.getUint(message, &id);
819 pf = (PixelFormat) pixelformat;
821 // First of all create the surface
822 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
824 // after that apply the native content
825 status &= m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));
829 response = m_ipcModule.createResponse(message);
830 m_ipcModule.appendUint(response, id);
834 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
837 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
840 void GenericCommunicator::InitializeSurface(t_ilm_message message)
842 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
843 uint id = GraphicalObject::INVALID_ID;
845 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
848 response = m_ipcModule.createResponse(message);
849 m_ipcModule.appendUint(response, id);
853 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
856 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
859 void GenericCommunicator::InitializeSurfaceFromId(t_ilm_message message)
861 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
863 m_ipcModule.getUint(message, &id);
864 t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(&id));
867 response = m_ipcModule.createResponse(message);
868 m_ipcModule.appendUint(response, id);
872 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
875 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
878 void GenericCommunicator::SetSurfaceNativeContent(t_ilm_message message)
880 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
885 uint pixelformat = 0;
886 PixelFormat pf = PIXELFORMAT_UNKNOWN;
888 m_ipcModule.getUint(message, &id);
889 m_ipcModule.getUint(message, &handle);
890 m_ipcModule.getUint(message, &width);
891 m_ipcModule.getUint(message, &height);
892 m_ipcModule.getUint(message, &pixelformat);
894 pf = (PixelFormat) pixelformat;
896 t_ilm_bool status = m_executor->execute(new SurfaceSetNativeContentCommand(id, handle, pf, width, height));
899 response = m_ipcModule.createResponse(message);
903 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
906 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
909 void GenericCommunicator::RemoveSurfaceNativeContent(t_ilm_message message)
911 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
913 m_ipcModule.getUint(message, &id);
915 t_ilm_bool status = m_executor->execute(new SurfaceRemoveNativeContentCommand(id));
918 response = m_ipcModule.createResponse(message);
922 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
925 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
928 void GenericCommunicator::RemoveSurface(t_ilm_message message)
930 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
932 m_ipcModule.getUint(message, ¶m);
933 t_ilm_bool status = m_executor->execute(new SurfaceRemoveCommand(param));
936 response = m_ipcModule.createResponse(message);
940 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
943 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
946 void GenericCommunicator::CreateLayer(t_ilm_message message)
948 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
949 uint id = GraphicalObject::INVALID_ID;
950 // use resolution of default screen as default width and height of layers
951 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
952 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(resolution[0], resolution[1], &id));
955 response = m_ipcModule.createResponse(message);
956 m_ipcModule.appendUint(response, id);
960 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
963 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
966 void GenericCommunicator::CreateLayerFromId(t_ilm_message message)
968 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
969 uint id = GraphicalObject::INVALID_ID;
971 m_ipcModule.getUint(message, &id);
972 // use resolution of default screen as default width and height of layers
973 uint* resolution = m_executor->getScreenResolution(DEFAULT_SCREEN);
974 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(resolution[0], resolution[1], &id));
977 response = m_ipcModule.createResponse(message);
978 m_ipcModule.appendUint(response, id);
982 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
985 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
989 void GenericCommunicator::CreateLayerWithDimension(t_ilm_message message)
991 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
993 m_ipcModule.getUint(message, &width);
995 m_ipcModule.getUint(message, &height);
997 uint id = GraphicalObject::INVALID_ID;
998 t_ilm_bool status = m_executor->execute(new LayerCreateCommand(width, height, &id));
1001 response = m_ipcModule.createResponse(message);
1002 m_ipcModule.appendUint(response, id);
1006 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1009 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1012 void GenericCommunicator::CreateLayerFromIdWithDimension(t_ilm_message message)
1014 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1015 uint id = GraphicalObject::INVALID_ID;
1018 t_ilm_bool status = ILM_FALSE;
1020 m_ipcModule.getUint(message, &id);
1021 m_ipcModule.getUint(message, &width);
1022 m_ipcModule.getUint(message, &height);
1024 status = m_executor->execute(new LayerCreateCommand(width, height, &id));
1027 response = m_ipcModule.createResponse(message);
1028 m_ipcModule.appendUint(response, id);
1032 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1035 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1038 void GenericCommunicator::RemoveLayer(t_ilm_message message)
1040 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1042 m_ipcModule.getUint(message, ¶m);
1043 t_ilm_bool status = m_executor->execute(new LayerRemoveCommand(param));
1046 response = m_ipcModule.createResponse(message);
1050 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1053 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1056 void GenericCommunicator::AddSurfaceToSurfaceGroup(t_ilm_message message)
1058 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1060 uint surfacegroupid = 0;
1062 m_ipcModule.getUint(message, &surfaceid);
1063 m_ipcModule.getUint(message, &surfacegroupid);
1065 t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(surfacegroupid, surfaceid));
1068 response = m_ipcModule.createResponse(message);
1072 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1075 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1078 void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(t_ilm_message message)
1080 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1082 uint surfacegroupid = 0;
1084 m_ipcModule.getUint(message, &surfaceid);
1085 m_ipcModule.getUint(message, &surfacegroupid);
1087 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(surfacegroupid, surfaceid));
1090 response = m_ipcModule.createResponse(message);
1094 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1097 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1100 void GenericCommunicator::AddLayerToLayerGroup(t_ilm_message message)
1102 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1104 uint layergroupid = 0;
1106 m_ipcModule.getUint(message, &layerid);
1107 m_ipcModule.getUint(message, &layergroupid);
1109 t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(layergroupid, layerid));
1112 response = m_ipcModule.createResponse(message);
1116 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1119 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1122 void GenericCommunicator::RemoveLayerFromLayerGroup(t_ilm_message message)
1124 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1126 uint layergroupid = 0;
1128 m_ipcModule.getUint(message, &layerid);
1129 m_ipcModule.getUint(message, &layergroupid);
1131 t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(layergroupid, layerid));
1134 response = m_ipcModule.createResponse(message);
1138 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1141 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1144 void GenericCommunicator::AddSurfaceToLayer(t_ilm_message message)
1146 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1150 m_ipcModule.getUint(message, &surfaceid);
1151 m_ipcModule.getUint(message, &layer);
1153 t_ilm_bool status = m_executor->execute(new LayerAddSurfaceCommand(layer, surfaceid));
1156 response = m_ipcModule.createResponse(message);
1160 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1163 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1166 void GenericCommunicator::RemoveSurfaceFromLayer(t_ilm_message message)
1168 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1171 m_ipcModule.getUint(message, &surfaceid);
1172 m_ipcModule.getUint(message, &layerid);
1174 t_ilm_bool status = m_executor->execute(new LayerRemoveSurfaceCommand(layerid, surfaceid));
1177 response = m_ipcModule.createResponse(message);
1181 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1184 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1187 void GenericCommunicator::CreateSurfaceGroup(t_ilm_message message)
1189 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1190 uint newID = GraphicalObject::INVALID_ID;
1192 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1195 response = m_ipcModule.createResponse(message);
1196 m_ipcModule.appendUint(response, newID);
1200 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1203 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1206 void GenericCommunicator::CreateSurfaceGroupFromId(t_ilm_message message)
1208 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1209 uint newID = GraphicalObject::INVALID_ID;
1211 m_ipcModule.getUint(message, &newID);
1213 t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(&newID));
1216 response = m_ipcModule.createResponse(message);
1217 m_ipcModule.appendUint(response, newID);
1221 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1224 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1227 void GenericCommunicator::RemoveSurfaceGroup(t_ilm_message message)
1229 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1231 m_ipcModule.getUint(message, ¶m);
1233 t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(param));
1236 response = m_ipcModule.createResponse(message);
1240 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1243 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1246 void GenericCommunicator::CreateLayerGroup(t_ilm_message message)
1248 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1249 uint newID = GraphicalObject::INVALID_ID;
1251 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1254 response = m_ipcModule.createResponse(message);
1255 m_ipcModule.appendUint(response, newID);
1259 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1262 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1265 void GenericCommunicator::CreateLayerGroupFromId(t_ilm_message message)
1267 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1268 uint newID = GraphicalObject::INVALID_ID;
1270 m_ipcModule.getUint(message, &newID);
1272 t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(&newID));
1275 response = m_ipcModule.createResponse(message);
1276 m_ipcModule.appendUint(response, newID);
1280 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
1283 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1286 void GenericCommunicator::RemoveLayerGroup(t_ilm_message message)
1288 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1290 m_ipcModule.getUint(message, ¶m);
1292 t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(param));
1295 response = m_ipcModule.createResponse(message);
1299 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1302 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1305 void GenericCommunicator::SetSurfaceSourceRegion(t_ilm_message message)
1307 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1314 m_ipcModule.getUint(message, &id);
1315 m_ipcModule.getUint(message, &x);
1316 m_ipcModule.getUint(message, &y);
1317 m_ipcModule.getUint(message, &width);
1318 m_ipcModule.getUint(message, &height);
1320 t_ilm_bool status = m_executor->execute(new SurfaceSetSourceRectangleCommand(id, x, y, width, height));
1323 response = m_ipcModule.createResponse(message);
1327 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1330 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1333 void GenericCommunicator::SetLayerSourceRegion(t_ilm_message message)
1335 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1342 m_ipcModule.getUint(message, &id);
1343 m_ipcModule.getUint(message, &x);
1344 m_ipcModule.getUint(message, &y);
1345 m_ipcModule.getUint(message, &width);
1346 m_ipcModule.getUint(message, &height);
1348 t_ilm_bool status = m_executor->execute(new LayerSetSourceRectangleCommand(id, x, y, width, height));
1351 response = m_ipcModule.createResponse(message);
1355 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1358 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1361 void GenericCommunicator::SetSurfaceDestinationRegion(t_ilm_message message)
1363 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1370 m_ipcModule.getUint(message, &id);
1371 m_ipcModule.getUint(message, &x);
1372 m_ipcModule.getUint(message, &y);
1373 m_ipcModule.getUint(message, &width);
1374 m_ipcModule.getUint(message, &height);
1376 t_ilm_bool status = m_executor->execute(new SurfaceSetDestinationRectangleCommand(id, x, y, width, height));
1379 response = m_ipcModule.createResponse(message);
1383 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1386 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1389 void GenericCommunicator::SetSurfacePosition(t_ilm_message message)
1391 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1396 m_ipcModule.getUint(message, &id);
1397 m_ipcModule.getUint(message, &x);
1398 m_ipcModule.getUint(message, &y);
1400 t_ilm_bool status = m_executor->execute(new SurfaceSetPositionCommand(id, x, y));
1403 response = m_ipcModule.createResponse(message);
1407 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1410 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1413 void GenericCommunicator::GetSurfacePosition(t_ilm_message message)
1415 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1420 m_ipcModule.getUint(message, &id);
1422 t_ilm_bool status = m_executor->execute(new SurfaceGetPositionCommand(id, &x, &y));
1425 response = m_ipcModule.createResponse(message);
1426 m_ipcModule.appendUint(response, x);
1427 m_ipcModule.appendUint(response, y);
1431 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1434 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1437 void GenericCommunicator::SetSurfaceDimension(t_ilm_message message)
1439 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1444 m_ipcModule.getUint(message, &id);
1445 m_ipcModule.getUint(message, &width);
1446 m_ipcModule.getUint(message, &height);
1448 t_ilm_bool status = m_executor->execute(new SurfaceSetDimensionCommand(id, width, height));
1451 response = m_ipcModule.createResponse(message);
1455 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1458 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1461 void GenericCommunicator::SetLayerDestinationRegion(t_ilm_message message)
1463 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1470 m_ipcModule.getUint(message, &id);
1471 m_ipcModule.getUint(message, &x);
1472 m_ipcModule.getUint(message, &y);
1473 m_ipcModule.getUint(message, &width);
1474 m_ipcModule.getUint(message, &height);
1476 t_ilm_bool status = m_executor->execute(new LayerSetDestinationRectangleCommand(id, x, y, width, height));
1479 response = m_ipcModule.createResponse(message);
1483 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1486 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1489 void GenericCommunicator::SetLayerPosition(t_ilm_message message)
1491 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1496 m_ipcModule.getUint(message, &id);
1497 m_ipcModule.getUint(message, &x);
1498 m_ipcModule.getUint(message, &y);
1500 t_ilm_bool status = m_executor->execute(new LayerSetPositionCommand(id, x, y));
1503 response = m_ipcModule.createResponse(message);
1507 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1510 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1513 void GenericCommunicator::GetLayerPosition(t_ilm_message message)
1515 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1520 m_ipcModule.getUint(message, &id);
1522 t_ilm_bool status = m_executor->execute(new LayerGetPositionCommand(id, &x, &y));
1525 response = m_ipcModule.createResponse(message);
1526 m_ipcModule.appendUint(response, x);
1527 m_ipcModule.appendUint(response, y);
1531 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1534 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1537 void GenericCommunicator::SetLayerDimension(t_ilm_message message)
1539 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1544 m_ipcModule.getUint(message, &id);
1545 m_ipcModule.getUint(message, &width);
1546 m_ipcModule.getUint(message, &height);
1548 t_ilm_bool status = m_executor->execute(new LayerSetDimensionCommand(id, width, height));
1551 response = m_ipcModule.createResponse(message);
1555 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1558 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1561 void GenericCommunicator::GetLayerDimension(t_ilm_message message)
1563 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1568 m_ipcModule.getUint(message, &id);
1570 t_ilm_bool status = m_executor->execute(new LayerGetDimensionCommand(id, &width, &height));
1573 response = m_ipcModule.createResponse(message);
1574 m_ipcModule.appendUint(response, width);
1575 m_ipcModule.appendUint(response, height);
1579 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1582 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1585 void GenericCommunicator::GetSurfaceDimension(t_ilm_message message)
1587 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1592 m_ipcModule.getUint(message, &id);
1594 t_ilm_bool status = m_executor->execute(new SurfaceGetDimensionCommand(id, &width, &height));
1597 response = m_ipcModule.createResponse(message);
1598 m_ipcModule.appendUint(response, width);
1599 m_ipcModule.appendUint(response, height);
1603 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1606 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1609 void GenericCommunicator::SetSurfaceOpacity(t_ilm_message message)
1611 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1615 m_ipcModule.getUint(message, &id);
1616 m_ipcModule.getDouble(message, ¶m);
1618 t_ilm_bool status = m_executor->execute(new SurfaceSetOpacityCommand(id, param));
1621 response = m_ipcModule.createResponse(message);
1625 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1628 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1631 void GenericCommunicator::SetLayerOpacity(t_ilm_message message)
1633 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1637 m_ipcModule.getUint(message, &id);
1638 m_ipcModule.getDouble(message, ¶m);
1640 t_ilm_bool status = m_executor->execute(new LayerSetOpacityCommand(id, param));
1643 response = m_ipcModule.createResponse(message);
1647 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1650 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1653 void GenericCommunicator::SetSurfacegroupOpacity(t_ilm_message message)
1655 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1659 m_ipcModule.getUint(message, &id);
1660 m_ipcModule.getDouble(message, ¶m);
1662 t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(id, param));
1665 response = m_ipcModule.createResponse(message);
1669 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1672 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1675 void GenericCommunicator::SetLayergroupOpacity(t_ilm_message message)
1677 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1681 m_ipcModule.getUint(message, &id);
1682 m_ipcModule.getDouble(message, ¶m);
1684 t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(id, param));
1687 response = m_ipcModule.createResponse(message);
1691 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1694 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1697 void GenericCommunicator::GetSurfaceOpacity(t_ilm_message message)
1699 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1703 m_ipcModule.getUint(message, &id);
1705 t_ilm_bool status = m_executor->execute(new SurfaceGetOpacityCommand(id, ¶m));
1708 response = m_ipcModule.createResponse(message);
1709 m_ipcModule.appendDouble(response, param);
1713 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1716 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1719 void GenericCommunicator::GetLayerOpacity(t_ilm_message message)
1721 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1725 m_ipcModule.getUint(message, &id);
1727 t_ilm_bool status = m_executor->execute(new LayerGetOpacityCommand(id, ¶m));
1730 response = m_ipcModule.createResponse(message);
1731 m_ipcModule.appendDouble(response, param);
1735 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1738 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1741 void GenericCommunicator::SetSurfaceOrientation(t_ilm_message message)
1743 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1746 OrientationType o = Zero;
1748 m_ipcModule.getUint(message, &id);
1749 m_ipcModule.getUint(message, ¶m);
1751 o = (OrientationType) param;
1753 t_ilm_bool status = m_executor->execute(new SurfaceSetOrientationCommand(id, o));
1756 response = m_ipcModule.createResponse(message);
1760 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1763 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1766 void GenericCommunicator::GetSurfaceOrientation(t_ilm_message message)
1768 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1772 m_ipcModule.getUint(message, &id);
1774 t_ilm_bool status = m_executor->execute(new SurfaceGetOrientationCommand(id, &o));
1777 response = m_ipcModule.createResponse(message);
1778 m_ipcModule.appendUint(response, o);
1782 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1785 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1788 void GenericCommunicator::SetLayerOrientation(t_ilm_message message)
1790 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1793 OrientationType o = Zero;
1795 m_ipcModule.getUint(message, &id);
1796 m_ipcModule.getUint(message, ¶m);
1798 o = (OrientationType) param;
1800 t_ilm_bool status = m_executor->execute(new LayerSetOrientationCommand(id, o));
1803 response = m_ipcModule.createResponse(message);
1807 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1810 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1813 void GenericCommunicator::GetLayerOrientation(t_ilm_message message)
1815 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1819 m_ipcModule.getUint(message, &id);
1821 t_ilm_bool status = m_executor->execute(new LayerGetOrientationCommand(id, &o));
1824 response = m_ipcModule.createResponse(message);
1825 m_ipcModule.appendUint(response, o);
1829 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1832 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1835 void GenericCommunicator::GetSurfacePixelformat(t_ilm_message message)
1837 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1839 PixelFormat pixelFormat;
1841 m_ipcModule.getUint(message, &id);
1843 t_ilm_bool status = m_executor->execute(new SurfaceGetPixelformatCommand(id, &pixelFormat));
1846 response = m_ipcModule.createResponse(message);
1847 m_ipcModule.appendUint(response, pixelFormat);
1851 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1854 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1857 void GenericCommunicator::SetSurfaceVisibility(t_ilm_message message)
1859 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1861 t_ilm_bool newVis = ILM_FALSE;
1863 m_ipcModule.getUint(message, &surfaceid);
1864 m_ipcModule.getBool(message, &newVis);
1866 t_ilm_bool status = m_executor->execute(new SurfaceSetVisibilityCommand(surfaceid, newVis));
1869 response = m_ipcModule.createResponse(message);
1873 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1876 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1879 void GenericCommunicator::SetLayerVisibility(t_ilm_message message)
1881 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1883 t_ilm_bool myparam = ILM_FALSE;
1885 m_ipcModule.getUint(message, &layerid);
1886 m_ipcModule.getBool(message, &myparam);
1888 t_ilm_bool status = m_executor->execute(new LayerSetVisibilityCommand(layerid, myparam));
1891 response = m_ipcModule.createResponse(message);
1895 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1898 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1901 void GenericCommunicator::GetSurfaceVisibility(t_ilm_message message)
1903 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1907 m_ipcModule.getUint(message, &id);
1909 t_ilm_bool status = m_executor->execute(new SurfaceGetVisibilityCommand(id, &visibility));
1912 response = m_ipcModule.createResponse(message);
1913 m_ipcModule.appendBool(response, visibility);
1917 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1920 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1923 void GenericCommunicator::GetLayerVisibility(t_ilm_message message)
1925 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1929 m_ipcModule.getUint(message, &id);
1931 t_ilm_bool status = m_executor->execute(new LayerGetVisibilityCommand(id, &visibility));
1934 response = m_ipcModule.createResponse(message);
1935 m_ipcModule.appendBool(response, visibility);
1939 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1942 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1945 void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
1947 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1949 t_ilm_bool myparam = ILM_FALSE;
1951 m_ipcModule.getUint(message, &groupid);
1952 m_ipcModule.getBool(message, &myparam);
1954 t_ilm_bool status = m_executor->execute(new SurfacegroupSetVisibilityCommand(groupid, myparam));
1957 response = m_ipcModule.createResponse(message);
1961 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1964 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1967 void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
1969 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1971 t_ilm_bool myparam = ILM_FALSE;
1973 m_ipcModule.getUint(message, &groupid);
1974 m_ipcModule.getBool(message, &myparam);
1976 t_ilm_bool status = m_executor->execute(new LayergroupSetVisibilityCommand(groupid, myparam));
1979 response = m_ipcModule.createResponse(message);
1983 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
1986 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
1990 void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message)
1992 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
1996 m_ipcModule.getUintArray(message, &array, &length);
1998 t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(array, length));
2001 response = m_ipcModule.createResponse(message);
2005 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2008 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2011 void GenericCommunicator::SetSurfaceRenderOrderWithinLayer(t_ilm_message message)
2013 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2018 m_ipcModule.getUint(message, &layerid);
2019 m_ipcModule.getUintArray(message, &array, &length);
2021 t_ilm_bool status = m_executor->execute(new LayerSetRenderOrderCommand(layerid, array, length));
2024 response = m_ipcModule.createResponse(message);
2028 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2031 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2034 void GenericCommunicator::GetLayerType(t_ilm_message message)
2036 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2038 m_ipcModule.getUint(message, &id);
2040 Layer* layer = m_executor->getScene()->getLayer(id);
2043 response = m_ipcModule.createResponse(message);
2044 m_ipcModule.appendUint(response, layer->getLayerType());
2048 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2051 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2054 void GenericCommunicator::GetLayertypeCapabilities(t_ilm_message message)
2056 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2058 LayerType type = Unknown;
2060 m_ipcModule.getUint(message, &id);
2062 type = (LayerType) id;
2064 uint capabilities = m_executor->getLayerTypeCapabilities(type);
2065 response = m_ipcModule.createResponse(message);
2066 m_ipcModule.appendUint(response, capabilities);
2067 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2070 void GenericCommunicator::GetLayerCapabilities(t_ilm_message message)
2072 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2074 m_ipcModule.getUint(message, &id);
2076 Layer* layer = m_executor->getScene()->getLayer(id);
2079 response = m_ipcModule.createResponse(message);
2080 m_ipcModule.appendUint(response, layer->getCapabilities());
2084 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2087 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2090 void GenericCommunicator::FadeIn(t_ilm_message message)
2092 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2093 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2094 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2097 void GenericCommunicator::SynchronizedFade(t_ilm_message message)
2099 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2100 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2101 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2104 void GenericCommunicator::FadeOut(t_ilm_message message)
2106 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2107 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, NOT_IMPLEMENTED);
2108 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2111 void GenericCommunicator::Exit(t_ilm_message message)
2113 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2114 t_ilm_bool status = m_executor->execute(new ExitCommand());
2117 response = m_ipcModule.createResponse(message);
2121 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
2124 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2127 void GenericCommunicator::CommitChanges(t_ilm_message message)
2129 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2130 t_ilm_bool status = m_executor->execute(new CommitCommand());
2133 response = m_ipcModule.createResponse(message);
2137 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
2140 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2143 void GenericCommunicator::CreateShader(t_ilm_message message)
2145 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2146 char vertname[1024];
2147 char fragname[1024];
2150 m_ipcModule.getString(message, vertname);
2151 m_ipcModule.getString(message, fragname);
2153 t_ilm_bool status = m_executor->execute(new ShaderCreateCommand(vertname, fragname, &id));
2156 response = m_ipcModule.createResponse(message);
2157 m_ipcModule.appendUint(response, id);
2161 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2164 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2167 void GenericCommunicator::DestroyShader(t_ilm_message message)
2169 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2172 m_ipcModule.getUint(message, &shaderid);
2174 t_ilm_bool status = m_executor->execute(new ShaderDestroyCommand(shaderid));
2177 response = m_ipcModule.createResponse(message);
2181 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2184 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2187 void GenericCommunicator::SetShader(t_ilm_message message)
2189 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2193 m_ipcModule.getUint(message, &surfaceId);
2194 m_ipcModule.getUint(message, &shaderid);
2196 t_ilm_bool status = m_executor->execute(new SurfaceSetShaderCommand(surfaceId, shaderid));
2199 response = m_ipcModule.createResponse(message);
2203 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2206 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2209 void GenericCommunicator::SetUniforms(t_ilm_message message)
2211 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2213 std::vector<string> uniforms;
2215 m_ipcModule.getUint(message, &id);
2218 //m_ipcModule.getStringArray(&uniforms);
2220 t_ilm_bool status = m_executor->execute(new ShaderSetUniformsCommand(id, uniforms));
2223 response = m_ipcModule.createResponse(message);
2227 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2230 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2233 void GenericCommunicator::SetKeyboardFocusOn(t_ilm_message message)
2235 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2236 t_ilm_message response;
2239 m_ipcModule.getUint(message, &surfaceId);
2241 t_ilm_bool status = m_executor->execute(new SurfaceSetKeyboardFocusCommand(surfaceId));
2244 response = m_ipcModule.createResponse(message);
2248 response = m_ipcModule.createErrorResponse(message);
2249 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2252 m_ipcModule.sendToClients(response, &clientHandle, 1);
2253 m_ipcModule.destroyMessage(response);
2257 void GenericCommunicator::GetKeyboardFocusSurfaceId(t_ilm_message message)
2259 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2262 t_ilm_bool status = m_executor->execute(new SurfaceGetKeyboardFocusCommand(&surfaceId));
2265 response = m_ipcModule.createResponse(message);
2266 m_ipcModule.appendUint(response, surfaceId);
2270 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2273 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2277 void GenericCommunicator::UpdateInputEventAcceptanceOn(t_ilm_message message)
2279 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2280 t_ilm_message response;
2283 InputDevice devices;
2286 m_ipcModule.getUint(message, &surfaceId);
2287 m_ipcModule.getUint(message, &udevices);
2288 m_ipcModule.getBool(message, &accept);
2290 devices = (InputDevice) udevices;
2292 t_ilm_bool status = m_executor->execute(new SurfaceUpdateInputEventAcceptance(surfaceId, devices, accept));
2295 response = m_ipcModule.createResponse(message);
2299 response = m_ipcModule.createErrorResponse(message);
2300 m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2303 m_ipcModule.sendToClients(response, &clientHandle, 1);
2304 m_ipcModule.destroyMessage(response);
2307 void GenericCommunicator::SetSurfaceChromaKey(t_ilm_message message)
2309 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2314 m_ipcModule.getUint(message, &surfaceid);
2315 m_ipcModule.getUintArray(message, &array, &length);
2317 t_ilm_bool status = m_executor->execute(new SurfaceSetChromaKeyCommand(surfaceid, array, length));
2320 response = m_ipcModule.createResponse(message);
2324 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2327 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2330 void GenericCommunicator::SetLayerChromaKey(t_ilm_message message)
2332 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2337 m_ipcModule.getUint(message, &layerid);
2338 m_ipcModule.getUintArray(message, &array, &length);
2340 t_ilm_bool status = m_executor->execute(new LayerSetChromaKeyCommand(layerid, array, length));
2343 response = m_ipcModule.createResponse(message);
2347 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
2350 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2353 void GenericCommunicator::LayerAddNotification(t_ilm_message message)
2355 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2358 m_ipcModule.getUint(message, &layerid);
2360 Layer* layer = m_executor->getScene()->getLayer(layerid);
2363 layer->addNotification(clientHandle);
2364 response = m_ipcModule.createResponse(message);
2368 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
2371 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2374 void GenericCommunicator::SurfaceAddNotification(t_ilm_message message)
2376 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2379 m_ipcModule.getUint(message, &surfaceid);
2381 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2384 surface->addNotification(clientHandle);
2385 response = m_ipcModule.createResponse(message);
2389 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
2392 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2395 void GenericCommunicator::LayerRemoveNotification(t_ilm_message message)
2397 t_ilm_message response; t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2400 m_ipcModule.getUint(message, &layerid);
2402 Layer* layer = m_executor->getScene()->getLayer(layerid);
2405 layer->removeNotification(clientHandle);
2406 response = m_ipcModule.createResponse(message);
2410 response = m_ipcModule.createErrorResponse(message); m_ipcModule.appendString(response, INVALID_ARGUMENT);
2413 m_ipcModule.sendToClients(response, &clientHandle, 1); m_ipcModule.destroyMessage(response);
2416 void GenericCommunicator::SurfaceRemoveNotification(t_ilm_message message)
2418 t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
2419 t_ilm_message response;
2422 m_ipcModule.getUint(message, &surfaceid);
2424 Surface* surface = m_executor->getScene()->getSurface(surfaceid);
2427 surface->removeNotification(clientHandle);
2428 response = m_ipcModule.createResponse(message);
2432 response = m_ipcModule.createErrorResponse(message);
2433 m_ipcModule.appendString(response, INVALID_ARGUMENT);
2436 m_ipcModule.sendToClients(response, &clientHandle, 1);
2437 m_ipcModule.destroyMessage(response);
2440 void GenericCommunicator::processNotificationQueue()
2442 NotificationQueue& notificationQueue = m_executor->getClientNotificationQueue();
2443 NotificationQueue::iterator iter = notificationQueue.begin();
2444 NotificationQueue::iterator end = notificationQueue.end();
2446 for (; iter != end; ++iter)
2448 GraphicalObject* object = iter->first;
2449 t_ilm_notification_mask mask = iter->second;
2450 sendNotification(object, mask);
2452 notificationQueue.clear();
2455 void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notification_mask mask)
2457 switch (object->type)
2461 Layer* layer = static_cast<Layer*>(object);
2464 ApplicationReferenceList& arl = layer->getNotificationClients();
2468 t_ilm_message notification;
2469 Rectangle dest = layer->getDestinationRegion();
2470 Rectangle src = layer->getSourceRegion();
2471 OrientationType orientation = layer->getOrientation();
2473 unsigned char chromaKeyRed = 0;
2474 unsigned char chromaKeyGreen = 0;
2475 unsigned char chromaKeyBlue = 0;
2476 layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2478 std::stringstream notificationName;
2479 notificationName << "NotificationForLayer" << layer->getID();
2481 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2482 m_ipcModule.appendUint(notification, layer->getID());
2483 m_ipcModule.appendUint(notification, mask);
2485 m_ipcModule.appendDouble(notification, layer->getOpacity());
2486 m_ipcModule.appendUint(notification, src.x);
2487 m_ipcModule.appendUint(notification, src.y);
2488 m_ipcModule.appendUint(notification, src.width);
2489 m_ipcModule.appendUint(notification, src.height);
2490 m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
2491 m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
2492 m_ipcModule.appendUint(notification, dest.x);
2493 m_ipcModule.appendUint(notification, dest.y);
2494 m_ipcModule.appendUint(notification, dest.width);
2495 m_ipcModule.appendUint(notification, dest.height);
2496 m_ipcModule.appendUint(notification, orientation);
2497 m_ipcModule.appendBool(notification, layer->getVisibility());
2498 m_ipcModule.appendUint(notification, layer->getLayerType());
2499 m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
2500 m_ipcModule.appendUint(notification, chromaKeyRed);
2501 m_ipcModule.appendUint(notification, chromaKeyGreen);
2502 m_ipcModule.appendUint(notification, chromaKeyBlue);
2504 int clientCount = arl.size();
2505 t_ilm_client_handle clients[clientCount];
2507 ApplicationReferenceList::iterator iter = arl.begin();
2508 ApplicationReferenceList::iterator end = arl.end();
2510 for (int clientNumber = 0; iter != end; ++iter, ++clientNumber)
2512 clients[clientNumber] = *iter;
2515 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
2517 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2519 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2522 m_ipcModule.destroyMessage(notification);
2529 Surface* surface = static_cast<Surface*>(object);
2532 ApplicationReferenceList& arl = surface->getNotificationClients();
2536 t_ilm_message notification;
2537 std::stringstream notificationName;
2538 notificationName << "NotificationForSurface" << surface->getID();
2540 unsigned char chromaKeyRed = 0;
2541 unsigned char chromaKeyGreen = 0;
2542 unsigned char chromaKeyBlue = 0;
2543 surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
2545 notification = m_ipcModule.createNotification(notificationName.str().c_str());
2546 m_ipcModule.appendUint(notification, surface->getID());
2547 m_ipcModule.appendUint(notification, mask);
2549 m_ipcModule.appendDouble(notification, surface->getOpacity());
2550 m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
2551 m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
2552 m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
2553 m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
2554 m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
2555 m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
2556 m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
2557 m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
2558 m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
2559 m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
2560 m_ipcModule.appendUint(notification, surface->getOrientation());
2561 m_ipcModule.appendBool(notification, surface->getVisibility());
2562 m_ipcModule.appendUint(notification, surface->frameCounter);
2563 m_ipcModule.appendUint(notification, surface->drawCounter);
2564 m_ipcModule.appendUint(notification, surface->updateCounter);
2565 m_ipcModule.appendUint(notification, surface->getPixelFormat());
2566 m_ipcModule.appendUint(notification, surface->getNativeContent());
2567 m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
2568 m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
2569 m_ipcModule.appendUint(notification, chromaKeyRed);
2570 m_ipcModule.appendUint(notification, chromaKeyGreen);
2571 m_ipcModule.appendUint(notification, chromaKeyBlue);
2573 int clientCount = arl.size();
2574 t_ilm_client_handle clients[clientCount];
2576 ApplicationReferenceList::iterator iter = arl.begin();
2577 ApplicationReferenceList::iterator end = arl.end();
2579 for (int clientNumber = 0; iter != end; ++iter, ++clientNumber)
2581 clients[clientNumber] = *iter;
2584 LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
2586 if (!m_ipcModule.sendToClients(notification, clients, clientCount))
2588 LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
2591 m_ipcModule.destroyMessage(notification);
2597 LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
2602 extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
2604 return new GenericCommunicator(executor);
2607 extern "C" void destroyGenericCommunicator(GenericCommunicator* p)