diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-12 19:38:49 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-03-16 17:10:41 +0100 |
commit | 24057b7fad6d4d1f1f264995d0f5865acf466004 (patch) | |
tree | ced9c92076a3f6c1e87f9aeb0312bfa2440fd3a1 /src/diagnostic/diagnostic-manager.hpp | |
parent | 62eb024d989037ae7f2ba86de8b68c826cb61ec9 (diff) |
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'src/diagnostic/diagnostic-manager.hpp')
-rw-r--r-- | src/diagnostic/diagnostic-manager.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
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<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 * explicitly spcified in the request. If NULL, all requests require an explicit bus.*/ std::vector<active_diagnostic_request_t*> 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<can_bus_dev_t> cbd); - can_bus_dev_t* get_can_bus_dev(); + std::shared_ptr<can_bus_dev_t> 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<active_diagnostic_request_t*>& 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); |