option (WITH_TEXT_RENDERER "Build renderer renderer (only logging)" OFF)
+option (WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER "Build scene provider plugin for example applciations" OFF)
+
#==============================================================================
# Internal global settings not available to user
if (WITH_CLIENTEXAMPLES)
add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
add_subdirectory (LayerManagerExamples/LayerManagerControl)
- add_subdirectory (LayerManagerExamples/LayerSceneDescriptionExample)
set (BUILD_UTILS_LIB ON)
endif(WITH_CLIENTEXAMPLES)
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
#==============================================================================
+if (WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER)
+ add_subdirectory (LayerManagerPlugins/SceneProvider/ExampleSceneProvider)
+endif(WITH_PLUGIN_EXAMPLE_SCENE_PROVIDER)
+
if (WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR)
add_subdirectory (LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor)
endif(WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR)
#
############################################################################
-include_directories ("include")
-include_directories ("../../LayerManagerCommands/include")
-include_directories ("../../LayerManagerService/include")
-add_library(LayerScene SHARED src/LayerSceneProvider.cpp)
-
-target_link_libraries(LayerScene LayerManagerCommands ${LIBS})
-add_dependencies(LayerScene LayerManagerCommands)
-
-install (TARGETS LayerScene DESTINATION lib/layermanager)
+# examples was moved to
+# <src_root>/LayerManagerPlugins/SceneProvider/ExampleSceneProvider
\ No newline at end of file
/**
* scene Providers to setup a inital layer scenary on target platform
*/
-class LayerSceneProvider : public ISceneProvider
+class ExampleSceneProvider : public ISceneProvider
{
public:
- LayerSceneProvider(ICommandExecutor* executor);
- virtual ~LayerSceneProvider() {}
+ ExampleSceneProvider(ICommandExecutor* executor);
+ virtual ~ExampleSceneProvider() {}
/**
* Delegate Scene : this method will be called on LayerManager startup
* to delegate a initial scene description of Layers on the target Platform
#include "SurfaceSetOpacityCommand.h"
#include <unistd.h>
-LayerSceneProvider::LayerSceneProvider(ICommandExecutor* executor)
+ExampleSceneProvider::LayerSceneProvider(ICommandExecutor* executor)
: ISceneProvider(executor)
{
}
};
-bool LayerSceneProvider::delegateScene()
+bool ExampleSceneProvider::delegateScene()
{
bool result = true;
pid_t layermanagerPid = getpid();
extern "C" ISceneProvider* createLayerScene(ICommandExecutor* executor)
{
- return new LayerSceneProvider(executor);
+ return new ExampleSceneProvider(executor);
}
-extern "C" void destroyLayerScene(LayerSceneProvider* p)
+extern "C" void destroyLayerScene(ExampleSceneProvider* p)
{
delete p;
}
--- /dev/null
+############################################################################
+#
+# Copyright 2010, 2011 BMW Car IT GmbH
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+############################################################################
+cmake_minimum_required (VERSION 2.6)
+
+project(ExampleSceneProvider)
+
+include_directories(
+ include
+ ${CMAKE_SOURCE_DIR}/LayerManagerCommands/include
+ ${CMAKE_SOURCE_DIR}/LayerManagerService/include
+)
+
+add_library(${PROJECT_NAME} SHARED
+ src/ExampleSceneProvider.cpp
+)
+
+target_link_libraries(${PROJECT_NAME} LayerManagerCommands ${LIBS})
+
+add_dependencies(${PROJECT_NAME} LayerManagerCommands)
+
+install (TARGETS ${PROJECT_NAME} DESTINATION lib/layermanager/sceneprovider)
--- /dev/null
+/***************************************************************************
+ *
+ * Copyright 2010,2011 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+#ifndef _LAYERSCENE_H_
+#define _LAYERSCENE_H_
+
+typedef enum e_layers
+{
+ LAYER_NEW = 0,
+ LAYER_EXAMPLE_GLES_APPLICATIONS = 1000,
+ LAYER_EXAMPLE_X_APPLICATIONS = 2000,
+ LAYER_EXAMPLE_VIDEO_APPLICATIONS = 3000
+} scenelayers;
+
+typedef enum e_surfaces
+{
+ SURFACE_NEW = 0,
+ SURFACE_EXAMPLE_EGLX11_APPLICATION = 10,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_1 = 11,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_2 = 12,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_3 = 13,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_4 = 14,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_5 = 15,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_6 = 16,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_7 = 17,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_8 = 18,
+ SURFACE_EXAMPLE_GDTESTENV_APPLICATION_9 = 19,
+ SURFACE_EXAMPLE_GLXX11_APPLICATION = 20,
+ SURFACE_EXAMPLE_EGLRAW_APPLICATION = 30,
+ SURFACE_EXAMPLE_VIDEO_APPLICATION = 40
+} sceneSurfaces;
+
+typedef enum e_surfaceGroups
+{
+ SURFACEGROUP_NEW = 0
+} sceneSurfaceGroups;
+
+typedef enum e_layerGroups
+{
+ LAYERGROUP_NEW = 0
+} sceneLayerGroups;
+
+#endif /* _LAYERSCENE_H_ */
--- /dev/null
+/***************************************************************************
+ *
+ * Copyright 2012 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#ifndef _LAYERSCENE_PROVIDER_H_
+#define _LAYERSCENE_PROVIDER_H_
+
+#include "ISceneProvider.h"
+
+class ICommandExecutor;
+
+/**
+ * scene Providers to setup a inital layer scenary on target platform
+ */
+class ExampleSceneProvider : public ISceneProvider
+{
+public:
+
+ ExampleSceneProvider(ICommandExecutor* executor);
+ virtual ~ExampleSceneProvider() {}
+ /**
+ * Delegate Scene : this method will be called on LayerManager startup
+ * to delegate a initial scene description of Layers on the target Platform
+ */
+ virtual bool delegateScene();
+};
+
+
+#endif /* _LAYERSCENE_PROVIDER_H_ */
--- /dev/null
+/***************************************************************************
+ *
+ * Copyright 2010,2011 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#include "ExampleSceneProvider.h"
+#include "ICommandExecutor.h"
+#include "CommitCommand.h"
+#include "LayerCreateCommand.h"
+#include "LayerSetDestinationRectangleCommand.h"
+#include "LayerSetSourceRectangleCommand.h"
+#include "LayerSetVisibilityCommand.h"
+#include "LayerSetOpacityCommand.h"
+#include "ScreenSetRenderOrderCommand.h"
+#include "ExampleAppIds.h"
+#include "SurfaceCreateCommand.h"
+#include "SurfaceSetVisibilityCommand.h"
+#include "SurfaceSetOpacityCommand.h"
+#include <unistd.h>
+
+ExampleSceneProvider::ExampleSceneProvider(ICommandExecutor* executor)
+: ISceneProvider(executor)
+{
+}
+
+typedef struct t_layerScene
+{
+ unsigned int layer;
+ bool visibility;
+ float opacity;
+} layerScene;
+
+typedef struct t_surfaceScene
+{
+ unsigned int surface;
+ bool visibility;
+ float opacity;
+} surfaceScene;
+
+
+static layerScene gInitialLayerScene[] =
+{
+ { LAYER_EXAMPLE_VIDEO_APPLICATIONS, true, 1.0 },
+ { LAYER_EXAMPLE_GLES_APPLICATIONS, true, 1.0 },
+ { LAYER_EXAMPLE_X_APPLICATIONS, true, 1.0 }
+};
+
+static surfaceScene gInitialSurfaceScene[] =
+{
+ { SURFACE_EXAMPLE_EGLX11_APPLICATION,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_1,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_2,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_3,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_4,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_5,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_6,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_7,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_8,false,1.0 },
+ { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_9,false,1.0 },
+ { SURFACE_EXAMPLE_GLXX11_APPLICATION,false,1.0 },
+ { SURFACE_EXAMPLE_EGLRAW_APPLICATION,false,1.0 },
+ { SURFACE_EXAMPLE_VIDEO_APPLICATION,false,1.0 }
+};
+
+
+bool ExampleSceneProvider::delegateScene()
+{
+ bool result = true;
+ pid_t layermanagerPid = getpid();
+ int i = 0;
+ int numberOfLayers = sizeof(gInitialLayerScene) / sizeof (layerScene);
+ int numberOfSurfaces = sizeof(gInitialSurfaceScene) / sizeof (surfaceScene);
+ unsigned int *renderOrder = new unsigned int [numberOfLayers];
+ unsigned int* screenResolution = m_executor->getScreenResolution(0);
+ if ( numberOfLayers > 0 )
+ {
+ /* setup inital layer scenery */
+ for (i = 0;i<numberOfLayers;i++)
+ {
+ result &= m_executor->execute(new LayerCreateCommand(layermanagerPid, screenResolution[0], screenResolution[1], &(gInitialLayerScene[i].layer)));
+ result &= m_executor->execute(new LayerSetSourceRectangleCommand(layermanagerPid, gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
+ result &= m_executor->execute(new LayerSetDestinationRectangleCommand(layermanagerPid, gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
+ result &= m_executor->execute(new LayerSetOpacityCommand(layermanagerPid, gInitialLayerScene[i].layer, gInitialLayerScene[i].opacity) );
+ result &= m_executor->execute(new LayerSetVisibilityCommand(layermanagerPid, gInitialLayerScene[i].layer, gInitialLayerScene[i].visibility) );
+ result &= m_executor->execute(new CommitCommand(layermanagerPid));
+ renderOrder[i]=gInitialLayerScene[i].layer;
+ }
+ /* Finally set the first executed renderorder */
+ result &= m_executor->execute(new ScreenSetRenderOrderCommand(layermanagerPid, renderOrder, numberOfLayers));
+ result &= m_executor->execute(new CommitCommand(layermanagerPid));
+ }
+
+ if ( numberOfSurfaces > 0 )
+ {
+ /* setup inital surface scenery */
+ for (i = 0;i<numberOfSurfaces;i++)
+ {
+ result &= m_executor->execute(new SurfaceCreateCommand(layermanagerPid, &(gInitialSurfaceScene[i].surface)));
+ result &= m_executor->execute(new SurfaceSetOpacityCommand(layermanagerPid, gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].opacity));
+ result &= m_executor->execute(new SurfaceSetVisibilityCommand(layermanagerPid, gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].visibility));
+ result &= m_executor->execute(new CommitCommand(layermanagerPid));
+ }
+ /* Finally set the first executed renderorder */
+ }
+ return result;
+}
+
+extern "C" ISceneProvider* createExampleSceneProvider(ICommandExecutor* executor)
+{
+ return new ExampleSceneProvider(executor);
+}
+
+extern "C" void destroyExampleSceneProvider(ExampleSceneProvider* p)
+{
+ delete p;
+}
uint gCommunicatorPluginDirectoriesCount = sizeof(gCommunicatorPluginDirectories) / sizeof(gCommunicatorPluginDirectories[0]);
-const char* gScenePluginDirectories[] = { "" };
+const char* gScenePluginDirectories[] = { "/sceneprovider" };
uint gScenePluginDirectoriesCount = sizeof(gScenePluginDirectories) / sizeof(gScenePluginDirectories[0]);