13 #include "common/logger.h" 
   19 namespace udp_channel {
 
  142     -> std::vector<std::uint8_t> {
 
  143   std::vector<std::uint8_t> output_buffer{};
 
  146   output_buffer.emplace_back(
static_cast<std::uint8_t
>((payload_type & 0xFF00) >> 8));
 
  147   output_buffer.emplace_back(
static_cast<std::uint8_t
>(payload_type & 0x00FF));
 
  148   output_buffer.emplace_back(
static_cast<std::uint8_t
>((payload_len & 0xFF000000) >> 24));
 
  149   output_buffer.emplace_back(
static_cast<std::uint8_t
>((payload_len & 0x00FF0000) >> 16));
 
  150   output_buffer.emplace_back(
static_cast<std::uint8_t
>((payload_len & 0x0000FF00) >> 8));
 
  151   output_buffer.emplace_back(
static_cast<std::uint8_t
>(payload_len & 0x000000FF));
 
  152   return output_buffer;
 
  163   std::uint16_t vehicle_identification_type{0u};
 
  164   std::uint8_t vehicle_identification_length{0u};
 
  165   switch (preselection_mode) {
 
  181   return VehiclePayloadType{vehicle_identification_type, vehicle_identification_length};
 
  215                             std::make_unique<kIdle>(VehicleIdentificationState::kIdle));
 
  218                             std::make_unique<kSendVehicleIdentificationReq>(
 
  219                                 VehicleIdentificationState::kSendVehicleIdentificationReq));
 
  222                             std::make_unique<kWaitForVehicleIdentificationRes>(
 
  223                                 VehicleIdentificationState::kWaitForVehicleIdentificationRes));
 
  226         VehicleIdentificationState::kDoIPCtrlTimeout,
 
  227         std::make_unique<kDoIPCtrlTimeout>(VehicleIdentificationState::kDoIPCtrlTimeout));
 
  290   if (handler_impl_->GetStateContext().GetActiveState().GetState() ==
 
  291       VehicleIdentificationState::kIdle) {
 
  294     handler_impl_->GetStateContext().TransitionTo(
 
  295         VehicleIdentificationState::kWaitForVehicleIdentificationRes);
 
  296     if (SendVehicleIdentificationRequest(std::move(vehicle_identification_request)) ==
 
  300       handler_impl_->GetSyncTimer().WaitForTimeout(
 
  302             handler_impl_->GetStateContext().TransitionTo(
 
  303                 VehicleIdentificationState::kDoIPCtrlTimeout);
 
  310       handler_impl_->GetStateContext().TransitionTo(VehicleIdentificationState::kIdle);
 
  313       handler_impl_->GetStateContext().TransitionTo(VehicleIdentificationState::kIdle);
 
  315           FILE_NAME, __LINE__, 
"", [](std::stringstream &msg) {
 
  316             msg << 
"Vehicle Identification request transmission Failed";
 
  327   if (handler_impl_->GetStateContext().GetActiveState().GetState() ==
 
  328       VehicleIdentificationState::kWaitForVehicleIdentificationRes) {
 
  332         ret_val{handler_impl_->GetDoipChannel().IndicateMessage(
 
  336             doip_payload.GetPayload().size(), 0U, 
"DoIPUdp", doip_payload.GetPayload())};
 
  337     if ((ret_val.first ==
 
  339         (ret_val.second != 
nullptr)) {
 
  342           {
"kRemoteIpAddress", std::string{doip_payload.GetHostIpAddress()}}};
 
  343       ret_val.second->AddMetaInfo(
 
  344           std::make_shared<uds_transport::UdsMessage::MetaInfoMap>(meta_info_map));
 
  346       (void) std::copy(doip_payload.GetPayload().begin(), doip_payload.GetPayload().end(),
 
  347                        ret_val.second->GetPayload().begin());
 
  348       handler_impl_->GetDoipChannel().HandleMessage(std::move(ret_val.second));
 
  361   std::uint8_t 
const preselection_mode{vehicle_identification_request->GetPayload()[1u]};
 
  367   UdpMessage::BufferType compose_vehicle_identification_req{
 
  371     compose_vehicle_identification_req.insert(
 
  373         vehicle_identification_request->GetPayload().begin() + 2U,
 
  374         vehicle_identification_request->GetPayload().end());
 
  378       std::make_unique<UdpMessage>(vehicle_identification_request->GetHostIpAddress(),
 
  379                                    vehicle_identification_request->GetHostPortNumber(),
 
  380                                    std::move(compose_vehicle_identification_req))};
 
  381   if (handler_impl_->GetSocketHandler().Transmit(std::move(doip_vehicle_identification_req))) {
 
Immutable class to store received doip message.
 
Class to manage a udp channel as per DoIP protocol.
 
Class implements vehicle identification handler.
 
VehicleIdentificationStateContext state_context_
Stores the vehicle identification states.
 
VehicleIdentificationHandlerImpl(sockets::UdpSocketHandler &udp_socket_handler, DoipUdpChannel &channel)
Constructs an instance of VehicleDiscoveryHandlerImpl.
 
DoipUdpChannel & channel_
The reference to doip channel.
 
sockets::UdpSocketHandler & udp_socket_handler_
The reference to socket handler.
 
auto GetStateContext() noexcept -> VehicleIdentificationStateContext &
Function to get the Vehicle Identification State context.
 
SyncTimer sync_timer_
Store the synchronous timer.
 
auto GetSyncTimer() noexcept -> SyncTimer &
Function to get the sync timer.
 
auto GetSocketHandler() noexcept -> sockets::UdpSocketHandler &
Function to get the socket handler.
 
auto GetDoipChannel() noexcept -> DoipUdpChannel &
Function to get the doip channel.
 
auto SendVehicleIdentificationRequest(uds_transport::UdsMessageConstPtr vehicle_identification_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to send vehicle identification request.
 
~VehicleIdentificationHandler()
Destruct an instance of VehicleIdentificationHandler.
 
sockets::UdpSocketHandler::MessagePtr UdpMessagePtr
Type alias for Tcp message pointer.
 
auto HandleVehicleIdentificationRequest(uds_transport::UdsMessageConstPtr vehicle_identification_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to handle sending of vehicle identification request.
 
void ProcessVehicleIdentificationResponse(DoipMessage &doip_payload) noexcept
Function to process received vehicle identification response.
 
VehicleIdentificationHandler(sockets::UdpSocketHandler &udp_socket_handler, DoipUdpChannel &channel)
Constructs an instance of VehicleIdentificationHandler.
 
Class implements sending of vehicle identification request state.
 
void Stop() override
Function to stop the current state.
 
void Start() override
Function to start the current state.
 
kSendVehicleIdentificationReq(VehicleIdentificationState state)
Constructs an instance of kSendVehicleIdentificationReq.
 
Class implements wait for vehicle identification response state.
 
void Start() override
Function to start the current state.
 
kWaitForVehicleIdentificationRes(VehicleIdentificationState state)
Constructs an instance of kWaitForVehicleIdentificationRes.
 
void Stop() override
Function to stop the current state.
 
Class implements Ctrl timeout state.
 
void Start() override
Function to start the current state.
 
kDoIPCtrlTimeout(VehicleIdentificationState state)
Constructs an instance of kDoIPCtrlTimeout.
 
void Stop() override
Function to stop the current state.
 
Class implements idle state.
 
void Stop() override
Function to stop the current state.
 
void Start() override
Function to start the current state.
 
kIdle(VehicleIdentificationState state)
Constructs an instance of kIdle.
 
static auto GetDiagClientLogger() noexcept -> DoipClientLogger &
 
Handler class to manage different socket of various client (Udp / Tcp)
 
std::map< std::string, std::string > MetaInfoMap
 
void TransitionTo(EnumState state)
 
void AddState(EnumState state, std::unique_ptr< State< EnumState >> state_ptr)
 
std::pair< std::uint16_t, std::uint8_t > VehiclePayloadType
Type alias of vehicle payload type.
 
auto CreateDoipGenericHeader(std::uint16_t payload_type, std::uint32_t payload_len) noexcept -> std::vector< std::uint8_t >
Function to create doip generic header.
 
auto GetVehicleIdentificationPayloadType(std::uint8_t preselection_mode) noexcept -> VehiclePayloadType
Get the vehicle identification payload type based on preselection mode.
 
VehicleIdentificationState
Different vehicle identification state.
 
SocketHandler< boost_support::client::udp::UdpClient > UdpSocketHandler
Type alias of Udp socket handler.
 
constexpr std::uint8_t kDoipheadrSize
 
constexpr std::uint16_t kDoip_VehicleIdentification_ReqType
 
constexpr std::uint32_t kDoIPCtrl
 
constexpr std::uint32_t kDoip_VehicleIdentification_ReqLen
 
constexpr std::uint8_t kDoip_ProtocolVersion
 
constexpr std::uint32_t kDoip_VehicleIdentificationVIN_ReqLen
 
constexpr std::uint16_t kDoip_VehicleIdentificationVIN_ReqType
 
constexpr std::uint32_t kDoip_VehicleIdentificationEID_ReqLen
 
constexpr std::uint16_t kDoip_VehicleIdentificationEID_ReqType
 
std::unique_ptr< const UdsMessage > UdsMessageConstPtr
 
std::unique_ptr< UdsMessage > UdsMessagePtr
 
State
Definitions of different connection state.