Handle project new architecture using new CMakeFile
authorRomain Forlot <romain.forlot@iot.bzh>
Tue, 11 Apr 2017 10:55:23 +0000 (12:55 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Tue, 11 Apr 2017 10:55:23 +0000 (12:55 +0200)
Change-Id: I672a9b49d9d5a3953ba6dccaafbbd738839f64a6
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
# Conflicts:
# low-can-binding/libs/bitfield-c
# low-can-binding/libs/isotp-c
# low-can-binding/libs/openxc-message-format

52 files changed:
.gitmodules
CMakeLists.txt
etc/config.cmake [new file with mode: 0644]
etc/export.map [moved from src/export.map with 100% similarity]
low-can-binding/CMakeLists.txt [new file with mode: 0644]
low-can-binding/can/can-bus-dev.cpp [moved from src/can/can-bus-dev.cpp with 100% similarity]
low-can-binding/can/can-bus-dev.hpp [moved from src/can/can-bus-dev.hpp with 100% similarity]
low-can-binding/can/can-bus.cpp [moved from src/can/can-bus.cpp with 100% similarity]
low-can-binding/can/can-bus.hpp [moved from src/can/can-bus.hpp with 100% similarity]
low-can-binding/can/can-command.hpp [moved from src/can/can-command.hpp with 100% similarity]
low-can-binding/can/can-decoder.cpp [moved from src/can/can-decoder.cpp with 100% similarity]
low-can-binding/can/can-decoder.hpp [moved from src/can/can-decoder.hpp with 100% similarity]
low-can-binding/can/can-message-definition.cpp [moved from src/can/can-message-definition.cpp with 100% similarity]
low-can-binding/can/can-message-definition.hpp [moved from src/can/can-message-definition.hpp with 100% similarity]
low-can-binding/can/can-message-set.cpp [moved from src/can/can-message-set.cpp with 100% similarity]
low-can-binding/can/can-message-set.hpp [moved from src/can/can-message-set.hpp with 100% similarity]
low-can-binding/can/can-message.cpp [moved from src/can/can-message.cpp with 100% similarity]
low-can-binding/can/can-message.hpp [moved from src/can/can-message.hpp with 100% similarity]
low-can-binding/can/can-signals.cpp [moved from src/can/can-signals.cpp with 100% similarity]
low-can-binding/can/can-signals.hpp [moved from src/can/can-signals.hpp with 100% similarity]
low-can-binding/configuration-generated.cpp [new file with mode: 0644]
low-can-binding/configuration.cpp [moved from src/configuration.cpp with 100% similarity]
low-can-binding/configuration.hpp [moved from src/configuration.hpp with 100% similarity]
low-can-binding/diagnostic/active-diagnostic-request.cpp [moved from src/diagnostic/active-diagnostic-request.cpp with 100% similarity]
low-can-binding/diagnostic/active-diagnostic-request.hpp [moved from src/diagnostic/active-diagnostic-request.hpp with 100% similarity]
low-can-binding/diagnostic/diagnostic-manager.cpp [moved from src/diagnostic/diagnostic-manager.cpp with 100% similarity]
low-can-binding/diagnostic/diagnostic-manager.hpp [moved from src/diagnostic/diagnostic-manager.hpp with 100% similarity]
low-can-binding/diagnostic/diagnostic-message.cpp [moved from src/diagnostic/diagnostic-message.cpp with 100% similarity]
low-can-binding/diagnostic/diagnostic-message.hpp [moved from src/diagnostic/diagnostic-message.hpp with 100% similarity]
low-can-binding/libs/bitfield-c [moved from src/libs/bitfield-c with 100% similarity]
low-can-binding/libs/isotp-c [moved from src/libs/isotp-c with 100% similarity]
low-can-binding/libs/nanopb [new submodule]
low-can-binding/libs/openxc-message-format [moved from src/libs/openxc-message-format with 100% similarity]
low-can-binding/libs/uds-c [new submodule]
low-can-binding/low-can-binding.cpp [moved from src/low-can-binding.cpp with 100% similarity]
low-can-binding/low-can-binding.hpp [moved from src/low-can-binding.hpp with 100% similarity]
low-can-binding/packaging/wgt/config.xml [moved from src/config.xml.in with 100% similarity]
low-can-binding/packaging/wgt/etc/can_buses.json [moved from src/can_buses.json.in with 100% similarity]
low-can-binding/packaging/wgt/icon.png [moved from src/icon.png with 100% similarity]
low-can-binding/subCMakeLists.txt [moved from src/CMakeLists.txt with 81% similarity]
low-can-binding/utils/config-parser.cpp [moved from src/utils/config-parser.cpp with 100% similarity]
low-can-binding/utils/config-parser.hpp [moved from src/utils/config-parser.hpp with 100% similarity]
low-can-binding/utils/openxc-utils.cpp [moved from src/utils/openxc-utils.cpp with 100% similarity]
low-can-binding/utils/openxc-utils.hpp [moved from src/utils/openxc-utils.hpp with 100% similarity]
low-can-binding/utils/signals.cpp [moved from src/utils/signals.cpp with 100% similarity]
low-can-binding/utils/signals.hpp [moved from src/utils/signals.hpp with 100% similarity]
low-can-binding/utils/socket.cpp [moved from src/utils/socket.cpp with 100% similarity]
low-can-binding/utils/socket.hpp [moved from src/utils/socket.hpp with 100% similarity]
low-can-binding/utils/timer.cpp [moved from src/utils/timer.cpp with 100% similarity]
low-can-binding/utils/timer.hpp [moved from src/utils/timer.hpp with 100% similarity]
src/libs/nanopb [deleted submodule]
src/libs/uds-c [deleted submodule]

index de99e87..74a13e8 100644 (file)
@@ -1,15 +1,15 @@
-[submodule "src/libs/openxc-message-format"]
-       path = src/libs/openxc-message-format
-       url = https://github.com/openxc/openxc-message-format.git
-[submodule "src/libs/nanopb"]
-       path = src/libs/nanopb
+[submodule "low-can-binding/libs/openxc-message-format"]
+       path = low-can-binding/libs/openxc-message-format
+       url = https://github.com/openxc/openxc-message-format
+[submodule "low-can-binding/libs/nanopb"]
+       path = low-can-binding/libs/nanopb
        url = https://github.com/nanopb/nanopb.git
-[submodule "src/libs/uds-c"]
-       path = src/libs/uds-c
+[submodule "low-can-binding/libs/uds-c"]
+       path = low-can-binding/libs/uds-c
        url = https://github.com/openxc/uds-c.git
-[submodule "src/libs/bitfield-c"]
-       path = src/libs/bitfield-c
+[submodule "low-can-binding/libs/bitfield-c"]
+       path = low-can-binding/libs/bitfield-c
        url = https://github.com/openxc/bitfield-c.git
-[submodule "src/libs/isotp-c"]
-       path = src/libs/isotp-c
-       url = https://github.com/openxc/isotp-c.git
+[submodule "low-can-binding/libs/isotp-c"]
+       path = low-can-binding/libs/isotp-c
+       url = https://github.com/openxc/isotp-c
index 233ee69..4ba6136 100644 (file)
@@ -1,8 +1,7 @@
 ###########################################################################
-# Copyright 2016 IoT.bzh
+# Copyright 2015, 2016, 2017 IoT.bzh
 #
-# author: José Bollo <jose.bollo@iot.bzh>
-# author: Stéphane Desneux <stephane.desneux@iot.bzh>
+# author: Fulup Ar Foll <fulup@iot.bzh>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # limitations under the License.
 ###########################################################################
 
-cmake_minimum_required(VERSION 3.3)
-project(low-can-binding)
-add_subdirectory(src)
+
+#--------------------------------------------------------------------------
+#  WARNING: 
+#     Do not change this cmake template
+#     Customise your preferences in "./etc/config.cmake"
+#--------------------------------------------------------------------------
+
+
+# Generic useful macro
+# -----------------------
+macro(PROJECT_TARGET_ADD TARGET_NAME)
+       set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS)
+endmacro(PROJECT_TARGET_ADD)
+
+macro(defstr name value)
+       add_definitions(-D${name}=${value})
+endmacro(defstr)
+
+macro(setc name value)
+       if(NOT DEFINED ${name})
+       set(${name} ${value})
+       endif(NOT DEFINED ${name})
+endmacro(setc)
+
+macro(fill_include_dir path)
+       file(GLOB_RECURSE dirlist LIST_DIRECTORIES true "${path}/*")
+       foreach(filename ${dirlist})
+               if(IS_DIRECTORY ${filename})
+                       include_directories(${filename})
+               endif(IS_DIRECTORY ${filename})
+       endforeach()
+endmacro(fill_include_dir)
+
+function(find_source_files path)
+       file(GLOB_RECURSE filelist "${path}/*.[cpx]")
+       foreach(filename ${filelist})
+               if(NOT ${filename} MATCHES ".*(test|example|sample).*")
+                       string(APPEND sources "${filename};")
+               endif(NOT ${filename} MATCHES ".*(test|example|sample).*")
+       endforeach()
+       set(sources_files ${sources} PARENT_SCOPE)
+endfunction(find_source_files)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
+setc(CMAKE_BUILD_TYPE Debug)
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CMP0048 1)
+
+# Compiler selection should append before project definition
+# -----------------------------------------------------------
+foreach (GCC_VERSION "6" "5")
+       execute_process(COMMAND gcc-${GCC_VERSION} -dumpversion RESULT_VARIABLE GCCRC OUTPUT_QUIET ERROR_QUIET)
+       if(GCCRC EQUAL 0)
+               set(CMAKE_C_COMPILER "gcc-${GCC_VERSION}")
+               set(CMAKE_CXX_COMPILER "g++-${GCC_VERSION}")
+               set(CMAKE_C_VERSION ${GCC_VERSION})
+               break()
+       endif(GCCRC EQUAL 0)
+endforeach(GCC_VERSION)
+
+# Include project configuration
+# ------------------------------
+include(${CMAKE_CURRENT_SOURCE_DIR}/etc/config.cmake)
+project(${NAME} VERSION ${VERSION})
+setc(PROJECT_PRETTY_NAME "${PRETTY_NAME}")
+setc(PROJECT_DESCRIPTION "${DESCRIPTION}")
+setc(PROJECT_WGT_DIR "packaging/wgt")
+setc(PROJECT_LIBDIR "libs")
+setc(PROJECT_RESOURCES "data")
+
+message(STATUS "")
+message(STATUS "Project=${PROJECT_NAME}/${VERSION}[${PRETTY_NAME} ${DESCRIPTION}]")
+message(STATUS "")
+message(STATUS "gcc/g++ version-${CMAKE_C_VERSION}.x selected")
+
+INCLUDE(FindPkgConfig)
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+INCLUDE(GNUInstallDirs)
+
+# Default compilation options
+############################################################################
+link_libraries(-Wl,--as-needed -Wl,--gc-sections)
+add_compile_options(-Wall -Wextra -Wconversion)
+add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
+add_compile_options(-Wno-sign-compare -Wno-sign-conversion)
+add_compile_options(-Werror=maybe-uninitialized)
+add_compile_options(-Werror=implicit-function-declaration)
+add_compile_options(-ffunction-sections -fdata-sections)
+add_compile_options(-fPIC)
+add_compile_options(-g)
+
+setc(CMAKE_C_FLAGS_PROFILING   "-g -O2 -pg -Wp,-U_FORTIFY_SOURCE")
+setc(CMAKE_C_FLAGS_DEBUG       "-g -O2 -ggdb -Wp,-U_FORTIFY_SOURCE")
+setc(CMAKE_C_FLAGS_RELEASE     "-O2")
+setc(CMAKE_C_FLAGS_CCOV        "-g -O2 --coverage")
+setc(CMAKE_INSTALL_PREFIX      "${CMAKE_SOURCE_DIR}/Install")
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable]
+setc(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1)
+
+# Loop on required package and add options
+foreach (PKG_CONFIG ${PKG_REQUIRED_LIST})
+       PKG_CHECK_MODULES(${PKG_CONFIG} REQUIRED ${PKG_CONFIG})
+
+       INCLUDE_DIRECTORIES(${${PKG_CONFIG}_INCLUDE_DIRS})
+       list (APPEND link_libraries ${${PKG_CONFIG}_LIBRARIES})
+       add_compile_options (${${PKG_CONFIG}_CFLAGS})
+endforeach(PKG_CONFIG)
+
+# Optional LibEfence Malloc debug library
+IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
+CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE)
+IF(HAVE_LIBEFENCE)
+       MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...")
+       SET(libefence_LIBRARIES "-lefence")
+       list (APPEND link_libraries libefence_LIBRARIES})
+ENDIF(HAVE_LIBEFENCE)
+ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
+
+# set default include directories
+INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS})
+
+# If no install dir try to guest some smart default
+if(BINDINGS_INSTALL_PREFIX)
+       set(BINDINGS_INSTALL_DIR ${BINDINGS_INSTALL_PREFIX}/${PROJECT_NAME})
+else()
+       set(BINDINGS_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME})
+endif()
+
+# Default Linkflag
+if(NOT BINDINGS_LINK_FLAG)
+       set(BINDINGS_LINK_FLAG "-Wl,--version-script=${CMAKE_SOURCE_DIR}/etc/export.map")
+endif()
+
+# Bindings to compile
+# --------------------
+file(GLOB filelist "[A-z]*")
+foreach(filename ${filelist})
+if(EXISTS "${filename}/CMakeLists.txt")
+       add_subdirectory(${filename})
+endif(EXISTS "${filename}/CMakeLists.txt")
+endforeach()
+
+# Add a dummy target to enable global dependency order
+# -----------------------------------------------------
+if(EXTRA_DEPENDENCIES_ORDER)
+       set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies)
+       add_custom_target(${DEPENDENCIES_TARGET} ALL
+               DEPENDS ${EXTRA_DEPENDENCY_ORDER} 
+       )
+endif()
+
+# Cmake does not maintain targets list before 3.7
+# -------------------------------------------------
+if(${CMAKE_VERSION} VERSION_LESS 3.7)
+       set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
+else()
+       get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
+endif()
+
+# Print developer helper message when everything is done
+# -------------------------------------------------------
+if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
+       add_custom_target(${PROJECT_NAME}_done ALL
+               DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
+               COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
+       )
+endif()
diff --git a/etc/config.cmake b/etc/config.cmake
new file mode 100644 (file)
index 0000000..dc695b4
--- /dev/null
@@ -0,0 +1,75 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# 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.
+###########################################################################
+
+# Project Info
+# ------------------
+set(NAME low-can-binding)
+set(VERSION "1.0")
+set(PRETTY_NAME "Low level CAN binding")
+set(DESCRIPTION "Expose CAN Low Level APIs through AGL Framework")
+set(URL "https://github.com/iotbzh/CAN_signaling")
+set(PROJECT_ICON "icon.png")
+
+# Compilation Mode (DEBUG, RELEASE)
+# ----------------------------------
+setc(CMAKE_BUILD_TYPE "DEBUG")
+
+# PKG_CONFIG required packages
+# -----------------------------
+set (PKG_REQUIRED_LIST 
+       json-c
+       libsystemd
+       afb-daemon
+)
+
+# Static constante definition
+# -----------------------------
+add_compile_options(-D_REENTRANT)
+add_compile_options(-DPB_FIELD_16BIT)
+
+# Print a helper message when every thing is finished
+setc(CLOSING_MESSAGE "Test with: afb-daemon --ldpaths=\$\$(pwd)/package/lib --port=1234 --roothttp=\$\$(pwd)/package/htdocs --tracereq=common --token=\"\" --verbose")
+# ----------------------------------------------------
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
+# ---------------------------------------------------------------------
+setc(CMAKE_INSTALL_PREFIX ${HOME}/opt)
+setc(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+setc(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+
+# Optional dependencies order
+# ---------------------------
+#set(EXTRA_DEPENDENCIES_ORDER target1 target2 ...)
+
+# Optional Extra global include path
+# -----------------------------------
+#set(EXTRA_INCLUDE_DIRS incdir1 incdir2 ...)
+
+# Optional extra libraries
+# -------------------------
+set(EXTRA_LINK_LIBRARIES nanopb bitfield-c isotp-c uds-c openxc-message-format)
+
+# Optional force binding installation
+# ------------------------------------
+# set(BINDINGS_INSTALL_PREFIX DestinationPath )
+
+# Optional force binding Linking flag
+# ------------------------------------
+# set(BINDINGS_LINK_FLAG LinkOptions )
+
+
similarity index 100%
rename from src/export.map
rename to etc/export.map
diff --git a/low-can-binding/CMakeLists.txt b/low-can-binding/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ae035c9
--- /dev/null
@@ -0,0 +1,81 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# 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.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(low-can-binding)
+
+       # Define project Targets
+       fill_include_dir(${PROJECT_LIBDIR})
+       file(GLOB filelist "${PROJECT_LIBDIR}/*")
+       foreach(filename ${filelist})
+               if(IS_DIRECTORY ${filename})
+                       include_directories(${filename})
+                       STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename})
+                       find_source_files(${PROJECT_LIBDIR})
+                       add_library(${shortname} STATIC ${sources_files})
+               endif(IS_DIRECTORY ${filename})
+       endforeach()
+       
+       add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp configuration.cpp configuration-generated.cpp
+               can/can-bus.cpp can/can-bus-dev.cpp can/can-message-set.cpp can/can-message-definition.cpp can/can-message.cpp can/can-signals.cpp can/can-decoder.cpp
+               diagnostic/diagnostic-message.cpp diagnostic/diagnostic-manager.cpp diagnostic/active-diagnostic-request.cpp
+               utils/signals.cpp utils/openxc-utils.cpp utils/timer.cpp utils/socket.cpp)
+
+       # Binder exposes a unique public entry point
+       SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+       PREFIX ""
+       LINK_FLAGS ${BINDINGS_LINK_FLAG}
+               OUTPUT_NAME ${PROJECT_NAME}
+       )
+
+       # Library dependencies (include updates automatically)
+       TARGET_LINK_LIBRARIES(${PROJECT_NAME}
+               ${EXTRA_LINK_LIBRARIES}
+               ${link_libraries}
+       )
+
+       # installation directory
+       INSTALL(TARGETS ${PROJECT_NAME}
+               LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR})
+
+       # WGT packaging
+       message(STATUS "Creation of ${PROJECT_NAME}.wgt package for AppFW")
+
+       configure_file(${PROJECT_WGT_DIR}/config.xml config.xml)
+
+       if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/etc")
+               file(GLOB conf_files "${PROJECT_WGT_DIR}/etc/*")
+               foreach(filename ${conf_files})
+                       STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename})
+                       message(STATUS "Copying config file ${shortname}")
+                       configure_file(${filename} ${shortname})
+               endforeach()
+       endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_WGT_DIR}/etc")
+
+       add_custom_command(
+               OUTPUT ${PROJECT_NAME}.wgt
+               DEPENDS ${PROJECT_NAME} ${EXTRA_LINK_LIBRARIES} ${conf_files} ${PROJECT_WGT_DIR}/config.xml
+               COMMAND rm -rf package
+               COMMAND mkdir -p package/lib package/htdocs package/etc
+               COMMAND cp config.xml package/
+               COMMAND cp ${conf_files} package/etc
+               COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/packaging/wgt/${PROJECT_ICON} package/icon.png
+               COMMAND cp ${PROJECT_NAME}.so package/lib
+               COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt package
+       )
+       add_custom_target(widget ALL DEPENDS ${PROJECT_NAME}.wgt)
\ No newline at end of file
diff --git a/low-can-binding/configuration-generated.cpp b/low-can-binding/configuration-generated.cpp
new file mode 100644 (file)
index 0000000..2e96570
--- /dev/null
@@ -0,0 +1,350 @@
+#include "configuration.hpp"
+#include "can/can-decoder.hpp"
+
+configuration_t::configuration_t()
+       : can_message_set_{{0, "example", 0, 1, 5, 0, 20}}
+       , can_message_definition_
+       {
+               {
+                       can_message_definition_t(0, "can0", 0x620, can_message_format_t::STANDARD, frequency_clock_t(0.00000f), true)
+               }
+       }
+       , can_signals_
+       {
+               {
+                       {
+                               0,
+                               0,
+                               "doors.coffer.open",
+                               88,
+                               1,
+                               0.00000f, 
+                               0, 
+                               0,
+                               0,
+                               frequency_clock_t(0.00000f),
+                               true,
+                               false,
+                               {
+                               },
+                               false,
+                               decoder_t::booleanDecoder,
+                               nullptr,
+                               false
+                       },
+                       {
+                               0,
+                               0,
+                               "doors.driver.open",
+                               78,
+                               1,
+                               0.00000f, 
+                               0, 
+                               0,
+                               0,
+                               frequency_clock_t(0.00000f),
+                               true,
+                               false,
+                               {
+                               },
+                               false,
+                               decoder_t::booleanDecoder,
+                               nullptr,
+                               false
+                       },
+                       {
+                               0,
+                               0,
+                               "doors.passenger.open",
+                               79,
+                               1,
+                               0.00000f, 
+                               0, 
+                               0,
+                               0,
+                               frequency_clock_t(0.00000f),
+                               true,
+                               false,
+                               {
+                               },
+                               false,
+                               decoder_t::booleanDecoder,
+                               nullptr,
+                               false
+                       },
+                       {
+                               0,
+                               0,
+                               "doors.rearleft.open",
+                               86,
+                               1,
+                               0.00000f, 
+                               0, 
+                               0,
+                               0,
+                               frequency_clock_t(0.00000f),
+                               true,
+                               false,
+                               {
+                               },
+                               false,
+                               decoder_t::booleanDecoder,
+                               nullptr,
+                               false
+                       },
+                       {
+                               0,
+                               0,
+                               "doors.rearright.open",
+                               85,
+                               4,
+                               0.00000f, 
+                               0, 
+                               0,
+                               0,
+                               frequency_clock_t(0.00000f),
+                               true,
+                               false,
+                               {
+                               },
+                               false,
+                               decoder_t::booleanDecoder,
+                               nullptr,
+                               false
+                       }
+               }
+       }
+       , diagnostic_messages_
+       {
+               {
+                       {
+                               4,
+                               "engine.load",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               5,
+                               "engine.coolant.temperature",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               10,
+                               "fuel.pressure",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               11,
+                               "intake.manifold.pressure",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               12,
+                               "engine.speed",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               13,
+                               "vehicle.speed",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               15,
+                               "intake.air.temperature",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               16,
+                               "mass.airflow",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               17,
+                               "throttle.position",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               31,
+                               "running.time",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               45,
+                               "EGR.error",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               0.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               47,
+                               "fuel.level",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               51,
+                               "barometric.pressure",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               76,
+                               "commanded.throttle.position",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               82,
+                               "ethanol.fuel.percentage",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               90,
+                               "accelerator.pedal.position",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               91,
+                               "hybrid.battery-pack.remaining.life",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               5.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               92,
+                               "engine.oil.temperature",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               94,
+                               "engine.fuel.rate",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       },
+                       {
+                               99,
+                               "engine.torque",
+                               0,
+                               0,
+                               UNIT::INVALID,
+                               1.00000f,
+                               decoder_t::decode_obd2_response,
+                               nullptr,
+                               true
+                       }
+               }
+       }
+{
+}
+
+const std::string configuration_t::get_diagnostic_bus() const
+{
+       return "can0";
+}
+
+
diff --git a/low-can-binding/libs/nanopb b/low-can-binding/libs/nanopb
new file mode 160000 (submodule)
index 0000000..651bdc4
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 651bdc45f2180b17c132470ff1a3a515dbffaa78
diff --git a/low-can-binding/libs/uds-c b/low-can-binding/libs/uds-c
new file mode 160000 (submodule)
index 0000000..ca20db3
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit ca20db3dd978871bbb9f01f3c862b510c03d1dc4
similarity index 81%
rename from src/CMakeLists.txt
rename to low-can-binding/subCMakeLists.txt
index 4c4132b..23869ef 100644 (file)
@@ -70,10 +70,22 @@ link_libraries(${EXTRAS_LIBRARIES})
 ###########################################################################
 # the library used by the binding : openxc, bitfield, uds, isotp
 
-add_library(bitfield STATIC ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/8byte.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitarray.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitfield.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/read.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/write.c)
-add_library(isotp STATIC ${PROJECT_LIBDIR}/isotp-c/src/isotp/isotp.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/receive.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/send.c)
-add_library(uds STATIC ${PROJECT_LIBDIR}/uds-c/src/uds/extras.c ${PROJECT_LIBDIR}/uds-c/src/uds/uds.c)
-add_library(openxc STATIC ${PROJECT_LIBDIR}/openxc-message-format/gen/cpp/openxc.pb.c ${PROJECT_LIBDIR}/nanopb/pb_encode.c ${PROJECT_LIBDIR}/nanopb/pb_decode.c ${PROJECT_LIBDIR}/nanopb/pb_common.c)
+# Bindings to compile
+# --------------------
+file(GLOB filelist "${PROJECT_LIBDIR}/*")
+foreach(filename ${filelist})
+  if(IS_DIRECTORY ${filename})
+    message(STATUS "${filename}")
+    file(GLOB_RECURSE c_list "*.[chpx]")
+    string(REGEX REPLACE "^.*\/(.*)$" "\\1" LIB_NAME ${filename})
+    add_library(${LIB_NAME} STATIC ${c_list})
+  endif(IS_DIRECTORY ${filename})
+endforeach()
+
+#add_library(bitfield STATIC ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/8byte.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitarray.c ${PROJECT_LIBDIR}/bitfield-c/src/bitfield/bitfield.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/read.c ${PROJECT_LIBDIR}/bitfield-c/src/canutil/write.c)
+#add_library(isotp STATIC ${PROJECT_LIBDIR}/isotp-c/src/isotp/isotp.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/receive.c ${PROJECT_LIBDIR}/isotp-c/src/isotp/send.c)
+#add_library(uds STATIC ${PROJECT_LIBDIR}/uds-c/src/uds/extras.c ${PROJECT_LIBDIR}/uds-c/src/uds/uds.c)
+#add_library(openxc STATIC ${PROJECT_LIBDIR}/openxc-message-format/gen/cpp/openxc.pb.c ${PROJECT_LIBDIR}/nanopb/pb_encode.c ${PROJECT_LIBDIR}/nanopb/pb_decode.c ${PROJECT_LIBDIR}/nanopb/pb_common.c)
 ###########################################################################
 # the binding for afb
 
@@ -83,7 +95,7 @@ add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp configuration.cpp configu
        can/can-bus.cpp can/can-bus-dev.cpp can/can-message-set.cpp can/can-message-definition.cpp can/can-message.cpp can/can-signals.cpp can/can-decoder.cpp
        diagnostic/diagnostic-message.cpp diagnostic/diagnostic-manager.cpp diagnostic/active-diagnostic-request.cpp
        utils/signals.cpp utils/openxc-utils.cpp utils/timer.cpp utils/socket.cpp)
-target_link_libraries(${PROJECT_NAME} pthread bitfield uds isotp openxc)
+target_link_libraries(${PROJECT_NAME} pthread bitfield-c uds-c isotp-c openxc-message-format)
 
 set_target_properties(${PROJECT_NAME} PROPERTIES
        PREFIX ""
diff --git a/src/libs/nanopb b/src/libs/nanopb
deleted file mode 160000 (submodule)
index ffe4aff..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit ffe4aff87cc3a15863c09aa808adf2381c8f2fb7
diff --git a/src/libs/uds-c b/src/libs/uds-c
deleted file mode 160000 (submodule)
index e506334..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e506334e270d77b20c0bc259ac6c7d8c9b702b7a