Woman, Life, Freedom


DoIP Library
Diagnostics over Internet Protocol (DoIP) C++ library
DoipLib::DiagMessage Class Reference

Diagnostic message (e.g., an UDS message) More...

#include <diag_message.h>

Inheritance diagram for DoipLib::DiagMessage:
DoipLib::Message

Public Member Functions

 DiagMessage (uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, const std::vector< uint8_t > &userData)
 Constructor. More...
 
 DiagMessage (uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, std::vector< uint8_t > &&userData)
 Constructor. More...
 
uint16_t GetSourceAddress () const noexcept
 Get message source address. More...
 
uint16_t GetTargetAddress () const noexcept
 Get message target address. More...
 
void GetUserData (std::vector< uint8_t > &userData) const
 Get user data. More...
 
- Public Member Functions inherited from DoipLib::Message
void Serialize (std::vector< uint8_t > &serializedMessage) const
 Serialize DoIP message. More...
 
bool TryDeserialize (const std::vector< uint8_t > &serializedMessage, GenericNackType &nackCode)
 Try to deserialize DoIP message. More...
 

Protected Member Functions

void GetPayload (std::vector< uint8_t > &payload) const override
 Get message payload. More...
 
virtual bool TrySetPayload (const std::vector< uint8_t > &payload, uint32_t payloadLength) override
 Try to set message payload. More...
 
- Protected Member Functions inherited from DoipLib::Message
 Message (PayloadType payloadType) noexcept
 Constructor. More...
 
 Message (uint8_t protocolVersion, PayloadType payloadType) noexcept
 Constructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DoipLib::Message
static bool TryExtractPayloadType (const std::vector< uint8_t > &serializedMessage, PayloadType &payloadType)
 Try to extract the payload type from the given serialized message. More...
 
- Static Protected Attributes inherited from DoipLib::Message
static const std::size_t cHeaderSize {8}
 DoIP message header size.
 

Detailed Description

Diagnostic message (e.g., an UDS message)

Constructor & Destructor Documentation

◆ DiagMessage() [1/2]

DoipLib::DiagMessage::DiagMessage ( uint8_t  protocolVersion,
uint16_t  sourceAddress,
uint16_t  targetAddress,
const std::vector< uint8_t > &  userData 
)

Constructor.

Parameters
protocolVersionDoIP ISO protocol version
sourceAddressSender logical address
targetAddressReceiver logical address
userDataActual diagnostic payload data (e.g., UDS message payload)

◆ DiagMessage() [2/2]

DoipLib::DiagMessage::DiagMessage ( uint8_t  protocolVersion,
uint16_t  sourceAddress,
uint16_t  targetAddress,
std::vector< uint8_t > &&  userData 
)

Constructor.

Parameters
protocolVersionDoIP ISO protocol version
sourceAddressSender logical address
targetAddressReceiver logical address
userDataActual diagnostic payload data (e.g., UDS message payload)

Member Function Documentation

◆ GetPayload()

void DoipLib::DiagMessage::GetPayload ( std::vector< uint8_t > &  payload) const
overrideprotectedvirtual

Get message payload.

Parameters
[out]payloadPayload byte array

Implements DoipLib::Message.

◆ GetSourceAddress()

uint16_t DoipLib::DiagMessage::GetSourceAddress ( ) const
noexcept

Get message source address.

Returns
Sender logical address

◆ GetTargetAddress()

uint16_t DoipLib::DiagMessage::GetTargetAddress ( ) const
noexcept

Get message target address.

Returns
Receiver logical address

◆ GetUserData()

void DoipLib::DiagMessage::GetUserData ( std::vector< uint8_t > &  userData) const

Get user data.

Parameters
[out]userDataActual diagnostic payload data (e.g., UDS message payload)

◆ TrySetPayload()

virtual bool DoipLib::DiagMessage::TrySetPayload ( const std::vector< uint8_t > &  payload,
uint32_t  payloadLength 
)
overrideprotectedvirtual

Try to set message payload.

Parameters
[in]payloadPayload byte array
[in]payloadLengthPayload length from the message header
Returns
True if the payload is set successfully, otherwise false

Implements DoipLib::Message.