diff options
author | Kevron Rees <tripzero.kev@gmail.com> | 2016-04-08 15:09:23 -0700 |
---|---|---|
committer | Kevron Rees <tripzero.kev@gmail.com> | 2016-04-08 15:09:23 -0700 |
commit | cfa575b59daa4caa09310fc6f378878605af972c (patch) | |
tree | 40cee74a601450dae4687344f487fdd8d461ffbc | |
parent | a945ea17cfdaf3e9c044da4e5a270510cf26e632 (diff) | |
parent | c4e2169481c493b542638b55289b3298d8734ba9 (diff) | |
download | automotive-message-broker-cfa575b59daa4caa09310fc6f378878605af972c.tar.gz |
Merge pull request #67 from tripzero/trip
fix can error. fix cmake plugin_install_dir
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/timestamp.cpp | 5 | ||||
-rw-r--r-- | lib/timestamp.h | 3 | ||||
-rw-r--r-- | plugins/common/cansocketbcm.cpp | 4 |
4 files changed, 11 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 26b49337..0fa62aad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ add_definitions(-DPROJECT_SERIES="${PROJECT_SERIES}") set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" ) -set (PLUGIN_INSTALL_PATH "${LIB_INSTALL_DIR}/${PROJECT_NAME}") +set (PLUGIN_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}") set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") set (DOC_INSTALL_DIR "${CMAKE_INSTALL_DOCDIR}/${PROJECT_SERIES}") set (PLUGIN_SEGMENT_INSTALL_PATH "/${CMAKE_INSTALL_SYSCONFDIR}/ambd/plugins.d") diff --git a/lib/timestamp.cpp b/lib/timestamp.cpp index 7b1f5931..9c25902d 100644 --- a/lib/timestamp.cpp +++ b/lib/timestamp.cpp @@ -68,3 +68,8 @@ struct ::timeval amb::Timestamp::toTimeval(const double time) { return { (__time_t) time, (__suseconds_t)fmod(time*1e6, 1e6) }; } + +struct ::bcm_timeval amb::Timestamp::toBcmTimeval(const double time) +{ + return { (long) time, (long)fmod(time*1e6, 1e6) }; +} diff --git a/lib/timestamp.h b/lib/timestamp.h index 0e7d1b6e..d654d3f7 100644 --- a/lib/timestamp.h +++ b/lib/timestamp.h @@ -2,6 +2,7 @@ #define _TIMESTAMP_H___ #include <time.h> +#include <linux/can/bcm.h> namespace amb { @@ -44,6 +45,8 @@ public: static double fromTimeval(const struct ::timeval& tv); static struct ::timeval toTimeval(const double time); + static struct ::bcm_timeval toBcmTimeval(const double time); + public: /*! * \brief instance diff --git a/plugins/common/cansocketbcm.cpp b/plugins/common/cansocketbcm.cpp index d923ce3e..3e7c4a9b 100644 --- a/plugins/common/cansocketbcm.cpp +++ b/plugins/common/cansocketbcm.cpp @@ -255,8 +255,8 @@ bool CANSocketBCM::registerCyclicMessageForReceive(int canId, double minCycleTim hdr.flags = RX_FILTER_ID | RX_CHECK_DLC | SETTIMER | STARTTIMER | RX_ANNOUNCE_RESUME; hdr.nframes = 0; hdr.can_id = canId; - hdr.ival1 = amb::Timestamp::toTimeval(maxCycleTime); - hdr.ival2 = amb::Timestamp::toTimeval(minCycleTime); + hdr.ival1 = amb::Timestamp::toBcmTimeval(maxCycleTime); + hdr.ival2 = amb::Timestamp::toBcmTimeval(minCycleTime); // and write ssize_t nbytes = ::write(mSocket, &hdr, sizeof(hdr)); |