Comments fixes, typo and formating.
[apps/low-level-can-service.git] / src / diagnostic / diagnostic-manager.cpp
index 7ff8644..2d4669e 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "diagnostic-manager.hpp"
 
-#include "uds/uds.h"
 #include "../utils/openxc-utils.hpp"
 #include "../configuration.hpp"
 
@@ -38,7 +37,7 @@ diagnostic_manager_t::diagnostic_manager_t()
 ///  to have 1 diagnostic bus which are the first bus declared in the JSON
 ///  description file. Configuration instance will return it.
 ///
-/// @desc this will initialize DiagnosticShims and cancel all active requests 
+/// this will initialize DiagnosticShims and cancel all active requests 
 ///  if there are any.
 bool diagnostic_manager_t::initialize()
 {
@@ -223,7 +222,7 @@ active_diagnostic_request_t* diagnostic_manager_t::find_recurring_request(const
 
 /// @brief Add and send a new one-time diagnostic request.
 ///
-/// @desc A one-time (aka non-recurring) request can existing in parallel with a
+/// A one-time (aka non-recurring) request can existing in parallel with a
 /// recurring request for the same PID or mode, that's not a problem.
 ///
 /// For an example, see the docs for addRecurringRequest. This function is very
@@ -233,7 +232,7 @@ active_diagnostic_request_t* diagnostic_manager_t::find_recurring_request(const
 /// @param[in] name - Human readable name this response, to be used when
 ///      publishing received responses. TODO: If the name is NULL, the published output
 ///      will use the raw OBD-II response format.
-/// @param[in] waitForMultipleResponses - If false, When any response is received
+/// @param[in] wait_for_multiple_responses - If false, When any response is received
 ///      for this request it will be removed from the active list. If true, the
 ///      request will remain active until the timeout clock expires, to allow it
 ///      to receive multiple response. Functional broadcast requests will always
@@ -327,7 +326,7 @@ bool diagnostic_manager_t::validate_optional_request_attributes(float frequencyH
 /// @param[in] name - An optional human readable name this response, to be used when
 ///      publishing received responses. If the name is NULL, the published output
 ///      will use the raw OBD-II response format.
-/// @param[in] waitForMultipleResponses - If false, When any response is received
+/// @param[in] wait_for_multiple_responses - If false, When any response is received
 ///      for this request it will be removed from the active list. If true, the
 ///      request will remain active until the timeout clock expires, to allow it
 ///      to receive multiple response. Functional broadcast requests will always
@@ -460,18 +459,16 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void *
                {
                        usec = usec + (uint64_t)(frequency_clock_t::frequency_to_period(adr->get_frequency_clock().get_frequency())*MICRO);
                        DEBUG(binder_interface, "send_request: Event loop state: %d. usec: %ld", sd_event_get_state(afb_daemon_get_event_loop(binder_interface->daemon)), usec);
-                       if(sd_event_source_set_time(s, usec+1000000) >= 0)
+                       if(sd_event_source_set_time(s, usec) >= 0)
                                if(sd_event_source_set_enabled(s, SD_EVENT_ON) >= 0)
-                               {
-                                       sd_event_source_unref(s);
-                                       return -2;
-                               }
-                       return 1;
+                                       return 0;
+                       sd_event_source_unref(s);
+                       return -1;
                }
        }
        sd_event_source_unref(s);
        ERROR(binder_interface, "send_request: Something goes wrong when submitting a new request to the CAN bus");
-       return -3;
+       return -2;
 }
 
 /// @brief Will decode the diagnostic response and build the final openxc_VehicleMessage to return.