summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-31 12:46:02 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-01 18:22:49 +0200
commit1f4eb8c5562bf5c0bc6ebd1b35977cd71d9b3a83 (patch)
tree0373a64035f894a7b18139306cbf879989d28268 /CAN-binder/low-can-binding/utils
parentc28f479a597de89f38b2bbd155afc26c7f2de822 (diff)
Reworked subscription to integrate filtering.
- Creation of an object which old the subscription context (filter, signal) : low_can_subscription_t - Move socket from can_signal_t to this new object. - Adding a member to can_message_t to transport subscription_id to be able to retrieve it with all the context through running. Change-Id: I87be8cd6c3c93a81040357920d8c081a316800c3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils')
-rw-r--r--CAN-binder/low-can-binding/utils/signals.cpp2
-rw-r--r--CAN-binder/low-can-binding/utils/signals.hpp5
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp1
3 files changed, 5 insertions, 3 deletions
diff --git a/CAN-binder/low-can-binding/utils/signals.cpp b/CAN-binder/low-can-binding/utils/signals.cpp
index 9dd3bfde..02b84054 100644
--- a/CAN-binder/low-can-binding/utils/signals.cpp
+++ b/CAN-binder/low-can-binding/utils/signals.cpp
@@ -39,7 +39,7 @@ namespace utils
/// @brief return the subscribed_signals map.
///
/// @return Map of subscribed signals.
- std::map<std::string, struct afb_event>& signals_manager_t::get_subscribed_signals()
+ std::map<int, std::pair<std::shared_ptr<low_can_subscription_t>, struct afb_event> >& signals_manager_t::get_subscribed_signals()
{
return subscribed_signals_;
}
diff --git a/CAN-binder/low-can-binding/utils/signals.hpp b/CAN-binder/low-can-binding/utils/signals.hpp
index a0fa99d1..54d88938 100644
--- a/CAN-binder/low-can-binding/utils/signals.hpp
+++ b/CAN-binder/low-can-binding/utils/signals.hpp
@@ -27,6 +27,7 @@
#include "../diagnostic/diagnostic-message.hpp"
#include "../binding/low-can-hat.hpp"
+#include "../binding/low-can-cb.hpp"
namespace utils
{
@@ -40,7 +41,7 @@ namespace utils
{
private:
std::mutex subscribed_signals_mutex_;
- std::map<std::string, struct afb_event> subscribed_signals_;
+ std::map<int, std::pair<std::shared_ptr<low_can_subscription_t>, struct afb_event> > subscribed_signals_;
signals_manager_t(); ///< Private constructor to make singleton class.
@@ -48,7 +49,7 @@ namespace utils
static signals_manager_t& instance();
std::mutex& get_subscribed_signals_mutex();
- std::map<std::string, struct afb_event>& get_subscribed_signals();
+ std::map<int, std::pair<std::shared_ptr<low_can_subscription_t>, struct afb_event> >& get_subscribed_signals();
struct signals_found find_signals(const openxc_DynamicField &key);
void find_diagnostic_messages(const openxc_DynamicField &key, std::vector<std::shared_ptr<diagnostic_message_t> >& found_signals);
diff --git a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index 38f48522..1009a421 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
@@ -90,6 +90,7 @@ namespace utils
cm = ::can_message_t::convert_from_frame(msg.frames ,
nbytes-sizeof(struct bcm_msg_head),
timestamp);
+ cm.set_sub_id((int)s.socket());
return s;
}