summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-socket.cpp
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-03-02 11:51:42 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-03-15 17:40:45 +0100
commit2debfc561d3ad517ad0c82ebd18cba8ec78ab6ce (patch)
tree7d0235e2aa8e9d43f45516326045b22d3a0df54e /low-can-binding/binding/low-can-socket.cpp
parent4becc6d7986cf656f10f02ecdd5202b5b0fdddf1 (diff)
Change subscribed signals search to check filters as well
When a new subscription is made, search in existing subscription for a combination of a signal and a filter instead of searching for just a signal. In this way, each subscription will receive signals according to their requesting filter. Bug-AGL: SPEC-1339 Change-Id: I22cb96a2dbaaf48dbd77025ff1610bde151b19b4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-socket.cpp')
-rw-r--r--low-can-binding/binding/low-can-socket.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/low-can-binding/binding/low-can-socket.cpp b/low-can-binding/binding/low-can-socket.cpp
index c479a0ad..8a8efbf7 100644
--- a/low-can-binding/binding/low-can-socket.cpp
+++ b/low-can-binding/binding/low-can-socket.cpp
@@ -62,6 +62,11 @@ const std::shared_ptr<can_signal_t> low_can_socket_t::get_can_signal() const
return can_signal_;
}
+bool low_can_socket_t::is_signal_subscription_corresponding(const std::shared_ptr<can_signal_t> can_signal, const struct event_filter_t& event_filter) const
+{
+ return can_signal_ == can_signal && event_filter_ == event_filter;
+}
+
const std::vector<std::shared_ptr<diagnostic_message_t> > low_can_socket_t::get_diagnostic_message() const
{
return diagnostic_message_;
@@ -235,7 +240,7 @@ int low_can_socket_t::create_rx_filter(std::shared_ptr<can_signal_t> sig)
CAN_MAX_DLEN);
struct timeval freq, timeout = {0, 0};
- frequency_clock_t f = std::isnan(event_filter_.frequency) ? can_signal_->get_frequency() : frequency_clock_t(event_filter_.frequency);
+ frequency_clock_t f = event_filter_.frequency == 0 ? can_signal_->get_frequency() : frequency_clock_t(event_filter_.frequency);
freq = f.get_timeval_from_period();
utils::simple_bcm_msg bcm_msg = make_bcm_head(RX_SETUP, can_signal_->get_message()->get_id(), SETTIMER|RX_NO_AUTOTIMER, timeout, freq);