Diag-Client-Lib
Public Types | Public Member Functions | Private Attributes | List of all members
doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl Class Referencefinal

Class implements vehicle discovery handler. More...

Collaboration diagram for doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl:
Collaboration graph
[legend]

Public Types

using VehicleDiscoveryStateContext = utility::state::StateContext< VehicleDiscoveryState >
 Type alias for state context. More...
 

Public Member Functions

 VehicleDiscoveryHandlerImpl (sockets::UdpSocketHandler &udp_socket_handler)
 Constructs an instance of VehicleDiscoveryHandlerImpl. More...
 
auto GetStateContext () noexcept -> VehicleDiscoveryStateContext &
 Function to get the Vehicle Discovery State context. More...
 
auto GetSocketHandler () noexcept -> sockets::UdpSocketHandler &
 Function to get the socket handler. More...
 

Private Attributes

sockets::UdpSocketHandlerudp_socket_handler_
 The reference to socket handler. More...
 
VehicleDiscoveryStateContext state_context_
 Stores the vehicle discovery states. More...
 

Detailed Description

Class implements vehicle discovery handler.

Definition at line 102 of file doip_vehicle_discovery_handler.cpp.

Member Typedef Documentation

◆ VehicleDiscoveryStateContext

Type alias for state context.

Definition at line 107 of file doip_vehicle_discovery_handler.cpp.

Constructor & Destructor Documentation

◆ VehicleDiscoveryHandlerImpl()

doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl::VehicleDiscoveryHandlerImpl ( sockets::UdpSocketHandler udp_socket_handler)
inlineexplicit

Constructs an instance of VehicleDiscoveryHandlerImpl.

Parameters
[in]udp_socket_handlerThe reference to socket handler

Definition at line 114 of file doip_vehicle_discovery_handler.cpp.

115  : udp_socket_handler_{udp_socket_handler},
116  state_context_{} {
117  // create and add state for vehicle discovery
118  // kIdle
119  state_context_.AddState(VehicleDiscoveryState::kIdle,
120  std::make_unique<kIdle>(VehicleDiscoveryState::kIdle));
121  // kWaitForVehicleAnnouncement
122  state_context_.AddState(VehicleDiscoveryState::kWaitForVehicleAnnouncement,
123  std::make_unique<kWaitForVehicleAnnouncement>(
124  VehicleDiscoveryState::kWaitForVehicleAnnouncement));
125  // kDoIPCtrlTimeout
127  VehicleDiscoveryState::kDoIPCtrlTimeout,
128  std::make_unique<kDoIPCtrlTimeout>(VehicleDiscoveryState::kDoIPCtrlTimeout));
129  // Transit to wait for vehicle announcement
130  state_context_.TransitionTo(VehicleDiscoveryState::kWaitForVehicleAnnouncement);
131  }
void TransitionTo(EnumState state)
Definition: state.h:70
void AddState(EnumState state, std::unique_ptr< State< EnumState >> state_ptr)
Definition: state.h:58

References utility::state::StateContext< EnumState >::AddState(), state_context_, and utility::state::StateContext< EnumState >::TransitionTo().

Here is the call graph for this function:

Member Function Documentation

◆ GetSocketHandler()

auto doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl::GetSocketHandler ( ) -> sockets::UdpSocketHandler &
inlinenoexcept

Function to get the socket handler.

Returns
The reference to socket handler

Definition at line 143 of file doip_vehicle_discovery_handler.cpp.

143 { return udp_socket_handler_; }

References udp_socket_handler_.

◆ GetStateContext()

auto doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl::GetStateContext ( ) -> VehicleDiscoveryStateContext &
inlinenoexcept

Function to get the Vehicle Discovery State context.

Returns
The reference to state context

Definition at line 137 of file doip_vehicle_discovery_handler.cpp.

137 { return state_context_; }

References state_context_.

Member Data Documentation

◆ state_context_

VehicleDiscoveryStateContext doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl::state_context_
private

Stores the vehicle discovery states.

Definition at line 154 of file doip_vehicle_discovery_handler.cpp.

Referenced by GetStateContext(), and VehicleDiscoveryHandlerImpl().

◆ udp_socket_handler_

sockets::UdpSocketHandler& doip_client::channel::udp_channel::VehicleDiscoveryHandler::VehicleDiscoveryHandlerImpl::udp_socket_handler_
private

The reference to socket handler.

Definition at line 149 of file doip_vehicle_discovery_handler.cpp.

Referenced by GetSocketHandler().


The documentation for this class was generated from the following file: