Code Review
/
apps
/
agl-service-can-low-level.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Format renaming
[apps/agl-service-can-low-level.git]
/
CAN-binder
/
low-can-binding
/
diagnostic
/
diagnostic-manager.hpp
diff --git
a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
index
3edb2b1
..
f9f2018
100644
(file)
--- a/
CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
+++ b/
CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
@@
-21,6
+21,7
@@
#include <map>
#include <vector>
#include <map>
#include <vector>
+#include "../utils/socketcan-bcm.hpp"
#include "uds/uds.h"
#include "openxc.pb.h"
#include "../can/can-bus.hpp"
#include "uds/uds.h"
#include "openxc.pb.h"
#include "../can/can-bus.hpp"
@@
-41,11
+42,6
@@
class active_diagnostic_request_t;
/// the diagnostics library to the CAN device.
///
class diagnostic_manager_t {
/// the diagnostics library to the CAN device.
///
class diagnostic_manager_t {
-protected:
- static bool shims_send(const uint32_t arbitration_id, const uint8_t* data, const uint8_t size);
- static void shims_logger(const char* m, ...);
- static void shims_timer();
-
private:
DiagnosticShims shims_; /*!< shims_ - Shim functions for each CAN bus that plug the diagnostics
* library (uds-c) into the VI's CAN peripheral.*/
private:
DiagnosticShims shims_; /*!< shims_ - Shim functions for each CAN bus that plug the diagnostics
* library (uds-c) into the VI's CAN peripheral.*/
@@
-55,15
+51,25
@@
private:
std::vector<active_diagnostic_request_t*> non_recurring_requests_; /*!< nonrecurringRequests - A list of active one-time diagnostic requests. When a
* response is received for a non-recurring request or it times out, it is removed*/
bool initialized_; /*!< * initialized - True if the DiagnosticsManager has been initialized with shims. It will interface with the uds-c lib*/
std::vector<active_diagnostic_request_t*> non_recurring_requests_; /*!< nonrecurringRequests - A list of active one-time diagnostic requests. When a
* response is received for a non-recurring request or it times out, it is removed*/
bool initialized_; /*!< * initialized - True if the DiagnosticsManager has been initialized with shims. It will interface with the uds-c lib*/
+ utils::socketcan_bcm_t socket_; ///< socket_ - a BCM socket with 8 RX_SETUP jobs for the 8 CAN ID on which ECU could respond.
+ struct sd_event_source* event_source_;
void init_diagnostic_shims();
void reset();
void init_diagnostic_shims();
void reset();
+ int add_rx_filter(uint32_t can_id);
+
+ static bool shims_send(const uint32_t arbitration_id, const uint8_t* data, const uint8_t size);
+ static void shims_logger(const char* m, ...);
+ static void shims_timer();
public:
diagnostic_manager_t();
bool initialize();
public:
diagnostic_manager_t();
bool initialize();
- std::shared_ptr<can_bus_dev_t> get_can_bus_dev();
+ void read_socket();
+ utils::socketcan_bcm_t& get_socket();
+ std::string get_can_bus();
+ active_diagnostic_request_t* get_last_recurring_requests() const;
DiagnosticShims& get_shims();
void find_and_erase(active_diagnostic_request_t* entry, std::vector<active_diagnostic_request_t*>& requests_list);
DiagnosticShims& get_shims();
void find_and_erase(active_diagnostic_request_t* entry, std::vector<active_diagnostic_request_t*>& requests_list);
@@
-76,11
+82,11
@@
public:
const DiagnosticResponse& response, float parsedPayload);
// Subscription parts
const DiagnosticResponse& response, float parsedPayload);
// Subscription parts
-
bool
add_request(DiagnosticRequest* request, const std::string name,
+
active_diagnostic_request_t*
add_request(DiagnosticRequest* request, const std::string name,
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback);
bool validate_optional_request_attributes(float frequencyHz);
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback);
bool validate_optional_request_attributes(float frequencyHz);
-
bool
add_recurring_request(DiagnosticRequest* request, const char* name,
+
active_diagnostic_request_t*
add_recurring_request(DiagnosticRequest* request, const char* name,
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz);
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz);
@@
-95,5
+101,4
@@
public:
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, 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);
-
};
};