get verb: add option id
[apps/agl-service-can-low-level.git] / low-can-binding / diagnostic / diagnostic-manager.cpp
index 91dba47..9357883 100644 (file)
@@ -56,16 +56,24 @@ diagnostic_manager_t::~diagnostic_manager_t()
 ///
 /// 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();
+       if (! diagnostic_bus.empty())
+       {
+               bus_ = diagnostic_bus;
+               init_diagnostic_shims();
+               reset();
 
-       init_diagnostic_shims();
-       reset();
+               AFB_DEBUG("Diagnostic Manager initialized");
+               initialized_ = true;
+               return initialized_;
+       }
+       AFB_ERROR("Diagnostic Manager missing its bus name in the config");
+       return initialized_;
+}
 
-       initialized_ = true;
-       AFB_DEBUG("Diagnostic Manager initialized");
+bool diagnostic_manager_t::is_initialized() const
+{
        return initialized_;
 }
 
@@ -113,6 +121,8 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8
        bcm_msg.msg_head.can_id  = arbitration_id;
        bcm_msg.msg_head.flags = SETTIMER|STARTTIMER|TX_CP_CAN_ID;
        bcm_msg.msg_head.count = 0;
+       bcm_msg.msg_head.ival1.tv_sec = 0;
+       bcm_msg.msg_head.ival1.tv_usec = 0;
        bcm_msg.msg_head.ival2.tv_sec = freq.tv_sec;
        bcm_msg.msg_head.ival2.tv_usec = freq.tv_usec;
        bcm_msg.msg_head.nframes = 1;