From 2debfc561d3ad517ad0c82ebd18cba8ec78ab6ce Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Fri, 2 Mar 2018 11:51:42 +0100 Subject: 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 --- low-can-binding/binding/low-can-socket.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'low-can-binding/binding/low-can-socket.hpp') diff --git a/low-can-binding/binding/low-can-socket.hpp b/low-can-binding/binding/low-can-socket.hpp index 018b3076..71731b30 100644 --- a/low-can-binding/binding/low-can-socket.hpp +++ b/low-can-binding/binding/low-can-socket.hpp @@ -32,7 +32,10 @@ struct event_filter_t float frequency; ///< frequency - Maximum frequency which will be received and pushed a subscribed event. float min; ///< min - Minimum value that the signal don't have to go below to be pushed. float max; ///< max - Maximum value that the signal don't have to go above to be pushed. - event_filter_t() : frequency{NAN}, min{NAN}, max{NAN} {} + event_filter_t() : frequency{0}, min{-__FLT_MAX__}, max{__FLT_MAX__} {}; + bool operator==(const event_filter_t& ext) const { + return frequency == ext.frequency && min == ext.min && max == ext.max; + } }; /// @brief An object storing socket to CAN to be used to write on it. @@ -62,6 +65,7 @@ public: int get_index() const; const std::shared_ptr get_can_signal() const; + bool is_signal_subscription_corresponding(const std::shared_ptr, const struct event_filter_t& event_filter) const; const std::shared_ptr get_diagnostic_message(uint32_t pid) const; const std::vector > get_diagnostic_message() const; const std::shared_ptr get_diagnostic_message(const std::string& name) const; -- cgit 1.2.3-korg