From 72305e67ee45ba6b56bca48b17303bf0322a8209 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 9 Mar 2017 10:43:30 +0100 Subject: Fix: wrong signature due to reference discarding "const". Change-Id: I7dada9d01eb8619c3807647b6df378dd147bb7fb Signed-off-by: Romain Forlot --- src/configuration.cpp | 29 ++++++++++++++++------------- src/configuration.hpp | 20 ++++++++++---------- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/configuration.cpp b/src/configuration.cpp index 2257cbf..aeecdb6 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -15,7 +15,9 @@ * limitations under the License. */ -#include +#include "configuration.hpp" + +#include "utils/signals.hpp" #define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df @@ -51,9 +53,10 @@ std::vector> SIGNALS; configuration_t::configuration_t() : obd2_signals_{OBD2_PIDS}, can_message_set_{CAN_MESSAGE_SET}, can_signals_{SIGNALS}, can_message_definition_{CAN_MESSAGES_DEFINTION} +{} configuration_t& configuration_t::get_configuration() -{ +{ return *this; } @@ -62,7 +65,7 @@ can_bus_t& configuration_t::get_can_bus_manager() return can_bus_manager_; } -diagnostic_manager_t& configuration_t::get_diagnostic_manager() const +diagnostic_manager_t& configuration_t::get_diagnostic_manager() { return diagnostic_manager_; } @@ -72,24 +75,24 @@ uint8_t configuration_t::get_active_message_set() const return active_message_set_; } -const std::vector& configuration_t::get_can_message_set() const +const std::vector& configuration_t::get_can_message_set() { return can_message_set_; } -std::vector& configuration_t::get_can_signals() const +std::vector& configuration_t::get_can_signals() { return can_signals_[active_message_set_]; } -const std::vector& configuration_t::get_can_message_definition() const +const std::vector& configuration_t::get_can_message_definition() { return can_message_definition_[active_message_set_]; } -std::vector& configuration_t::get_obd2_signals() const +std::vector& configuration_t::get_obd2_signals() { - return obd2_signals_; + return obd2_signals_[active_message_set_]; } uint32_t configuration_t::get_signal_id(obd2_signal_t& sig) const @@ -99,7 +102,7 @@ uint32_t configuration_t::get_signal_id(obd2_signal_t& sig) const uint32_t configuration_t::get_signal_id(can_signal_t& sig) const { - return sig.get_message()->get_id(); + return sig.get_message().get_id(); } void configuration_t::set_active_message_set(uint8_t id) @@ -121,10 +124,10 @@ void configuration_t::find_obd2_signals(const openxc_DynamicField &key, std::vec switch(key.type) { case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING: - lookup_signals_by_name(key.string_value, obd2_signals_, found_signals); + lookup_signals_by_name(key.string_value, obd2_signals_[active_message_set_], found_signals); break; case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM: - lookup_signals_by_id(key.numeric_value, obd2_signals_, found_signals); + lookup_signals_by_id(key.numeric_value, obd2_signals_[active_message_set_], found_signals); break; default: ERROR(binder_interface, "find_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only."); @@ -147,10 +150,10 @@ void configuration_t::find_can_signals(const openxc_DynamicField& key, std::vect switch(key.type) { case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING: - lookup_signals_by_name(std::string(key.string_value), can_signals_, found_signals); + lookup_signals_by_name(std::string(key.string_value), can_signals_[active_message_set_], found_signals); break; case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM: - lookup_signals_by_id(key.numeric_value, can_signals_ found_signals); + lookup_signals_by_id(key.numeric_value, can_signals_[active_message_set_], found_signals); break; default: ERROR(binder_interface, "find_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only."); diff --git a/src/configuration.hpp b/src/configuration.hpp index 9c49da0..981e69e 100644 --- a/src/configuration.hpp +++ b/src/configuration.hpp @@ -48,26 +48,26 @@ class configuration_t public: configuration_t(); - const std::vector obd2_signals_; - const std::vector can_message_set_; - const std::vector> can_signals_; - const std::vector> can_message_definition_; + std::vector can_message_set_; + std::vector> can_signals_; + std::vector> obd2_signals_; + std::vector> can_message_definition_; - configuration_t& get_configuration() const; + configuration_t& get_configuration() ; can_bus_t& get_can_bus_manager(); - diagnostic_manager_t& get_diagnostic_manager() const; + diagnostic_manager_t& get_diagnostic_manager() ; uint8_t get_active_message_set() const; - const std::vector& get_can_message_set() const; + const std::vector& get_can_message_set(); - std::vector& get_can_signals() const; + std::vector& get_can_signals(); - const std::vector& get_can_message_definition() const; + const std::vector& get_can_message_definition(); - std::vector& get_obd2_signals() const; + std::vector& get_obd2_signals(); uint32_t get_signal_id(obd2_signal_t& sig) const; -- cgit 1.2.3-korg