Adding missing doxygen comments.
[apps/agl-service-can-low-level.git] / src / diagnostic / active-diagnostic-request.cpp
index fcdbc97..8cb047d 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "../configuration.hpp"
 
+#define ERROR_PID 0xFF
+
+// @brief
 std::string active_diagnostic_request_t::prefix_ = "diagnostic_messages";
 
 bool active_diagnostic_request_t::operator==(const active_diagnostic_request_t& b)
@@ -73,6 +76,13 @@ const std::shared_ptr<can_bus_dev_t> active_diagnostic_request_t::get_can_bus_de
        return can_bus_t::get_can_device(bus_);
 }
 
+uint16_t active_diagnostic_request_t::get_pid() const
+{
+       if (handle_->request.has_pid)
+               return handle_->request.pid;
+       return ERROR_PID;
+}
+
 DiagnosticRequestHandle* active_diagnostic_request_t::get_handle()
 {
        return handle_;
@@ -80,7 +90,7 @@ DiagnosticRequestHandle* active_diagnostic_request_t::get_handle()
 
 const std::string active_diagnostic_request_t::get_name() const
 {
-       return active_diagnostic_request_t::prefix_ + "." + name_;
+       return name_;
 }
 
 std::string& active_diagnostic_request_t::get_prefix()
@@ -128,11 +138,14 @@ 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.
-*/
+///
+/// @brief Check if requested signal name is a diagnostic message. If the name
+///  begin with the diagnostic message prefix then true else false.
+///
+/// @param[in] name - A signal name.
+///
+/// @return true if name began with the diagnostic message prefix else false.
+///
 bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name)
 {
        const std::string p = active_diagnostic_request_t::prefix_ + "*";
@@ -141,6 +154,11 @@ bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name)
        return false;
 }
 
+/// @brief Check is the request should be sent or not
+///
+/// @return true if the request isn't already running and not
+/// recurring nor completed, or it is recurring its clock elapsed so it's
+/// time to send another one.
 bool active_diagnostic_request_t::should_send()
 {
        return !get_in_flight() && (
@@ -148,6 +166,9 @@ bool active_diagnostic_request_t::should_send()
                        (get_recurring() && get_frequency_clock().elapsed(true)));
 }
 
+/// @brief check if the timeout clock has elapsed
+///
+/// @return true if elapsed, so it is a timeout, else false.
 bool active_diagnostic_request_t::timed_out()
 {
        // don't use staggered start with the timeout clock