X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fdiagnostic%2Fdiagnostic-manager.cpp;h=65afecfe46ee6e60ce767728fa1acbbf954dd22d;hb=a6fb72a70f90c35e0968f2460d324a8505410562;hp=2f22b14d53ee01b0b779a3a5a749350622043330;hpb=e4e00c65f8b686dd93e68a3226020692a62e1d26;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index 2f22b14d..65afecfe 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -49,8 +49,8 @@ diagnostic_manager_t::~diagnostic_manager_t() } } -/// @brief Diagnostic manager isn't initialized at launch but after -/// CAN bus devices initialization. For the moment, it is only possible +/// @brief Diagnostic manager is not initialized at launch but after +/// the initialization of CAN bus devices. For the moment, it is only possible /// to have 1 diagnostic bus which are the first bus declared in the JSON /// description file. Configuration instance will return it. /// @@ -102,29 +102,28 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8 // Make sure that socket has been opened. if(! tx_socket) - tx_socket.open( - dm.get_bus_device_name()); + tx_socket.open(dm.get_bus_device_name()); - struct utils::simple_bcm_msg bcm_msg; - struct can_frame cfd; - - memset(&cfd, 0, sizeof(cfd)); - memset(&bcm_msg.msg_head, 0, sizeof(bcm_msg.msg_head)); + struct utils::bcm_msg bcm_msg; + struct can_frame cf; struct timeval freq = current_adr->get_frequency_clock().get_timeval_from_period(); bcm_msg.msg_head.opcode = TX_SETUP; 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.ival2.tv_sec = freq.tv_sec; bcm_msg.msg_head.ival2.tv_usec = freq.tv_usec; bcm_msg.msg_head.nframes = 1; - cfd.can_dlc = size; - ::memcpy(cfd.data, data, size); + cf.can_dlc = size; + + ::memset(cf.data, 0, sizeof(cf.data)); + ::memcpy(cf.data, data, size); - bcm_msg.frames = cfd; + bcm_msg.frames[0] = cf; - tx_socket << bcm_msg; + tx_socket.write_message(bcm_msg); if(tx_socket) return true; return false; @@ -257,7 +256,7 @@ active_diagnostic_request_t* diagnostic_manager_t::find_recurring_request(Diagno } return nullptr; } - +/* /// @brief Add and send a new one-time diagnostic request. DON'T USED AT THIS TIME /// /// A one-time (aka non-recurring) request can existing in parallel with a @@ -314,7 +313,7 @@ active_diagnostic_request_t* diagnostic_manager_t::add_request(DiagnosticRequest } return entry; } - +*/ /// @brief Validate frequency asked don't get higher than the maximum of a classical /// CAN bus OBD2 request. ///