return initialized_;
}
-void diagnostic_manager_t::read_socket()
-{
- can_message_t msg;
- can_bus_t& cbm = configuration_t::instance().get_can_bus_manager();
- socket_ >> msg;
- std::lock_guard<std::mutex> can_message_lock(cbm.get_can_message_mutex());
- { cbm.push_new_can_message(msg); }
- cbm.get_new_can_message_cv().notify_one();
-}
-
utils::socketcan_bcm_t& diagnostic_manager_t::get_socket()
{
return socket_;
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);
bcm_msg.frames = cfd;
/// @param[in] force - Force the cleaning or not ?
void diagnostic_manager_t::cleanup_request(active_diagnostic_request_t* entry, bool force)
{
- if((force || (entry != nullptr && entry->get_in_flight() && entry->request_completed())))
+ if((force || (entry != nullptr && entry->response_received())))
{
- entry->set_in_flight(false);
-
char request_string[128] = {0};
diagnostic_request_to_string(&entry->get_handle()->request,
request_string, sizeof(request_string));
&event_source_,
socket_.socket(),
EPOLLIN,
- read_diagnostic_message,
+ read_message,
nullptr) < 0)
{
cleanup_request(entry, true);
return entry;
}
-/// @brief Returns true if there are two active requests running for the same arbitration ID.
-bool diagnostic_manager_t::conflicting(active_diagnostic_request_t* request, active_diagnostic_request_t* candidate) const
-{
- return (candidate->get_in_flight() && candidate != request &&
- candidate->get_can_bus_dev() == request->get_can_bus_dev() &&
- candidate->get_id() == request->get_id());
-}
-
-
-/// @brief Returns true if there are no other active requests to the same arbitration ID
-/// and if there aren't more than 8 requests in flight at the same time.
-bool diagnostic_manager_t::clear_to_send(active_diagnostic_request_t* request) const
-{
- int total_in_flight = 0;
- for ( auto entry : non_recurring_requests_)
- {
- if(conflicting(request, entry))
- return false;
- if(entry->get_in_flight())
- total_in_flight++;
- }
-
- for ( auto entry : recurring_requests_)
- {
- if(conflicting(request, entry))
- return false;
- if(entry->get_in_flight())
- total_in_flight++;
- }
-
- if(total_in_flight > MAX_SIMULTANEOUS_IN_FLIGHT_REQUESTS)
- return false;
- return true;
-}
-
/// @brief Will decode the diagnostic response and build the final openxc_VehicleMessage to return.
///
/// @param[in] adr - A pointer to an active diagnostic request holding a valid diagnostic handle
}
// Reset the completed flag handle to make sure that it will be reprocessed the next time.
- adr->get_handle()->completed = false;
+ adr->get_handle()->success = false;
return message;
}