diff options
author | Michael Schuldt <michael.schuldt@bmw.de> | 2013-07-05 12:38:04 +0200 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2013-07-05 12:56:48 +0200 |
commit | f0b9f4236dcc88e187c58d435eb3904584eca5d7 (patch) | |
tree | c83d1fce97000892aab61b271313b4d1097dc6f4 | |
parent | df155269475853e61fd41c86119a6fa15f56524e (diff) | |
download | layer_management-f0b9f4236dcc88e187c58d435eb3904584eca5d7.tar.gz |
GenericCommunicator: added handling of synchronized surfaces commands
Signed-off-by: Michael Schuldt <michael.schuldt@bmw.de>
-rw-r--r-- | LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h | 2 | ||||
-rw-r--r-- | LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp | 72 |
2 files changed, 73 insertions, 1 deletions
diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h b/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h index d744581..fd9a2de 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h @@ -96,6 +96,8 @@ private: void CreateSurfaceFromId(t_ilm_message message); void SetSurfaceNativeContent(t_ilm_message message); void RemoveSurfaceNativeContent(t_ilm_message message); + void SetSynchronizedSurfaces(t_ilm_message message); + void RemoveSynchronizedSurfaces(t_ilm_message message); void RemoveSurface(t_ilm_message message); void CreateLayer(t_ilm_message message); void CreateLayerFromId(t_ilm_message message); diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp b/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp index e2056fd..0984477 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp @@ -76,6 +76,8 @@ #include "LayerSetChromaKeyCommand.h" #include "SetOptimizationModeCommand.h" #include "GetOptimizationModeCommand.h" +#include "SetSynchronizedSurfacesCommand.h" +#include "RemoveSynchronizedSurfacesCommand.h" #include <stdbool.h> #include <unistd.h> #include <stdio.h> @@ -171,7 +173,9 @@ GenericCommunicator::GenericCommunicator(ICommandExecutor& executor, Configurati { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification }, { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode }, { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode }, - { "GetPropertiesOfScreen", &GenericCommunicator::GetPropertiesOfScreen } + { "GetPropertiesOfScreen", &GenericCommunicator::GetPropertiesOfScreen }, + { "SetSynchronizedSurfaces", &GenericCommunicator::SetSynchronizedSurfaces }, + { "RemoveSynchronizedSurfaces", &GenericCommunicator::RemoveSynchronizedSurfaces } }; int entryCount = sizeof(manager_methods) / sizeof(MethodTable); @@ -1785,6 +1789,72 @@ void GenericCommunicator::GetLayerVisibility(t_ilm_message message) m_ipcModule.destroyMessage(response); } +void GenericCommunicator::SetSynchronizedSurfaces(t_ilm_message message) +{ + t_ilm_message response; + t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message); + t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle); + + // ipcArray was created in ipcModule using malloc (it's implemented C) + // so we copy it to a buffer created with new() and discard + // the ipcArray using free() to avoid memory corruption + uint* ipcArray = NULL; + uint* array = NULL; + int length = 0; + m_ipcModule.getUintArray(message, &ipcArray, &length); + array = new uint[length]; + memset(array, 0, length * sizeof(uint)); + memcpy(array, ipcArray, length * sizeof(uint)); + free(ipcArray); + + t_ilm_bool status = m_executor->execute(new SetSynchronizedSurfacesCommand(clientPid, array, length)); + if (status) + { + response = m_ipcModule.createResponse(message); + } + else + { + response = m_ipcModule.createErrorResponse(message); + m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND); + } + + m_ipcModule.sendToClients(response, &clientHandle, 1); + m_ipcModule.destroyMessage(response); +} + +void GenericCommunicator::RemoveSynchronizedSurfaces(t_ilm_message message) +{ + t_ilm_message response; + t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message); + t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle); + + // ipcArray was created in ipcModule using malloc (it's implemented C) + // so we copy it to a buffer created with new() and discard + // the ipcArray using free() to avoid memory corruption + uint* ipcArray = NULL; + uint* array = NULL; + int length = 0; + m_ipcModule.getUintArray(message, &ipcArray, &length); + array = new uint[length]; + memset(array, 0, length * sizeof(uint)); + memcpy(array, ipcArray, length * sizeof(uint)); + free(ipcArray); + + t_ilm_bool status = m_executor->execute(new RemoveSynchronizedSurfacesCommand(clientPid, array, length)); + if (status) + { + response = m_ipcModule.createResponse(message); + } + else + { + response = m_ipcModule.createErrorResponse(message); + m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND); + } + + m_ipcModule.sendToClients(response, &clientHandle, 1); + m_ipcModule.destroyMessage(response); +} + void GenericCommunicator::SetRenderOrderOfLayers(t_ilm_message message) { t_ilm_message response; |