diff options
author | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2014-01-31 13:42:10 +0100 |
---|---|---|
committer | Timo Lotterbach <timo.lotterbach@bmw-carit.de> | 2014-01-31 13:42:10 +0100 |
commit | 11968937b90d4cf3f84edcb4bad1e7b84a6fb061 (patch) | |
tree | 890fbb1dbe7a02d103ae89ac5605bd5e256c13d3 | |
parent | 70833645706d167b351e1b0f65bfe8ec3da1efe9 (diff) | |
download | wayland-ivi-extension-11968937b90d4cf3f84edcb4bad1e7b84a6fb061.tar.gz |
removed obsolete code and build scripts
- removed LayerSceneDescriptionExample
- removed LayerManagerUtils
- removed config project
- updated build system
Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
44 files changed, 4 insertions, 2884 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 731f1e2..5ee005b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,13 +26,8 @@ SET(ILM_VERSION "1.2.0") #=========================================================================================================== # cmake configuration #=========================================================================================================== -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/DefaultSettings.txt) -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/CMakeVersions.txt) -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/CustomMacros.txt) add_subdirectory(ivi-layermanagement-api/ilmClient) add_subdirectory(ivi-layermanagement-api/ilmCommon) add_subdirectory(ivi-layermanagement-api/ilmControl) add_subdirectory(weston-ivi-shell) -add_subdirectory(config) add_subdirectory(ivi-layermanagement-examples) diff --git a/cmake/modules/CMakeVersions.txt b/cmake/modules/CMakeVersions.txt deleted file mode 100644 index 6dda282..0000000 --- a/cmake/modules/CMakeVersions.txt +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -set( ${PROJECT_NAME}_MAJOR_VERSION 0 ) -set( ${PROJECT_NAME}_MINOR_VERSION 9 ) -set( ${PROJECT_NAME}_PATCH_LEVEL 9 ) -set( ${PROJECT_NAME}_RELEASE release ) - -set(VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL}.${${PROJECT_NAME}_RELEASE}) - -if(NOT DEFINED ILM_VERSION) - -execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE RESULT_VAR - OUTPUT_VARIABLE ILM_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) - -if(NOT "${RESULT_VAR}" STREQUAL 0) - -message(STATUS "Unable launch automatic version build! Using default version!") -set(ILM_VERSION ${VERSION}) - -else(NOT "${RESULT_VAR}" STREQUAL 0) - -string(REPLACE "-" "_" ILM_VERSION ${ILM_VERSION}) - -endif(NOT "${RESULT_VAR}" STREQUAL 0) - -endif(NOT DEFINED ILM_VERSION) - -set(LICENSE "APACHE 2.0") - -set(GENIVI_PROJECT_VERSION ${VERSION}) -message(STATUS - "Build for Version ${VERSION} build ${ILM_VERSION}" - ) - -##################### RPM CONFIG ######################## -set(GENIVI_RPM_RELEASE "${ILM_VERSION}") -set(SPEC_DIR ".") -######################################################### diff --git a/cmake/modules/CustomMacros.txt b/cmake/modules/CustomMacros.txt deleted file mode 100644 index d779238..0000000 --- a/cmake/modules/CustomMacros.txt +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################ -# -# Copyright 2010-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. -# -############################################################################ - -MACRO(add_subdirectory_once path) - get_filename_component(subdir ${path} NAME) - if (NOT ${subdir}_already_built) - set(${subdir}_already_built 1) - add_subdirectory(${path}) - endif (NOT ${subdir}_already_built) -ENDMACRO(add_subdirectory_once) - -MACRO(project_type mode) - string(TOUPPER ${mode} mode_capital) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS_${mode_capital}}") - set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") - - if (mode_capital STREQUAL "PLUGIN" AND WITH_STATIC_LIBRARIES) - set (STATICALLY_LINKED_PLUGINS ${STATICALLY_LINKED_PLUGINS} - ${PROJECT_NAME} CACHE INTERNAL "list of static plugins") - endif (mode_capital STREQUAL "PLUGIN" AND WITH_STATIC_LIBRARIES) - -ENDMACRO(project_type) - -MACRO(export_build_flag name description) - set (descLine "/* ${description} */") - set (nameLine "#cmakedefine ${name}") - SET(BUILD_FLAG_LIST "${BUILD_FLAG_LIST};${descLine};${nameLine}; " CACHE INTERNAL "") - SET(BUILD_FLAG_ARRAY "${BUILD_FLAG_ARRAY};${name}" CACHE INTERNAL "") -ENDMACRO(export_build_flag) - -MACRO(build_flag name description defaultvalue) - export_build_flag(${name} "${description}") - option (${name} "${description}" ${defaultvalue}) -ENDMACRO(build_flag) diff --git a/cmake/modules/DefaultSettings.txt b/cmake/modules/DefaultSettings.txt deleted file mode 100644 index 783fcc3..0000000 --- a/cmake/modules/DefaultSettings.txt +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -#============================================================================== -# set default build type, if not defined by user -#============================================================================== -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING - "Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel." - FORCE) - message(STATUS "Build type not defined. Using default build type 'Release'.") -endif (NOT CMAKE_BUILD_TYPE) - -#============================================================================== -# define shared library build mode -#============================================================================== -if (WITH_STATIC_LIBRARIES) - set (LIBRARY_BUILDMODE "STATIC") -else (WITH_STATIC_LIBRARIES) - set (LIBRARY_BUILDMODE "SHARED") -endif (WITH_STATIC_LIBRARIES) - - -#============================================================================== -# default compiler flags (and why we set them) -# -# -fPIC enable position independent code. required for -# (at least) Linux 64bit builds -# -# -Wno-variadic-macros required by google test framework -# -# -Wno-sign-compare required by google test framework -# -# -Wall enable all default compiler warnings -# -# -Wextra enable more strict compiler warnings -# -# -Wpedantic enable ISO C++ compliance warnings, aims for -# best portability -# -# -Wno-long-long ISO C++ does not provide long long support, -# but the use of long long is a widely accepted -# solution -# -# -Wno-unused-function LayerManagement has a function, that is not used by -# reference plugins, which turns into a warning -# during compilation. This function can be used by -# other implementations and will stay in the code. -#============================================================================== -set (COMPILER_FLAGS_3RDPARTY "-fPIC -Wno-variadic-macros -Wno-sign-compare") -set (COMPILER_FLAGS_TEST "-fPIC -Wno-variadic-macros -Wno-sign-compare") -set (COMPILER_FLAGS_EXAMPLE "-fPIC -Wall -Wextra") -set (COMPILER_FLAGS_PLUGIN "-fPIC -Wall -Wextra -pedantic -Wno-long-long -Wno-unused-function") -set (COMPILER_FLAGS_CORE "-fPIC -Wall -Wextra -pedantic -Wno-long-long -Wno-unused-function") - - -#============================================================================== -# set default build parameters -#============================================================================== -include_directories( - ${CMAKE_SOURCE_DIR}/config - ${CMAKE_SOURCE_DIR}/3rdParty - ${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmCommon/include -) - - -#============================================================================== -# Internal global settings not available to user -#============================================================================== -set (STATICALLY_LINKED_PLUGINS "" CACHE INTERNAL "list of static plugins") -set (BUILD_FLAG_LIST "" CACHE INTERNAL "list of build flag names") -set (BUILD_FLAG_ARRAY "" CACHE INTERNAL "array of build flags for logging") - - -#============================================================================== -# cppcheck configuration -#============================================================================== -set (CPPCHECK_CONFIG - --quiet - --enable=performance,portability - --template='{file}:{line}: warning: {message} [{severity}]' -) - -FOREACH (ARG ${CPPCHECK_CONFIG}) - set (CPPCHECK_CONFIG_STRING "${CPPCHECK_CONFIG_STRING} ${ARG}") -ENDFOREACH(ARG) diff --git a/cmake/modules/FindAutomotiveDlt.cmake b/cmake/modules/FindAutomotiveDlt.cmake deleted file mode 100644 index b436af6..0000000 --- a/cmake/modules/FindAutomotiveDlt.cmake +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################ -# -# Copyright 2012, BMW AG -# -# -# 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. -# -############################################################################ - -FIND_PACKAGE(PkgConfig) -IF (PKG_CONFIG_FOUND) -# added aditional pkg config check to find dbus dependend includes - pkg_check_modules(DLT_PKG_PATHS automotive-dlt) -ENDIF (PKG_CONFIG_FOUND) - - -FIND_PATH(DLT_INCLUDE_DIR dlt/dlt.h -${DLT_PKG_PATHS_INCLUDE_DIRS} -/usr/include -) - - -FIND_LIBRARY(DLT_LIBRARY -NAMES dlt -PATHS /lib -) - -SET( DLT_FOUND "NO" ) -IF(DLT_LIBRARY) - SET( DLT_FOUND "YES" ) - message(STATUS "Found Dlt libs: ${DLT_LIBRARY}") - message(STATUS "Found Dlt includes: ${DLT_INCLUDE_DIR}") -ENDIF(DLT_LIBRARY) - -MARK_AS_ADVANCED( - DLT_INCLUDE_DIR - DLT_LIBRARY -) diff --git a/cmake/modules/FindCairo.cmake b/cmake/modules/FindCairo.cmake deleted file mode 100644 index 663029b..0000000 --- a/cmake/modules/FindCairo.cmake +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright 2010, 2011 BMW Car IT GmbH -# Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia 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. -# -############################################################################ - -FIND_PATH(CAIRO_INCLUDE_DIR cairo.h -/usr/include/cairo -) - -FIND_LIBRARY(CAIRO_LIBRARIES -NAMES cairo -PATHS /usr/lib -) - -SET( CAIRO_FOUND "NO" ) -IF(CAIRO_LIBRARIES) - SET( CAIRO_FOUND "YES" ) - message(STATUS "Found cairo libs: ${CAIRO_LIBRARIES}") - message(STATUS "Found cairo includes: ${CAIRO_INCLUDE_DIR}") -ENDIF(CAIRO_LIBRARIES) - -MARK_AS_ADVANCED( - CAIRO_INCLUDE_DIR - CAIRO_LIBRARIES -) diff --git a/cmake/modules/FindDBUS.cmake b/cmake/modules/FindDBUS.cmake deleted file mode 100644 index f7ace63..0000000 --- a/cmake/modules/FindDBUS.cmake +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -FIND_PACKAGE(PkgConfig) -IF (PKG_CONFIG_FOUND) -# added aditional pkg config check to find dbus dependend includes - pkg_check_modules(DBUS_PKG_PATHS dbus-1) -ENDIF (PKG_CONFIG_FOUND) - - -FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h -${DBUS_PKG_PATHS_INCLUDE_DIRS} -/usr/include/dbus-1.0 -) - -FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h -${DBUS_PKG_PATHS_INCLUDE_DIRS} -/usr/lib/dbus-1.0/include -) - -FIND_LIBRARY(DBUS_LIBRARY -NAMES dbus-1 -PATHS /lib -) - -SET( DBUS_FOUND "NO" ) -IF(DBUS_LIBRARY) - SET( DBUS_FOUND "YES" ) - message(STATUS "Found DBUS libs: ${DBUS_LIBRARY}") - message(STATUS "Found DBUS includes: ${DBUS_INCLUDE_DIR}") - message(STATUS "Found DBUS arch dependent includes: ${DBUS_ARCH_INCLUDE_DIR}") -ENDIF(DBUS_LIBRARY) - -MARK_AS_ADVANCED( - DBUS_INCLUDE_DIR - DBUS_ARCH_INCLUDE_DIR - DBUS_LIBRARY -) diff --git a/cmake/modules/FindDRM.cmake b/cmake/modules/FindDRM.cmake deleted file mode 100644 index f8cc55e..0000000 --- a/cmake/modules/FindDRM.cmake +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################ -# -# Copyright 2010, 2011 BMW Car IT GmbH -# Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia 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. -# -############################################################################ - -FIND_PATH(UDEV_INCLUDE_DIR /libudev.h -/usr/include -) - -FIND_LIBRARY(UDEV_LIBRARIES -NAMES udev -PATHS /usr/lib -) - -FIND_PATH(GBM_INCLUDE_DIR /gbm.h -/usr/include -) - -FIND_LIBRARY(GBM_LIBRARIES -NAMES gbm -PATHS /usr/lib -) - -FIND_PATH(DRM_INCLUDE_DIR /drm.h -/usr/include/libdrm /usr/include/drm -) - -FIND_LIBRARY(DRM_LIBRARIES -NAMES drm -PATHS /usr/lib -) - -SET( DRM_FOUND "NO" ) -IF(UDEV_LIBRARIES AND GBM_LIBRARIES AND DRM_LIBRARIES) - SET( DRM_FOUND "YES" ) - message(STATUS "Found udev libs: ${UDEV_LIBRARIES}") - message(STATUS "Found udev includes: ${UDEV_INCLUDE_DIR}") - message(STATUS "Found gbm libs: ${GBM_LIBRARIES}") - message(STATUS "Found gbm includes: ${GBM_INCLUDE_DIR}") - message(STATUS "Found drm includes: ${DRM_INCLUDE_DIR}") - message(STATUS "Found drm libs: ${DRM_LIBRARIES}") -ENDIF(UDEV_LIBRARIES AND GBM_LIBRARIES AND DRM_LIBRARIES) - -MARK_AS_ADVANCED( - UDEV_INCLUDE_DIR - UDEV_LIBRARIES - GBM_INCLUDE_DIR - GBM_LIBRARIES - DRM_INCLUDE_DIR - DRM_LIBRARIES -) diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake deleted file mode 100644 index 8a43ec7..0000000 --- a/cmake/modules/FindEGL.cmake +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h -/usr/include -) - -FIND_LIBRARY(EGL_LIBRARY -NAMES EGL -PATHS -) - -SET( EGL_FOUND "NO" ) -IF(EGL_LIBRARY) - SET( EGL_FOUND "YES" ) - message(STATUS "Found EGL libs: ${EGL_LIBRARY}") - message(STATUS "Found EGL includes: ${EGL_INCLUDE_DIR}") -ENDIF(EGL_LIBRARY) - -MARK_AS_ADVANCED( - EGL_INCLUDE_DIR - EGL_LIBRARY -) diff --git a/cmake/modules/FindGLESv2.cmake b/cmake/modules/FindGLESv2.cmake deleted file mode 100644 index 8f7e6e5..0000000 --- a/cmake/modules/FindGLESv2.cmake +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -FIND_PATH(GLESv2_INCLUDE_DIR GLES2/gl2.h -/usr/include -) - -FIND_LIBRARY(GLESv2_LIBRARIES -NAMES GLESv2 -PATHS -) - -SET( GLESv2_FOUND "NO" ) -IF(GLESv2_LIBRARIES) - SET( GLESv2_FOUND "YES" ) - message(STATUS "Found GLESv2 libs: ${GLESv2_LIBRARIES}") - message(STATUS "Found GLESv2 includes: ${GLESv2_INCLUDE_DIR}") -ENDIF(GLESv2_LIBRARIES) - -MARK_AS_ADVANCED( - GLESv2_INCLUDE_DIR - GLESv2_LIBRARIES -) diff --git a/cmake/modules/FindGLX.cmake b/cmake/modules/FindGLX.cmake deleted file mode 100644 index 72b88d4..0000000 --- a/cmake/modules/FindGLX.cmake +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# -# 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. -# -############################################################################ - -FIND_PATH(GLX_INCLUDE_DIR GL/glx.h -/usr/include -) - -FIND_LIBRARY(GLX_LIBRARIES -NAMES GL -PATHS /usr/lib /usr/local/lib -) - -SET( GLX_FOUND "NO" ) -IF(GLX_LIBRARIES) - SET( GLX_FOUND "YES" ) - message(STATUS "Found GLX libs: ${GLX_LIBRARIES}") - message(STATUS "Found GLX includes: ${GLX_INCLUDE_DIR}") -ENDIF(GLX_LIBRARIES) - -MARK_AS_ADVANCED( - GLX_INCLUDE_DIR - GLX_LIBRARIES -) diff --git a/cmake/modules/FindPixman.cmake b/cmake/modules/FindPixman.cmake deleted file mode 100644 index 5e892be..0000000 --- a/cmake/modules/FindPixman.cmake +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# -# Copyright (C) 2013 DENSO CORPORATION -# -# -# 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. -# -############################################################################ - -FIND_PATH(PIXMAN_INCLUDE_DIR pixman.h -/usr/include/pixman-1 -/include/pixman-1 -) - -FIND_LIBRARY(PIXMAN_LIBRARIES -NAMES pixman-1 -PATHS /usr/lib -) - -SET( PIXMAN_FOUND "NO" ) -IF(PIXMAN_LIBRARIES) - SET( PIXMAN_FOUND "YES" ) - message(STATUS "Found pixman libs: ${PIXMAN_LIBRARIES}") - message(STATUS "Found pixman includes: ${PIXMAN_INCLUDE_DIR}") -ENDIF(PIXMAN_LIBRARIES) - -MARK_AS_ADVANCED( - PIXMAN_INCLUDE_DIR - PIXMAN_LIBRARIES -) diff --git a/config/.gitignore b/config/.gitignore deleted file mode 100644 index 0e56cf2..0000000 --- a/config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -config.h diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt deleted file mode 100644 index 010897a..0000000 --- a/config/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################ -# -# 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) - -# check configuration - -message(STATUS "Checking configuration, if valid.") -if (WITH_TESTS AND WITH_STATIC_LIBRARIES) - message(FATAL_ERROR "unit tests (WITH_TESTS=ON) are not supported with static linking (WITH_STATIC_LIBRARIES=ON)") -endif (WITH_TESTS AND WITH_STATIC_LIBRARIES) - - -# generate cmake configuration header file, includes information on the -# project configuration, compiler settings, ... - -message(STATUS "Generating config.h header file with build system configuration.") - -foreach(FLAG ${BUILD_FLAG_LIST}) - SET(EXPORTED_BUILD_FLAGS "${EXPORTED_BUILD_FLAGS}${FLAG}\n") -endforeach(FLAG ${BUILD_FLAG_LIST}) - -LIST(SORT BUILD_FLAG_ARRAY) -foreach(FLAG ${BUILD_FLAG_ARRAY}) - SET(EXPORTED_BUILD_FLAG_ARRAY "${EXPORTED_BUILD_FLAG_ARRAY} { DEBUG_FLAG, \"${FLAG} = ${${FLAG}}\" },\n") -endforeach(FLAG ${BUILD_FLAG_ARRAY}) - -foreach(PLUGIN ${STATICALLY_LINKED_PLUGINS}) - SET(STATIC_PLUGIN_REGISTRATION "${STATIC_PLUGIN_REGISTRATION} \\\n REGISTER_PLUGIN(${PLUGIN})") -endforeach(PLUGIN ${STATICALLY_LINKED_PLUGINS}) - -configure_file( - ${CMAKE_SOURCE_DIR}/config/res/config.h.cmake - ${CMAKE_SOURCE_DIR}/config/config.h.1stpass -) - -configure_file( - ${CMAKE_SOURCE_DIR}/config/config.h.1stpass - ${CMAKE_SOURCE_DIR}/config/config.h -) diff --git a/config/config.h.1stpass b/config/config.h.1stpass deleted file mode 100644 index 30dd55f..0000000 --- a/config/config.h.1stpass +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * Copyright 2010,2011 BMW Car IT GmbH - * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia 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 __CONFIG_H__ -#define __CONFIG_H__ - -/* - Auto-generated. Do not modify. - Variables configured by CMake build system -*/ - -/* ------------------------------------------------------------------------------ - string variables ------------------------------------------------------------------------------ -*/ -/* version of the LayerManagementService */ -#define ILM_VERSION "0.9.9.release" - -/* CMake build type, e.g. Debug, Release */ -#define CMAKE_BUILD_TYPE "Release" - -/* compiler flags used to build project */ -#define CMAKE_CXX_FLAGS "" - -/* install prefix of target platform */ -#define CMAKE_INSTALL_PREFIX "/home/user/usrfs" - -/* ------------------------------------------------------------------------------ - build flags ------------------------------------------------------------------------------ -*/ - - -/* ------------------------------------------------------------------------------ - human readable report ------------------------------------------------------------------------------ -*/ -#define DEBUG_FLAG 1 -#define INFO_FLAG 2 - -typedef struct -{ - int type; - const char* description; -} BuildFlag; - -const BuildFlag gBuildFlags[] = -{ - { INFO_FLAG, "Build Version = 0.9.9.release" }, - { DEBUG_FLAG, "Build Type = Release" }, - - - { DEBUG_FLAG, "Install Prefix = /home/user/usrfs" } -}; - -const int gBuildFlagCount = sizeof(gBuildFlags) / sizeof(gBuildFlags[0]); - -/* ------------------------------------------------------------------------------ - manage list of statically linked plugins ------------------------------------------------------------------------------ -*/ -#define REGISTER_PLUGIN(PLUGIN) \ - extern "C" IPlugin* create ## PLUGIN(ICommandExecutor& executor, Configuration& config); \ - static bool PLUGIN ## _instance = PluginManager::registerStaticPluginCreateFunction(create ## PLUGIN); - -#define STATIC_PLUGIN_REGISTRATION - -/* ------------------------------------------------------------------------------ - define plugin entry point depending on build settings ------------------------------------------------------------------------------ -*/ -#define DECLARE_LAYERMANAGEMENT_PLUGIN(name) \ -extern "C" IPlugin* create ## name(ICommandExecutor& executor, Configuration& config) \ -{ \ - return new name(executor, config); \ -} - -#endif /* __CONFIG_H__ */ diff --git a/config/res/config.h.cmake b/config/res/config.h.cmake deleted file mode 100644 index cd5c234..0000000 --- a/config/res/config.h.cmake +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * Copyright 2010,2011 BMW Car IT GmbH - * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia 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 __CONFIG_H__ -#define __CONFIG_H__ - -/* - Auto-generated. Do not modify. - Variables configured by CMake build system -*/ - -/* ------------------------------------------------------------------------------ - string variables ------------------------------------------------------------------------------ -*/ -/* version of the LayerManagementService */ -#define ILM_VERSION "${ILM_VERSION}" - -/* CMake build type, e.g. Debug, Release */ -#define CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" - -/* compiler flags used to build project */ -#define CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" - -/* install prefix of target platform */ -#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" - -/* ------------------------------------------------------------------------------ - build flags ------------------------------------------------------------------------------ -*/ -${EXPORTED_BUILD_FLAGS} - -/* ------------------------------------------------------------------------------ - human readable report ------------------------------------------------------------------------------ -*/ -#define DEBUG_FLAG 1 -#define INFO_FLAG 2 - -typedef struct -{ - int type; - const char* description; -} BuildFlag; - -const BuildFlag gBuildFlags[] = -{ - { INFO_FLAG, "Build Version = ${ILM_VERSION}" }, - { DEBUG_FLAG, "Build Type = ${CMAKE_BUILD_TYPE}" }, - -${EXPORTED_BUILD_FLAG_ARRAY} - { DEBUG_FLAG, "Install Prefix = ${CMAKE_INSTALL_PREFIX}" } -}; - -const int gBuildFlagCount = sizeof(gBuildFlags) / sizeof(gBuildFlags[0]); - -/* ------------------------------------------------------------------------------ - manage list of statically linked plugins ------------------------------------------------------------------------------ -*/ -#define REGISTER_PLUGIN(PLUGIN) \ - extern "C" IPlugin* create ## PLUGIN(ICommandExecutor& executor, Configuration& config); \ - static bool PLUGIN ## _instance = PluginManager::registerStaticPluginCreateFunction(create ## PLUGIN); - -#define STATIC_PLUGIN_REGISTRATION ${STATIC_PLUGIN_REGISTRATION} - -/* ------------------------------------------------------------------------------ - define plugin entry point depending on build settings ------------------------------------------------------------------------------ -*/ -#define DECLARE_LAYERMANAGEMENT_PLUGIN(name) \ -extern "C" IPlugin* create ## name(ICommandExecutor& executor, Configuration& config) \ -{ \ - return new name(executor, config); \ -} - -#endif /* __CONFIG_H__ */ diff --git a/ivi-layermanagement-api/ilmClient/CMakeLists.txt b/ivi-layermanagement-api/ilmClient/CMakeLists.txt index 601f1a4..7a86e16 100644 --- a/ivi-layermanagement-api/ilmClient/CMakeLists.txt +++ b/ivi-layermanagement-api/ilmClient/CMakeLists.txt @@ -20,7 +20,6 @@ cmake_minimum_required (VERSION 2.6) project(ilmClient) -project_type(CORE) find_package(Threads) find_package(PkgConfig REQUIRED) diff --git a/ivi-layermanagement-api/ilmCommon/CMakeLists.txt b/ivi-layermanagement-api/ilmCommon/CMakeLists.txt index 92a4ee6..0c4aa3e 100644 --- a/ivi-layermanagement-api/ilmCommon/CMakeLists.txt +++ b/ivi-layermanagement-api/ilmCommon/CMakeLists.txt @@ -21,7 +21,6 @@ cmake_minimum_required (VERSION 2.6) project(ilmCommon) -project_type(CORE) find_package(Threads) find_package(PkgConfig REQUIRED) diff --git a/ivi-layermanagement-api/ilmControl/CMakeLists.txt b/ivi-layermanagement-api/ilmControl/CMakeLists.txt index 4524b08..83c9ab6 100644 --- a/ivi-layermanagement-api/ilmControl/CMakeLists.txt +++ b/ivi-layermanagement-api/ilmControl/CMakeLists.txt @@ -21,7 +21,6 @@ cmake_minimum_required (VERSION 2.6) project(ilmControl) -project_type(CORE) find_package(Threads) find_package(PkgConfig REQUIRED) diff --git a/ivi-layermanagement-examples/CMakeLists.txt b/ivi-layermanagement-examples/CMakeLists.txt index 5a8d427..7cc3e7e 100644 --- a/ivi-layermanagement-examples/CMakeLists.txt +++ b/ivi-layermanagement-examples/CMakeLists.txt @@ -23,6 +23,5 @@ project (ivi-layermanagement-examples) #=========================================================================================================== # cmake configuration #=========================================================================================================== -add_subdirectory(LayerManagerUtils) add_subdirectory(LayerManagerControl) add_subdirectory(EGLWLMockNavigation) diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/CMakeLists.txt b/ivi-layermanagement-examples/EGLWLMockNavigation/CMakeLists.txt index 3720b88..7d0ea43 100644 --- a/ivi-layermanagement-examples/EGLWLMockNavigation/CMakeLists.txt +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/CMakeLists.txt @@ -20,8 +20,6 @@ cmake_minimum_required (VERSION 2.6) -project_type(EXAMPLE) - find_package(PkgConfig) pkg_check_modules(GLESv2 glesv2 REQUIRED) pkg_check_modules(EGL egl REQUIRED) @@ -36,8 +34,6 @@ include_directories( "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmClient/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include" "include" - "../LayerSceneDescriptionExample/include" - "../LayerManagerUtils/include" ) set (HEADER_FILES @@ -70,6 +66,7 @@ set (SRC_FILES src/ShaderLighting.cpp src/main.cpp src/WaylandServerinfoProtocol.cpp + src/IlmMatrix.cpp ) add_executable(EGLWLMockNavigation @@ -78,8 +75,10 @@ add_executable(EGLWLMockNavigation ) add_dependencies(EGLWLMockNavigation + ilmCommon ilmClient - EGLWLMockNavigation LayerManagerUtils wayland-client + ilmControl + wayland-client ) set(LIBS @@ -88,7 +87,6 @@ set(LIBS ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${EGL_LIBRARIES} - LayerManagerUtils ilmClient ilmControl ) diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h b/ivi-layermanagement-examples/EGLWLMockNavigation/include/IlmMatrix.h index e0c606f..e0c606f 100644 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/IlmMatrix.h +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/include/IlmMatrix.h diff --git a/ivi-layermanagement-examples/LayerSceneDescriptionExample/include/LayerScene.h b/ivi-layermanagement-examples/EGLWLMockNavigation/include/LayerScene.h index 21530b7..21530b7 100644 --- a/ivi-layermanagement-examples/LayerSceneDescriptionExample/include/LayerScene.h +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/include/LayerScene.h diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/IlmMatrix.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/IlmMatrix.cpp index 5e50b6c..5e50b6c 100644 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/IlmMatrix.cpp +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/IlmMatrix.cpp diff --git a/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt b/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt index 62136b4..4b83eff 100644 --- a/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt +++ b/ivi-layermanagement-examples/LayerManagerControl/CMakeLists.txt @@ -18,14 +18,12 @@ ############################################################################ project (LayerManagerControl) -project_type(CORE) include_directories( include "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmClient/include" "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmControl/include" - "${CMAKE_SOURCE_DIR}/ivi-layermanagement-example/LayerManagerUtils/include" ) add_executable(${PROJECT_NAME} @@ -46,7 +44,6 @@ add_executable(${PROJECT_NAME} add_dependencies(${PROJECT_NAME} ilmClient ilmControl - LayerManagerUtils ) target_link_libraries(${PROJECT_NAME} ilmClient ilmControl) diff --git a/ivi-layermanagement-examples/LayerManagerUtils/CMakeLists.txt b/ivi-layermanagement-examples/LayerManagerUtils/CMakeLists.txt deleted file mode 100644 index 12521c3..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -############################################################################ -# -# 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(LayerManagerUtils) -project_type(CORE) - -find_package (Threads) - -add_library(${PROJECT_NAME} STATIC - src/Bitmap.cpp - src/IlmMatrix.cpp - src/Log.cpp - src/LogMessageBuffer.cpp - src/ThreadBase.cpp - src/IpcModuleLoader.cpp -) - -set(INCLUDE_DIRS - "include" - "${CMAKE_SOURCE_DIR}/config" - "${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include" -) - -set(LIBS - ${LIBS} - ${CMAKE_THREAD_LIBS_INIT} - dl -) - -if (WITH_DLT) - - find_package(AutomotiveDlt REQUIRED) - - set(INCLUDE_DIRS - ${INCLUDE_DIRS} - ${DLT_INCLUDE_DIR} - ) - - set(LIBS - ${LIBS} - ${DLT_LIBRARY} - ) - - target_link_libraries(${PROJECT_NAME} ${LIBS}) - -endif (WITH_DLT) - -include_directories(${INCLUDE_DIRS}) - -install(FILES - include/Log.h - include/LogMessageBuffer.h - include/IlmMatrix.h - include/Bitmap.h - include/IpcModuleLoader.h - DESTINATION - include/layermanager -) - -install(TARGETS - ${PROJECT_NAME} - DESTINATION - lib/layermanager/static -) - -add_subdirectory(tests) diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h b/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h deleted file mode 100644 index ec6a1d7..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/Bitmap.h +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** -* -* 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 _BITMAP_H_ -#define _BITMAP_H_ - -#include <string> - -void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height); - -#endif /*_BITMAP_H_ */ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h deleted file mode 100644 index ff0e959..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModule.h +++ /dev/null @@ -1,107 +0,0 @@ -/*************************************************************************** -* -* 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 __IPCMODULE_H__ -#define __IPCMODULE_H__ - -#include "ilm_types.h" - -/* -============================================================================= - initialization -============================================================================= -*/ -t_ilm_bool initClientMode(); -t_ilm_bool initServiceMode(); - -/* -============================================================================= - create new messages -============================================================================= -*/ -t_ilm_message createMessage(t_ilm_const_string); -t_ilm_message createResponse(t_ilm_message); -t_ilm_message createErrorResponse(t_ilm_message); -t_ilm_message createNotification(t_ilm_const_string); - -/* -============================================================================= - add content to message -============================================================================= -*/ -t_ilm_bool appendBool(t_ilm_message, const t_ilm_bool); -t_ilm_bool appendDouble(t_ilm_message, const double); -t_ilm_bool appendString(t_ilm_message, const char*); -t_ilm_bool appendInt(t_ilm_message, const int); -t_ilm_bool appendIntArray(t_ilm_message, const int*, int); -t_ilm_bool appendUint(t_ilm_message, const unsigned int); -t_ilm_bool appendUintArray(t_ilm_message, const unsigned int*, int); - -/* -============================================================================= - send message -============================================================================= -*/ -t_ilm_bool sendToClients(t_ilm_message, t_ilm_client_handle*, int); -t_ilm_bool sendToService(t_ilm_message); - -/* -============================================================================= - receive message -============================================================================= -*/ -t_ilm_message receive(t_ilm_int); /* timeout in ms*/ - -/* -============================================================================= - get message information -============================================================================= -*/ -t_ilm_const_string getMessageName(t_ilm_message); -t_ilm_message_type getMessageType(t_ilm_message); -t_ilm_const_string getSenderName(t_ilm_message); -t_ilm_client_handle getSenderHandle(t_ilm_message); - -/* -============================================================================= - get content of message -============================================================================= -*/ -t_ilm_bool getBool(t_ilm_message, t_ilm_bool*); -t_ilm_bool getDouble(t_ilm_message, double*); -t_ilm_bool getString(t_ilm_message, char*); -t_ilm_bool getInt(t_ilm_message, int*); -t_ilm_bool getIntArray(t_ilm_message, int**, int*); -t_ilm_bool getUint(t_ilm_message, unsigned int*); -t_ilm_bool getUintArray(t_ilm_message, unsigned int**, int*); - -/* -============================================================================= - destroy message -============================================================================= -*/ -t_ilm_bool destroyMessage(t_ilm_message); - -/* -============================================================================= - shutdown -============================================================================= -*/ -t_ilm_bool destroy(); - -#endif /* __IPCMODULE_H__*/ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h b/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h deleted file mode 100644 index 0e1952e..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/IpcModuleLoader.h +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************** - * - * 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 __IPCMODULELOADER_H_ -#define __IPCMODULELOADER_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus*/ - -#include "ilm_types.h" - -struct IpcModule -{ - t_ilm_bool (*initClientMode)(); - t_ilm_bool (*initServiceMode)(); - - t_ilm_message (*createMessage)(t_ilm_const_string); - t_ilm_message (*createResponse)(t_ilm_message); - t_ilm_message (*createErrorResponse)(t_ilm_message); - t_ilm_message (*createNotification)(t_ilm_const_string); - - t_ilm_bool (*appendBool)(t_ilm_message, const t_ilm_bool); - t_ilm_bool (*appendDouble)(t_ilm_message, const double); - t_ilm_bool (*appendString)(t_ilm_message, const char*); - t_ilm_bool (*appendInt)(t_ilm_message, const int); - t_ilm_bool (*appendIntArray)(t_ilm_message, const int*, int); - t_ilm_bool (*appendUint)(t_ilm_message, const unsigned int); - t_ilm_bool (*appendUintArray)(t_ilm_message, const unsigned int*, int); - - t_ilm_bool (*sendToClients)(t_ilm_message, t_ilm_client_handle*, int); - t_ilm_bool (*sendToService)(t_ilm_message); - - t_ilm_message (*receive)(t_ilm_int); /* timeout in ms*/ - - t_ilm_const_string (*getMessageName)(t_ilm_message); - t_ilm_message_type (*getMessageType)(t_ilm_message); - t_ilm_const_string (*getSenderName)(t_ilm_message); - t_ilm_client_handle (*getSenderHandle)(t_ilm_message); - - t_ilm_bool (*getBool)(t_ilm_message, t_ilm_bool*); - t_ilm_bool (*getDouble)(t_ilm_message, double*); - t_ilm_bool (*getString)(t_ilm_message, char*); - t_ilm_bool (*getInt)(t_ilm_message, int*); - t_ilm_bool (*getIntArray)(t_ilm_message, int**, int*); - t_ilm_bool (*getUint)(t_ilm_message, unsigned int*); - t_ilm_bool (*getUintArray)(t_ilm_message, unsigned int**, int*); - - t_ilm_bool (*destroyMessage)(t_ilm_message); - - t_ilm_bool (*destroy)(); -}; - -t_ilm_bool loadIpcModule(struct IpcModule* communicator); - -#ifdef __cplusplus -} /* extern "C"*/ -#endif /* __cplusplus*/ - -#endif /* __IPCMODULELOADER_H_*/ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h b/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h deleted file mode 100644 index 3d96d30..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/Log.h +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011 BMW Car IT GmbH. -* Author: Michael Schuldt (michael.schuldt@bmw-carit.de) -* -* 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. -* -* This file incorporates work covered by the following copyright and -* permission notice: -* Apache log4cxx -* Copyright 2004-2007 The Apache Software Foundation -* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You 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 _LOG_H_ -#define _LOG_H_ -#include "LogMessageBuffer.h" -#include <iostream> -#include <fstream> -#include <pthread.h> -#include <map> -typedef enum -{ - LOG_DISABLED = 0, - LOG_ERROR = 1, - LOG_INFO = 2, - LOG_WARNING = 3, - LOG_DEBUG = 4, - LOG_MAX_LEVEL -} LOG_MODES; - -/*The log context content is configuration dependend. Due - to the fact that we don't want to share the config file - in development headers, the real context is established - during the compiliation phase*/ -typedef void* LogContext; - -/* Diagnostic Injection Callback function to wrap dlt_injections for usage with c++ class names */ -typedef void (*diagnosticInjectionCallback)(unsigned int module_id, void *data, unsigned int length, void* userdata); - -class Log -{ -public: - - typedef struct diagnosticCallbackData_t - { - unsigned int module_id; - void *userdata; - diagnosticInjectionCallback diagFunc; - } diagnosticCallbackData; - - typedef std::map<unsigned int, diagnosticCallbackData*> DiagnosticCallbackMap; - - virtual ~Log(); - static LOG_MODES fileLogLevel; - static LOG_MODES consoleLogLevel; - static LOG_MODES dltLogLevel; - static Log* getInstance(); - static DiagnosticCallbackMap* getDiagnosticCallbackMap() - { - return getInstance()->m_diagnosticCallbackMap; - } - void warning(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output); - void info(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output); - void error(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output); - void debug(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output); - void log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output); - void registerDiagnosticInjectionCallback(unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata); - void unregisterDiagnosticInjectionCallback(unsigned int module_id); - LogContext getLogContext(); - static void closeInstance(); -private: - Log(); - void LogToFile(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output); - void LogToConsole(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output); - void LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output); - -private: - std::ofstream* m_fileStream; - pthread_mutex_t m_LogBufferMutex; - LogContext m_logContext; - static DiagnosticCallbackMap* m_diagnosticCallbackMap; - - static Log* m_instance; -}; - -//#define LOG_ERROR(logcontext,module, message) - -#define LOG_ERROR(module, message) { \ - LogMessageBuffer oss_; \ - Log::getInstance()->error(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); } - -//#define LOG_INFO(logcontext,module, message) - -#define LOG_INFO(module, message) { \ - LogMessageBuffer oss_; \ - Log::getInstance()->info(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); } - -//#define LOG_DEBUG(logcontext,module, message) - -#define LOG_DEBUG(module, message) { \ - LogMessageBuffer oss_; \ - Log::getInstance()->debug(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); } - -//#define LOG_WARNING(logcontext,module, message) - -#define LOG_WARNING(module, message) { \ - LogMessageBuffer oss_; \ - Log::getInstance()->warning(Log::getInstance()->getLogContext(), module, oss_.str(oss_<< message)); } -#endif /* _LOG_H_ */ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h b/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h deleted file mode 100644 index aca6166..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/LogMessageBuffer.h +++ /dev/null @@ -1,126 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011 BMW Car IT GmbH. -* Author: Michael Schuldt (michael.schuldt@bmw-carit.de) -* -* 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. -* -* This file incorporates work covered by the following copyright and -* permission notice: -* Apache log4cxx -* Copyright 2004-2007 The Apache Software Foundation -* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You 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 _LOGMESSAGEBUFFER_H_ -#define _LOGMESSAGEBUFFER_H_ - -#include <sstream> -#include <pthread.h> -typedef std::ios_base& (*ios_base_manip)(std::ios_base&); - -class LogMessageBuffer -{ -public: - /** - * Creates a new instance. - */ - LogMessageBuffer(); - /** - * Destructor. - */ - ~LogMessageBuffer(); - - LogMessageBuffer& operator<<(const std::basic_string<char>& msg); - - LogMessageBuffer& operator<<(const char* msg); - - LogMessageBuffer& operator<<(char* msg); - - LogMessageBuffer& operator<<(const char msg); - - std::ostream& operator<<(ios_base_manip manip); - - std::ostream& operator<<(bool val); - - std::ostream& operator<<(short val); - - std::ostream& operator<<(int val); - - std::ostream& operator<<(unsigned int val); - - std::ostream& operator<<(long val); - - std::ostream& operator<<(unsigned long val); - - std::ostream& operator<<(float val); - - std::ostream& operator<<(double val); - - std::ostream& operator<<(long double val); - - std::ostream& operator<<(void* val); - - /** - * Cast to ostream. - */ - operator std::basic_ostream<char>&(); - - const std::basic_string<char>& str(std::basic_ostream<char>& os); - - const std::basic_string<char>& str() const; - - bool hasStream() const; - -private: - /** - * No default copy constructor. - */ - LogMessageBuffer(const LogMessageBuffer&); - - /** - * No assignment operator. - */ - LogMessageBuffer& operator=(const LogMessageBuffer&); - - /** - * Encapsulated std::string. - */ - std::basic_string<char> buf; - - /** - * Encapsulated stream, created on demand. - */ - std::basic_ostringstream<char>* stream; -}; - -template<class V> -std::basic_ostream<char>& operator<<(LogMessageBuffer& os, const V& val) -{ - return ((std::basic_ostream<char>&) os) << val; -} - -#endif /* _LOGMESSAGEBUFFER_H_ */ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h b/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h deleted file mode 100644 index 77cc7b5..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/include/ThreadBase.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * - * 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 __THREADBASE_H__ -#define __THREADBASE_H__ - -#include "ilm_types.h" -#include <pthread.h> - -class ThreadBase -{ -public: - ThreadBase(); - virtual ~ThreadBase(); - - t_ilm_bool threadCreate(); - t_ilm_bool threadInit(); - t_ilm_bool threadStart(); - t_ilm_bool threadStop(); - - pthread_t threadGetId() const; - t_ilm_bool threadIsRunning(); - - // override in inheriting class if required - virtual t_ilm_bool threadInitInThreadContext(); - virtual t_ilm_bool threadDestroyInThreadContext(); - - // implement in inheriting class - virtual t_ilm_bool threadMainLoop() = 0; - -private: - static unsigned int mGlobalThreadCount; - pthread_t mThreadId; - pthread_mutex_t mInitLock; - pthread_mutex_t mRunLock; - t_ilm_bool mRunning; -}; - -#endif // __THREADBASE_H__ diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/Bitmap.cpp b/ivi-layermanagement-examples/LayerManagerUtils/src/Bitmap.cpp deleted file mode 100644 index e0910ab..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/Bitmap.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** -* -* 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 "Bitmap.h" -#include "Log.h" -#include <stdint.h> -#include <sys/stat.h> -#include <stdio.h> -#include <string> -#include <stdlib.h> - -typedef struct BMPHeaderStruct -{ - uint32_t size; // filesize - uint16_t a; - uint16_t b; - uint32_t offset; // offset -} BMPHeader; - -typedef struct headerStruct -{ - uint32_t headersize; - int32_t width; - int32_t height; - uint16_t planes; - uint16_t bits; - uint32_t compress; - uint32_t imagesize; - int32_t xresolution; - int32_t yresolution; - uint32_t color1; - uint32_t color2; -} InfoHeader; - -void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height) -{ - LOG_DEBUG("Bitmap", "writing Bitmap to file:" << FileName); - - BMPHeader bmpHeader; - InfoHeader header; - int imagebytes = width*height*3; - char firstbytes[2]; - firstbytes[0] = 'B'; - firstbytes[1] = 'M'; - bmpHeader.size = 2 + sizeof(BMPHeader) + sizeof(header) + imagebytes; - bmpHeader.a = 0; - bmpHeader.b = 0; - bmpHeader.offset = 2 + sizeof(BMPHeader) + sizeof(header); - header.headersize = sizeof(header); - header.width = width; - header.height = height; - header.planes = 1; - header.bits = 24; // bitmap does not do alpha - header.compress = 0; - header.imagesize = imagebytes; - header.xresolution = 2835; // because of dpi - header.yresolution = 2835; - header.color1 = 0; - header.color2 = 0; - - // make sure parent directory exists - std::size_t currentPos = 0; - std::size_t lastPos = FileName.find_first_of("/", currentPos); - while (lastPos != std::string::npos) - { - std::string directory = FileName.substr(0, lastPos); - LOG_DEBUG("Bitmap", "Creating directory " << directory); - mkdir(directory.c_str(), 0755); - currentPos = lastPos; - lastPos = FileName.find_first_of("/", currentPos + 1); - } - - FILE* file = fopen(FileName.c_str(), "wb"); - - if (file) - { - fwrite(firstbytes, 2, 1, file); - fwrite((void*)&bmpHeader, sizeof(BMPHeader), 1, file); - fwrite((void*)&header, sizeof(header), 1, file); - fwrite(imagedataRGB, header.imagesize, 1, file); - fclose(file); - } - else - { - LOG_DEBUG("Bitmap", "File could not be opened for writing"); - } -} diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/IpcModuleLoader.cpp b/ivi-layermanagement-examples/LayerManagerUtils/src/IpcModuleLoader.cpp deleted file mode 100644 index c5bf8dd..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/IpcModuleLoader.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/************************************************************************** - * - * 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. - * - ****************************************************************************/ -#include "IpcModuleLoader.h" -#include "IpcModule.h" -#include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <dlfcn.h> -#include <errno.h> -#include <dirent.h> /* DIR*/ -#include <string.h> /* strcpy, strcat, strstr*/ - -/* -============================================================================= - global variables -============================================================================= -*/ -const char* gDefaultPluginLookupPath = CMAKE_INSTALL_PREFIX"/lib/layermanager"; -const char* gCommunicatorPluginDirectory = "ipcmodules"; - -/* -============================================================================= - plugin loading -============================================================================= -*/ -t_ilm_bool loadSymbolTable(struct IpcModule* ipcModule, char* path, char* file) -{ - struct ApiFunction - { - const char* name; - void** funcPtr; - }; - - struct ApiFunction ApiFunctionTable[] = - { - { "initClientMode", (void**)&ipcModule->initClientMode }, - { "initServiceMode", (void**)&ipcModule->initServiceMode }, - - { "createMessage", (void**)&ipcModule->createMessage }, - { "createResponse", (void**)&ipcModule->createResponse }, - { "createErrorResponse", (void**)&ipcModule->createErrorResponse }, - { "createNotification", (void**)&ipcModule->createNotification }, - - { "appendBool", (void**)&ipcModule->appendBool }, - { "appendDouble", (void**)&ipcModule->appendDouble }, - { "appendString", (void**)&ipcModule->appendString }, - { "appendInt", (void**)&ipcModule->appendInt }, - { "appendIntArray", (void**)&ipcModule->appendIntArray }, - { "appendUint", (void**)&ipcModule->appendUint }, - { "appendUintArray", (void**)&ipcModule->appendUintArray }, - - { "sendToClients", (void**)&ipcModule->sendToClients }, - { "sendToService", (void**)&ipcModule->sendToService }, - - { "receive", (void**)&ipcModule->receive }, - - { "getMessageName", (void**)&ipcModule->getMessageName }, - { "getMessageType", (void**)&ipcModule->getMessageType }, - { "getSenderName", (void**)&ipcModule->getSenderName }, - { "getSenderHandle", (void**)&ipcModule->getSenderHandle }, - - { "getBool", (void**)&ipcModule->getBool }, - { "getDouble", (void**)&ipcModule->getDouble }, - { "getString", (void**)&ipcModule->getString }, - { "getInt", (void**)&ipcModule->getInt }, - { "getIntArray", (void**)&ipcModule->getIntArray }, - { "getUint", (void**)&ipcModule->getUint }, - { "getUintArray", (void**)&ipcModule->getUintArray }, - - { "destroyMessage", (void**)&ipcModule->destroyMessage }, - - { "destroy", (void**)&ipcModule->destroy } - }; - - const unsigned int apiFunctionCount = sizeof(ApiFunctionTable) / sizeof(struct ApiFunction); - unsigned int symbolCount = 0; - t_ilm_bool returnValue = ILM_FALSE; - void* pluginLibHandle = 0; - char fullFilePath[1024]; - fullFilePath[0] = '\0'; - - snprintf(fullFilePath, sizeof(fullFilePath), "%s/%s", path, file); - - pluginLibHandle = dlopen(fullFilePath, RTLD_LAZY); - - if (pluginLibHandle) - { - unsigned int i = 0; - for (i = 0; i < apiFunctionCount; ++i) - { - struct ApiFunction* func = &ApiFunctionTable[i]; - - *func->funcPtr = dlsym(pluginLibHandle, func->name); - if (*func->funcPtr) - { - symbolCount++; - /*printf("[ OK ] symbol %s\n", func->name);*/ - } - else - { - /*printf("[FAIL] symbol %s\n", func->name);*/ - } - } - } - - if (symbolCount == apiFunctionCount) - { - returnValue = ILM_TRUE; - } - else - { - printf("Error in %s: found %d symbols, expected %d symbols.\n", fullFilePath, symbolCount, apiFunctionCount); - if (0 != errno) - { - printf("--> error: %s\n", strerror(errno)); - } - printf("--> not a valid ipc module\n"); - if (pluginLibHandle) - { - dlclose(pluginLibHandle); - } - } - - /* - * Note: will break plugin. must be done during shutdown, - * but currently there is no unloadIpcModule - * dlclose(pluginLibHandle); - */ - - return returnValue; -} - -t_ilm_bool loadIpcModule(struct IpcModule* communicator) -{ - t_ilm_bool result = ILM_FALSE; - char path[1024]; - DIR *directory; - - /* find communicator client plugin*/ - char* pluginLookupPath = getenv("LM_PLUGIN_PATH"); - if (pluginLookupPath) - { - gDefaultPluginLookupPath = pluginLookupPath; - } - - snprintf(path, sizeof(path), "%s/%s", gDefaultPluginLookupPath, - gCommunicatorPluginDirectory); - - /* open directory*/ - directory = opendir(path); - if (directory) - { - /* iterate content of directory*/ - struct dirent *itemInDirectory = 0; - while ((itemInDirectory = readdir(directory)) && !result) - { - char* fileName = itemInDirectory->d_name; - - if (strstr(fileName, ".so")) - { - result = loadSymbolTable(communicator, path, fileName); - } - } - - closedir(directory); - } - else - { - printf("IpcModuleLoader: Error opening plugin dir %s\n", path); - } - - return result; -} diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/Log.cpp b/ivi-layermanagement-examples/LayerManagerUtils/src/Log.cpp deleted file mode 100644 index 7528849..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/Log.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011 BMW Car IT GmbH. -* Author: Michael Schuldt (michael.schuldt@bmw-carit.de) -* -* 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. -* -* This file incorporates work covered by the following copyright and -* permission notice: -* Apache log4cxx -* Copyright 2004-2007 The Apache Software Foundation -* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You 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 "Log.h" -#include <iomanip> -#include "config.h" -#ifdef WITH_DLT -#include <dlt/dlt.h> -#endif - -Log* Log::m_instance = NULL; -Log::DiagnosticCallbackMap* Log::m_diagnosticCallbackMap = NULL; -LOG_MODES Log::fileLogLevel = LOG_DISABLED; -LOG_MODES Log::consoleLogLevel = LOG_INFO; -#ifdef WITH_DLT -LOG_MODES Log::dltLogLevel = LOG_DEBUG; -#else -LOG_MODES Log::dltLogLevel = LOG_DISABLED; -#endif - - -Log::Log() -{ - // TODO Auto-generated constructor stub - m_fileStream = new std::ofstream("/tmp/LayerManagerService.log"); - pthread_mutex_init(&m_LogBufferMutex, NULL); - Log::m_diagnosticCallbackMap = new Log::DiagnosticCallbackMap; -#ifdef WITH_DLT - m_logContext = new DltContext; - DLT_REGISTER_APP("LMSA", "LayerManagerService"); - DLT_REGISTER_CONTEXT(*((DltContext*)m_logContext), "LMSC", "LayerManagerService"); - DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_DEFAULT); -#else - m_logContext = NULL; -#endif -} - -Log* Log::getInstance() -{ - if (m_instance == NULL) - { - m_instance = new Log(); - } - return m_instance; -} - -void Log::closeInstance() -{ - delete m_instance; - m_instance = NULL; -} - -Log::~Log() -{ - // TODO Auto-generated destructor stub - m_fileStream->close(); - pthread_mutex_destroy(&m_LogBufferMutex); - Log::m_instance = NULL; -#ifdef WITH_DLT - DLT_UNREGISTER_CONTEXT(*((DltContext*)m_logContext)); - delete((DltContext*)m_logContext); - DLT_UNREGISTER_APP(); -#endif - delete m_diagnosticCallbackMap; - m_diagnosticCallbackMap = NULL; - m_logContext = NULL; -} - -void Log::warning(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output) -{ - log(logContext, LOG_WARNING, moduleName, output); -} - -void Log::info(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output) -{ - log(logContext, LOG_INFO, moduleName, output); -} - -void Log::error(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output) -{ - log(logContext, LOG_ERROR, moduleName, output); -} - -void Log::debug(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output) -{ - log(logContext, LOG_DEBUG, moduleName, output); -} - -void Log::log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output) -{ - (void)logContext; - - std::string logString[LOG_MAX_LEVEL] = {"", "ERROR", "INFO", "WARNING", "DEBUG"}; - std::string logOutLevelString = logString[LOG_INFO]; - pthread_mutex_lock(&m_LogBufferMutex); - if (logMode < LOG_MAX_LEVEL) - { - logOutLevelString = logString[logMode]; - } - if (consoleLogLevel >= logMode) - { - LogToConsole(logOutLevelString, moduleName, output); - } - if (fileLogLevel >= logMode) - { - LogToFile(logOutLevelString, moduleName, output); - } -#ifdef WITH_DLT - if (dltLogLevel >= logMode) - { - LogToDltDaemon(logContext, logMode, moduleName, output); - } -#endif - pthread_mutex_unlock(&m_LogBufferMutex); -} - -void Log::LogToFile(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output) -{ - static unsigned int maxLengthModuleName = 0; - static unsigned int maxLengthLogModeName = 0; - - if (moduleName.length() > maxLengthModuleName) - { - maxLengthModuleName = moduleName.length(); - } - - if (logMode.length() > maxLengthLogModeName) - { - maxLengthLogModeName = logMode.length(); - } - - *m_fileStream << std::setw(maxLengthModuleName) << std::left << moduleName << " | " - << std::setw(maxLengthLogModeName) << std::left << logMode << " | " - << output << std::endl; -} - -void Log::LogToConsole(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output) -{ - static unsigned int maxLengthModuleName = 0; - static unsigned int maxLengthLogModeName = 0; - - if (moduleName.length() > maxLengthModuleName) - { - maxLengthModuleName = moduleName.length(); - } - - if (logMode.length() > maxLengthLogModeName) - { - maxLengthLogModeName = logMode.length(); - } - - std::cout << std::setw(maxLengthModuleName) << std::left << moduleName << " | " - << std::setw(maxLengthLogModeName) << std::left << logMode << " | " - << output << std::endl; -} - -LogContext Log::getLogContext() -{ - return m_logContext; -} - -#ifdef WITH_DLT -int dlt_injection_callback(unsigned int module_id, void *data, unsigned int length) -{ - LOG_DEBUG("LOG", "Injection for service " << module_id << " called"); - Log::diagnosticCallbackData *cbData = (*Log::getDiagnosticCallbackMap())[module_id]; - if (cbData) - { - cbData->diagFunc(module_id, data, length, cbData->userdata); - } - return 0; -} -#endif - -void Log::registerDiagnosticInjectionCallback(unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata) -{ - Log::diagnosticCallbackData *cbData = new Log::diagnosticCallbackData; - cbData->module_id = module_id; - cbData->userdata = userdata; - cbData->diagFunc = diagFunc; - (*m_diagnosticCallbackMap)[module_id] = cbData; -#ifdef WITH_DLT - DLT_REGISTER_INJECTION_CALLBACK(*(DltContext*)m_logContext, module_id, dlt_injection_callback); -#endif -} - -void Log::unregisterDiagnosticInjectionCallback(unsigned int module_id) -{ - m_diagnosticCallbackMap->erase(module_id); -} - -#ifdef WITH_DLT - -// DLT macros will fail using -pedantic with -// warning: ISO C++ forbids braced-groups within expressions -#pragma GCC diagnostic ignored "-pedantic" - -void Log::LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output) -{ - std::stringstream oss; - std::string dltString; - static unsigned int maxLengthModuleName = 0; - - if (moduleName.length() > maxLengthModuleName) - { - maxLengthModuleName = moduleName.length(); - } - oss << std::setw(maxLengthModuleName) << std::left << moduleName << " | " - << output << std::endl; - dltString = oss.str(); - - switch (logMode) - { - case LOG_INFO: - DLT_LOG(*((DltContext*)logContext), DLT_LOG_INFO, DLT_STRING(dltString.c_str())); - break; - - case LOG_ERROR: - DLT_LOG(*((DltContext*)logContext), DLT_LOG_ERROR, DLT_STRING(dltString.c_str())); - break; - - case LOG_DEBUG: - DLT_LOG(*((DltContext*)logContext), DLT_LOG_DEBUG, DLT_STRING(dltString.c_str())); - break; - - case LOG_WARNING: - DLT_LOG(*((DltContext*)logContext), DLT_LOG_WARN, DLT_STRING(dltString.c_str())); - break; - - default: - DLT_LOG(*((DltContext*)logContext), DLT_LOG_INFO, DLT_STRING(dltString.c_str())); - } -} -#endif diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/LogMessageBuffer.cpp b/ivi-layermanagement-examples/LayerManagerUtils/src/LogMessageBuffer.cpp deleted file mode 100644 index e1b07f5..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/LogMessageBuffer.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2011 BMW Car IT GmbH. -* Author: Michael Schuldt (michael.schuldt@bmw-carit.de) -* -* 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. -* -* This file incorporates work covered by the following copyright and -* permission notice: -* Apache log4cxx -* Copyright 2004-2007 The Apache Software Foundation -* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You 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 "LogMessageBuffer.h" - -LogMessageBuffer::LogMessageBuffer() -: stream(0) -{ -} - -LogMessageBuffer::~LogMessageBuffer() -{ - if (stream) - { - delete stream; - } -} - -LogMessageBuffer& LogMessageBuffer::operator<<(const std::basic_string<char>& msg) -{ - if (stream) - { - *stream << msg; - } - else - { - buf.append(msg); - } - return *this; -} - -LogMessageBuffer& LogMessageBuffer::operator<<(const char* msg) -{ - const char* actualMsg = msg; - if (!actualMsg) - { - actualMsg = "null"; - } - - if (stream) - { - *stream << actualMsg; - } - else - { - buf.append(actualMsg); - } - return *this; -} - -LogMessageBuffer& LogMessageBuffer::operator<<(char* msg) -{ - return operator<<((const char*) msg); -} - -LogMessageBuffer& LogMessageBuffer::operator<<(const char msg) -{ - if (stream) - { - buf.assign(1, msg); - *stream << buf; - } - else - { - buf.append(1, msg); - } - return *this; -} - -LogMessageBuffer::operator std::basic_ostream<char>&() -{ - if (!stream) - { - stream = new std::basic_ostringstream<char>(); - - if (!buf.empty()) - { - *stream << buf; - } - } - return *stream; -} - -const std::basic_string<char>& LogMessageBuffer::str(std::basic_ostream<char>&) -{ - buf = stream->str(); - return buf; -} - -const std::basic_string<char>& LogMessageBuffer::str() const -{ - return buf; -} - -bool LogMessageBuffer::hasStream() const -{ - return (stream != 0); -} - -std::ostream& LogMessageBuffer::operator<<(ios_base_manip manip) -{ - std::ostream& s = *this; - (*manip)(s); - return s; -} - -std::ostream& LogMessageBuffer::operator<<(bool val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(short val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(int val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(unsigned int val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(long val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(unsigned long val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(float val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(double val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(long double val) -{ - return ((std::ostream&) *this).operator<<(val); -} - -std::ostream& LogMessageBuffer::operator<<(void* val) -{ - return ((std::ostream&) *this).operator<<(val); -} diff --git a/ivi-layermanagement-examples/LayerManagerUtils/src/ThreadBase.cpp b/ivi-layermanagement-examples/LayerManagerUtils/src/ThreadBase.cpp deleted file mode 100644 index 202fd28..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/src/ThreadBase.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*************************************************************************** - * - * 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 "ThreadBase.h" -#include "Log.h" -#include <stdlib.h> -#include <pthread.h> -#include <signal.h> - -//=========================================================================== -// internal data structures -//=========================================================================== -struct ThreadArgument -{ - ThreadBase* obj; - pthread_mutex_t* initLock; - pthread_mutex_t* runLock; - t_ilm_bool* running; -}; - -//=========================================================================== -// static member initialization -//=========================================================================== -unsigned int ThreadBase::mGlobalThreadCount = 1; // main thread already running - -//=========================================================================== -// global thread cleanup function (automatically called on thread shutwon) -//=========================================================================== -static void threadBaseMainLoopCleanup(void* arg) -{ - // destroy in thread context - ((ThreadArgument*)arg)->obj->threadDestroyInThreadContext(); - pthread_mutex_unlock(((ThreadArgument*)arg)->runLock); - *(((ThreadArgument*)arg)->running) = ILM_FALSE; - delete((ThreadArgument*)arg); -} - -//=========================================================================== -// global thread loop function -//=========================================================================== -static void* threadBaseMainLoop(void* arg) -{ - if (!arg) - { - LOG_ERROR("ThreadBase", "invalid thread argument (arg)"); - return NULL; - } - - if (!((ThreadArgument*)arg)->obj) - { - LOG_ERROR("ThreadBase", "invalid thread argument (obj)"); - return NULL; - } - - if (!((ThreadArgument*)arg)->running) - { - LOG_ERROR("ThreadBase", "invalid thread argument (running)"); - return NULL; - } - - // register cleanup function - pthread_cleanup_push(threadBaseMainLoopCleanup, arg); - - // init in thread context - *(((ThreadArgument*)arg)->running) = ((ThreadArgument*)arg)->obj->threadInitInThreadContext(); - - // indicate initialization complete - pthread_mutex_unlock(((ThreadArgument*)arg)->initLock); - - // wait for start permit - pthread_mutex_lock(((ThreadArgument*)arg)->runLock); - - // run thread - while (*(((ThreadArgument*)arg)->running)) - { - *(((ThreadArgument*)arg)->running) = ((ThreadArgument*)arg)->obj->threadMainLoop(); - } - - // execute cleanup handlers - pthread_cleanup_pop(1); - - return NULL; -} - -//=========================================================================== -// class implementation -//=========================================================================== -ThreadBase::ThreadBase() -: mThreadId(0) -, mRunning(ILM_FALSE) -{ - pthread_mutex_init(&mRunLock, NULL); - pthread_mutex_lock(&mRunLock); - - pthread_mutex_init(&mInitLock, NULL); - pthread_mutex_lock(&mInitLock); -} - -ThreadBase::~ThreadBase() -{ - pthread_mutex_unlock(&mInitLock); - pthread_mutex_destroy(&mInitLock); - - pthread_mutex_unlock(&mRunLock); - pthread_mutex_destroy(&mRunLock); -} - -pthread_t ThreadBase::threadGetId() const -{ - return mThreadId; -} - -t_ilm_bool ThreadBase::threadIsRunning() -{ - if (0 == pthread_mutex_trylock(&mRunLock)) - { - pthread_mutex_unlock(&mRunLock); - mRunning = ILM_FALSE; - } - if (0 != pthread_kill(mThreadId, 0)) - { - mRunning = ILM_FALSE; - } - return mRunning; -} - -t_ilm_bool ThreadBase::threadCreate() -{ - pthread_attr_t notificationThreadAttributes; - pthread_attr_init(¬ificationThreadAttributes); - pthread_attr_setdetachstate(¬ificationThreadAttributes, - PTHREAD_CREATE_JOINABLE); - - ThreadArgument* arg = new ThreadArgument(); - arg->obj = this; - arg->runLock = &mRunLock; - arg->initLock = &mInitLock; - arg->running = &mRunning; - - int ret = pthread_create(&mThreadId, - ¬ificationThreadAttributes, - threadBaseMainLoop, - (void*)arg); - if (0 != ret) - { - LOG_ERROR("ThreadBase", "Failed to start thread."); - } - else - { - ++mGlobalThreadCount; - LOG_DEBUG("ThreadBase", "Started thread (now " << mGlobalThreadCount << ")"); - mRunning = ILM_TRUE; - } - - return threadIsRunning(); -} - -t_ilm_bool ThreadBase::threadInit() -{ - return (0 == pthread_mutex_lock(&mInitLock)) ? ILM_TRUE : ILM_FALSE; -} - -t_ilm_bool ThreadBase::threadStart() -{ - return (0 == pthread_mutex_unlock(&mRunLock)) ? ILM_TRUE : ILM_FALSE; -} - -t_ilm_bool ThreadBase::threadStop() -{ - t_ilm_bool result = ILM_TRUE; - - mRunning = threadIsRunning(); - - if (mRunning) - { - LOG_INFO("ThreadBase", "pthread_cancel"); - if (0 != pthread_cancel(mThreadId)) - { - LOG_ERROR("ThreadBase", "Stopping thread failed (cancel)"); - result = ILM_FALSE; - } - else - { - LOG_INFO("ThreadBase", "pthread_join"); - if (0 != pthread_join(mThreadId, NULL)) - { - LOG_ERROR("ThreadBase", "Stopping thread failed (join)"); - result = ILM_FALSE; - } - } - } - - if (result) - { - --mGlobalThreadCount; - LOG_DEBUG("ThreadBase", "Stopped thread (now " << mGlobalThreadCount << ")"); - } - - return result; -} - -//===================================================================================== -// base implementation for overriding in inheriting classes -//===================================================================================== -t_ilm_bool ThreadBase::threadInitInThreadContext() -{ - LOG_DEBUG("ThreadBase", "threadInitInThreadContext (default implementation)"); - return ILM_TRUE; -} - -t_ilm_bool ThreadBase::threadDestroyInThreadContext() -{ - LOG_DEBUG("ThreadBase", "threadDestroyInThreadContext (default implementation)"); - return ILM_TRUE; -} diff --git a/ivi-layermanagement-examples/LayerManagerUtils/tests/BitmapTest.cpp b/ivi-layermanagement-examples/LayerManagerUtils/tests/BitmapTest.cpp deleted file mode 100644 index a02ee4f..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/tests/BitmapTest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * - * 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 <gtest/gtest.h> -#include <stdio.h> - -#include "Bitmap.h" - -#define WIDTH 1 -#define HEIGHT 1 - -char* imageData = new char[3]; - -bool fileExists(std::string filename) -{ - struct stat stFileInfo; - int status = stat(filename.c_str(),&stFileInfo); - return status == 0; -} - -TEST(BitmapTest, WriteBitmapIntoCurrentDirectory) { - const char* filename = "test.bmp"; - writeBitmap(filename, imageData, WIDTH, HEIGHT); - - ASSERT_TRUE(fileExists(filename)); -} - -TEST(BitmapTest, WriteBitmapIntoAbsoluteDirectory) { - const char* filename = "/tmp/test2.bmp"; - writeBitmap(filename, imageData, WIDTH, HEIGHT); - - ASSERT_TRUE(fileExists(filename)); -} - -TEST(BitmapTest, WriteBitmapIntoNonExistingRelativeDirectory) { - const char* filename = "./testa/testb/testc/test2.bmp"; - writeBitmap(filename, imageData, WIDTH, HEIGHT); - - ASSERT_TRUE(fileExists(filename)); -} - -TEST(BitmapTest, WriteBitmapIntoNonExistingAbsoluteDirectory) { - const char* filename = "/tmp/testa/testb/test2.bmp"; - writeBitmap(filename, imageData, WIDTH, HEIGHT); - - ASSERT_TRUE(fileExists(filename)); -} - -TEST(BitmapTest, WriteToFileOrDirectoryNotAllowed) { - const char* invalidFile = "//invalid"; - writeBitmap(invalidFile, imageData, 1, 1); - - // this test ensures that if the bitmap is not writeable nothing else happens -} diff --git a/ivi-layermanagement-examples/LayerManagerUtils/tests/CMakeLists.txt b/ivi-layermanagement-examples/LayerManagerUtils/tests/CMakeLists.txt deleted file mode 100644 index aaccf48..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/tests/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################ -# -# 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) - -if (WITH_TESTS) - - enable_testing() - - project(LayerManagerUtils_Test) - project_type(TEST) - - set(LIBS - ${LIBS} - ${CMAKE_THREAD_LIBS_INIT} - LayerManagerUtils - dl - gtest - ) - - include_directories(${INCLUDE_DIRS}) - - add_executable(${PROJECT_NAME} - BitmapTest.cpp - LogTest.cpp - ) - - target_link_libraries(${PROJECT_NAME} ${LIBS}) - - install(TARGETS ${PROJECT_NAME} - DESTINATION bin - ) - - add_test(LayerManagerUtils ${PROJECT_NAME}) - -endif(WITH_TESTS) diff --git a/ivi-layermanagement-examples/LayerManagerUtils/tests/LogTest.cpp b/ivi-layermanagement-examples/LayerManagerUtils/tests/LogTest.cpp deleted file mode 100644 index 013901c..0000000 --- a/ivi-layermanagement-examples/LayerManagerUtils/tests/LogTest.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/*************************************************************************** - * - * 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 <gtest/gtest.h> -#include <stdio.h> - -#include "Log.h" - -#define WIDTH 1 -#define HEIGHT 1 - -std::string moduleName = "TheModuleName"; -std::string logFileName = "/tmp/LayerManagerService.log"; -int i=0; - -bool checkLogFileForMessage(std::string message) -{ - std::string line; - std::ifstream logFile(logFileName.c_str()); - - if (logFile.is_open()) - { - while ( logFile.good() ) - { - getline (logFile,line); - int position = line.find(message); - if (position >0) - return true; - } - logFile.close(); - } - // did not find the message in any line of the logfile - return false; -} - - -TEST(LogTest, writeAWarning) { - Log::getInstance()->fileLogLevel = LOG_MAX_LEVEL; - LOG_WARNING(moduleName, "writeAWarning"); - - ASSERT_TRUE(checkLogFileForMessage("writeAWarning")); -} - -TEST(LogTest, writeAnError) { - Log::getInstance()->fileLogLevel = LOG_INFO; - LOG_ERROR(moduleName, "writeAnError"); - - ASSERT_TRUE(checkLogFileForMessage("writeAnError")); -} - -TEST(LogTest, writeAnInformation) { - Log::getInstance()->fileLogLevel = LOG_INFO; - LOG_INFO(moduleName, "writeAnInformation"); - - ASSERT_TRUE(checkLogFileForMessage("writeAnInformation")); -} - - -TEST(LogTest, logSomethingWithLowerLogLevel) { - - // when disabled, nothing should ever be logged - Log::getInstance()->fileLogLevel = LOG_DISABLED; - LOG_ERROR(moduleName, "err1"); - ASSERT_FALSE(checkLogFileForMessage("err1")); - - LOG_DEBUG(moduleName, "debug1"); - ASSERT_FALSE(checkLogFileForMessage("debug1")); - - LOG_WARNING(moduleName, "warn1"); - ASSERT_FALSE(checkLogFileForMessage("warn1")); - - LOG_INFO(moduleName, "info1"); - ASSERT_FALSE(checkLogFileForMessage("info1")); - - // when error is set, only higher levels may be logged - Log::getInstance()->fileLogLevel = LOG_ERROR; - LOG_ERROR(moduleName, "err2"); - ASSERT_TRUE(checkLogFileForMessage("err2")); - - LOG_DEBUG(moduleName, "debug2"); - ASSERT_FALSE(checkLogFileForMessage("debug2")); - - LOG_WARNING(moduleName, "warn2"); - ASSERT_FALSE(checkLogFileForMessage("warn2")); - - LOG_INFO(moduleName, "info2"); - ASSERT_FALSE(checkLogFileForMessage("info2")); - - // when debug is set, only higher levels may be logged - Log::getInstance()->fileLogLevel = LOG_DEBUG; - LOG_ERROR(moduleName, "err3"); - ASSERT_TRUE(checkLogFileForMessage("err3")); - - LOG_DEBUG(moduleName, "debug3"); - ASSERT_TRUE(checkLogFileForMessage("debug3")); - - LOG_WARNING(moduleName, "warn3"); - ASSERT_TRUE(checkLogFileForMessage("warn3")); - - LOG_INFO(moduleName, "info3"); - ASSERT_TRUE(checkLogFileForMessage("info3")); - - // when info is set, only higher levels may be logged - Log::getInstance()->fileLogLevel = LOG_INFO; - LOG_ERROR(moduleName, "err4"); - ASSERT_TRUE(checkLogFileForMessage("err4")); - - LOG_DEBUG(moduleName, "debug4"); - ASSERT_FALSE(checkLogFileForMessage("debug4")); - - LOG_WARNING(moduleName, "warn4"); - ASSERT_FALSE(checkLogFileForMessage("warn4")); - - LOG_INFO(moduleName, "info4"); - ASSERT_TRUE(checkLogFileForMessage("info4")); - -} diff --git a/ivi-layermanagement-examples/LayerSceneDescriptionExample/CMakeLists.txt b/ivi-layermanagement-examples/LayerSceneDescriptionExample/CMakeLists.txt deleted file mode 100644 index 590af2c..0000000 --- a/ivi-layermanagement-examples/LayerSceneDescriptionExample/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################ -# -# 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. -# - -############################################################################ - -# examples was moved to -# <src_root>/LayerManagerPlugins/SceneProvider/ExampleSceneProvider
\ No newline at end of file diff --git a/ivi-layermanagement-examples/LayerSceneDescriptionExample/include/LayerSceneProvider.h b/ivi-layermanagement-examples/LayerSceneDescriptionExample/include/LayerSceneProvider.h deleted file mode 100644 index 832ac2b..0000000 --- a/ivi-layermanagement-examples/LayerSceneDescriptionExample/include/LayerSceneProvider.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * - * 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 _LAYERSCENEPROVIDER_H_ -#define _LAYERSCENEPROVIDER_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 /* _LAYERSCENEPROVIDER_H_ */ diff --git a/ivi-layermanagement-examples/LayerSceneDescriptionExample/src/LayerSceneProvider.cpp b/ivi-layermanagement-examples/LayerSceneDescriptionExample/src/LayerSceneProvider.cpp deleted file mode 100644 index 8374014..0000000 --- a/ivi-layermanagement-examples/LayerSceneDescriptionExample/src/LayerSceneProvider.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * - * 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 "LayerSceneProvider.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 "LayerScene.h" -#include "SurfaceCreateCommand.h" -#include "SurfaceSetVisibilityCommand.h" -#include "SurfaceSetOpacityCommand.h" -#include <unistd.h> - -ExampleSceneProvider::LayerSceneProvider(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, 0, 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* createLayerScene(ICommandExecutor* executor) -{ - return new ExampleSceneProvider(executor); -} - -extern "C" void destroyLayerScene(ExampleSceneProvider* p) -{ - delete p; -} diff --git a/weston-ivi-shell/CMakeLists.txt b/weston-ivi-shell/CMakeLists.txt index fb39dfa..92807ec 100644 --- a/weston-ivi-shell/CMakeLists.txt +++ b/weston-ivi-shell/CMakeLists.txt @@ -20,7 +20,6 @@ cmake_minimum_required (VERSION 2.6) project(ivi-controller) -project_type(CORE) find_package(PkgConfig REQUIRED) pkg_check_modules(WAYLAND_SERVER wayland-server REQUIRED) |