summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-07 15:31:20 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:09:03 +0100
commit4d5b071ab451260ef9d3cbf393aca0992104b0d7 (patch)
tree4ca1492aeaeac94367b4045ae639bb974721c9d6 /src
parentabdd2abd39eaa1543fa90125cc6261a8626c2cc9 (diff)
Make an extern get_signal_id() function plug to get_pid()
member function from class obd2_signals class. Change-Id: I5a0f1cfd0c2fb9374cc3928861ca4e8a52911942 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/diagnostic/diagnostic-message.cpp14
-rw-r--r--src/diagnostic/diagnostic-message.hpp4
2 files changed, 15 insertions, 3 deletions
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index 0b1a933..71b0f7d 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -59,9 +59,9 @@ const char *UNIT_NAMES[10] = {
{ 0x63, "obd2.engine.torque", 0, 65535, NM, 1, false}
};
-obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int min, const int max, enum UNIT unit, int frequency, bool supported)
- : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit}, frequency_{frequency}, supported_{supported}
+uint32_t get_signal_id(obd2_signals_t& sig)
{
+ return sig.get_pid();
}
std::vector<obd2_signals_t>& get_obd2_signals()
@@ -69,6 +69,16 @@ std::vector<obd2_signals_t>& get_obd2_signals()
return OBD2_PIDS;
}
+obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int min, const int max, enum UNIT unit, int frequency, bool supported)
+ : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit}, frequency_{frequency}, supported_{supported}
+{
+}
+
+uint32_t obd2_signals_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
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 062f7b5..cd4afd5 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -79,6 +79,8 @@ class obd2_signals_t {
const char* generic_name = generic_name_;
obd2_signals_t(uint8_t pid, const char* generic_name, const int min_, const int max_, enum UNIT unit, int frequency, bool supported);
+ uint32_t get_pid();
+
void add_request(int pid);
void find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& found_signals);
@@ -90,5 +92,5 @@ class obd2_signals_t {
float decode_obd2_response(const DiagnosticResponse* response, float parsedPayload);
};
-uint32_t get_signal_id(const obd2_signals_t& sig);
+uint32_t get_signal_id(obd2_signals_t& sig);
std::vector<obd2_signals_t>& get_obd2_signals(); \ No newline at end of file