aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-30 10:24:57 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-11 12:41:42 +0200
commit34d84de6e8b825ced7d476672035c0b94856862e (patch)
tree8430ce85a6d824e9e302879bba598f8979511e18
parentdad5753b133c5312f51a4b154b91559bda94aef9 (diff)
Fix: unsubscription to diagnostic messages.
Unsubscriptions weren't managed anymore since we handle supported flag in diagnostic messages. Now it's back, unsubscription against appfw is done as well as canceling recurring active diagnostic request. Change-Id: I22ebba771646624cb323e72dd7bf21027b6c6ba7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-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 ee584bf..89999f4 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 ed1aa34..cee88a8 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;
}
}