Fix: make no clients event works with CAN subscription
[apps/low-level-can-service.git] / src / diagnostic / active-diagnostic-request.cpp
index 9e64bd5..7ddf1d5 100644 (file)
 
 #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)
 {
-       return (bus_ == b.bus_ && id_ == b.id_ && handle_ == b.handle_) ? true : false;
+       return (bus_ == b.bus_ && id_ == b.id_ && handle_ == b.handle_);
 }
 
 active_diagnostic_request_t& active_diagnostic_request_t::operator=(const active_diagnostic_request_t& adr)
@@ -156,14 +155,13 @@ bool active_diagnostic_request_t::is_diagnostic_signal(const std::string& name)
 
 /// @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.
+/// @return true if the request is not running or recurring nor completed,
+/// or it's recurring, its clock elapsed
+/// so it's time to send another one.
 bool active_diagnostic_request_t::should_send()
 {
-       return !get_in_flight() && (
-                       (!get_recurring() && !request_completed()) ||
-                       (get_recurring() && get_frequency_clock().elapsed(true)));
+       return !in_flight_ && ( (!recurring_ && !request_completed()) ||
+                       (recurring_ && frequency_clock_.elapsed(true)) );
 }
 
 /// @brief check if the timeout clock has elapsed