aboutsummaryrefslogtreecommitdiffstats
path: root/src/diagnostic/diagnostic-manager.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-13 14:58:22 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:15:55 +0100
commitf0d7a6523955ee94a32ec4b62e2a207b23f62316 (patch)
tree1856801bfd7f2718689888ccc488643dc99e436a /src/diagnostic/diagnostic-manager.hpp
parentb606db2b74d5c92d33a126071062c9eb2a548beb (diff)
Get decoding diagnostic request from decoding thread of can_bus_t
Decoding divided in 2 subfunctions dedicated to decode either pure CAN messages or diagnostic (obd2) message. About now, a diagnostic request has a name then it will be pushed on the event_queue as a SimpleMessage. Without name full details of diagnostic response will be pushed as diagnostic response. This behavior follows the one from OpenXC. Change-Id: I255f3f6487fa9511ea47c74606014995a7b0f720 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/diagnostic-manager.hpp')
-rw-r--r--src/diagnostic/diagnostic-manager.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/diagnostic/diagnostic-manager.hpp b/src/diagnostic/diagnostic-manager.hpp
index 29223fa0..061f5f9c 100644
--- a/src/diagnostic/diagnostic-manager.hpp
+++ b/src/diagnostic/diagnostic-manager.hpp
@@ -22,6 +22,7 @@
#include <vector>
#include "uds/uds.h"
+#include "openxc.pb.h"
#include "../can/can-bus-dev.hpp"
#include "../can/can-message.hpp"
#include "active-diagnostic-request.hpp"
@@ -32,6 +33,7 @@
* match the maximum CAN controller count.
*/
#define MAX_SHIM_COUNT can_bus_t.get_can_devices().size()
+#define DIAGNOSTIC_RESPONSE_ARBITRATION_ID_OFFSET 0x8
class active_diagnostic_request_t;
@@ -95,6 +97,11 @@ public:
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz);
+ bool is_diagnostic_response(const active_diagnostic_request_t& adr, const can_message_t& cm) const;
+ active_diagnostic_request_t* is_diagnostic_response(const can_message_t& can_message);
+
+ openxc_VehicleMessage relay_diagnostic_response(active_diagnostic_request_t* adr, const DiagnosticResponse& response) const;
+
bool conflicting(active_diagnostic_request_t* request, active_diagnostic_request_t* candidate) const;
bool clear_to_send(active_diagnostic_request_t* request) const;
static int send_request(sd_event_source *s, uint64_t usec, void *userdata);