aboutsummaryrefslogtreecommitdiffstats
path: root/src/low-can-binding.cpp
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 /src/low-can-binding.cpp
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>
Diffstat (limited to 'src/low-can-binding.cpp')
-rw-r--r--src/low-can-binding.cpp18
1 files changed, 13 insertions, 5 deletions
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;
}
}