Diag-Client-Lib
Public Types | Public Member Functions | Private Attributes | List of all members
doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl Class Reference

Class implements routing activation handler. More...

Collaboration diagram for doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl:
Collaboration graph
[legend]

Public Types

using DiagnosticMessageStateContext = utility::state::StateContext< DiagnosticMessageState >
 Type alias for state context. More...
 
using SyncTimer = utility::sync_timer::SyncTimer< std::chrono::steady_clock >
 Type alias for Sync timer. More...
 

Public Member Functions

 DiagnosticMessageHandlerImpl (sockets::TcpSocketHandler &tcp_socket_handler, DoipTcpChannel &channel)
 Constructs an instance of DiagnosticMessageHandlerImpl. More...
 
void Start ()
 Function to start the handler. More...
 
void Stop ()
 Function to stop the handler. More...
 
void Reset ()
 Function to reset the handler. More...
 
auto GetStateContext () noexcept -> DiagnosticMessageStateContext &
 Function to get the Diagnostic Message State context. More...
 
auto GetSocketHandler () noexcept -> sockets::TcpSocketHandler &
 Function to get the socket handler. More...
 
auto GetDoipChannel () noexcept -> DoipTcpChannel &
 Function to get the doip channel. More...
 
auto GetSyncTimer () noexcept -> SyncTimer &
 Function to get the sync timer. More...
 

Private Attributes

sockets::TcpSocketHandlertcp_socket_handler_
 The reference to socket handler. More...
 
DoipTcpChannelchannel_
 The reference to doip channel. More...
 
DiagnosticMessageStateContext state_context_
 Stores the diagnostic message states. More...
 
SyncTimer sync_timer_
 Store the synchronous timer. More...
 

Detailed Description

Class implements routing activation handler.

Definition at line 261 of file doip_diagnostic_message_handler.cpp.

Member Typedef Documentation

◆ DiagnosticMessageStateContext

Type alias for state context.

Definition at line 266 of file doip_diagnostic_message_handler.cpp.

◆ SyncTimer

Type alias for Sync timer.

Definition at line 271 of file doip_diagnostic_message_handler.cpp.

Constructor & Destructor Documentation

◆ DiagnosticMessageHandlerImpl()

doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::DiagnosticMessageHandlerImpl ( sockets::TcpSocketHandler tcp_socket_handler,
DoipTcpChannel channel 
)
inline

Constructs an instance of DiagnosticMessageHandlerImpl.

Parameters
[in]tcp_socket_handlerThe reference to socket handler
[in]channelThe reference to doip channel

Definition at line 280 of file doip_diagnostic_message_handler.cpp.

281  : tcp_socket_handler_{tcp_socket_handler},
282  channel_{channel},
283  state_context_{},
284  sync_timer_{} {
285  // create and add state for Diagnostic State
286  // kIdle
287  state_context_.AddState(DiagnosticMessageState::kIdle, std::make_unique<kIdle>(DiagnosticMessageState::kIdle));
288  // kSendDiagnosticReqFailed
290  DiagnosticMessageState::kSendDiagnosticReqFailed,
291  std::make_unique<kSendDiagnosticReqFailed>(DiagnosticMessageState::kSendDiagnosticReqFailed));
292  // kWaitForDiagnosticAck
293  state_context_.AddState(DiagnosticMessageState::kWaitForDiagnosticAck,
294  std::make_unique<kWaitForDiagnosticAck>(DiagnosticMessageState::kWaitForDiagnosticAck));
295  // kDiagnosticPositiveAckRecvd
297  DiagnosticMessageState::kDiagnosticPositiveAckRecvd,
298  std::make_unique<kDiagnosticPositiveAckRecvd>(DiagnosticMessageState::kDiagnosticPositiveAckRecvd));
299  // kDiagnosticNegativeAckRecvd
301  DiagnosticMessageState::kDiagnosticNegativeAckRecvd,
302  std::make_unique<kDiagnosticNegativeAckRecvd>(DiagnosticMessageState::kDiagnosticNegativeAckRecvd));
303  // kWaitForDiagnosticResponse
305  DiagnosticMessageState::kWaitForDiagnosticResponse,
306  std::make_unique<kWaitForDiagnosticResponse>(DiagnosticMessageState::kWaitForDiagnosticResponse));
307  // Transit to idle state
308  state_context_.TransitionTo(DiagnosticMessageState::kIdle);
309  }
void TransitionTo(EnumState state)
Definition: state.h:69
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

◆ GetDoipChannel()

auto doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::GetDoipChannel ( ) -> DoipTcpChannel &
inlinenoexcept

Function to get the doip channel.

Returns
The reference to channel

Definition at line 347 of file doip_diagnostic_message_handler.cpp.

347 { return channel_; }

References channel_.

◆ GetSocketHandler()

auto doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::GetSocketHandler ( ) -> sockets::TcpSocketHandler &
inlinenoexcept

Function to get the socket handler.

Returns
The reference to socket handler

Definition at line 341 of file doip_diagnostic_message_handler.cpp.

341 { return tcp_socket_handler_; }

References tcp_socket_handler_.

◆ GetStateContext()

auto doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::GetStateContext ( ) -> DiagnosticMessageStateContext &
inlinenoexcept

Function to get the Diagnostic Message State context.

Returns
The reference to state context

Definition at line 335 of file doip_diagnostic_message_handler.cpp.

335 { return state_context_; }

References state_context_.

◆ GetSyncTimer()

auto doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::GetSyncTimer ( ) -> SyncTimer &
inlinenoexcept

Function to get the sync timer.

Returns
The reference to sync timer

Definition at line 353 of file doip_diagnostic_message_handler.cpp.

353 { return sync_timer_; }

References sync_timer_.

◆ Reset()

void doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::Reset ( )
inline

Function to reset the handler.

This will reset all the internal handler back to default state

Definition at line 329 of file doip_diagnostic_message_handler.cpp.

References Stop().

Here is the call graph for this function:

◆ Start()

void doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::Start ( )
inline

Function to start the handler.

Definition at line 314 of file doip_diagnostic_message_handler.cpp.

314 {}

◆ Stop()

void doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::Stop ( )
inline

Function to stop the handler.

This will reset all the internal handler back to default state

Definition at line 320 of file doip_diagnostic_message_handler.cpp.

320  {
322  state_context_.TransitionTo(DiagnosticMessageState::kIdle);
323  }
void CancelWait()
Function to cancel the synchronous wait.
Definition: sync_timer.h:90
auto IsTimerActive()
Function to query if timer is running.
Definition: sync_timer.h:82

References utility::sync_timer::SyncTimer< ClockType >::CancelWait(), utility::sync_timer::SyncTimer< ClockType >::IsTimerActive(), state_context_, sync_timer_, and utility::state::StateContext< EnumState >::TransitionTo().

Referenced by Reset().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ channel_

DoipTcpChannel& doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::channel_
private

The reference to doip channel.

Definition at line 364 of file doip_diagnostic_message_handler.cpp.

Referenced by GetDoipChannel().

◆ state_context_

DiagnosticMessageStateContext doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::state_context_
private

Stores the diagnostic message states.

Definition at line 369 of file doip_diagnostic_message_handler.cpp.

Referenced by DiagnosticMessageHandlerImpl(), GetStateContext(), and Stop().

◆ sync_timer_

SyncTimer doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::sync_timer_
private

Store the synchronous timer.

Definition at line 374 of file doip_diagnostic_message_handler.cpp.

Referenced by GetSyncTimer(), and Stop().

◆ tcp_socket_handler_

sockets::TcpSocketHandler& doip_client::channel::tcp_channel::DiagnosticMessageHandler::DiagnosticMessageHandlerImpl::tcp_socket_handler_
private

The reference to socket handler.

Definition at line 359 of file doip_diagnostic_message_handler.cpp.

Referenced by GetSocketHandler().


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