summaryrefslogtreecommitdiffstats
path: root/src/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'src/diagnostic')
-rw-r--r--src/diagnostic/diagnostic-message.cpp10
-rw-r--r--src/diagnostic/diagnostic-message.hpp29
2 files changed, 15 insertions, 24 deletions
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index 8f42653..bd76de0 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -48,6 +48,16 @@ std::string& obd2_signal_t::get_generic_name()
return generic_name_;
}
+std::string obd2_signal_t::get_name()
+{
+ return prefix_ + "." + generic_name_;
+}
+
+void obd2_signal_t::set_prefix(std::string val)
+{
+ prefix_ = val;
+}
+
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 5ca651c..534b9a5 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -40,35 +40,14 @@ enum UNIT {
};
/**
- * @brief A representation of an OBD-II PID.
- *
- * pid - The 1 byte PID.
- * name - A human readable name to use for this PID when published.
- * min - minimum value for this pid
- * max - maximum value for this pid
- * unit - unit used
- * frequency - The frequency to request this PID if supported by the vehicle
- * when automatic, recurring OBD-II requests are enabled.
- * supported - is it supported by the vehicle. Initialized after scan
- */
-typedef struct _Obd2Pid {
- uint8_t pid;
- const char* generic_name;
- const int min;
- const int max;
- enum UNIT unit;
- int frequency;
- bool supported;
-} Obd2Pid;
-
-/**
- * @brief - Object to handle obd2 session with pre-scan of supported pid
- * then request them regularly
+ * @brief - A representation of an OBD-II PID.
*/
class obd2_signal_t {
private:
uint8_t pid_; /*!< pid - The 1 byte PID.*/
std::string generic_name_; /*!< generic_name_ - A human readable name to use for this PID when published.*/
+ std::string prefix_ = "diagnostic_messages."; /*!< prefix_ - generic_name_ will be prefixed with it. It has to reflect the used protocol.
+ * which make easier to sort message when the come in.*/
int min_; /*!< min_ - Minimum value that can take this pid */
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.*/
@@ -81,7 +60,9 @@ class obd2_signal_t {
uint32_t get_pid();
std::string& get_generic_name();
+ std::string get_name();
+ void set_prefix(std::string val);
void add_request(int pid);
bool is_obd2_response(can_message_t can_message);