bool active_diagnostic_request_t::operator==(const active_diagnostic_request_t& b)
{
return (bus_ == b.bus_ && id_ == b.id_ && handle_ == b.handle_) ? true : false;
bool active_diagnostic_request_t::operator==(const active_diagnostic_request_t& b)
{
return (bus_ == b.bus_ && id_ == b.id_ && handle_ == b.handle_) ? true : false;
-active_diagnostic_request_t::active_diagnostic_request_t(std::shared_ptr<can_bus_dev_t> bus, DiagnosticRequest* request,
- const std::string& name, bool wait_for_multiple_responses,
- const DiagnosticResponseDecoder decoder,
+active_diagnostic_request_t::active_diagnostic_request_t(const std::string& bus, DiagnosticRequest* request,
+ const std::string& name, bool wait_for_multiple_responses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz)
: bus_{bus}, id_{request->arbitration_id}, handle_{nullptr}, name_{name},
decoder_{decoder}, callback_{callback}, recurring_{frequencyHz ? true : false}, wait_for_multiple_responses_{wait_for_multiple_responses},
const DiagnosticResponseCallback callback, float frequencyHz)
: bus_{bus}, id_{request->arbitration_id}, handle_{nullptr}, name_{name},
decoder_{decoder}, callback_{callback}, recurring_{frequencyHz ? true : false}, wait_for_multiple_responses_{wait_for_multiple_responses},
+const std::string active_diagnostic_request_t::get_name() const
+{
+ return active_diagnostic_request_t::prefix_ + "." + 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_;
+}
+
+/**
+* @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)
+{
+ const std::string p = active_diagnostic_request_t::prefix_ + "*";
+ if(::fnmatch(p.c_str(), name.c_str(), FNM_CASEFOLD) == 0)
+ return true;
+ return false;
+}
+