Diag-Client-Lib
doip_diagnostic_message_handler.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2 * Copyright (C) 2024 Avijit Dey
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8 #ifndef DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CHANNEL_TCP_CHANNEL_DOIP_DIAGNOSTIC_MESSAGE_HANDLER_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CHANNEL_TCP_CHANNEL_DOIP_DIAGNOSTIC_MESSAGE_HANDLER_H_
10 
11 #include <memory>
12 #include <vector>
13 
14 #include "common/doip_message.h"
18 
19 namespace doip_client {
20 namespace channel {
21 namespace tcp_channel {
22 
23 // Forward declaration
24 class DoipTcpChannel;
25 
30  public:
35 
40 
41  public:
50 
55 
59  void Start();
60 
65  void Stop();
66 
71  void Reset();
72 
78  void ProcessDoIPDiagnosticAckMessageResponse(DoipMessage &doip_payload) noexcept;
79 
85  void ProcessDoIPDiagnosticMessageResponse(DoipMessage &doip_payload) noexcept;
86 
93  auto HandleDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept
95 
96  private:
103  auto SendDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept
105 
115  static void CreateDoipGenericHeader(std::vector<std::uint8_t> &doip_header, std::uint16_t payload_type,
116  std::uint32_t payload_len);
117 
118  private:
123 
127  std::unique_ptr<DiagnosticMessageHandlerImpl> handler_impl_;
128 };
129 
130 } // namespace tcp_channel
131 } // namespace channel
132 } // namespace doip_client
133 #endif //DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_CHANNEL_TCP_CHANNEL_DOIP_DIAGNOSTIC_MESSAGE_HANDLER_H_
Immutable class to store received tcp message.
Definition: tcp_message.h:25
Immutable class to store received doip message.
Definition: doip_message.h:21
Class used as a handler to process routing activation messages.
~DiagnosticMessageHandler()
Destruct an instance of DiagnosticMessageHandler.
auto HandleDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to handle sending of diagnostic request.
DiagnosticMessageHandler(sockets::TcpSocketHandler &tcp_socket_handler, DoipTcpChannel &channel)
Constructs an instance of DiagnosticMessageHandler.
sockets::TcpSocketHandler::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
void ProcessDoIPDiagnosticAckMessageResponse(DoipMessage &doip_payload) noexcept
Function to process received diagnostic acknowledgement from server.
auto SendDiagnosticRequest(uds_transport::UdsMessageConstPtr diagnostic_request) noexcept -> uds_transport::UdsTransportProtocolMgr::TransmissionResult
Function to send diagnostic request.
static void CreateDoipGenericHeader(std::vector< std::uint8_t > &doip_header, std::uint16_t payload_type, std::uint32_t payload_len)
Function to create doip generic header.
std::unique_ptr< DiagnosticMessageHandlerImpl > handler_impl_
Stores the Handler implementation.
void ProcessDoIPDiagnosticMessageResponse(DoipMessage &doip_payload) noexcept
Function to process received diagnostic positive/negative response from server.
Class to manage a tcp channel as per DoIP protocol.
Class used to create a tcp socket for handling transmission and reception of tcp message from driver.
boost_support::socket::tcp::TcpMessagePtr TcpMessagePtr
Type alias for Tcp message pointer.
boost_support::socket::tcp::TcpMessage TcpMessage
Type alias for Tcp message.
std::unique_ptr< const UdsMessage > UdsMessageConstPtr
Definition: uds_message.h:69