aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/diagnostic/diagnostic-manager.cpp2
-rw-r--r--src/low-can-binding.cpp18
2 files changed, 14 insertions, 6 deletions
diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp
index ee584bf7..89999f4f 100644
--- a/src/diagnostic/diagnostic-manager.cpp
+++ b/src/diagnostic/diagnostic-manager.cpp
@@ -490,7 +490,7 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void *
}
sd_event_source_unref(s);
- ERROR(binder_interface, "send_request: Something goes wrong when submitting a new request to the CAN bus");
+ NOTICE(binder_interface, "send_request: Request doesn't exist anymore. Canceling.'");
return -2;
}
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index ed1aa34c..cee88a87 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -140,16 +140,24 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
// poll a PID for nothing.
if(found.front()->get_supported())
{
- float frequency = found.front()->get_frequency();
- configuration_t::instance().get_diagnostic_manager().add_recurring_request(
- diag_req, sig.c_str(), false, found.front()->get_decoder(), found.front()->get_callback(), (float)frequency);
- //TODO: Adding callback requesting ignition status: diag_req, sig.c_str(), false, diagnostic_message_t::decode_obd2_response, diagnostic_message_t::check_ignition_status, frequency);
+ if(subscribe)
+ {
+ float frequency = found.front()->get_frequency();
+ configuration_t::instance().get_diagnostic_manager().add_recurring_request(
+ diag_req, sig.c_str(), false, found.front()->get_decoder(), found.front()->get_callback(), (float)frequency);
+ //TODO: Adding callback requesting ignition status: diag_req, sig.c_str(), false, diagnostic_message_t::decode_obd2_response, diagnostic_message_t::check_ignition_status, frequency);
+ }
+ else
+ {
+ active_diagnostic_request_t* adr = configuration_t::instance().get_diagnostic_manager().find_recurring_request(diag_req);
+ configuration_t::instance().get_diagnostic_manager().cleanup_request(adr, true);
+ }
}
else
{
configuration_t::instance().get_diagnostic_manager().cleanup_request(
configuration_t::instance().get_diagnostic_manager().find_recurring_request(diag_req), true);
- DEBUG(binder_interface, "Signal: %s isn't supported. Canceling operation.", sig.c_str());
+ WARNING(binder_interface, "Signal: %s isn't supported. Canceling operation.", sig.c_str());
return -1;
}
}