From 24057b7fad6d4d1f1f264995d0f5865acf466004 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Sun, 12 Mar 2017 19:38:49 +0100 Subject: Make diagnostic manager initialization processus. It is initiliazed with by default the first CAN bus device in the CAN bus device list from CAN bus manager. The object is instancied at configuration_t object first invokation and after all CAN buses has been initialized then the diag manager is initialized too. Change-Id: I4894f2c62f575676c34efec3608b97de8c5326e1 Signed-off-by: Romain Forlot --- src/diagnostic/diagnostic-manager.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/diagnostic/diagnostic-manager.hpp') diff --git a/src/diagnostic/diagnostic-manager.hpp b/src/diagnostic/diagnostic-manager.hpp index 8602db86..39aae321 100644 --- a/src/diagnostic/diagnostic-manager.hpp +++ b/src/diagnostic/diagnostic-manager.hpp @@ -49,7 +49,7 @@ protected: private: DiagnosticShims shims_; /*!< shims_ - An array of shim functions for each CAN bus that plug the diagnostics * library (uds-c) into the VI's CAN peripheral.*/ - can_bus_dev_t* bus_; /*!< bus_ - A pointer to the CAN bus that should be used for all standard OBD-II requests, if the bus is not + std::shared_ptr bus_; /*!< bus_ - A pointer to the CAN bus that should be used for all standard OBD-II requests, if the bus is not * explicitly spcified in the request. If NULL, all requests require an explicit bus.*/ std::vector recurring_requests_; /*!< recurringRequests - A queue of active, recurring diagnostic requests. When * a response is received for a recurring request or it times out, it is @@ -64,14 +64,16 @@ private: bool initialized_; /*!< * initialized - True if the DiagnosticsManager has been initialized with shims. It will interface with the uds-c lib*/ + void init_diagnostic_shims(); + void reset(); public: diagnostic_manager_t(); - diagnostic_manager_t(can_bus_dev_t& bus); - void init_diagnostic_shims(); + bool initialize(std::shared_ptr cbd); - can_bus_dev_t* get_can_bus_dev(); + std::shared_ptr get_can_bus_dev(); active_diagnostic_request_t* get_free_entry(); + DiagnosticShims& get_shims(); void find_and_erase(active_diagnostic_request_t* entry, std::vector& requests_list); void cancel_request(active_diagnostic_request_t* entry); @@ -81,7 +83,6 @@ public: bool validate_optional_request_attributes(float frequencyHz); - void reset(); void checkSupportedPids(const active_diagnostic_request_t& request, const DiagnosticResponse& response, float parsedPayload); -- cgit 1.2.3-korg