std::map<std::string, std::shared_ptr<low_can_subscription_t> >& get_can_devices();
- const std::string get_diagnostic_bus() const;
-
diagnostic_manager_t& get_diagnostic_manager() ;
uint8_t get_active_message_set() const;
if( subscription.signal_ )
ret = subscription.socket_->open(subscription.signal_->get_message()->get_bus_device_name());
else if(! subscription.diagnostic_message_.empty())
- ret = subscription.socket_->open(application_t::instance().get_diagnostic_bus());
+ ret = subscription.socket_->open(application_t::instance().get_diagnostic_manager().get_bus_name());
else if(! bus_name.empty())
ret = subscription.socket_->open(bus_name);
///
/// this will initialize DiagnosticShims and cancel all active requests
/// if there are any.
-bool diagnostic_manager_t::initialize()
+bool diagnostic_manager_t::initialize(std::string diagnostic_bus)
{
- // Mandatory to set the bus before intialize shims.
- bus_ = application_t::instance().get_diagnostic_bus();
-
- init_diagnostic_shims();
- reset();
+ if (! diagnostic_bus.empty())
+ {
+ bus_ = diagnostic_bus;
+ init_diagnostic_shims();
+ reset();
- initialized_ = true;
- AFB_DEBUG("Diagnostic Manager initialized");
+ AFB_DEBUG("Diagnostic Manager initialized");
+ initialized_ = true;
+ return initialized_;
+ }
+ AFB_ERROR("Diagnostic Manager missing its bus name in the config");
return initialized_;
}
#define DIAGNOSTIC_RESPONSE_ARBITRATION_ID_OFFSET 0x8
///
-/// @brief The core structure for running the diagnostics module of the binding.
+/// @brief The binding structure for running the diagnostics module of the binding.
///
/// This stores details about the active requests and shims required to connect
/// the diagnostics library to the CAN device.
static bool shims_send(const uint32_t arbitration_id, const uint8_t* data, const uint8_t size);
static void shims_logger(const char* m, ...);
+
public:
diagnostic_manager_t();
~diagnostic_manager_t();
- bool initialize();
+ bool initialize(std::string diagnostic_bus);
const std::string get_bus_name() const;
const std::string get_bus_device_name() const;