1 /**************************************************************************
3 * Copyright 2012 BMW Car IT GmbH
4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
5 * Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
20 #include "ilm_client.h"
21 #include "ilm_types.h"
22 #include "IpcModuleLoader.h"
23 #include "ObjectType.h"
34 //=============================================================================
36 //=============================================================================
37 const int gReceiveTimeout = -1; // in ms, negative value for infinite
38 const int gResponseTimeout = 500; // in ms
40 // must be same as GraphicalObject::INVALID_ID, but this is defined in C++
41 // and can not be used here
42 #define INVALID_ID 0xFFFFFFFF
44 // queue names for incoming notifications and messages
45 #define NOTIFICATION_QUEUE_NAME "/ilmClient%dNotification"
46 #define INCOMING_QUEUE_NAME "/ilmClient%dIncoming"
48 //=============================================================================
50 //=============================================================================
51 extern char *__progname; // automatically gets assigned argv[0]
53 static struct IpcModule gIpcModule;
55 static pthread_t gReceiveThread;
56 static pthread_mutex_t gSendReceiveLock;
57 static pthread_t gNotificationThread;
59 static mqd_t incomingMqRead;
60 static mqd_t incomingMqWrite;
62 static mqd_t notificationMqRead;
63 static mqd_t notificationMqWrite;
65 static t_ilm_bool gInitialized = ILM_FALSE;
67 //=============================================================================
68 // notification management
69 //=============================================================================
70 #define MAX_CALLBACK_COUNT 64
74 layerNotificationFunc callback;
75 } static gLayerNotificationCallbacks[MAX_CALLBACK_COUNT];
80 surfaceNotificationFunc callback;
81 } static gSurfaceNotificationCallbacks[MAX_CALLBACK_COUNT];
83 void initNotificationCallbacks()
86 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
88 gLayerNotificationCallbacks[i].id = INVALID_ID;
89 gLayerNotificationCallbacks[i].callback = NULL;
90 gSurfaceNotificationCallbacks[i].id = INVALID_ID;
91 gSurfaceNotificationCallbacks[i].callback = NULL;
95 layerNotificationFunc getLayerNotificationCallback(t_ilm_layer layer)
98 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
100 if (gLayerNotificationCallbacks[i].id == layer)
102 return gLayerNotificationCallbacks[i].callback;
108 surfaceNotificationFunc getSurfaceNotificationCallback(t_ilm_surface surface)
111 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
113 if (gSurfaceNotificationCallbacks[i].id == surface)
115 return gSurfaceNotificationCallbacks[i].callback;
121 t_ilm_bool findLayerCallback(t_ilm_layer layer)
125 // try to overwrite existing entry for layer id
126 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
128 if (gLayerNotificationCallbacks[i].id == layer)
136 t_ilm_bool addLayerCallback(t_ilm_layer layer, layerNotificationFunc func)
140 if (findLayerCallback(layer))
145 // find free slot and store callback
146 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
148 if (gLayerNotificationCallbacks[i].id == INVALID_ID)
150 gLayerNotificationCallbacks[i].id = layer;
151 gLayerNotificationCallbacks[i].callback = func;
155 printf("DbusIpcModule: addLayerCallback() failed. no free slots.");
159 t_ilm_bool findSurfaceCallback(t_ilm_surface surface)
163 // try to overwrite existing entry for layer id
164 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
166 if (gSurfaceNotificationCallbacks[i].id == surface)
174 t_ilm_bool addSurfaceCallback(t_ilm_surface surface, surfaceNotificationFunc func)
178 if (findSurfaceCallback(surface))
183 // find free slot and store callback
184 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
186 if (gSurfaceNotificationCallbacks[i].id == INVALID_ID)
188 gSurfaceNotificationCallbacks[i].id = surface;
189 gSurfaceNotificationCallbacks[i].callback = func;
193 printf("DbusIpcModule: addSurfaceCallback() failed. no free slots.");
197 void removeLayerCallback(t_ilm_layer layer)
200 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
202 if (gLayerNotificationCallbacks[i].id == layer)
204 gLayerNotificationCallbacks[i].id = INVALID_ID;
205 gLayerNotificationCallbacks[i].callback = NULL;
211 void removeSurfaceCallback(t_ilm_surface layer)
214 for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
216 if (gSurfaceNotificationCallbacks[i].id == layer)
218 gSurfaceNotificationCallbacks[i].id = INVALID_ID;
219 gSurfaceNotificationCallbacks[i].callback = NULL;
225 //=============================================================================
226 // handling of internal notification thread for dispatching notifications
227 // Note: notification callbacks may be blocked by client, but receive thread
228 // must not be blocked
229 //=============================================================================
230 void* notificationThreadLoop(void* param)
232 t_ilm_message notification;
234 while (-1 != mq_receive(notificationMqRead, (char*)¬ification, sizeof(notification), NULL))
236 t_ilm_const_string name = gIpcModule.getMessageName(notification);
238 // this depends on message name, but it is fast
243 struct ilmLayerProperties properties;
245 gIpcModule.getUint(notification, &id);
246 gIpcModule.getUint(notification, &mask);
247 gIpcModule.getDouble(notification, &properties.opacity);
248 gIpcModule.getUint(notification, &properties.sourceX);
249 gIpcModule.getUint(notification, &properties.sourceY);
250 gIpcModule.getUint(notification, &properties.sourceWidth);
251 gIpcModule.getUint(notification, &properties.sourceHeight);
252 gIpcModule.getUint(notification, &properties.origSourceWidth);
253 gIpcModule.getUint(notification, &properties.origSourceHeight);
254 gIpcModule.getUint(notification, &properties.destX);
255 gIpcModule.getUint(notification, &properties.destY);
256 gIpcModule.getUint(notification, &properties.destWidth);
257 gIpcModule.getUint(notification, &properties.destHeight);
258 gIpcModule.getUint(notification, &properties.orientation);
259 gIpcModule.getBool(notification, &properties.visibility);
260 gIpcModule.getUint(notification, &properties.type);
261 gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
262 gIpcModule.getUint(notification, &properties.chromaKeyRed);
263 gIpcModule.getUint(notification, &properties.chromaKeyGreen);
264 gIpcModule.getUint(notification, &properties.chromaKeyBlue);
265 gIpcModule.getInt(notification, &properties.creatorPid);
267 layerNotificationFunc func = getLayerNotificationCallback(id);
270 (*func)(id, &properties, mask);
274 fprintf(stderr, "notification for layer %d received, but no callback set\n", id);
282 struct ilmSurfaceProperties properties;
284 gIpcModule.getUint(notification, &id);
285 gIpcModule.getUint(notification, &mask);
286 gIpcModule.getDouble(notification, &properties.opacity);
287 gIpcModule.getUint(notification, &properties.sourceX);
288 gIpcModule.getUint(notification, &properties.sourceY);
289 gIpcModule.getUint(notification, &properties.sourceWidth);
290 gIpcModule.getUint(notification, &properties.sourceHeight);
291 gIpcModule.getUint(notification, &properties.origSourceWidth);
292 gIpcModule.getUint(notification, &properties.origSourceHeight);
293 gIpcModule.getUint(notification, &properties.destX);
294 gIpcModule.getUint(notification, &properties.destY);
295 gIpcModule.getUint(notification, &properties.destWidth);
296 gIpcModule.getUint(notification, &properties.destHeight);
297 gIpcModule.getUint(notification, &properties.orientation);
298 gIpcModule.getBool(notification, &properties.visibility);
299 gIpcModule.getUint(notification, &properties.frameCounter);
300 gIpcModule.getUint(notification, &properties.drawCounter);
301 gIpcModule.getUint(notification, &properties.updateCounter);
302 gIpcModule.getUint(notification, &properties.pixelformat);
303 gIpcModule.getUint(notification, &properties.nativeSurface);
304 gIpcModule.getUint(notification, &properties.inputDevicesAcceptance);
305 gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
306 gIpcModule.getUint(notification, &properties.chromaKeyRed);
307 gIpcModule.getUint(notification, &properties.chromaKeyGreen);
308 gIpcModule.getUint(notification, &properties.chromaKeyBlue);
309 gIpcModule.getInt(notification, &properties.creatorPid);
311 surfaceNotificationFunc func = getSurfaceNotificationCallback(id);
314 (*func)(id, &properties, mask);
318 fprintf(stderr, "notification for surface %d received, but no callback set\n", id);
321 gIpcModule.destroyMessage(notification);
326 //=============================================================================
327 // handling of internal receive thread for event handling
328 //=============================================================================
329 void* receiveThreadLoop(void* param)
331 t_ilm_bool running = ILM_TRUE;
332 t_ilm_bool waitForMessageRelease = ILM_FALSE;
336 t_ilm_message message = gIpcModule.receive(gReceiveTimeout);
337 t_ilm_message_type messageType = gIpcModule.getMessageType(message);
340 case IpcMessageTypeNotification:
341 if (-1 == mq_send(notificationMqWrite, (char*)&message, sizeof(message), 0))
345 printf("Notification queue full, dropped notification %s\n", gIpcModule.getMessageName(message));
350 case IpcMessageTypeCommand:
351 case IpcMessageTypeError:
352 if (-1 == mq_send(incomingMqWrite, (char*)&message, sizeof(message), 0))
356 printf("Incoming queue full, dropped message %s\n", gIpcModule.getMessageName(message));
361 case IpcMessageTypeNone:
365 printf("ilmClient: discarded unexpected message (type: %d)\n", (int)messageType);
366 gIpcModule.destroyMessage(message);
374 void calculateTimeout(struct timeval* currentTime, int giventimeout, struct timespec* timeout)
376 // nanoseconds is old value in nanoseconds + the given milliseconds as nanoseconds
377 t_ilm_ulong newNanoSeconds = currentTime->tv_usec * 1000 + giventimeout * (1000 * 1000);
379 // only use non full seconds, otherwise overflow!
380 timeout->tv_nsec = newNanoSeconds % (1000000000);
382 // new seconds are old seconds + full seconds from new nanoseconds part
383 timeout->tv_sec = currentTime->tv_sec + (newNanoSeconds / 1000000000 );
386 t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response, int timeoutInMs)
389 t_ilm_message_type responseType = IpcMessageTypeNone;
391 // send / receive may only be performed by one thread at a time
392 pthread_mutex_lock(&gSendReceiveLock);
394 if (gIpcModule.sendToService(command))
396 if (-1 == mq_receive(incomingMqRead, (char*)response, sizeof(t_ilm_message), NULL))
398 fprintf(stderr,"waitForResponse: mq_receive failed, errno = %d\n", errno);
402 responseType = gIpcModule.getMessageType(*response);
405 pthread_mutex_unlock(&gSendReceiveLock);
407 return (*response && (IpcMessageTypeCommand == responseType));
410 //=============================================================================
412 //=============================================================================
413 ilmErrorTypes ilm_init()
415 ilmErrorTypes result = ILM_FAILED;
419 printf("ilm_init() was called, but ilmClientLib is already initialized. returning success, but initialization was skipped this time.\n");
423 initNotificationCallbacks();
425 if (loadIpcModule(&gIpcModule))
429 if (gIpcModule.initClientMode())
431 result = ILM_SUCCESS;
433 struct mq_attr mqAttr =
436 .mq_msgsize = sizeof(t_ilm_message),
437 .mq_flags = 0, //O_NONBLOCK,
442 snprintf(mqName, sizeof(mqName), NOTIFICATION_QUEUE_NAME, getpid());
444 notificationMqWrite = mq_open(mqName, O_WRONLY | O_CREAT, 0600, &mqAttr);
445 notificationMqRead = mq_open(mqName, O_RDONLY);
446 mq_unlink(mqName); // is destroyed on closed filedescriptor
448 snprintf(mqName, sizeof(mqName), INCOMING_QUEUE_NAME, getpid());
449 incomingMqWrite = mq_open(mqName, O_WRONLY | O_CREAT, 0600, &mqAttr);
450 incomingMqRead = mq_open(mqName, O_RDONLY);
451 mq_unlink(mqName); // is destroyed on closed filedescriptor
453 if ((mqd_t)-1 == notificationMqRead || (mqd_t)-1 == notificationMqWrite)
455 printf("mq_open failed, errno = %d\n", errno);
459 pthread_mutex_init(&gSendReceiveLock, NULL);
461 pthread_attr_t notificationThreadAttributes;
462 pthread_attr_init(¬ificationThreadAttributes);
463 pthread_attr_setdetachstate(¬ificationThreadAttributes,
464 PTHREAD_CREATE_JOINABLE);
466 int ret = pthread_create(&gReceiveThread,
467 ¬ificationThreadAttributes,
473 printf("Failed to start internal receive thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
477 ret = pthread_create(&gNotificationThread,
478 ¬ificationThreadAttributes,
479 notificationThreadLoop,
484 printf("Failed to start internal notification thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
491 printf("Failed to initialize Client Ipc Module");
495 t_ilm_message response = 0;
496 t_ilm_message command = gIpcModule.createMessage("ServiceConnect");
498 && gIpcModule.appendUint(command, pid)
499 && gIpcModule.appendString(command, __progname)
500 && sendAndWaitForResponse(command, &response, gResponseTimeout))
502 result = ILM_SUCCESS;
507 printf("Failed to connect to LayerManagerService.");
509 gIpcModule.destroyMessage(response);
510 gIpcModule.destroyMessage(command);
513 gInitialized = (result == ILM_SUCCESS) ? ILM_TRUE : ILM_FALSE;
518 ilmErrorTypes ilm_destroy()
520 ilmErrorTypes result = ILM_FAILED;
522 t_ilm_message response = 0;
523 t_ilm_message command = gIpcModule.createMessage("ServiceDisconnect");
525 && gIpcModule.appendUint(command, getpid())
526 && sendAndWaitForResponse(command, &response, gResponseTimeout))
528 result = ILM_SUCCESS;
530 gIpcModule.destroyMessage(response);
531 gIpcModule.destroyMessage(command);
533 // cancel worker threads
534 void* threadReturnValue = NULL;
536 pthread_cancel(gReceiveThread);
537 pthread_cancel(gNotificationThread);
539 pthread_join(gReceiveThread, &threadReturnValue);
540 pthread_join(gNotificationThread, &threadReturnValue);
542 pthread_mutex_unlock(&gSendReceiveLock);
544 pthread_mutex_destroy(&gSendReceiveLock);
546 gIpcModule.destroy();
548 mq_close(notificationMqRead);
549 mq_close(notificationMqWrite);
551 mq_close(incomingMqRead);
552 mq_close(incomingMqWrite);
554 gInitialized = ILM_FALSE;
559 ilmErrorTypes ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, struct ilmSurfaceProperties* pSurfaceProperties)
561 ilmErrorTypes returnValue = ILM_FAILED;
563 t_ilm_message response = 0;
564 t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfSurface");
566 if (pSurfaceProperties
568 && gIpcModule.appendUint(command, surfaceID)
569 && sendAndWaitForResponse(command, &response, gResponseTimeout)
570 && gIpcModule.getDouble(response, &pSurfaceProperties->opacity)
571 && gIpcModule.getUint(response, &pSurfaceProperties->sourceX)
572 && gIpcModule.getUint(response, &pSurfaceProperties->sourceY)
573 && gIpcModule.getUint(response, &pSurfaceProperties->sourceWidth)
574 && gIpcModule.getUint(response, &pSurfaceProperties->sourceHeight)
575 && gIpcModule.getUint(response, &pSurfaceProperties->origSourceWidth)
576 && gIpcModule.getUint(response, &pSurfaceProperties->origSourceHeight)
577 && gIpcModule.getUint(response, &pSurfaceProperties->destX)
578 && gIpcModule.getUint(response, &pSurfaceProperties->destY)
579 && gIpcModule.getUint(response, &pSurfaceProperties->destWidth)
580 && gIpcModule.getUint(response, &pSurfaceProperties->destHeight)
581 && gIpcModule.getUint(response, &pSurfaceProperties->orientation)
582 && gIpcModule.getBool(response, &pSurfaceProperties->visibility)
583 && gIpcModule.getUint(response, &pSurfaceProperties->frameCounter)
584 && gIpcModule.getUint(response, &pSurfaceProperties->drawCounter)
585 && gIpcModule.getUint(response, &pSurfaceProperties->updateCounter)
586 && gIpcModule.getUint(response, &pSurfaceProperties->pixelformat)
587 && gIpcModule.getUint(response, &pSurfaceProperties->nativeSurface)
588 && gIpcModule.getUint(response, &pSurfaceProperties->inputDevicesAcceptance)
589 && gIpcModule.getBool(response, &pSurfaceProperties->chromaKeyEnabled)
590 && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyRed)
591 && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyGreen)
592 && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyBlue)
593 && gIpcModule.getInt(response, &pSurfaceProperties->creatorPid))
595 returnValue = ILM_SUCCESS;
597 gIpcModule.destroyMessage(response);
598 gIpcModule.destroyMessage(command);
602 ilmErrorTypes ilm_getPropertiesOfLayer(t_ilm_uint layerID, struct ilmLayerProperties* pLayerProperties)
604 ilmErrorTypes returnValue = ILM_FAILED;
606 t_ilm_message response = 0;
607 t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfLayer");
610 && gIpcModule.appendUint(command, layerID)
611 && sendAndWaitForResponse(command, &response, gResponseTimeout)
612 && gIpcModule.getDouble(response, &pLayerProperties->opacity)
613 && gIpcModule.getUint(response, &pLayerProperties->sourceX)
614 && gIpcModule.getUint(response, &pLayerProperties->sourceY)
615 && gIpcModule.getUint(response, &pLayerProperties->sourceWidth)
616 && gIpcModule.getUint(response, &pLayerProperties->sourceHeight)
617 && gIpcModule.getUint(response, &pLayerProperties->origSourceWidth)
618 && gIpcModule.getUint(response, &pLayerProperties->origSourceHeight)
619 && gIpcModule.getUint(response, &pLayerProperties->destX)
620 && gIpcModule.getUint(response, &pLayerProperties->destY)
621 && gIpcModule.getUint(response, &pLayerProperties->destWidth)
622 && gIpcModule.getUint(response, &pLayerProperties->destHeight)
623 && gIpcModule.getUint(response, &pLayerProperties->orientation)
624 && gIpcModule.getBool(response, &pLayerProperties->visibility)
625 && gIpcModule.getUint(response, &pLayerProperties->type)
626 && gIpcModule.getBool(response, &pLayerProperties->chromaKeyEnabled)
627 && gIpcModule.getUint(response, &pLayerProperties->chromaKeyRed)
628 && gIpcModule.getUint(response, &pLayerProperties->chromaKeyGreen)
629 && gIpcModule.getUint(response, &pLayerProperties->chromaKeyBlue)
630 && gIpcModule.getInt(response, &pLayerProperties->creatorPid))
632 returnValue = ILM_SUCCESS;
634 gIpcModule.destroyMessage(response);
635 gIpcModule.destroyMessage(command);
639 ilmErrorTypes ilm_getNumberOfHardwareLayers(t_ilm_uint screenID, t_ilm_uint* pNumberOfHardwareLayers)
641 ilmErrorTypes returnValue = ILM_FAILED;
643 t_ilm_message response = 0;
644 t_ilm_message command = gIpcModule.createMessage("GetNumberOfHardwareLayers");
645 if (pNumberOfHardwareLayers
647 && gIpcModule.appendUint(command, screenID)
648 && sendAndWaitForResponse(command, &response, gResponseTimeout)
649 && gIpcModule.getUint(response, pNumberOfHardwareLayers))
651 returnValue = ILM_SUCCESS;
653 gIpcModule.destroyMessage(response);
654 gIpcModule.destroyMessage(command);
658 ilmErrorTypes ilm_getScreenResolution(t_ilm_uint screenID, t_ilm_uint* pWidth, t_ilm_uint* pHeight)
660 ilmErrorTypes returnValue = ILM_FAILED;
662 t_ilm_message response = 0;
663 t_ilm_message command = gIpcModule.createMessage("GetScreenResolution");
664 if (pWidth && pHeight
666 && gIpcModule.appendUint(command, screenID)
667 && sendAndWaitForResponse(command, &response, gResponseTimeout)
668 && gIpcModule.getUint(response, pWidth)
669 && gIpcModule.getUint(response, pHeight))
671 returnValue = ILM_SUCCESS;
673 gIpcModule.destroyMessage(response);
674 gIpcModule.destroyMessage(command);
678 ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength, t_ilm_layer** ppArray)
680 ilmErrorTypes returnValue = ILM_FAILED;
682 t_ilm_message response = 0;
683 t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDS");
684 if (pLength && ppArray
686 && sendAndWaitForResponse(command, &response, gResponseTimeout)
687 && gIpcModule.getUintArray(response, ppArray, pLength))
689 returnValue = ILM_SUCCESS;
691 gIpcModule.destroyMessage(response);
692 gIpcModule.destroyMessage(command);
696 ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenId, t_ilm_int* pLength, t_ilm_layer** ppArray)
698 ilmErrorTypes returnValue = ILM_FAILED;
700 t_ilm_message response = 0;
701 t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDsOnScreen");
702 if (pLength && ppArray
704 && gIpcModule.appendUint(command, screenId)
705 && sendAndWaitForResponse(command, &response, gResponseTimeout)
706 && gIpcModule.getUintArray(response, ppArray, pLength))
708 returnValue = ILM_SUCCESS;
710 gIpcModule.destroyMessage(response);
711 gIpcModule.destroyMessage(command);
715 ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength, t_ilm_surface** ppArray)
717 ilmErrorTypes returnValue = ILM_FAILED;
719 t_ilm_message response = 0;
720 t_ilm_message command = gIpcModule.createMessage("ListAllSurfaceIDS");
721 if (pLength && ppArray
723 && sendAndWaitForResponse(command, &response, gResponseTimeout)
724 && gIpcModule.getUintArray(response, ppArray, pLength))
726 returnValue = ILM_SUCCESS;
728 gIpcModule.destroyMessage(response);
729 gIpcModule.destroyMessage(command);
733 ilmErrorTypes ilm_getLayerGroupIDs(t_ilm_int* pLength, t_ilm_layergroup** ppArray)
735 ilmErrorTypes returnValue = ILM_FAILED;
737 t_ilm_message response = 0;
738 t_ilm_message command = gIpcModule.createMessage("ListAllLayerGroupIDS");
739 if (pLength && ppArray
741 && sendAndWaitForResponse(command, &response, gResponseTimeout)
742 && gIpcModule.getUintArray(response, ppArray, pLength))
744 returnValue = ILM_SUCCESS;
746 gIpcModule.destroyMessage(response);
747 gIpcModule.destroyMessage(command);
751 ilmErrorTypes ilm_getSurfaceGroupIDs(t_ilm_int* pLength, t_ilm_surfacegroup** ppArray)
753 ilmErrorTypes returnValue = ILM_FAILED;
755 t_ilm_message response = 0;
756 t_ilm_message command = gIpcModule.createMessage("ListAllSurfaceGroupIDS");
757 if (pLength && ppArray
759 && sendAndWaitForResponse(command, &response, gResponseTimeout)
760 && gIpcModule.getUintArray(response, ppArray, pLength))
762 returnValue = ILM_SUCCESS;
764 gIpcModule.destroyMessage(response);
765 gIpcModule.destroyMessage(command);
769 ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer, t_ilm_int* pLength, t_ilm_surface** ppArray)
771 ilmErrorTypes returnValue = ILM_FAILED;
773 t_ilm_message response = 0;
774 t_ilm_message command = gIpcModule.createMessage("ListSurfaceofLayer");
775 if (pLength && ppArray
777 && gIpcModule.appendUint(command, layer)
778 && sendAndWaitForResponse(command, &response, gResponseTimeout)
779 && gIpcModule.getUintArray(response, ppArray, pLength))
781 returnValue = ILM_SUCCESS;
783 gIpcModule.destroyMessage(response);
784 gIpcModule.destroyMessage(command);
788 ilmErrorTypes ilm_layerCreate(t_ilm_layer* pLayerId)
790 ilmErrorTypes returnValue = ILM_FAILED;
792 if (pLayerId && (INVALID_ID != *pLayerId))
794 t_ilm_message response = 0;
795 t_ilm_message command = gIpcModule.createMessage("CreateLayerFromId");
797 && gIpcModule.appendUint(command, *pLayerId)
798 && sendAndWaitForResponse(command, &response, gResponseTimeout)
799 && gIpcModule.getUint(response, pLayerId))
801 returnValue = ILM_SUCCESS;
803 gIpcModule.destroyMessage(response);
804 gIpcModule.destroyMessage(command);
808 t_ilm_message response = 0;
809 t_ilm_message command = gIpcModule.createMessage("CreateLayer");
811 && sendAndWaitForResponse(command, &response, gResponseTimeout)
812 && gIpcModule.getUint(response, pLayerId))
814 returnValue = ILM_SUCCESS;
816 gIpcModule.destroyMessage(response);
817 gIpcModule.destroyMessage(command);
822 ilmErrorTypes ilm_layerCreateWithDimension(t_ilm_layer* pLayerId, t_ilm_uint width, t_ilm_uint height)
824 ilmErrorTypes returnValue = ILM_FAILED;
826 if (pLayerId && (INVALID_ID != *pLayerId))
828 t_ilm_message response = 0;
829 t_ilm_message command = gIpcModule.createMessage("CreateLayerFromIdWithDimension");
831 && gIpcModule.appendUint(command, *pLayerId)
832 && gIpcModule.appendUint(command, width)
833 && gIpcModule.appendUint(command, height)
834 && sendAndWaitForResponse(command, &response, gResponseTimeout)
835 && gIpcModule.getUint(response, pLayerId))
837 returnValue = ILM_SUCCESS;
839 gIpcModule.destroyMessage(response);
840 gIpcModule.destroyMessage(command);
844 t_ilm_message response = 0;
845 t_ilm_message command = gIpcModule.createMessage("CreateLayerWithDimension");
847 && gIpcModule.appendUint(command, width)
848 && gIpcModule.appendUint(command, height)
849 && sendAndWaitForResponse(command, &response, gResponseTimeout)
850 && gIpcModule.getUint(response, pLayerId))
852 returnValue = ILM_SUCCESS;
854 gIpcModule.destroyMessage(response);
855 gIpcModule.destroyMessage(command);
860 ilmErrorTypes ilm_layerRemove(t_ilm_layer layerId)
862 ilmErrorTypes returnValue = ILM_FAILED;
864 t_ilm_message response = 0;
865 t_ilm_message command = gIpcModule.createMessage("RemoveLayer");
867 && gIpcModule.appendUint(command, layerId)
868 && sendAndWaitForResponse(command, &response, gResponseTimeout))
870 returnValue = ILM_SUCCESS;
872 gIpcModule.destroyMessage(response);
873 gIpcModule.destroyMessage(command);
877 ilmErrorTypes ilm_layerAddSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
879 ilmErrorTypes returnValue = ILM_FAILED;
881 t_ilm_message response = 0;
882 t_ilm_message command = gIpcModule.createMessage("AddSurfaceToLayer");
884 && gIpcModule.appendUint(command, surfaceId)
885 && gIpcModule.appendUint(command, layerId)
886 && sendAndWaitForResponse(command, &response, gResponseTimeout))
888 returnValue = ILM_SUCCESS;
890 gIpcModule.destroyMessage(response);
891 gIpcModule.destroyMessage(command);
895 ilmErrorTypes ilm_layerRemoveSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
897 ilmErrorTypes returnValue = ILM_FAILED;
899 t_ilm_message response = 0;
900 t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceFromLayer");
902 && gIpcModule.appendUint(command, surfaceId)
903 && gIpcModule.appendUint(command, layerId)
904 && sendAndWaitForResponse(command, &response, gResponseTimeout))
906 returnValue = ILM_SUCCESS;
908 gIpcModule.destroyMessage(response);
909 gIpcModule.destroyMessage(command);
913 ilmErrorTypes ilm_layerGetType(t_ilm_layer layerId, ilmLayerType* pLayerType)
915 ilmErrorTypes returnValue = ILM_FAILED;
917 t_ilm_message response = 0;
918 t_ilm_message command = gIpcModule.createMessage("GetLayerType");
921 && gIpcModule.appendUint(command, layerId)
922 && sendAndWaitForResponse(command, &response, gResponseTimeout)
923 && gIpcModule.getUint(response, pLayerType))
925 returnValue = ILM_SUCCESS;
927 gIpcModule.destroyMessage(response);
928 gIpcModule.destroyMessage(command);
932 ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibility)
934 ilmErrorTypes returnValue = ILM_FAILED;
936 t_ilm_message response = 0;
937 t_ilm_message command = gIpcModule.createMessage("SetLayerVisibility");
939 && gIpcModule.appendUint(command, layerId)
940 && gIpcModule.appendBool(command, newVisibility)
941 && sendAndWaitForResponse(command, &response, gResponseTimeout))
943 returnValue = ILM_SUCCESS;
945 gIpcModule.destroyMessage(response);
946 gIpcModule.destroyMessage(command);
950 ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId, t_ilm_bool *pVisibility)
952 ilmErrorTypes returnValue = ILM_FAILED;
954 t_ilm_message response = 0;
955 t_ilm_message command = gIpcModule.createMessage("GetLayerVisibility");
958 && gIpcModule.appendUint(command, layerId)
959 && sendAndWaitForResponse(command, &response, gResponseTimeout)
960 && gIpcModule.getBool(response, pVisibility))
962 returnValue = ILM_SUCCESS;
964 gIpcModule.destroyMessage(response);
965 gIpcModule.destroyMessage(command);
969 ilmErrorTypes ilm_layerSetOpacity(t_ilm_layer layerId, t_ilm_float opacity)
971 ilmErrorTypes returnValue = ILM_FAILED;
973 t_ilm_message response = 0;
974 t_ilm_message command = gIpcModule.createMessage("SetLayerOpacity");
976 && gIpcModule.appendUint(command, layerId)
977 && gIpcModule.appendDouble(command, opacity)
978 && sendAndWaitForResponse(command, &response, gResponseTimeout))
980 returnValue = ILM_SUCCESS;
982 gIpcModule.destroyMessage(response);
983 gIpcModule.destroyMessage(command);
987 ilmErrorTypes ilm_layerGetOpacity(t_ilm_layer layerId, t_ilm_float *pOpacity)
989 ilmErrorTypes returnValue = ILM_FAILED;
991 t_ilm_message response = 0;
992 t_ilm_message command = gIpcModule.createMessage("GetLayerOpacity");
995 && gIpcModule.appendUint(command, layerId)
996 && sendAndWaitForResponse(command, &response, gResponseTimeout)
997 && gIpcModule.getDouble(response, pOpacity))
999 returnValue = ILM_SUCCESS;
1001 gIpcModule.destroyMessage(response);
1002 gIpcModule.destroyMessage(command);
1006 ilmErrorTypes ilm_layerSetSourceRectangle(t_ilm_layer layerId, t_ilm_uint x, t_ilm_uint y, t_ilm_uint width, t_ilm_uint height)
1008 ilmErrorTypes returnValue = ILM_FAILED;
1010 t_ilm_message response = 0;
1011 t_ilm_message command = gIpcModule.createMessage("SetLayerSourceRegion");
1013 && gIpcModule.appendUint(command, layerId)
1014 && gIpcModule.appendUint(command, x)
1015 && gIpcModule.appendUint(command, y)
1016 && gIpcModule.appendUint(command, width)
1017 && gIpcModule.appendUint(command, height)
1018 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1020 returnValue = ILM_SUCCESS;
1022 gIpcModule.destroyMessage(response);
1023 gIpcModule.destroyMessage(command);
1027 ilmErrorTypes ilm_layerSetDestinationRectangle(t_ilm_layer layerId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
1029 ilmErrorTypes returnValue = ILM_FAILED;
1031 t_ilm_message response = 0;
1032 t_ilm_message command = gIpcModule.createMessage("SetLayerDestinationRegion");
1034 && gIpcModule.appendUint(command, layerId)
1035 && gIpcModule.appendUint(command, x)
1036 && gIpcModule.appendUint(command, y)
1037 && gIpcModule.appendUint(command, width)
1038 && gIpcModule.appendUint(command, height)
1039 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1041 returnValue = ILM_SUCCESS;
1043 gIpcModule.destroyMessage(response);
1044 gIpcModule.destroyMessage(command);
1048 ilmErrorTypes ilm_layerGetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
1050 ilmErrorTypes returnValue = ILM_FAILED;
1052 t_ilm_message response = 0;
1053 t_ilm_message command = gIpcModule.createMessage("GetLayerDimension");
1056 && gIpcModule.appendUint(command, layerId)
1057 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1058 && gIpcModule.getUint(response, &pDimension[0])
1059 && gIpcModule.getUint(response, &pDimension[1]))
1061 returnValue = ILM_SUCCESS;
1063 gIpcModule.destroyMessage(response);
1064 gIpcModule.destroyMessage(command);
1068 ilmErrorTypes ilm_layerSetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
1070 ilmErrorTypes returnValue = ILM_FAILED;
1072 t_ilm_message response = 0;
1073 t_ilm_message command = gIpcModule.createMessage("SetLayerDimension");
1076 && gIpcModule.appendUint(command, layerId)
1077 && gIpcModule.appendUint(command, pDimension[0])
1078 && gIpcModule.appendUint(command, pDimension[1])
1079 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1081 returnValue = ILM_SUCCESS;
1083 gIpcModule.destroyMessage(response);
1084 gIpcModule.destroyMessage(command);
1088 ilmErrorTypes ilm_layerGetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
1090 ilmErrorTypes returnValue = ILM_FAILED;
1092 t_ilm_message response = 0;
1093 t_ilm_message command = gIpcModule.createMessage("GetLayerPosition");
1096 && gIpcModule.appendUint(command, layerId)
1097 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1098 && gIpcModule.getUint(response, &pPosition[0])
1099 && gIpcModule.getUint(response, &pPosition[1]))
1101 returnValue = ILM_SUCCESS;
1103 gIpcModule.destroyMessage(response);
1104 gIpcModule.destroyMessage(command);
1108 ilmErrorTypes ilm_layerSetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
1110 ilmErrorTypes returnValue = ILM_FAILED;
1112 t_ilm_message response = 0;
1113 t_ilm_message command = gIpcModule.createMessage("SetLayerPosition");
1116 && gIpcModule.appendUint(command, layerId)
1117 && gIpcModule.appendUint(command, pPosition[0])
1118 && gIpcModule.appendUint(command, pPosition[1])
1119 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1121 returnValue = ILM_SUCCESS;
1123 gIpcModule.destroyMessage(response);
1124 gIpcModule.destroyMessage(command);
1128 ilmErrorTypes ilm_layerSetOrientation(t_ilm_layer layerId, ilmOrientation orientation)
1130 ilmErrorTypes returnValue = ILM_FAILED;
1132 t_ilm_message response = 0;
1133 t_ilm_message command = gIpcModule.createMessage("SetLayerOrientation");
1135 && gIpcModule.appendUint(command, layerId)
1136 && gIpcModule.appendUint(command, orientation)
1137 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1139 returnValue = ILM_SUCCESS;
1141 gIpcModule.destroyMessage(response);
1142 gIpcModule.destroyMessage(command);
1146 ilmErrorTypes ilm_layerGetOrientation(t_ilm_layer layerId, ilmOrientation *pOrientation)
1148 ilmErrorTypes returnValue = ILM_FAILED;
1150 t_ilm_message response = 0;
1151 t_ilm_message command = gIpcModule.createMessage("GetLayerOrientation");
1154 && gIpcModule.appendUint(command, layerId)
1155 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1156 && gIpcModule.getUint(response, pOrientation))
1158 returnValue = ILM_SUCCESS;
1160 gIpcModule.destroyMessage(response);
1161 gIpcModule.destroyMessage(command);
1165 ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor)
1167 ilmErrorTypes returnValue = ILM_FAILED;
1169 t_ilm_message response = 0;
1170 t_ilm_message command = gIpcModule.createMessage("SetLayerChromaKey");
1172 && gIpcModule.appendUint(command, layerId))
1174 t_ilm_bool comResult = ILM_TRUE;
1176 // Checking pColor has a content, otherwise chromakey is disabled
1179 const t_ilm_uint number = 3;
1180 comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
1183 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1185 returnValue = ILM_SUCCESS;
1187 gIpcModule.destroyMessage(response);
1189 gIpcModule.destroyMessage(command);
1193 ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number)
1195 ilmErrorTypes returnValue = ILM_FAILED;
1197 t_ilm_message response = 0;
1198 t_ilm_message command = gIpcModule.createMessage("SetSurfaceRenderOrderWithinLayer");
1201 && gIpcModule.appendUint(command, layerId)
1202 && gIpcModule.appendUintArray(command, pSurfaceId, number)
1203 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1205 returnValue = ILM_SUCCESS;
1207 gIpcModule.destroyMessage(response);
1208 gIpcModule.destroyMessage(command);
1212 ilmErrorTypes ilm_layerGetCapabilities(t_ilm_layer layerId, t_ilm_layercapabilities *pCapabilities)
1214 ilmErrorTypes returnValue = ILM_FAILED;
1216 t_ilm_message response = 0;
1217 t_ilm_message command = gIpcModule.createMessage("GetLayerCapabilities");
1220 && gIpcModule.appendUint(command, layerId)
1221 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1222 && gIpcModule.getUint(response, pCapabilities))
1224 returnValue = ILM_SUCCESS;
1226 gIpcModule.destroyMessage(response);
1227 gIpcModule.destroyMessage(command);
1231 ilmErrorTypes ilm_layerTypeGetCapabilities(ilmLayerType layerType, t_ilm_layercapabilities *pCapabilities)
1233 ilmErrorTypes returnValue = ILM_FAILED;
1235 t_ilm_message response = 0;
1236 t_ilm_message command = gIpcModule.createMessage("GetLayertypeCapabilities");
1239 && gIpcModule.appendUint(command, layerType)
1240 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1241 && gIpcModule.getUint(response, pCapabilities))
1243 returnValue = ILM_SUCCESS;
1245 gIpcModule.destroyMessage(response);
1246 gIpcModule.destroyMessage(command);
1250 ilmErrorTypes ilm_layergroupCreate(t_ilm_layergroup *pLayergroup)
1252 ilmErrorTypes returnValue = ILM_FAILED;
1254 if (pLayergroup && (INVALID_ID != *pLayergroup))
1256 t_ilm_message response = 0;
1257 t_ilm_message command = gIpcModule.createMessage("CreateLayerGroupFromId");
1260 && gIpcModule.appendUint(command, *pLayergroup)
1261 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1262 && gIpcModule.getUint(response, pLayergroup))
1264 returnValue = ILM_SUCCESS;
1266 gIpcModule.destroyMessage(response);
1267 gIpcModule.destroyMessage(command);
1271 t_ilm_message response = 0;
1272 t_ilm_message command = gIpcModule.createMessage("CreateLayerGroup");
1275 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1276 && gIpcModule.getUint(response, pLayergroup))
1278 returnValue = ILM_SUCCESS;
1280 gIpcModule.destroyMessage(response);
1281 gIpcModule.destroyMessage(command);
1286 ilmErrorTypes ilm_layergroupRemove(t_ilm_layergroup group)
1288 ilmErrorTypes returnValue = ILM_FAILED;
1290 t_ilm_message response = 0;
1291 t_ilm_message command = gIpcModule.createMessage("RemoveLayerGroup");
1293 && gIpcModule.appendUint(command, group)
1294 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1296 returnValue = ILM_SUCCESS;
1298 gIpcModule.destroyMessage(response);
1299 gIpcModule.destroyMessage(command);
1303 ilmErrorTypes ilm_layergroupAddLayer(t_ilm_layergroup group, t_ilm_layer layer)
1305 ilmErrorTypes returnValue = ILM_FAILED;
1307 t_ilm_message response = 0;
1308 t_ilm_message command = gIpcModule.createMessage("AddLayerToLayerGroup");
1310 && gIpcModule.appendUint(command, layer)
1311 && gIpcModule.appendUint(command, group)
1312 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1314 returnValue = ILM_SUCCESS;
1316 gIpcModule.destroyMessage(response);
1317 gIpcModule.destroyMessage(command);
1321 ilmErrorTypes ilm_layergroupRemoveLayer(t_ilm_layergroup group, t_ilm_layer layer)
1323 ilmErrorTypes returnValue = ILM_FAILED;
1325 t_ilm_message response = 0;
1326 t_ilm_message command = gIpcModule.createMessage("RemoveLayerFromLayerGroup");
1328 && gIpcModule.appendUint(command, layer)
1329 && gIpcModule.appendUint(command, group)
1330 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1332 returnValue = ILM_SUCCESS;
1334 gIpcModule.destroyMessage(response);
1335 gIpcModule.destroyMessage(command);
1339 ilmErrorTypes ilm_layergroupSetVisibility(t_ilm_layergroup group, t_ilm_bool newVisibility)
1341 ilmErrorTypes returnValue = ILM_FAILED;
1343 t_ilm_message response = 0;
1344 t_ilm_message command = gIpcModule.createMessage("SetLayergroupVisibility");
1346 && gIpcModule.appendUint(command, group)
1347 && gIpcModule.appendBool(command, newVisibility)
1348 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1350 returnValue = ILM_SUCCESS;
1352 gIpcModule.destroyMessage(response);
1353 gIpcModule.destroyMessage(command);
1357 ilmErrorTypes ilm_layergroupSetOpacity(t_ilm_layergroup group, t_ilm_float opacity)
1359 ilmErrorTypes returnValue = ILM_FAILED;
1361 t_ilm_message response = 0;
1362 t_ilm_message command = gIpcModule.createMessage("SetLayergroupOpacity");
1364 && gIpcModule.appendUint(command, group)
1365 && gIpcModule.appendDouble(command, opacity)
1366 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1368 returnValue = ILM_SUCCESS;
1370 gIpcModule.destroyMessage(response);
1371 gIpcModule.destroyMessage(command);
1375 ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface* pSurfaceId)
1377 ilmErrorTypes returnValue = ILM_FAILED;
1379 if (pSurfaceId && (INVALID_ID != *pSurfaceId))
1381 t_ilm_message response = 0;
1382 t_ilm_message command = gIpcModule.createMessage("CreateSurfaceFromId");
1384 && gIpcModule.appendUint(command, nativehandle)
1385 && gIpcModule.appendUint(command, width)
1386 && gIpcModule.appendUint(command, height)
1387 && gIpcModule.appendUint(command, pixelFormat)
1388 && gIpcModule.appendUint(command, *pSurfaceId)
1389 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1390 && gIpcModule.getUint(response, pSurfaceId))
1392 returnValue = ILM_SUCCESS;
1394 gIpcModule.destroyMessage(response);
1395 gIpcModule.destroyMessage(command);
1399 t_ilm_message response = 0;
1400 t_ilm_message command = gIpcModule.createMessage("CreateSurface");
1402 && gIpcModule.appendUint(command, nativehandle)
1403 && gIpcModule.appendUint(command, width)
1404 && gIpcModule.appendUint(command, height)
1405 && gIpcModule.appendUint(command, pixelFormat)
1406 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1407 && gIpcModule.getUint(response, pSurfaceId))
1409 returnValue = ILM_SUCCESS;
1411 gIpcModule.destroyMessage(response);
1412 gIpcModule.destroyMessage(command);
1417 ilmErrorTypes ilm_surfaceInitialize(t_ilm_surface *pSurfaceId)
1419 ilmErrorTypes returnValue = ILM_FAILED;
1421 if (pSurfaceId && (INVALID_ID != *pSurfaceId))
1423 t_ilm_message response = 0;
1424 t_ilm_message command = gIpcModule.createMessage("InitializeSurfaceFromId");
1426 && gIpcModule.appendUint(command, *pSurfaceId)
1427 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1428 && gIpcModule.getUint(response, pSurfaceId))
1430 returnValue = ILM_SUCCESS;
1432 gIpcModule.destroyMessage(response);
1433 gIpcModule.destroyMessage(command);
1437 t_ilm_message response = 0;
1438 t_ilm_message command = gIpcModule.createMessage("InitializeSurface");
1440 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1441 && gIpcModule.getUint(response, pSurfaceId))
1443 returnValue = ILM_SUCCESS;
1445 gIpcModule.destroyMessage(response);
1446 gIpcModule.destroyMessage(command);
1451 ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface surfaceId)
1453 ilmErrorTypes returnValue = ILM_FAILED;
1455 t_ilm_message response = 0;
1456 t_ilm_message command = gIpcModule.createMessage("SetSurfaceNativeContent");
1458 && gIpcModule.appendUint(command, surfaceId)
1459 && gIpcModule.appendUint(command, nativehandle)
1460 && gIpcModule.appendUint(command, width)
1461 && gIpcModule.appendUint(command, height)
1462 && gIpcModule.appendUint(command, pixelFormat)
1463 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1465 returnValue = ILM_SUCCESS;
1467 gIpcModule.destroyMessage(response);
1468 gIpcModule.destroyMessage(command);
1472 ilmErrorTypes ilm_surfaceRemoveNativeContent(t_ilm_surface surfaceId)
1474 ilmErrorTypes returnValue = ILM_FAILED;
1476 t_ilm_message response = 0;
1477 t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceNativeContent");
1479 && gIpcModule.appendUint(command, surfaceId)
1480 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1482 returnValue = ILM_SUCCESS;
1484 gIpcModule.destroyMessage(response);
1485 gIpcModule.destroyMessage(command);
1489 ilmErrorTypes ilm_surfaceRemove(t_ilm_surface surfaceId)
1491 ilmErrorTypes returnValue = ILM_FAILED;
1493 t_ilm_message response = 0;
1494 t_ilm_message command = gIpcModule.createMessage("RemoveSurface");
1496 && gIpcModule.appendUint(command, surfaceId)
1497 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1499 returnValue = ILM_SUCCESS;
1501 gIpcModule.destroyMessage(response);
1502 gIpcModule.destroyMessage(command);
1506 ilmErrorTypes ilm_surfaceSetVisibility(t_ilm_surface surfaceId, t_ilm_bool newVisibility)
1508 ilmErrorTypes returnValue = ILM_FAILED;
1510 t_ilm_message response = 0;
1511 t_ilm_message command = gIpcModule.createMessage("SetSurfaceVisibility");
1513 && gIpcModule.appendUint(command, surfaceId)
1514 && gIpcModule.appendBool(command, newVisibility)
1515 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1517 returnValue = ILM_SUCCESS;
1519 gIpcModule.destroyMessage(response);
1520 gIpcModule.destroyMessage(command);
1524 ilmErrorTypes ilm_surfaceGetVisibility(t_ilm_surface surfaceId, t_ilm_bool *pVisibility)
1526 ilmErrorTypes returnValue = ILM_FAILED;
1528 t_ilm_message response = 0;
1529 t_ilm_message command = gIpcModule.createMessage("GetSurfaceVisibility");
1532 && gIpcModule.appendUint(command, surfaceId)
1533 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1534 && gIpcModule.getBool(response, pVisibility))
1536 returnValue = ILM_SUCCESS;
1538 gIpcModule.destroyMessage(response);
1539 gIpcModule.destroyMessage(command);
1543 ilmErrorTypes ilm_surfaceSetOpacity(t_ilm_surface surfaceId, t_ilm_float opacity)
1545 ilmErrorTypes returnValue = ILM_FAILED;
1547 t_ilm_message response = 0;
1548 t_ilm_message command = gIpcModule.createMessage("SetSurfaceOpacity");
1550 && gIpcModule.appendUint(command, surfaceId)
1551 && gIpcModule.appendDouble(command, opacity)
1552 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1554 returnValue = ILM_SUCCESS;
1556 gIpcModule.destroyMessage(response);
1557 gIpcModule.destroyMessage(command);
1561 ilmErrorTypes ilm_surfaceGetOpacity(t_ilm_surface surfaceId, t_ilm_float *pOpacity)
1563 ilmErrorTypes returnValue = ILM_FAILED;
1565 t_ilm_message response = 0;
1566 t_ilm_message command = gIpcModule.createMessage("GetSurfaceOpacity");
1569 && gIpcModule.appendUint(command, surfaceId)
1570 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1571 && gIpcModule.getDouble(response, pOpacity))
1573 returnValue = ILM_SUCCESS;
1575 gIpcModule.destroyMessage(response);
1576 gIpcModule.destroyMessage(command);
1580 ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
1582 ilmErrorTypes returnValue = ILM_FAILED;
1584 t_ilm_message response = 0;
1585 t_ilm_message command = gIpcModule.createMessage("SetSurfaceSourceRegion");
1587 && gIpcModule.appendUint(command, surfaceId)
1588 && gIpcModule.appendUint(command, x)
1589 && gIpcModule.appendUint(command, y)
1590 && gIpcModule.appendUint(command, width)
1591 && gIpcModule.appendUint(command, height)
1592 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1594 returnValue = ILM_SUCCESS;
1596 gIpcModule.destroyMessage(response);
1597 gIpcModule.destroyMessage(command);
1601 ilmErrorTypes ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
1603 ilmErrorTypes returnValue = ILM_FAILED;
1605 t_ilm_message response = 0;
1606 t_ilm_message command = gIpcModule.createMessage("SetSurfaceDestinationRegion");
1608 && gIpcModule.appendUint(command, surfaceId)
1609 && gIpcModule.appendUint(command, x)
1610 && gIpcModule.appendUint(command, y)
1611 && gIpcModule.appendUint(command, width)
1612 && gIpcModule.appendUint(command, height)
1613 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1615 returnValue = ILM_SUCCESS;
1617 gIpcModule.destroyMessage(response);
1618 gIpcModule.destroyMessage(command);
1622 ilmErrorTypes ilm_surfaceGetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
1624 ilmErrorTypes returnValue = ILM_FAILED;
1626 t_ilm_message response = 0;
1627 t_ilm_message command = gIpcModule.createMessage("GetSurfaceDimension");
1630 && gIpcModule.appendUint(command, surfaceId)
1631 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1632 && gIpcModule.getUint(response, &pDimension[0])
1633 && gIpcModule.getUint(response, &pDimension[1]))
1635 returnValue = ILM_SUCCESS;
1637 gIpcModule.destroyMessage(response);
1638 gIpcModule.destroyMessage(command);
1642 ilmErrorTypes ilm_surfaceSetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
1644 ilmErrorTypes returnValue = ILM_FAILED;
1646 t_ilm_message response = 0;
1647 t_ilm_message command = gIpcModule.createMessage("SetSurfaceDimension");
1650 && gIpcModule.appendUint(command, surfaceId)
1651 && gIpcModule.appendUint(command, pDimension[0])
1652 && gIpcModule.appendUint(command, pDimension[1])
1653 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1655 returnValue = ILM_SUCCESS;
1657 gIpcModule.destroyMessage(response);
1658 gIpcModule.destroyMessage(command);
1662 ilmErrorTypes ilm_surfaceGetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
1664 ilmErrorTypes returnValue = ILM_FAILED;
1666 t_ilm_message response = 0;
1667 t_ilm_message command = gIpcModule.createMessage("GetSurfacePosition");
1670 && gIpcModule.appendUint(command, surfaceId)
1671 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1672 && gIpcModule.getUint(response, &pPosition[0])
1673 && gIpcModule.getUint(response, &pPosition[1]))
1675 returnValue = ILM_SUCCESS;
1677 gIpcModule.destroyMessage(response);
1678 gIpcModule.destroyMessage(command);
1682 ilmErrorTypes ilm_surfaceSetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
1684 ilmErrorTypes returnValue = ILM_FAILED;
1686 t_ilm_message response = 0;
1687 t_ilm_message command = gIpcModule.createMessage("SetSurfacePosition");
1690 && gIpcModule.appendUint(command, surfaceId)
1691 && gIpcModule.appendUint(command, pPosition[0])
1692 && gIpcModule.appendUint(command, pPosition[1])
1693 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1695 returnValue = ILM_SUCCESS;
1697 gIpcModule.destroyMessage(response);
1698 gIpcModule.destroyMessage(command);
1702 ilmErrorTypes ilm_surfaceSetOrientation(t_ilm_surface surfaceId, ilmOrientation orientation)
1704 ilmErrorTypes returnValue = ILM_FAILED;
1706 t_ilm_message response = 0;
1707 t_ilm_message command = gIpcModule.createMessage("SetSurfaceOrientation");
1709 && gIpcModule.appendUint(command, surfaceId)
1710 && gIpcModule.appendUint(command, orientation)
1711 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1713 returnValue = ILM_SUCCESS;
1715 gIpcModule.destroyMessage(response);
1716 gIpcModule.destroyMessage(command);
1720 ilmErrorTypes ilm_surfaceGetOrientation(t_ilm_surface surfaceId, ilmOrientation *pOrientation)
1722 ilmErrorTypes returnValue = ILM_FAILED;
1724 t_ilm_message response = 0;
1725 t_ilm_message command = gIpcModule.createMessage("GetSurfaceOrientation");
1728 && gIpcModule.appendUint(command, surfaceId)
1729 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1730 && gIpcModule.getUint(response, pOrientation))
1732 returnValue = ILM_SUCCESS;
1734 gIpcModule.destroyMessage(response);
1735 gIpcModule.destroyMessage(command);
1739 ilmErrorTypes ilm_surfaceGetPixelformat(t_ilm_layer surfaceId, ilmPixelFormat *pPixelformat)
1741 ilmErrorTypes returnValue = ILM_FAILED;
1743 t_ilm_message response = 0;
1744 t_ilm_message command = gIpcModule.createMessage("GetSurfacePixelformat");
1747 && gIpcModule.appendUint(command, surfaceId)
1748 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1749 && gIpcModule.getUint(response, pPixelformat))
1751 returnValue = ILM_SUCCESS;
1753 gIpcModule.destroyMessage(response);
1754 gIpcModule.destroyMessage(command);
1758 ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor)
1760 ilmErrorTypes returnValue = ILM_FAILED;
1762 t_ilm_message response = 0;
1763 t_ilm_message command = gIpcModule.createMessage("SetSurfaceChromaKey");
1765 && gIpcModule.appendUint(command, surfaceId))
1767 t_ilm_bool comResult = ILM_TRUE;
1769 // Checking pColor has a content, otherwise chromakey is disabled
1772 const t_ilm_uint number = 3;
1773 comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
1776 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1778 returnValue = ILM_SUCCESS;
1781 gIpcModule.destroyMessage(response);
1782 gIpcModule.destroyMessage(command);
1786 ilmErrorTypes ilm_surfacegroupCreate(t_ilm_surfacegroup *pSurfacegroup)
1788 ilmErrorTypes returnValue = ILM_FAILED;
1790 if (pSurfacegroup && (INVALID_ID != *pSurfacegroup))
1792 t_ilm_message response = 0;
1793 t_ilm_message command = gIpcModule.createMessage("CreateSurfaceGroupFromId");
1795 && gIpcModule.appendUint(command, *pSurfacegroup)
1796 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1797 && gIpcModule.getUint(response, pSurfacegroup))
1799 returnValue = ILM_SUCCESS;
1801 gIpcModule.destroyMessage(response);
1802 gIpcModule.destroyMessage(command);
1806 t_ilm_message response = 0;
1807 t_ilm_message command = gIpcModule.createMessage("CreateSurfaceGroup");
1810 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1811 && gIpcModule.getUint(response, pSurfacegroup))
1813 returnValue = ILM_SUCCESS;
1815 gIpcModule.destroyMessage(response);
1816 gIpcModule.destroyMessage(command);
1821 ilmErrorTypes ilm_surfacegroupRemove(t_ilm_surfacegroup group)
1823 ilmErrorTypes returnValue = ILM_FAILED;
1825 t_ilm_message response = 0;
1826 t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceGroup");
1828 && gIpcModule.appendUint(command, group)
1829 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1831 returnValue = ILM_SUCCESS;
1833 gIpcModule.destroyMessage(response);
1834 gIpcModule.destroyMessage(command);
1838 ilmErrorTypes ilm_surfacegroupAddSurface(t_ilm_surfacegroup group, t_ilm_surface surface)
1840 ilmErrorTypes returnValue = ILM_FAILED;
1842 t_ilm_message response = 0;
1843 t_ilm_message command = gIpcModule.createMessage("AddSurfaceToSurfaceGroup");
1845 && gIpcModule.appendUint(command, surface)
1846 && gIpcModule.appendUint(command, group)
1847 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1849 returnValue = ILM_SUCCESS;
1851 gIpcModule.destroyMessage(response);
1852 gIpcModule.destroyMessage(command);
1856 ilmErrorTypes ilm_surfacegroupRemoveSurface(t_ilm_surfacegroup group, t_ilm_surface surface)
1858 ilmErrorTypes returnValue = ILM_FAILED;
1860 t_ilm_message response = 0;
1861 t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceFromSurfaceGroup");
1863 && gIpcModule.appendUint(command, surface)
1864 && gIpcModule.appendUint(command, group)
1865 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1867 returnValue = ILM_SUCCESS;
1869 gIpcModule.destroyMessage(response);
1870 gIpcModule.destroyMessage(command);
1874 ilmErrorTypes ilm_surfacegroupSetVisibility(t_ilm_surfacegroup group, t_ilm_bool newVisibility)
1876 ilmErrorTypes returnValue = ILM_FAILED;
1878 t_ilm_message response = 0;
1879 t_ilm_message command = gIpcModule.createMessage("SetSurfacegroupVisibility");
1881 && gIpcModule.appendUint(command, group)
1882 && gIpcModule.appendBool(command, newVisibility)
1883 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1885 returnValue = ILM_SUCCESS;
1887 gIpcModule.destroyMessage(response);
1888 gIpcModule.destroyMessage(command);
1892 ilmErrorTypes ilm_surfacegroupSetOpacity(t_ilm_surfacegroup group, t_ilm_float opacity)
1894 ilmErrorTypes returnValue = ILM_FAILED;
1896 t_ilm_message response = 0;
1897 t_ilm_message command = gIpcModule.createMessage("SetSurfacegroupOpacity");
1899 && gIpcModule.appendUint(command, group)
1900 && gIpcModule.appendDouble(command, opacity)
1901 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1903 returnValue = ILM_SUCCESS;
1905 gIpcModule.destroyMessage(response);
1906 gIpcModule.destroyMessage(command);
1910 ilmErrorTypes ilm_displaySetRenderOrder(t_ilm_display display, t_ilm_layer *pLayerId, const t_ilm_uint number)
1912 ilmErrorTypes returnValue = ILM_FAILED;
1914 t_ilm_message response = 0;
1915 t_ilm_message command = gIpcModule.createMessage("SetRenderOrderOfLayers");
1918 && gIpcModule.appendUintArray(command, pLayerId, number)
1919 && gIpcModule.appendUint(command, display)
1920 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1922 returnValue = ILM_SUCCESS;
1924 gIpcModule.destroyMessage(response);
1925 gIpcModule.destroyMessage(command);
1929 ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs)
1931 ilmErrorTypes returnValue = ILM_FAILED;
1933 t_ilm_message response = 0;
1934 t_ilm_message command = gIpcModule.createMessage("GetScreenIDs");
1935 if (pNumberOfIDs && ppIDs
1937 && sendAndWaitForResponse(command, &response, gResponseTimeout)
1938 && gIpcModule.getUintArray(response, ppIDs, (t_ilm_int *)pNumberOfIDs))
1940 returnValue = ILM_SUCCESS;
1942 gIpcModule.destroyMessage(response);
1943 gIpcModule.destroyMessage(command);
1947 ilmErrorTypes ilm_takeScreenshot(t_ilm_uint screen, t_ilm_const_string filename)
1949 ilmErrorTypes returnValue = ILM_FAILED;
1951 t_ilm_message response = 0;
1952 t_ilm_message command = gIpcModule.createMessage("ScreenShot");
1954 && gIpcModule.appendUint(command, screen)
1955 && gIpcModule.appendString(command, filename)
1956 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1958 returnValue = ILM_SUCCESS;
1960 gIpcModule.destroyMessage(response);
1961 gIpcModule.destroyMessage(command);
1965 ilmErrorTypes ilm_takeLayerScreenshot(t_ilm_const_string filename, t_ilm_layer layerid)
1967 ilmErrorTypes returnValue = ILM_FAILED;
1969 t_ilm_message response = 0;
1970 t_ilm_message command = gIpcModule.createMessage("ScreenShotOfLayer");
1972 && gIpcModule.appendString(command, filename)
1973 && gIpcModule.appendUint(command, layerid)
1974 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1976 returnValue = ILM_SUCCESS;
1978 gIpcModule.destroyMessage(response);
1979 gIpcModule.destroyMessage(command);
1983 ilmErrorTypes ilm_takeSurfaceScreenshot(t_ilm_const_string filename, t_ilm_surface surfaceid)
1985 ilmErrorTypes returnValue = ILM_FAILED;
1987 t_ilm_message response = 0;
1988 t_ilm_message command = gIpcModule.createMessage("ScreenShotOfSurface");
1990 && gIpcModule.appendString(command, filename)
1991 && gIpcModule.appendUint(command, surfaceid)
1992 && sendAndWaitForResponse(command, &response, gResponseTimeout))
1994 returnValue = ILM_SUCCESS;
1996 gIpcModule.destroyMessage(response);
1997 gIpcModule.destroyMessage(command);
2001 ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
2003 ilmErrorTypes returnValue = ILM_FAILED;
2005 t_ilm_message response = 0;
2006 t_ilm_message command = gIpcModule.createMessage("SetKeyboardFocusOn");
2008 && gIpcModule.appendUint(command, surfaceId)
2009 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2011 returnValue = ILM_SUCCESS;
2013 gIpcModule.destroyMessage(response);
2014 gIpcModule.destroyMessage(command);
2018 ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId)
2020 ilmErrorTypes returnValue = ILM_FAILED;
2022 t_ilm_message response = 0;
2023 t_ilm_message command = gIpcModule.createMessage("GetKeyboardFocusSurfaceId");
2025 && sendAndWaitForResponse(command, &response, gResponseTimeout)
2026 && gIpcModule.getUint(response, pSurfaceId))
2028 returnValue = ILM_SUCCESS;
2030 gIpcModule.destroyMessage(response);
2031 gIpcModule.destroyMessage(command);
2035 ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInputDevice devices, t_ilm_bool acceptance)
2037 ilmErrorTypes returnValue = ILM_FAILED;
2039 t_ilm_message response = 0;
2040 t_ilm_message command = gIpcModule.createMessage("UpdateInputEventAcceptanceOn");
2042 && gIpcModule.appendUint(command, surfaceId)
2043 && gIpcModule.appendUint(command, devices)
2044 && gIpcModule.appendBool(command, acceptance)
2045 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2047 returnValue = ILM_SUCCESS;
2049 gIpcModule.destroyMessage(response);
2050 gIpcModule.destroyMessage(command);
2054 ilmErrorTypes ilm_SetOptimizationMode(ilmOptimization id, ilmOptimizationMode mode)
2056 ilmErrorTypes returnValue = ILM_FAILED;
2058 t_ilm_message response = 0;
2059 t_ilm_message command = gIpcModule.createMessage("SetOptimizationMode");
2061 && gIpcModule.appendUint(command,id)
2062 && gIpcModule.appendUint(command,mode)
2063 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2065 returnValue = ILM_SUCCESS;
2067 gIpcModule.destroyMessage(response);
2068 gIpcModule.destroyMessage(command);
2072 ilmErrorTypes ilm_GetOptimizationMode(ilmOptimization id, ilmOptimizationMode* pMode)
2074 ilmErrorTypes returnValue = ILM_FAILED;
2075 t_ilm_message response = 0;
2076 t_ilm_message command = gIpcModule.createMessage("GetOptimizationMode");
2078 && gIpcModule.appendUint(command,id)
2079 && sendAndWaitForResponse(command, &response, gResponseTimeout)
2080 && gIpcModule.getUint(response, pMode))
2082 returnValue = ILM_SUCCESS;
2084 gIpcModule.destroyMessage(response);
2085 gIpcModule.destroyMessage(command);
2089 ilmErrorTypes ilm_commitChanges()
2091 ilmErrorTypes returnValue = ILM_FAILED;
2093 t_ilm_message response = 0;
2094 t_ilm_message command = gIpcModule.createMessage("CommitChanges");
2097 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2099 returnValue = ILM_SUCCESS;
2101 gIpcModule.destroyMessage(response);
2102 gIpcModule.destroyMessage(command);
2106 ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback)
2108 ilmErrorTypes returnValue = ILM_FAILED;
2110 if (findLayerCallback(layer))
2112 return ILM_ERROR_INVALID_ARGUMENTS;
2115 t_ilm_message response = 0;
2116 t_ilm_message command = gIpcModule.createMessage("LayerAddNotification");
2118 && gIpcModule.appendUint(command, layer)
2119 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2121 addLayerCallback(layer, callback);
2122 returnValue = ILM_SUCCESS;
2124 gIpcModule.destroyMessage(response);
2125 gIpcModule.destroyMessage(command);
2129 ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer)
2131 ilmErrorTypes returnValue = ILM_FAILED;
2133 if (!findLayerCallback(layer))
2135 return ILM_ERROR_INVALID_ARGUMENTS;
2138 t_ilm_message response = 0;
2139 t_ilm_message command = gIpcModule.createMessage("LayerRemoveNotification");
2141 && gIpcModule.appendUint(command, layer)
2142 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2144 removeLayerCallback(layer);
2145 returnValue = ILM_SUCCESS;
2147 gIpcModule.destroyMessage(response);
2148 gIpcModule.destroyMessage(command);
2152 ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificationFunc callback)
2154 ilmErrorTypes returnValue = ILM_FAILED;
2156 if (findSurfaceCallback(surface))
2158 return ILM_ERROR_INVALID_ARGUMENTS;
2161 t_ilm_message response = 0;
2162 t_ilm_message command = gIpcModule.createMessage("SurfaceAddNotification");
2164 && gIpcModule.appendUint(command, surface)
2165 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2167 addSurfaceCallback(surface, callback);
2168 returnValue = ILM_SUCCESS;
2170 gIpcModule.destroyMessage(response);
2171 gIpcModule.destroyMessage(command);
2175 ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface)
2177 ilmErrorTypes returnValue = ILM_FAILED;
2179 if (!findSurfaceCallback(surface))
2181 return ILM_ERROR_INVALID_ARGUMENTS;
2184 t_ilm_message response = 0;
2185 t_ilm_message command = gIpcModule.createMessage("SurfaceRemoveNotification");
2187 && gIpcModule.appendUint(command, surface)
2188 && sendAndWaitForResponse(command, &response, gResponseTimeout))
2190 removeSurfaceCallback(surface);
2191 returnValue = ILM_SUCCESS;
2193 gIpcModule.destroyMessage(response);
2194 gIpcModule.destroyMessage(command);