From 1ee222a7250896fc7f2e5fb1dc50a7466d81b741 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 16 Mar 2017 02:18:00 +0100 Subject: Implement check of supported diagnostic PID. Supported boolean member about diagnostic messages is now used. When a response is received, completed but not successful, then set the diagnostic message as not supported and clean the request from the queue. Subscription remains for now, not cool but will be fix soon. Change-Id: Ia5dc78d4a770f80f144724f4df6eabd2ffd4b8cc Signed-off-by: Romain Forlot --- src/low-can-binding.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/low-can-binding.cpp') diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp index 8ea885d..0830193 100644 --- a/src/low-can-binding.cpp +++ b/src/low-can-binding.cpp @@ -133,7 +133,12 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, std::vector found; configuration_t::instance().find_diagnostic_messages(build_DynamicField(sig), found); DiagnosticRequest* diag_req = new DiagnosticRequest(found.front()->build_diagnostic_request()); - + + // If the requested diagnostic message isn't supported by the car then unssubcribe. + // no matter what we want, worse case will be a fail unsubscription but at least we don't + // poll a PID for nothing. + if(found.front()->get_supported()) + subscribe = false; if(subscribe) { float frequency = found.front()->get_frequency(); -- cgit 1.2.3-korg