LayerManagerExamples: moved LayerSceneDescriptionExample to plugin directory
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 26 Nov 2012 14:11:31 +0000 (06:11 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 14 Jan 2013 08:34:15 +0000 (00:34 -0800)
LayerSceneDescriptionExample was moved to
LayerManagerPlugins/SceneProvider/ExampleSceneProvider

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
CMakeLists.txt
LayerManagerExamples/LayerSceneDescriptionExample/CMakeLists.txt
LayerManagerExamples/LayerSceneDescriptionExample/include/LayerSceneProvider.h
LayerManagerExamples/LayerSceneDescriptionExample/src/LayerSceneProvider.cpp
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/CMakeLists.txt [new file with mode: 0644]
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleAppIds.h [new file with mode: 0644]
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleSceneProvider.h [new file with mode: 0644]
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/src/ExampleSceneProvider.cpp [new file with mode: 0644]
LayerManagerService/src/PluginManager.cpp

index 51ce0e0..90eaa83 100644 (file)
@@ -62,6 +62,8 @@ option (WITH_PLUGIN_SYSTEMD_HEALTH_MONITOR "Build plugin for systemd health moni
 
 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
@@ -139,7 +141,6 @@ endif(WITH_GLX_EXAMPLE)
 if (WITH_CLIENTEXAMPLES)
     add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
     add_subdirectory (LayerManagerExamples/LayerManagerControl)
-    add_subdirectory (LayerManagerExamples/LayerSceneDescriptionExample)
     set (BUILD_UTILS_LIB ON)
 endif(WITH_CLIENTEXAMPLES)
 
@@ -159,6 +160,10 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
 #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)
index d24b61d..5c6f995 100644 (file)
 #
 
 ############################################################################
-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
index ca2cf4c..892e760 100644 (file)
@@ -27,12 +27,12 @@ class ICommandExecutor;
 /**
  * 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
index 9cbf64e..17a4a04 100644 (file)
@@ -32,7 +32,7 @@
 #include "SurfaceSetOpacityCommand.h"
 #include <unistd.h>
 
-LayerSceneProvider::LayerSceneProvider(ICommandExecutor* executor)
+ExampleSceneProvider::LayerSceneProvider(ICommandExecutor* executor)
 : ISceneProvider(executor)
 {
 }
@@ -77,7 +77,7 @@ static surfaceScene gInitialSurfaceScene[] =
 };
 
 
-bool LayerSceneProvider::delegateScene() 
+bool ExampleSceneProvider::delegateScene() 
 {
     bool result = true;
     pid_t layermanagerPid = getpid();
@@ -121,10 +121,10 @@ bool LayerSceneProvider::delegateScene()
 
 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;
 }
diff --git a/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/CMakeLists.txt b/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d5dd210
--- /dev/null
@@ -0,0 +1,38 @@
+############################################################################
+# 
+# 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)
diff --git a/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleAppIds.h b/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleAppIds.h
new file mode 100644 (file)
index 0000000..749ab2b
--- /dev/null
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *
+ * 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_ */
diff --git a/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleSceneProvider.h b/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleSceneProvider.h
new file mode 100644 (file)
index 0000000..7c42a6a
--- /dev/null
@@ -0,0 +1,44 @@
+/***************************************************************************
+ *
+ * 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_ */
diff --git a/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/src/ExampleSceneProvider.cpp b/LayerManagerPlugins/SceneProvider/ExampleSceneProvider/src/ExampleSceneProvider.cpp
new file mode 100644 (file)
index 0000000..e38be8b
--- /dev/null
@@ -0,0 +1,130 @@
+/***************************************************************************
+ *
+ * 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;
+}
index ae6da28..bed8654 100644 (file)
@@ -53,7 +53,7 @@ const char* gCommunicatorPluginDirectories[] = { "/communicator" };
 
 uint gCommunicatorPluginDirectoriesCount = sizeof(gCommunicatorPluginDirectories) / sizeof(gCommunicatorPluginDirectories[0]);
 
-const char* gScenePluginDirectories[] = { "" };
+const char* gScenePluginDirectories[] = { "/sceneprovider" };
 
 uint gScenePluginDirectoriesCount = sizeof(gScenePluginDirectories) / sizeof(gScenePluginDirectories[0]);