summaryrefslogtreecommitdiffstats
path: root/src/diagnostic/diagnostic-manager.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-16 02:18:00 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:21:57 +0100
commit1ee222a7250896fc7f2e5fb1dc50a7466d81b741 (patch)
tree7f73cc373b73314962ef4c774657b0842d3f9e94 /src/diagnostic/diagnostic-manager.cpp
parentf3ddfa1c2c4a9ac54f129a63dc9673afdc87bb9e (diff)
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/diagnostic-manager.cpp')
-rw-r--r--src/diagnostic/diagnostic-manager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp
index ac0aaadf..2c0a4d92 100644
--- a/src/diagnostic/diagnostic-manager.cpp
+++ b/src/diagnostic/diagnostic-manager.cpp
@@ -315,7 +315,7 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void *
return -1;
}
-openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_diagnostic_request_t* adr, const DiagnosticResponse& response) const
+openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_diagnostic_request_t* adr, const DiagnosticResponse& response)
{
openxc_VehicleMessage message = build_VehicleMessage();
float value = (float)diagnostic_payload_to_integer(&response);
@@ -339,6 +339,16 @@ openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_dia
message = build_VehicleMessage(adr, response, value);
}
+ // If not success but completed then the pid isn't supported
+ if(!response.success)
+ {
+ std::vector<diagnostic_message_t*> found_signals;
+ configuration_t::instance().find_diagnostic_messages( build_DynamicField(adr->get_name()), found_signals );
+ found_signals.front()->set_supported(false);
+ cleanup_request(adr, true);
+ NOTICE(binder_interface, "relay_diagnostic_response: PID not supported or ill formed. Please unsubscribe from it. Error code : %d", response.negative_response_code);
+ }
+
if(adr->get_callback() != nullptr)
{
adr->get_callback()(adr, &response, value);