aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/diagnostic')
-rw-r--r--low-can-binding/diagnostic/diagnostic-manager.cpp30
-rw-r--r--low-can-binding/diagnostic/diagnostic-manager.hpp6
-rw-r--r--low-can-binding/diagnostic/diagnostic-message.hpp2
3 files changed, 23 insertions, 15 deletions
diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp
index 65afecfe..7c067c6a 100644
--- a/low-can-binding/diagnostic/diagnostic-manager.cpp
+++ b/low-can-binding/diagnostic/diagnostic-manager.cpp
@@ -104,7 +104,7 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8
if(! tx_socket)
tx_socket.open(dm.get_bus_device_name());
- struct utils::bcm_msg bcm_msg;
+ struct bcm_msg bcm_msg;
struct can_frame cf;
struct timeval freq = current_adr->get_frequency_clock().get_timeval_from_period();
@@ -123,7 +123,12 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8
bcm_msg.frames[0] = cf;
- tx_socket.write_message(bcm_msg);
+
+ std::shared_ptr<message_t> msg = std::make_shared<can_message_t>();
+
+ msg->set_bcm_msg(bcm_msg);
+
+ tx_socket.write_message(msg);
if(tx_socket)
return true;
return false;
@@ -466,13 +471,13 @@ openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_dia
/// @param[in] cm - A raw CAN message.
///
/// @return A pointer to a filled openxc_VehicleMessage or a nullptr if nothing has been found.
-openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_handle(active_diagnostic_request_t* entry, const can_message_t& cm)
+openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_handle(active_diagnostic_request_t* entry, std::shared_ptr<message_t> m)
{
- DiagnosticResponse response = diagnostic_receive_can_frame(&shims_, entry->get_handle(), cm.get_id(), cm.get_data(), cm.get_length());
+ DiagnosticResponse response = diagnostic_receive_can_frame(&shims_, entry->get_handle(), m->get_id(), m->get_data(), m->get_length());
if(response.completed && entry->get_handle()->completed)
{
if(entry->get_handle()->success)
- return relay_diagnostic_response(entry, response, cm.get_timestamp());
+ return relay_diagnostic_response(entry, response, m->get_timestamp());
}
else if(!response.completed && response.multi_frame)
{
@@ -491,20 +496,20 @@ openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_handle(active_diagn
/// @param[in] cm - Raw CAN message received
///
/// @return VehicleMessage with decoded value.
-openxc_VehicleMessage diagnostic_manager_t::find_and_decode_adr(const can_message_t& cm)
+openxc_VehicleMessage diagnostic_manager_t::find_and_decode_adr(std::shared_ptr<message_t> m)
{
openxc_VehicleMessage vehicle_message = build_VehicleMessage();
for ( auto entry : non_recurring_requests_)
{
- vehicle_message = relay_diagnostic_handle(entry, cm);
+ vehicle_message = relay_diagnostic_handle(entry, m);
if (is_valid(vehicle_message))
return vehicle_message;
}
for ( auto entry : recurring_requests_)
{
- vehicle_message = relay_diagnostic_handle(entry, cm);
+ vehicle_message = relay_diagnostic_handle(entry, m);
if (is_valid(vehicle_message))
return vehicle_message;
}
@@ -519,9 +524,12 @@ openxc_VehicleMessage diagnostic_manager_t::find_and_decode_adr(const can_messag
/// @param[in] cm - CAN message received from the socket.
///
/// @return True if the active diagnostic request match the response.
-bool diagnostic_manager_t::is_diagnostic_response(const can_message_t& cm)
+bool diagnostic_manager_t::is_diagnostic_response(std::shared_ptr<message_t> m)
{
- if (cm.get_id() >= 0x7e8 && cm.get_id() <= 0x7ef)
- return true;
+ if(m->get_msg_format() == can_message_format_t::STANDARD || m->get_msg_format() == can_message_format_t::EXTENDED)
+ {
+ if (m->get_id() >= 0x7e8 && m->get_id() <= 0x7ef)
+ return true;
+ }
return false;
}
diff --git a/low-can-binding/diagnostic/diagnostic-manager.hpp b/low-can-binding/diagnostic/diagnostic-manager.hpp
index 26c869e2..64a19d7c 100644
--- a/low-can-binding/diagnostic/diagnostic-manager.hpp
+++ b/low-can-binding/diagnostic/diagnostic-manager.hpp
@@ -84,7 +84,7 @@ public:
// Decoding part
openxc_VehicleMessage relay_diagnostic_response(active_diagnostic_request_t* adr, const DiagnosticResponse& response, const uint64_t timestamp);
- openxc_VehicleMessage relay_diagnostic_handle(active_diagnostic_request_t* entry, const can_message_t& cm);
- openxc_VehicleMessage find_and_decode_adr(const can_message_t& cm);
- bool is_diagnostic_response(const can_message_t& cm);
+ openxc_VehicleMessage relay_diagnostic_handle(active_diagnostic_request_t* entry, std::shared_ptr<message_t> m);
+ openxc_VehicleMessage find_and_decode_adr(std::shared_ptr<message_t> m);
+ bool is_diagnostic_response(std::shared_ptr<message_t> m);
};
diff --git a/low-can-binding/diagnostic/diagnostic-message.hpp b/low-can-binding/diagnostic/diagnostic-message.hpp
index 4ae84358..86149413 100644
--- a/low-can-binding/diagnostic/diagnostic-message.hpp
+++ b/low-can-binding/diagnostic/diagnostic-message.hpp
@@ -22,7 +22,7 @@
#include "uds/uds.h"
#include "../can/can-message-set.hpp"
-#include "../can/can-message.hpp"
+#include "../can/message/can-message.hpp"
#include "active-diagnostic-request.hpp"
enum UNIT {