Woman, Life, Freedom


DoIP Library
Diagnostics over Internet Protocol (DoIP) C++ library
DoipLib::Message Class Referenceabstract

DoIP generic message. More...

#include <message.h>

Inheritance diagram for DoipLib::Message:
DoipLib::AliveCheckRequest DoipLib::AliveCheckResponse DoipLib::DiagMessage DoipLib::DiagMessageAck DoipLib::DiagMessageNack DoipLib::EidVehicleIdRequest DoipLib::EntityStatusRequest DoipLib::EntityStatusResponse DoipLib::GenericNack DoipLib::PowerModeRequest DoipLib::PowerModeResponse DoipLib::RoutingActivationRequest DoipLib::RoutingActivationResponse DoipLib::VehicleIdRequest DoipLib::VehicleIdResponse DoipLib::VinVehicleIdRequest

Public Member Functions

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...
 

Static Public Member Functions

static bool TryExtractPayloadType (const std::vector< uint8_t > &serializedMessage, PayloadType &payloadType)
 Try to extract the payload type from the given serialized message. More...
 

Protected Member Functions

 Message (PayloadType payloadType) noexcept
 Constructor. More...
 
 Message (uint8_t protocolVersion, PayloadType payloadType) noexcept
 Constructor. More...
 
virtual void GetPayload (std::vector< uint8_t > &payload) const =0
 Get message payload. More...
 
virtual bool TrySetPayload (const std::vector< uint8_t > &payload, uint32_t payloadLength)=0
 Try to set message payload. More...
 

Static Protected Attributes

static const std::size_t cHeaderSize {8}
 DoIP message header size.
 

Detailed Description

DoIP generic message.

Constructor & Destructor Documentation

◆ Message() [1/2]

DoipLib::Message::Message ( PayloadType  payloadType)
explicitprotectednoexcept

Constructor.

Parameters
payloadTypeDoIP message payload type

◆ Message() [2/2]

DoipLib::Message::Message ( uint8_t  protocolVersion,
PayloadType  payloadType 
)
protectednoexcept

Constructor.

Parameters
protocolVersionDoIP ISO protocol version
payloadTypeDoIP message payload type

Member Function Documentation

◆ GetPayload()

◆ Serialize()

void DoipLib::Message::Serialize ( std::vector< uint8_t > &  serializedMessage) const

Serialize DoIP message.

Parameters
[out]serializedMessageSerialize message byte array

◆ TryDeserialize()

bool DoipLib::Message::TryDeserialize ( const std::vector< uint8_t > &  serializedMessage,
GenericNackType &  nackCode 
)

Try to deserialize DoIP message.

Parameters
[in]serializedMessageSerialize message byte array
[out]nackCodeNegative acknowledgement code if deserialization failed
Returns
True if the deserialization is successful, otherwise false

◆ TryExtractPayloadType()

static bool DoipLib::Message::TryExtractPayloadType ( const std::vector< uint8_t > &  serializedMessage,
PayloadType &  payloadType 
)
static

Try to extract the payload type from the given serialized message.

Parameters
[in]serializedMessageSerialized message byte array
[out]payloadTypeExtracted payload type
Returns
True if the payload type is extracted successfully, otherwise false

◆ TrySetPayload()

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