#include "GenericCommunicator.h"
#include "ilm_types.h"
+#include "LmScreen.h"
#include "Log.h"
+#include "Configuration.h"
#include "ICommandExecutor.h"
#include "CommitCommand.h"
#include "LayerCreateCommand.h"
-#include "LayergroupCreateCommand.h"
#include "SurfaceCreateCommand.h"
-#include "SurfacegroupCreateCommand.h"
#include "SurfaceGetDimensionCommand.h"
#include "LayerGetDimensionCommand.h"
#include "SurfaceGetOpacityCommand.h"
#include "LayerRemoveSurfaceCommand.h"
#include "LayerRemoveCommand.h"
#include "SurfaceRemoveCommand.h"
-#include "LayergroupRemoveCommand.h"
-#include "SurfacegroupRemoveCommand.h"
#include "SurfaceGetOrientationCommand.h"
#include "LayerGetOrientationCommand.h"
-#include "LayergroupAddLayerCommand.h"
-#include "LayergroupRemoveLayerCommand.h"
#include "LayerSetDestinationRectangleCommand.h"
#include "SurfaceSetDestinationRectangleCommand.h"
#include "LayerSetOpacityCommand.h"
-#include "LayergroupSetOpacityCommand.h"
#include "SurfaceSetOpacityCommand.h"
-#include "SurfacegroupSetOpacityCommand.h"
#include "LayerSetSourceRectangleCommand.h"
#include "SurfaceSetSourceRectangleCommand.h"
#include "LayerSetOrientationCommand.h"
#include "SurfaceSetOrientationCommand.h"
-#include "SurfacegroupAddSurfaceCommand.h"
-#include "SurfacegroupRemoveSurfaceCommand.h"
#include "LayerSetVisibilityCommand.h"
#include "SurfaceSetVisibilityCommand.h"
-#include "LayergroupSetVisibilityCommand.h"
-#include "SurfacegroupSetVisibilityCommand.h"
#include "DebugCommand.h"
#include "ExitCommand.h"
#include "ScreenSetRenderOrderCommand.h"
#include "SurfaceUpdateInputEventAcceptance.h"
#include "SurfaceSetChromaKeyCommand.h"
#include "LayerSetChromaKeyCommand.h"
-
+#include "SetOptimizationModeCommand.h"
+#include "GetOptimizationModeCommand.h"
+#include "SetSynchronizedSurfacesCommand.h"
+#include "RemoveSynchronizedSurfacesCommand.h"
#include <stdbool.h>
#include <unistd.h>
#include <stdio.h>
#include <string>
#include <pthread.h>
#include <signal.h>
+#include <vector>
#define DEFAULT_SCREEN 0
-const char* RESOURCE_ALREADY_INUSE = "Ressource already in use";
-const char* INVALID_ARGUMENT = "Invalid argument";
-const char* RESOURCE_NOT_FOUND = "Ressource not found";
-const char* NOT_IMPLEMENTED = "Feature not implemented";
-
-
-GenericCommunicator::GenericCommunicator(ICommandExecutor* executor)
-: ICommunicator(executor)
+GenericCommunicator::GenericCommunicator(ICommandExecutor& executor, Configuration& config)
+: ICommunicator(&executor)
+, PluginBase(executor, config, Communicator_Api_v1)
, m_running(ILM_FALSE)
{
MethodTable manager_methods[] =
{
- { "ServiceConnect", &GenericCommunicator::ServiceConnect },
- { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
- { "Debug", &GenericCommunicator::Debug },
- { "ScreenShot", &GenericCommunicator::ScreenShot },
- { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
- { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
- { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
- { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
- { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
- { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
- { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
- { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
- { "ListAllLayerGroupIDS", &GenericCommunicator::ListAllLayerGroupIDS },
- { "ListAllSurfaceGroupIDS", &GenericCommunicator::ListAllSurfaceGroupIDS },
- { "ListSurfacesOfSurfacegroup", &GenericCommunicator::ListSurfacesOfSurfacegroup },
- { "ListLayersOfLayergroup", &GenericCommunicator::ListLayersOfLayergroup },
- { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
- { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
- { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
- { "CreateSurface", &GenericCommunicator::CreateSurface },
- { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
- { "InitializeSurface", &GenericCommunicator::InitializeSurface },
- { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
- { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
- { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
- { "RemoveSurface", &GenericCommunicator::RemoveSurface },
- { "CreateLayer", &GenericCommunicator::CreateLayer },
- { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
- { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
- { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
- { "RemoveLayer", &GenericCommunicator::RemoveLayer },
- { "AddSurfaceToSurfaceGroup", &GenericCommunicator::AddSurfaceToSurfaceGroup },
- { "RemoveSurfaceFromSurfaceGroup", &GenericCommunicator::RemoveSurfaceFromSurfaceGroup },
- { "AddLayerToLayerGroup", &GenericCommunicator::AddLayerToLayerGroup },
- { "RemoveLayerFromLayerGroup", &GenericCommunicator::RemoveLayerFromLayerGroup },
- { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
- { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
- { "CreateSurfaceGroup", &GenericCommunicator::CreateSurfaceGroup },
- { "CreateSurfaceGroupFromId", &GenericCommunicator::CreateSurfaceGroupFromId },
- { "RemoveSurfaceGroup", &GenericCommunicator::RemoveSurfaceGroup },
- { "CreateLayerGroup", &GenericCommunicator::CreateLayerGroup },
- { "CreateLayerGroupFromId", &GenericCommunicator::CreateLayerGroupFromId },
- { "RemoveLayerGroup", &GenericCommunicator::RemoveLayerGroup },
- { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
- { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
- { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
- { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
- { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
- { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
- { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
- { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
- { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
- { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
- { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
- { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
- { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
- { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
- { "SetSurfacegroupOpacity", &GenericCommunicator::SetSurfacegroupOpacity },
- { "SetLayergroupOpacity", &GenericCommunicator::SetLayergroupOpacity },
- { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
- { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
- { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
- { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
- { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
- { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
- { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
- { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
- { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
- { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
- { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
- { "SetSurfacegroupVisibility", &GenericCommunicator::SetSurfacegroupVisibility },
- { "SetLayergroupVisibility", &GenericCommunicator::SetLayergroupVisibility },
- { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
+ { "ServiceConnect", &GenericCommunicator::ServiceConnect },
+ { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
+ { "Debug", &GenericCommunicator::Debug },
+ { "ScreenShot", &GenericCommunicator::ScreenShot },
+ { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
+ { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
+ { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
+ { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
+ { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
+ { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
+ { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
+ { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
+ { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
+ { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
+ { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
+ { "CreateSurface", &GenericCommunicator::CreateSurface },
+ { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
+ { "InitializeSurface", &GenericCommunicator::InitializeSurface },
+ { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
+ { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
+ { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
+ { "RemoveSurface", &GenericCommunicator::RemoveSurface },
+ { "CreateLayer", &GenericCommunicator::CreateLayer },
+ { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
+ { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
+ { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
+ { "RemoveLayer", &GenericCommunicator::RemoveLayer },
+ { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
+ { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
+ { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
+ { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
+ { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
+ { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
+ { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
+ { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
+ { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
+ { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
+ { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
+ { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
+ { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
+ { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
+ { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
+ { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
+ { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
+ { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
+ { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
+ { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
+ { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
+ { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
+ { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
+ { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
+ { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
+ { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
+ { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
+ { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
{ "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
- { "GetLayerType", &GenericCommunicator::GetLayerType },
- { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
- { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
- { "Exit", &GenericCommunicator::Exit },
- { "CommitChanges", &GenericCommunicator::CommitChanges },
- { "CreateShader", &GenericCommunicator::CreateShader },
- { "DestroyShader", &GenericCommunicator::DestroyShader },
- { "SetShader", &GenericCommunicator::SetShader },
- { "SetUniforms", &GenericCommunicator::SetUniforms },
- { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
- { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
- { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
- { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
- { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
- { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
- { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
- { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
- { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification }
+ { "GetLayerType", &GenericCommunicator::GetLayerType },
+ { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
+ { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
+ { "Exit", &GenericCommunicator::Exit },
+ { "CommitChanges", &GenericCommunicator::CommitChanges },
+ { "CreateShader", &GenericCommunicator::CreateShader },
+ { "DestroyShader", &GenericCommunicator::DestroyShader },
+ { "SetShader", &GenericCommunicator::SetShader },
+ { "SetUniforms", &GenericCommunicator::SetUniforms },
+ { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
+ { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
+ { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
+ { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
+ { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
+ { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
+ { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
+ { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
+ { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification },
+ { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode },
+ { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode },
+ { "GetPropertiesOfScreen", &GenericCommunicator::GetPropertiesOfScreen },
+ { "SetSynchronizedSurfaces", &GenericCommunicator::SetSynchronizedSurfaces },
+ { "RemoveSynchronizedSurfaces", &GenericCommunicator::RemoveSynchronizedSurfaces }
};
int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
LOG_DEBUG("GenericCommunicator", "Initializing IpcModule success.");
m_running = ILM_TRUE;
- setHealth(HealthRunning);
+ pluginSetHealth(HealthRunning);
+
+ threadCreate();
+ threadInit();
+ threadStart();
return ILM_TRUE;
}
void GenericCommunicator::stop()
{
- LOG_INFO("GenericCommunicator","stopping");
+ LOG_INFO("GenericCommunicator", "stopping");
+
+ threadStop();
if (m_running)
{
m_ipcModule.destroy();
}
- setHealth(HealthStopped);
+ pluginSetHealth(HealthStopped);
}
void GenericCommunicator::process(int timeout_ms)
t_ilm_const_string name = m_ipcModule.getMessageName(message);
t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
- switch(messageType)
+ switch (messageType)
{
case IpcMessageTypeCommand:
if (m_callBackTable.end() != m_callBackTable.find(name))
{
LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
- << m_executor->getSenderName(senderHandle)
- << "(" << m_executor->getSenderPid(senderHandle) << ")");
+ << m_executor->getSenderName(senderHandle)
+ << "(" << m_executor->getSenderPid(senderHandle) << ")");
CallBackMethod method = m_callBackTable[name].function;
(this->*method)(message);
}
else
{
LOG_WARNING("GenericCommunicator", "Received unknown command " << name
- << " from " << m_executor->getSenderName(senderHandle)
- << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
+ << " from " << m_executor->getSenderName(senderHandle)
+ << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
}
processNotificationQueue();
break;
case IpcMessageTypeConnect:
LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
- << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
+ << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
break;
case IpcMessageTypeDisconnect:
LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
- << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
+ << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
{
const LayerMap& layers = m_executor->getScene()->getAllLayers();
- LayerMapConstIterator layerIter = layers.begin();
+ LayerMapConstIterator layerIter = layers.begin();
LayerMapConstIterator layerIterEnd = layers.end();
for (; layerIter != layerIterEnd; ++layerIter)
{
}
const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
- SurfaceMapConstIterator surfaceIter = surfaces.begin();
+ SurfaceMapConstIterator surfaceIter = surfaces.begin();
SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
{
Surface* surface = surfaceIter->second;
surface->removeNotification(senderHandle);
}
+ m_executor->removeApplicationReference(senderHandle);
}
break;
case IpcMessageTypeError:
LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
- << m_executor->getSenderName(senderHandle)
- << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
+ << m_executor->getSenderName(senderHandle)
+ << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
break;
case IpcMessageTypeShutdown:
default:
LOG_DEBUG("GenericCommunicator", "Received unknown data from "
- << m_executor->getSenderName(senderHandle)
- << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
+ << m_executor->getSenderName(senderHandle)
+ << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
break;
}
m_ipcModule.destroyMessage(message);
(void)onoff; // TODO: remove, only prevents warning
}
-void GenericCommunicator::ServiceConnect(t_ilm_message message)
+t_ilm_bool GenericCommunicator::threadMainLoop()
+{
+ process(-1);
+ return ILM_TRUE;
+}
+
+t_ilm_const_string GenericCommunicator::pluginGetName() const
{
- LOG_DEBUG("GenericCommunicator", "ServiceConnect called");
+ return "GenericCommunicator";
+}
+void GenericCommunicator::ServiceConnect(t_ilm_message message)
+{
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
+ LOG_DEBUG("GenericCommunicator", "ServiceConnect called from "
+ << m_executor->getSenderName(clientHandle)
+ << "(" << m_executor->getSenderPid(clientHandle) << ")");
+
response = m_ipcModule.createResponse(message);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
{
- LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called");
-
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
+ LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called from "
+ << m_executor->getSenderName(clientHandle)
+ << "(" << m_executor->getSenderPid(clientHandle) << ")");
+
m_executor->removeApplicationReference(clientHandle);
response = m_ipcModule.createResponse(message);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.appendUint(response, resolution[1]);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
+
+ delete [] resolution;
}
void GenericCommunicator::GetNumberOfHardwareLayers(t_ilm_message message)
m_ipcModule.appendUintArray(response, IDs, length);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
+ delete [] IDs;
}
void GenericCommunicator::ScreenShot(t_ilm_message message)
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
+
+ delete [] array;
}
void GenericCommunicator::ListAllSurfaceIDS(t_ilm_message message)
m_ipcModule.destroyMessage(response);
}
-void GenericCommunicator::ListAllLayerGroupIDS(t_ilm_message message)
-{
- t_ilm_message response;
- t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
- uint* array = NULL;
- uint length = 0;
- m_executor->getScene()->lockScene();
- m_executor->getScene()->getLayerGroupIDs(&length, &array);
- m_executor->getScene()->unlockScene();
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUintArray(response, array, length);
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::ListAllSurfaceGroupIDS(t_ilm_message message)
-{
- t_ilm_message response;
- t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
- uint* array = NULL;
- uint length = 0;
- m_executor->getScene()->lockScene();
- m_executor->getScene()->getSurfaceGroupIDs(&length, &array);
- m_executor->getScene()->unlockScene();
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUintArray(response, array, length);
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::ListSurfacesOfSurfacegroup(t_ilm_message message)
-{
- t_ilm_message response;
- t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
- uint id = 0;
- m_ipcModule.getUint(message, &id);
- m_executor->getScene()->lockScene();
- SurfaceGroup* sg = m_executor->getScene()->getSurfaceGroup(id);
- if (NULL != sg)
- {
- std::list<Surface*> surfaces = sg->getList();
- uint length = surfaces.size();
- uint* array = new uint[length];
- uint arrayPos = 0;
-
- for (std::list<Surface*>::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it)
- {
- Surface* s = *it;
- array[arrayPos] = s->getID();
- ++arrayPos;
- }
- m_executor->getScene()->unlockScene();
-
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUintArray(response, array, length);
- }
- else
- {
- m_executor->getScene()->unlockScene();
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::ListLayersOfLayergroup(t_ilm_message message)
-{
- t_ilm_message response;
- t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
- uint id = 0;
- m_ipcModule.getUint(message, &id);
- m_executor->getScene()->lockScene();
- LayerGroup* sg = m_executor->getScene()->getLayerGroup(id);
- if (NULL != sg)
- {
- std::list<Layer*> layers = sg->getList();
-
- uint length = layers.size();
- uint* array = new uint[length];
- uint arrayPos = 0;
-
- for (std::list<Layer*>::const_iterator it = layers.begin(); it != layers.end(); ++it)
- {
- Layer* l = *it;
- array[arrayPos] = l->getID();
- ++arrayPos;
- }
- m_executor->getScene()->unlockScene();
-
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUintArray(response, array, length);
- }
- else
- {
- m_executor->getScene()->unlockScene();
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
void GenericCommunicator::ListSurfaceofLayer(t_ilm_message message)
{
t_ilm_message response;
response = m_ipcModule.createResponse(message);
m_ipcModule.appendUintArray(response, array, length);
+ delete [] array;
}
else
{
m_executor->getScene()->unlockScene();
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
pf = (PixelFormat) pixelformat;
-
// First of all create the surface
t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
+
+ delete [] resolution;
}
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::AddSurfaceToSurfaceGroup(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);
- uint surfaceid = 0;
- uint surfacegroupid = 0;
-
- m_ipcModule.getUint(message, &surfaceid);
- m_ipcModule.getUint(message, &surfacegroupid);
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupAddSurfaceCommand(clientPid, surfacegroupid, surfaceid));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::RemoveSurfaceFromSurfaceGroup(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);
- uint surfaceid = 0;
- uint surfacegroupid = 0;
-
- m_ipcModule.getUint(message, &surfaceid);
- m_ipcModule.getUint(message, &surfacegroupid);
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveSurfaceCommand(clientPid, surfacegroupid, surfaceid));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::AddLayerToLayerGroup(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);
- uint layerid = 0;
- uint layergroupid = 0;
-
- m_ipcModule.getUint(message, &layerid);
- m_ipcModule.getUint(message, &layergroupid);
-
- t_ilm_bool status = m_executor->execute(new LayergroupAddLayerCommand(clientPid, layergroupid, layerid));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::RemoveLayerFromLayerGroup(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);
- uint layerid = 0;
- uint layergroupid = 0;
-
- m_ipcModule.getUint(message, &layerid);
- m_ipcModule.getUint(message, &layergroupid);
-
- t_ilm_bool status = m_executor->execute(new LayergroupRemoveLayerCommand(clientPid, layergroupid, layerid));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_ALREADY_INUSE);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::CreateSurfaceGroup(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);
- uint newID = GraphicalObject::INVALID_ID;
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUint(response, newID);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::CreateSurfaceGroupFromId(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);
- uint newID = GraphicalObject::INVALID_ID;
-
- m_ipcModule.getUint(message, &newID);
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupCreateCommand(clientPid, &newID));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUint(response, newID);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::RemoveSurfaceGroup(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);
- uint param = 0;
- m_ipcModule.getUint(message, ¶m);
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupRemoveCommand(clientPid, param));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::CreateLayerGroup(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);
- uint newID = GraphicalObject::INVALID_ID;
-
- t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUint(response, newID);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::CreateLayerGroupFromId(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);
- uint newID = GraphicalObject::INVALID_ID;
-
- m_ipcModule.getUint(message, &newID);
-
- t_ilm_bool status = m_executor->execute(new LayergroupCreateCommand(clientPid, &newID));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- m_ipcModule.appendUint(response, newID);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_ALREADY_INUSE);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::RemoveLayerGroup(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);
- uint param = 0;
- m_ipcModule.getUint(message, ¶m);
-
- t_ilm_bool status = m_executor->execute(new LayergroupRemoveCommand(clientPid, param));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::SetSurfacegroupOpacity(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);
- uint id = 0;
- double param = 0.0;
-
- m_ipcModule.getUint(message, &id);
- m_ipcModule.getDouble(message, ¶m);
-
- t_ilm_bool status = m_executor->execute(new SurfacegroupSetOpacityCommand(clientPid, id, param));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
- }
-
- m_ipcModule.sendToClients(response, &clientHandle, 1);
- m_ipcModule.destroyMessage(response);
-}
-
-void GenericCommunicator::SetLayergroupOpacity(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);
- uint id = 0;
- double param = 0.0;
-
- m_ipcModule.getUint(message, &id);
- m_ipcModule.getDouble(message, ¶m);
-
- t_ilm_bool status = m_executor->execute(new LayergroupSetOpacityCommand(clientPid, id, param));
- if (status)
- {
- response = m_ipcModule.createResponse(message);
- }
- else
- {
- response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
uint id = 0;
- PixelFormat pixelFormat;
+ PixelFormat pixelFormat = (PixelFormat)ILM_PIXEL_FORMAT_UNKNOWN;
m_ipcModule.getUint(message, &id);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
uint id = 0;
- bool visibility;
+ bool visibility = false;
m_ipcModule.getUint(message, &id);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
uint id = 0;
- bool visibility;
+ bool visibility = false;
m_ipcModule.getUint(message, &id);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
}
-void GenericCommunicator::SetSurfacegroupVisibility(t_ilm_message message)
+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);
- uint groupid = 0;
- t_ilm_bool myparam = ILM_FALSE;
- m_ipcModule.getUint(message, &groupid);
- m_ipcModule.getBool(message, &myparam);
+ // 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 SurfacegroupSetVisibilityCommand(clientPid, groupid, myparam));
+ 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.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
}
-void GenericCommunicator::SetLayergroupVisibility(t_ilm_message message)
+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);
- uint groupid = 0;
- t_ilm_bool myparam = ILM_FALSE;
- m_ipcModule.getUint(message, &groupid);
- m_ipcModule.getBool(message, &myparam);
+ // 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 LayergroupSetVisibilityCommand(clientPid, groupid, myparam));
+ 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.appendString(response, RESOURCE_NOT_FOUND);
+ 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;
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);
- m_ipcModule.getUintArray(message, &array, &length);
+ uint screenID = 0;
+
+ m_ipcModule.getUint(message, &screenID);
- t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, array, length));
+ t_ilm_bool status = m_executor->execute(new ScreenSetRenderOrderCommand(clientPid, screenID, array, length));
if (status)
{
response = m_ipcModule.createResponse(message);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
- uint* array = NULL;
- int length = 0;
- uint layerid = 0;
+ uint layerid = 0;
m_ipcModule.getUint(message, &layerid);
- m_ipcModule.getUintArray(message, &array, &length);
+
+ // 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 LayerSetRenderOrderCommand(clientPid, layerid, array, length));
if (status)
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, NOT_IMPLEMENTED);
+ m_ipcModule.appendUint(response, ILM_ERROR_NOT_IMPLEMENTED);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
}
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, NOT_IMPLEMENTED);
+ m_ipcModule.appendUint(response, ILM_ERROR_NOT_IMPLEMENTED);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
}
t_ilm_message response;
t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, NOT_IMPLEMENTED);
+ m_ipcModule.appendUint(response, ILM_ERROR_NOT_IMPLEMENTED);
m_ipcModule.sendToClients(response, &clientHandle, 1);
m_ipcModule.destroyMessage(response);
}
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, RESOURCE_NOT_FOUND);
+ m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
else
{
response = m_ipcModule.createErrorResponse(message);
- m_ipcModule.appendString(response, INVALID_ARGUMENT);
+ m_ipcModule.appendUint(response, ILM_ERROR_INVALID_ARGUMENTS);
}
m_ipcModule.sendToClients(response, &clientHandle, 1);
switch (object->type)
{
case TypeLayer:
- {
- Layer* layer = static_cast<Layer*>(object);
- if (layer)
{
- ApplicationReferenceList& arl = layer->getNotificationClients();
-
- if (arl.size())
+ Layer* layer = static_cast<Layer*>(object);
+ if (layer)
{
- t_ilm_message notification;
- Rectangle dest = layer->getDestinationRegion();
- Rectangle src = layer->getSourceRegion();
- OrientationType orientation = layer->getOrientation();
-
- unsigned char chromaKeyRed = 0;
- unsigned char chromaKeyGreen = 0;
- unsigned char chromaKeyBlue = 0;
- layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
-
- std::stringstream notificationName;
- notificationName << "NotificationForLayer" << layer->getID();
-
- notification = m_ipcModule.createNotification(notificationName.str().c_str());
- m_ipcModule.appendUint(notification, layer->getID());
- m_ipcModule.appendUint(notification, mask);
-
- m_ipcModule.appendDouble(notification, layer->getOpacity());
- m_ipcModule.appendUint(notification, src.x);
- m_ipcModule.appendUint(notification, src.y);
- m_ipcModule.appendUint(notification, src.width);
- m_ipcModule.appendUint(notification, src.height);
- m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
- m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
- m_ipcModule.appendUint(notification, dest.x);
- m_ipcModule.appendUint(notification, dest.y);
- m_ipcModule.appendUint(notification, dest.width);
- m_ipcModule.appendUint(notification, dest.height);
- m_ipcModule.appendUint(notification, orientation);
- m_ipcModule.appendBool(notification, layer->getVisibility());
- m_ipcModule.appendUint(notification, layer->getLayerType());
- m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
- m_ipcModule.appendUint(notification, chromaKeyRed);
- m_ipcModule.appendUint(notification, chromaKeyGreen);
- m_ipcModule.appendUint(notification, chromaKeyBlue);
- m_ipcModule.appendInt(notification, layer->getCreatorPid());
-
- int clientCount = arl.size();
- t_ilm_client_handle clientArray[256];
-
- ApplicationReferenceList::iterator iter = arl.begin();
- ApplicationReferenceList::iterator end = arl.end();
-
- for (int clientNumber = 0;
- iter != end, clientNumber < 256;
- ++iter, ++clientNumber)
- {
- t_ilm_client_handle client = *iter;
- clientArray[clientNumber] = client;
- }
+ ApplicationReferenceList& arl = layer->getNotificationClients();
- LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
-
- if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
+ if (arl.size())
{
- LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+ t_ilm_message notification;
+ Rectangle dest = layer->getDestinationRegion();
+ Rectangle src = layer->getSourceRegion();
+ OrientationType orientation = layer->getOrientation();
+
+ unsigned char chromaKeyRed = 0;
+ unsigned char chromaKeyGreen = 0;
+ unsigned char chromaKeyBlue = 0;
+ layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+
+ std::stringstream notificationName;
+ notificationName << "NotificationForLayer" << layer->getID();
+
+ notification = m_ipcModule.createNotification(notificationName.str().c_str());
+ m_ipcModule.appendUint(notification, layer->getID());
+ m_ipcModule.appendUint(notification, mask);
+
+ m_ipcModule.appendDouble(notification, layer->getOpacity());
+ m_ipcModule.appendUint(notification, src.x);
+ m_ipcModule.appendUint(notification, src.y);
+ m_ipcModule.appendUint(notification, src.width);
+ m_ipcModule.appendUint(notification, src.height);
+ m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
+ m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
+ m_ipcModule.appendUint(notification, dest.x);
+ m_ipcModule.appendUint(notification, dest.y);
+ m_ipcModule.appendUint(notification, dest.width);
+ m_ipcModule.appendUint(notification, dest.height);
+ m_ipcModule.appendUint(notification, orientation);
+ m_ipcModule.appendBool(notification, layer->getVisibility());
+ m_ipcModule.appendUint(notification, layer->getLayerType());
+ m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
+ m_ipcModule.appendUint(notification, chromaKeyRed);
+ m_ipcModule.appendUint(notification, chromaKeyGreen);
+ m_ipcModule.appendUint(notification, chromaKeyBlue);
+ m_ipcModule.appendInt(notification, layer->getCreatorPid());
+
+ int clientCount = arl.size();
+ t_ilm_client_handle clientArray[256];
+
+ ApplicationReferenceList::iterator iter = arl.begin();
+ ApplicationReferenceList::iterator end = arl.end();
+
+ for (int clientNumber = 0;
+ iter != end, clientNumber < 256;
+ ++iter, ++clientNumber)
+ {
+ t_ilm_client_handle client = *iter;
+ clientArray[clientNumber] = client;
+ }
+
+ LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
+
+ if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
+ {
+ LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+ }
+
+ m_ipcModule.destroyMessage(notification);
}
-
- m_ipcModule.destroyMessage(notification);
}
}
- }
- break;
+ break;
case TypeSurface:
- {
- Surface* surface = static_cast<Surface*>(object);
- if (surface)
{
- ApplicationReferenceList& arl = surface->getNotificationClients();
-
- if (arl.size())
+ Surface* surface = static_cast<Surface*>(object);
+ if (surface)
{
- t_ilm_message notification;
- std::stringstream notificationName;
- notificationName << "NotificationForSurface" << surface->getID();
-
- unsigned char chromaKeyRed = 0;
- unsigned char chromaKeyGreen = 0;
- unsigned char chromaKeyBlue = 0;
- surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
-
- notification = m_ipcModule.createNotification(notificationName.str().c_str());
- m_ipcModule.appendUint(notification, surface->getID());
- m_ipcModule.appendUint(notification, mask);
-
- m_ipcModule.appendDouble(notification, surface->getOpacity());
- m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
- m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
- m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
- m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
- m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
- m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
- m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
- m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
- m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
- m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
- m_ipcModule.appendUint(notification, surface->getOrientation());
- m_ipcModule.appendBool(notification, surface->getVisibility());
- m_ipcModule.appendUint(notification, surface->frameCounter);
- m_ipcModule.appendUint(notification, surface->drawCounter);
- m_ipcModule.appendUint(notification, surface->updateCounter);
- m_ipcModule.appendUint(notification, surface->getPixelFormat());
- m_ipcModule.appendUint(notification, surface->getNativeContent());
- m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
- m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
- m_ipcModule.appendUint(notification, chromaKeyRed);
- m_ipcModule.appendUint(notification, chromaKeyGreen);
- m_ipcModule.appendUint(notification, chromaKeyBlue);
- m_ipcModule.appendInt(notification, surface->getCreatorPid());
-
- int clientCount = arl.size();
- t_ilm_client_handle clients[256];
-
- ApplicationReferenceList::iterator iter = arl.begin();
- ApplicationReferenceList::iterator end = arl.end();
-
- for (int clientNumber = 0;
- iter != end, clientNumber < 256;
- ++iter, ++clientNumber)
- {
- clients[clientNumber] = *iter;
- }
+ ApplicationReferenceList& arl = surface->getNotificationClients();
- LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
-
- if (!m_ipcModule.sendToClients(notification, clients, clientCount))
+ if (arl.size())
{
- LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+ t_ilm_message notification;
+ std::stringstream notificationName;
+ notificationName << "NotificationForSurface" << surface->getID();
+
+ unsigned char chromaKeyRed = 0;
+ unsigned char chromaKeyGreen = 0;
+ unsigned char chromaKeyBlue = 0;
+ surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+
+ notification = m_ipcModule.createNotification(notificationName.str().c_str());
+ m_ipcModule.appendUint(notification, surface->getID());
+ m_ipcModule.appendUint(notification, mask);
+
+ m_ipcModule.appendDouble(notification, surface->getOpacity());
+ m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
+ m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
+ m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
+ m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
+ m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
+ m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
+ m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
+ m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
+ m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
+ m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
+ m_ipcModule.appendUint(notification, surface->getOrientation());
+ m_ipcModule.appendBool(notification, surface->getVisibility());
+ m_ipcModule.appendUint(notification, surface->frameCounter);
+ m_ipcModule.appendUint(notification, surface->drawCounter);
+ m_ipcModule.appendUint(notification, surface->updateCounter);
+ m_ipcModule.appendUint(notification, surface->getPixelFormat());
+ m_ipcModule.appendUint(notification, surface->getNativeContent());
+ m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
+ m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
+ m_ipcModule.appendUint(notification, chromaKeyRed);
+ m_ipcModule.appendUint(notification, chromaKeyGreen);
+ m_ipcModule.appendUint(notification, chromaKeyBlue);
+ m_ipcModule.appendInt(notification, surface->getCreatorPid());
+
+ int clientCount = arl.size();
+ t_ilm_client_handle clients[256];
+
+ ApplicationReferenceList::iterator iter = arl.begin();
+ ApplicationReferenceList::iterator end = arl.end();
+
+ for (int clientNumber = 0;
+ iter != end, clientNumber < 256;
+ ++iter, ++clientNumber)
+ {
+ clients[clientNumber] = *iter;
+ }
+
+ LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
+
+ if (!m_ipcModule.sendToClients(notification, clients, clientCount))
+ {
+ LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+ }
+
+ m_ipcModule.destroyMessage(notification);
}
-
- m_ipcModule.destroyMessage(notification);
}
}
- }
- break;
+ break;
default:
LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
break;
}
}
-HealthCondition GenericCommunicator::getHealth()
+HealthCondition GenericCommunicator::pluginGetHealth()
{
- HealthCondition health = PluginBase::getHealth();
+ HealthCondition health = PluginBase::pluginGetHealth();
if (0 != pthread_kill(mThreadId, 0))
{
health = HealthDead;
return health;
}
-extern "C" ICommunicator* createGenericCommunicator(ICommandExecutor* executor)
+void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
{
- return new GenericCommunicator(executor);
+ t_ilm_message response;
+ OptimizationType optimizationId;
+ OptimizationModeType optimizationMode;
+ unsigned int optMode;
+ t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
+ t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
+
+ m_ipcModule.getUint(message, &optMode);
+ optimizationId = (OptimizationType)optMode;
+ m_ipcModule.getUint(message, &optMode);
+ optimizationMode = (OptimizationModeType)optMode;
+
+ t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
+ 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);
}
-extern "C" void destroyGenericCommunicator(GenericCommunicator* p)
+void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
{
- delete p;
+ t_ilm_message response;
+ t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
+ t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
+ OptimizationType optimizationId;
+ OptimizationModeType optimizationMode;
+ unsigned int o;
+
+ m_ipcModule.getUint(message, &o);
+ optimizationId = (OptimizationType)o;
+
+ t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
+ if (status)
+ {
+ response = m_ipcModule.createResponse(message);
+ m_ipcModule.appendUint(response, (unsigned int)optimizationMode);
+ }
+ 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::GetPropertiesOfScreen(t_ilm_message message)
+{
+ t_ilm_message response;
+ t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
+ uint id = 0;
+ m_ipcModule.getUint(message, &id);
+
+ LmScreen* screen = m_executor->getScene()->getScreen(id);
+ if (screen != NULL)
+ {
+ LayerList renderOrder = screen->getCurrentRenderOrder();
+ std::vector<t_ilm_layer> layerIdVector;
+
+ LayerListConstIterator iter = renderOrder.begin();
+ LayerListConstIterator end = renderOrder.end();
+ for (; iter != end; ++iter)
+ {
+ layerIdVector.push_back((*iter)->getID());
+ }
+
+ uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(id);
+ uint* resolution = m_executor->getScreenResolution(id);
+
+ response = m_ipcModule.createResponse(message);
+ m_ipcModule.appendUintArray(response, layerIdVector.data(), layerIdVector.size());
+ m_ipcModule.appendUint(response, numberOfHardwareLayers);
+ m_ipcModule.appendUint(response, resolution[0]);
+ m_ipcModule.appendUint(response, resolution[1]);
+ }
+ 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);
+}
+
+DECLARE_LAYERMANAGEMENT_PLUGIN(GenericCommunicator)
+