summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <tripzero.kev@gmail.com>2016-04-03 16:36:30 -0700
committerKevron Rees <tripzero.kev@gmail.com>2016-04-03 16:36:30 -0700
commitc4e2169481c493b542638b55289b3298d8734ba9 (patch)
tree73a1a0849e9914857988dc703a2d8ba49cafad13
parente480af61dc4ba531c8113d54bb859d8fc409a1ee (diff)
downloadautomotive-message-broker-c4e2169481c493b542638b55289b3298d8734ba9.tar.gz
fix can error. fix cmake plugin_install_dir
can: add bcm_timestamp conversion. timeval to bcm_timeval conversion doesn't work with new gcc cmake: Fix install path for plugins. Was not being populated properly
-rw-r--r--CMakeLists.txt2
-rw-r--r--lib/timestamp.cpp5
-rw-r--r--lib/timestamp.h3
-rw-r--r--plugins/common/cansocketbcm.cpp4
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));