No need to listen diagnostic responses if there isn't any subscriptions.
Change-Id: I7fa48dbc3e8fb1847b8186337fe2813625894406
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
+bool diagnostic_manager_t::socket_close()
+{
+ if(non_recurring_requests_.empty() && recurring_requests_.empty())
+ {
+ socket_.close();
+ return true;
+ }
+ return false;
+}
+
/// @brief Search for a specific active diagnostic request in the provided requests list
/// and erase it from the vector. This is useful at unsubscription to clean up the list otherwize
/// all received CAN messages will be passed to DiagnosticRequestHandle of all active diagnostic request
/// @brief Search for a specific active diagnostic request in the provided requests list
/// and erase it from the vector. This is useful at unsubscription to clean up the list otherwize
/// all received CAN messages will be passed to DiagnosticRequestHandle of all active diagnostic request
request_string, sizeof(request_string));
if(force && entry->get_recurring())
{
request_string, sizeof(request_string));
if(force && entry->get_recurring())
{
- find_and_erase(entry, recurring_requests_);
+ find_and_erase(entry, recurring_requests_);
DEBUG(binder_interface, "%s: Cancelling completed, recurring request: %s", __FUNCTION__, request_string);
}
DEBUG(binder_interface, "%s: Cancelling completed, recurring request: %s", __FUNCTION__, request_string);
}
+ else if (!entry->get_recurring())
{
DEBUG(binder_interface, "%s: Cancelling completed, non-recurring request: %s", __FUNCTION__, request_string);
{
DEBUG(binder_interface, "%s: Cancelling completed, non-recurring request: %s", __FUNCTION__, request_string);
- find_and_erase(entry, non_recurring_requests_);
+ find_and_erase(entry, non_recurring_requests_);
void diagnostic_manager_t::cleanup_active_requests(bool force)
{
for(auto& entry : non_recurring_requests_)
void diagnostic_manager_t::cleanup_active_requests(bool force)
{
for(auto& entry : non_recurring_requests_)
if (entry != nullptr)
cleanup_request(entry, force);
if (entry != nullptr)
cleanup_request(entry, force);
for(auto& entry : recurring_requests_)
for(auto& entry : recurring_requests_)
if (entry != nullptr)
cleanup_request(entry, force);
if (entry != nullptr)
cleanup_request(entry, force);
}
/// @brief Will return the active_diagnostic_request_t pointer for theDiagnosticRequest or nullptr if
}
/// @brief Will return the active_diagnostic_request_t pointer for theDiagnosticRequest or nullptr if
const std::string get_bus_device_name() const;
active_diagnostic_request_t* get_last_recurring_requests() const;
DiagnosticShims& get_shims();
const std::string get_bus_device_name() const;
active_diagnostic_request_t* get_last_recurring_requests() const;
DiagnosticShims& get_shims();
void find_and_erase(active_diagnostic_request_t* entry, std::vector<active_diagnostic_request_t*>& requests_list);
void cancel_request(active_diagnostic_request_t* entry);
void find_and_erase(active_diagnostic_request_t* entry, std::vector<active_diagnostic_request_t*>& requests_list);
void cancel_request(active_diagnostic_request_t* entry);