diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-13 15:03:00 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-16 17:15:55 +0100 |
commit | 542518e3f4390fcb0d8fb17bcbb14c7eb4335a61 (patch) | |
tree | 340eda25b52c5f6e4b47dae3aace322c57359e55 /src/diagnostic/active-diagnostic-request.cpp | |
parent | f0d7a6523955ee94a32ec4b62e2a207b23f62316 (diff) |
Move member from obd2_signals_t class to
active_diagnostic_request_t (adr)class. It's more logical
to have them here as call about incoming diagnostic CAN
messages are made against adr class not obd2_signal_t that
it's a subset of diagnostic messages.
It's made to handle obd2 requests as well as normal UDS
diagnostic request for constructor proprietary diagnostic
signals.
Change-Id: I96c714640d6ecfa25dfc9942974057c1797eb0e1
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/active-diagnostic-request.cpp')
-rw-r--r-- | src/diagnostic/active-diagnostic-request.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp index 7a43a0d4..5e43d7ab 100644 --- a/src/diagnostic/active-diagnostic-request.cpp +++ b/src/diagnostic/active-diagnostic-request.cpp @@ -17,6 +17,8 @@ #include "active-diagnostic-request.hpp" +std::string active_diagnostic_request_t::prefix_ = "diagnostic_messages"; + bool active_diagnostic_request_t::operator==(const active_diagnostic_request_t& b) { return (bus_ == b.bus_ && id_ == b.id_ && handle_ == b.handle_) ? true : false; @@ -72,6 +74,26 @@ DiagnosticRequestHandle* active_diagnostic_request_t::get_handle() return handle_; } +std::string& active_diagnostic_request_t::get_name() +{ + return name_; +} + +std::string& active_diagnostic_request_t::get_prefix() +{ + return active_diagnostic_request_t::prefix_; +} + +DiagnosticResponseDecoder& active_diagnostic_request_t::get_decoder() +{ + return decoder_; +} + +DiagnosticResponseCallback& active_diagnostic_request_t::get_callback() +{ + return callback_; +} + bool active_diagnostic_request_t::get_recurring() const { return recurring_; @@ -102,6 +124,18 @@ void active_diagnostic_request_t::set_in_flight(bool val) in_flight_ = val; } +/** +* @brief Check if requested signal name is an obd2 pid +* +* @return true if name began with obd2 else false. +*/ +bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name) +{ + if(name.find_first_of(prefix_.c_str(), 0, prefix_.size())) + return true; + return false; +} + bool active_diagnostic_request_t::should_send() { return !get_in_flight() && ( |