Woman, Life, Freedom


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

Diagnostic message negative acknowledgement. More...

#include <diag_message_nack.h>

Inheritance diagram for DoipLib::DiagMessageNack:
DoipLib::Message

Public Member Functions

 DiagMessageNack (uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, DiagNackType nackCode)
 Constructor without previous message. More...
 
 DiagMessageNack (uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, DiagNackType nackCode, const std::vector< uint8_t > &previousMessage)
 Constructor including previous message. More...
 
 DiagMessageNack (uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, DiagNackType nackCode, std::vector< uint8_t > &&previousMessage)
 Constructor including previous message. More...
 
uint16_t GetSourceAddress () const noexcept
 Get message source address. More...
 
uint16_t GetTargetAddress () const noexcept
 Get message target address. More...
 
DiagNackType GetNackCode () const noexcept
 Get NACK code. More...
 
bool TryGetPreviousMessage (std::vector< uint8_t > &previousMessage)
 Get previous diagnostic message. 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 negative acknowledgement.

Constructor & Destructor Documentation

◆ DiagMessageNack() [1/3]

DoipLib::DiagMessageNack::DiagMessageNack ( uint8_t  protocolVersion,
uint16_t  sourceAddress,
uint16_t  targetAddress,
DiagNackType  nackCode 
)

Constructor without previous message.

Parameters
protocolVersionDoIP ISO protocol version
sourceAddressSender logical address
targetAddressReceiver logical address
nackCodeNegative acknowledgement code

◆ DiagMessageNack() [2/3]

DoipLib::DiagMessageNack::DiagMessageNack ( uint8_t  protocolVersion,
uint16_t  sourceAddress,
uint16_t  targetAddress,
DiagNackType  nackCode,
const std::vector< uint8_t > &  previousMessage 
)

Constructor including previous message.

Parameters
protocolVersionDoIP ISO protocol version
sourceAddressSender logical address
targetAddressReceiver logical address
nackCodeNegative acknowledgement code
previousMessagePrevious diagnostic message payload

◆ DiagMessageNack() [3/3]

DoipLib::DiagMessageNack::DiagMessageNack ( uint8_t  protocolVersion,
uint16_t  sourceAddress,
uint16_t  targetAddress,
DiagNackType  nackCode,
std::vector< uint8_t > &&  previousMessage 
)

Constructor including previous message.

Parameters
protocolVersionDoIP ISO protocol version
sourceAddressSender logical address
targetAddressReceiver logical address
nackCodeNegative acknowledgement code
previousMessagePrevious diagnostic message payload

Member Function Documentation

◆ GetNackCode()

DiagNackType DoipLib::DiagMessageNack::GetNackCode ( ) const
noexcept

Get NACK code.

Returns
Negative acknowledgement code

◆ GetPayload()

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

Get message payload.

Parameters
[out]payloadPayload byte array

Implements DoipLib::Message.

◆ GetSourceAddress()

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

Get message source address.

Returns
Sender logical address

◆ GetTargetAddress()

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

Get message target address.

Returns
Receiver logical address

◆ TryGetPreviousMessage()

bool DoipLib::DiagMessageNack::TryGetPreviousMessage ( std::vector< uint8_t > &  previousMessage)

Get previous diagnostic message.

Parameters
[out]previousMessagePrevious diagnostic message payload
Returns
True if the message is available, otherwise false

◆ TrySetPayload()

virtual bool DoipLib::DiagMessageNack::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.