diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-13 09:45:01 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-16 17:15:55 +0100 |
commit | b606db2b74d5c92d33a126071062c9eb2a548beb (patch) | |
tree | 26e0edc377c35521bba345a5f162809894751376 /src/diagnostic/diagnostic-message.hpp | |
parent | 37bf83a16cbd07b168b8c4f5a2c05cbf281d8fad (diff) |
Change the way to check signal type making prefix_
attribute as static with a static class method which
will check that the beginning of string argument
matches the prefix.
Change-Id: Idb129c7179391da61447996560957b2791aa9383
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/diagnostic-message.hpp')
-rw-r--r-- | src/diagnostic/diagnostic-message.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp index 02c6a9f6..ec4521f1 100644 --- a/src/diagnostic/diagnostic-message.hpp +++ b/src/diagnostic/diagnostic-message.hpp @@ -46,7 +46,7 @@ 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. + static std::string prefix_; /*!< 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 */ @@ -61,16 +61,16 @@ class obd2_signal_t { uint32_t get_pid(); const std::string& get_generic_name() const; const std::string get_name() const; - const std::string& get_prefix() const; + static const std::string& get_prefix(); int get_frequency() const; - void set_prefix(std::string val); + static void set_prefix(const std::string& val); const DiagnosticRequest build_diagnostic_request(); bool is_obd2_response(can_message_t can_message); bool is_obd2_request(DiagnosticRequest *request); - bool is_obd2_signal(const char *name); + static bool is_obd2_signal(const std::string& name); static float decode_obd2_response(const DiagnosticResponse* response, float parsedPayload); };
\ No newline at end of file |