aboutsummaryrefslogtreecommitdiffstats
path: root/src/diagnostic
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-08 02:41:56 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:09:03 +0100
commit2049aca0927b55f2a256fd60ff686616b73eecb7 (patch)
treeeb4e195c796aa5cc69bdedd772a659b4f83fe9d9 /src/diagnostic
parent64d3ead0ce87091a3489dd9796a9f77f241c468b (diff)
Beginning of work of get central configuration object
that will be used by the binding to access generated elements. It will hold generated structure/objects and make a resume to the binding configuration. Idea is to have an object that can be inherited in the generated code to extend its functionnalities or change some of its behoviors. Change-Id: If2ce5cbe2eb98a74a8e3f13000ee02855674216f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic')
-rw-r--r--src/diagnostic/diagnostic-message.cpp37
-rw-r--r--src/diagnostic/diagnostic-message.hpp4
2 files changed, 2 insertions, 39 deletions
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index 15fe0944..656a868c 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -19,8 +19,6 @@
#include "utils/signals.hpp"
-#define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df
-
const char *UNIT_NAMES[10] = {
"POURCENT",
"DEGREES_CELSIUS",
@@ -34,41 +32,6 @@ const char *UNIT_NAMES[10] = {
"NM"
};
-/*
-* Pre-defined OBD-II PIDs to query for if supported by the vehicle.
-*/
- std::vector<obd2_signals_t> OBD2_PIDS = {
- { 0x04, "obd2.engine.load", 0, 100, POURCENT, 5, false},
- { 0x05, "obd2.engine.coolant.temperature", -40, 215, DEGREES_CELSIUS, 1, false},
- { 0x0a, "obd2.fuel.pressure", 0, 765, KPA, 1, false},
- { 0x0b, "obd2.intake.manifold.pressure", 0, 255, KPA, 1, false},
- { 0x0c, "obd2.engine.speed", 0, 16383, RPM, 5, false},
- { 0x0d, "obd2.vehicle.speed", 0, 255, KM_H, 5, false},
- { 0x0f, "obd2.intake.air.temperature", -40, 215, DEGREES_CELSIUS, 1, false},
- { 0x10, "obd2.mass.airflow", 0, 655, GRAMS_SEC, 5, false},
- { 0x11, "obd2.throttle.position", 0, 100, POURCENT, 5, false},
- { 0x1f, "obd2.running.time", 0, 65535, SECONDS, 1, false},
- { 0x2d, "obd2.EGR.error", -100, 99, POURCENT, 0, false},
- { 0x2f, "obd2.fuel.level", 0, 100, POURCENT, 1, false},
- { 0x33, "obd2.barometric.pressure", 0, 255, KPA, 1, false},
- { 0x4c, "obd2.commanded.throttle.position", 0, 100, POURCENT, 1, false},
- { 0x52, "obd2.ethanol.fuel.percentage", 0, 100, POURCENT, 1, false},
- { 0x5a, "obd2.accelerator.pedal.position", 0, 100, POURCENT, 5, false},
- { 0x5b, "obd2.hybrid.battery-pack.remaining.life", 0, 100, POURCENT, 5, false},
- { 0x5c, "obd2.engine.oil.temperature",-40, 210, DEGREES_CELSIUS, 1, false},
- { 0x63, "obd2.engine.torque", 0, 65535, NM, 1, false}
-};
-
-uint32_t get_signal_id(obd2_signals_t& sig)
-{
- return sig.get_pid();
-}
-
-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}
{
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 5adbde59..ac6ca18e 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -68,7 +68,7 @@ typedef struct _Obd2Pid {
class obd2_signals_t {
private:
uint8_t pid_; /*!< pid - The 1 byte PID.*/
- const char* generic_name_; /*!< generic_name_ - A human readable name to use for this PID when published.*/
+ const std::string generic_name_; /*!< generic_name_ - A human readable name to use for this PID when published.*/
const int min_; /*!< min_ - Minimum value that can take this pid */
const int max_; /*!< max_ - Maximum value that can take this pid */
enum UNIT unit_; /*!< unit_ : Which unit system is used by that pid. See enum UNIT above.*/
@@ -76,7 +76,7 @@ class obd2_signals_t {
bool supported_; /*!< supported_ - boolean indicating whether this pid is supported by the vehicle or not.*/
public:
- const char* generic_name = generic_name_;
+ const char* generic_name = generic_name_.c_str();
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();