summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/can/can-signals.cpp24
-rw-r--r--src/can/can-signals.hpp1
-rw-r--r--src/configuration.cpp56
-rw-r--r--src/configuration.hpp8
-rw-r--r--src/diagnostic/diagnostic-message.cpp25
-rw-r--r--src/diagnostic/diagnostic-message.hpp1
6 files changed, 62 insertions, 53 deletions
diff --git a/src/can/can-signals.cpp b/src/can/can-signals.cpp
index faecdaa6..af7376b4 100644
--- a/src/can/can-signals.cpp
+++ b/src/can/can-signals.cpp
@@ -44,30 +44,6 @@ uint8_t can_signal_t::get_bit_size() const
return bit_size_;
}
-/**
- * @fn void find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
- * @brief return signals name found searching through CAN_signals and OBD2 pid
- *
- * @param[in] key - can contain numeric or string value in order to search against
- * can signals or obd2 signals name.
- * @param[out] found_signals - provided vector to fill with ponter to signals matched.
- *
- */
-void find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
-{
- switch(key.type)
- {
- case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
- lookup_signals_by_name(key.string_value, get_can_signals(), found_signals);
- break;
- case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM:
- lookup_signals_by_id(key.numeric_value, get_can_signals(), 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.");
- break;
- }
- DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
float can_signal_t::get_factor() const
{
return factor_;
diff --git a/src/can/can-signals.hpp b/src/can/can-signals.hpp
index a4f01eb2..91403d12 100644
--- a/src/can/can-signals.hpp
+++ b/src/can/can-signals.hpp
@@ -127,6 +127,5 @@ public:
float get_last_value() const;
void set_received(bool r);
-void find_can_signals(const openxc_DynamicField &key, std::vector<can_signal_t*>& found_signals); void set_received(bool r);
void set_last_value(float val);
}; \ No newline at end of file
diff --git a/src/configuration.cpp b/src/configuration.cpp
index b9d78c0b..2257cbf8 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -77,7 +77,7 @@ const std::vector<can_message_set_t>& configuration_t::get_can_message_set() con
return can_message_set_;
}
-const std::vector<can_signal_t>& configuration_t::get_can_signals() const
+std::vector<can_signal_t>& configuration_t::get_can_signals() const
{
return can_signals_[active_message_set_];
}
@@ -87,7 +87,7 @@ const std::vector<can_message_definition_t>& configuration_t::get_can_message_de
return can_message_definition_[active_message_set_];
}
-const std::vector<obd2_signal_t>& configuration_t::get_obd2_signals() const
+std::vector<obd2_signal_t>& configuration_t::get_obd2_signals() const
{
return obd2_signals_;
}
@@ -105,4 +105,56 @@ uint32_t configuration_t::get_signal_id(can_signal_t& sig) const
void configuration_t::set_active_message_set(uint8_t id)
{
active_message_set_ = id;
+}
+
+/**
+ * @fn std::vector<std::string> find_signals(const openxc_DynamicField &key)
+ * @brief return signals name found searching through CAN_signals and OBD2 pid
+ *
+ * @param[in] key - can contain numeric or string value in order to search against
+ * can signals or obd2 signals name.
+ *
+ * @return Vector of signals name found.
+ */
+void configuration_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signal_t*>& found_signals)
+{
+ switch(key.type)
+ {
+ case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
+ lookup_signals_by_name(key.string_value, obd2_signals_, found_signals);
+ break;
+ case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM:
+ lookup_signals_by_id(key.numeric_value, obd2_signals_, 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.");
+ break;
+ }
+ DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
+}
+
+/**
+ * @fn void find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
+ * @brief return signals name found searching through CAN_signals and OBD2 pid
+ *
+ * @param[in] key - can contain numeric or string value in order to search against
+ * can signals or obd2 signals name.
+ * @param[out] found_signals - provided vector to fill with ponter to signals matched.
+ *
+ */
+void configuration_t::find_can_signals(const openxc_DynamicField& key, std::vector<can_signal_t*>& found_signals)
+{
+ switch(key.type)
+ {
+ case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
+ lookup_signals_by_name(std::string(key.string_value), can_signals_, found_signals);
+ break;
+ case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM:
+ lookup_signals_by_id(key.numeric_value, can_signals_ 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.");
+ break;
+ }
+ DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
} \ No newline at end of file
diff --git a/src/configuration.hpp b/src/configuration.hpp
index 77f452ff..9c49da04 100644
--- a/src/configuration.hpp
+++ b/src/configuration.hpp
@@ -63,11 +63,11 @@ class configuration_t
const std::vector<can_message_set_t>& get_can_message_set() const;
- const std::vector<can_signal_t>& get_can_signals() const;
+ std::vector<can_signal_t>& get_can_signals() const;
const std::vector<can_message_definition_t>& get_can_message_definition() const;
- const std::vector<obd2_signal_t>& get_obd2_signals() const;
+ std::vector<obd2_signal_t>& get_obd2_signals() const;
uint32_t get_signal_id(obd2_signal_t& sig) const;
@@ -75,6 +75,10 @@ class configuration_t
void set_active_message_set(uint8_t id);
+ void find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signal_t*>& found_signals);
+
+ void find_can_signals(const openxc_DynamicField &key, std::vector<can_signal_t*>& found_signals);
+
/*
/// TODO: implement this function as method into can_bus class
/// @brief Pre initialize actions made before CAN bus initialization
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index 76b97996..247917b3 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -42,30 +42,9 @@ uint32_t obd2_signal_t::get_pid()
return (uint32_t)pid_;
}
-/**
- * @fn std::vector<std::string> find_signals(const openxc_DynamicField &key)
- * @brief return signals name found searching through CAN_signals and OBD2 pid
- *
- * @param[in] key - can contain numeric or string value in order to search against
- * can signals or obd2 signals name.
- *
- * @return Vector of signals name found.
- */
-void obd2_signal_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signal_t*>& found_signals)
+std::string& obd2_signal_t::get_generic_name()
{
- switch(key.type)
- {
- case openxc_DynamicField_Type::openxc_DynamicField_Type_STRING:
- lookup_signals_by_name(key.string_value, get_obd2_signals(), found_signals);
- break;
- case openxc_DynamicField_Type::openxc_DynamicField_Type_NUM:
- lookup_signals_by_id(key.numeric_value, get_obd2_signals(), 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.");
- break;
- }
- DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
+ return generic_name_;
}
bool obd2_signal_t::is_obd2_response(can_message_t can_message)
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 33035ff1..9dca770e 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -83,7 +83,6 @@ class obd2_signal_t {
void add_request(int pid);
- void find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signal_t*>& found_signals);
bool is_obd2_response(can_message_t can_message);
bool is_obd2_request(DiagnosticRequest *request);