From 6c988cacd4fa284b0effb12e65c76502565c4248 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 31 May 2017 17:01:54 +0200 Subject: Retrieve signal last value and timestamp at once. Change-Id: I8401030ece94b5e397b6d2b71b29ff4e435d1486 Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/can/can-signals.cpp | 6 ++++++ CAN-binder/low-can-binding/can/can-signals.hpp | 1 + 2 files changed, 7 insertions(+) (limited to 'CAN-binder/low-can-binding/can') diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp index 260d577..fe74115 100644 --- a/CAN-binder/low-can-binding/can/can-signals.cpp +++ b/CAN-binder/low-can-binding/can/can-signals.cpp @@ -165,11 +165,17 @@ bool can_signal_t::get_received() const { return received_; } + float can_signal_t::get_last_value() const { return last_value_; } +std::pair can_signal_t::get_last_value_with_timestamp() const +{ + return std::make_pair(last_value_, frequency_.get_last_tick()); +} + void can_signal_t::set_parent(can_message_definition_t* parent) { parent_ = parent; diff --git a/CAN-binder/low-can-binding/can/can-signals.hpp b/CAN-binder/low-can-binding/can/can-signals.hpp index 2d67f27..d528f6a 100644 --- a/CAN-binder/low-can-binding/can/can-signals.hpp +++ b/CAN-binder/low-can-binding/can/can-signals.hpp @@ -147,6 +147,7 @@ public: SignalEncoder& get_encoder(); bool get_received() const; float get_last_value() const; + std::pair get_last_value_with_timestamp() const; void set_parent(can_message_definition_t* parent); void set_prefix(std::string val); -- cgit 1.2.3-korg