Woman, Life, Freedom


DoIP Library
Diagnostics over Internet Protocol (DoIP) C++ library
diag_message_ack.h
1#ifndef DIAG_MESSAGE_ACK_H
2#define DIAG_MESSAGE_ACK_H
3
4#include "./message.h"
5
6namespace DoipLib
7{
9 class DiagMessageAck : public Message
10 {
11 private:
12 static const PayloadType cPayloadType{
13 PayloadType::DiagMessagePositiveAcknowledgement};
14 const uint8_t cAckCode{0x00};
15
16 uint16_t mSourceAddress;
17 uint16_t mTargetAddress;
18 bool mHasPreviousMessage;
19 std::vector<uint8_t> mPreviousMessage;
20
21 bool TrySetCompulsoryPayload(const std::vector<uint8_t> &payload);
22
23 protected:
24 void GetPayload(std::vector<uint8_t> &payload) const override;
25
26 virtual bool TrySetPayload(
27 const std::vector<uint8_t> &payload,
28 uint32_t payloadLength) override;
29
30 public:
32
38 uint8_t protocolVersion,
39 uint16_t sourceAddress,
40 uint16_t targetAddress);
41
48 uint8_t protocolVersion,
49 uint16_t sourceAddress,
50 uint16_t targetAddress,
51 const std::vector<uint8_t> &previousMessage);
52
59 uint8_t protocolVersion,
60 uint16_t sourceAddress,
61 uint16_t targetAddress,
62 std::vector<uint8_t> &&previousMessage);
63
66 uint16_t GetSourceAddress() const noexcept;
67
70 uint16_t GetTargetAddress() const noexcept;
71
75 bool TryGetPreviousMessage(std::vector<uint8_t> &previousMessage);
76 };
77}
78
79#endif
Diagnostic message positive acknowledgement.
Definition: diag_message_ack.h:10
DiagMessageAck(uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, const std::vector< uint8_t > &previousMessage)
Constructor including previous message.
DiagMessageAck(uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress, std::vector< uint8_t > &&previousMessage)
Constructor including previous message.
uint16_t GetTargetAddress() const noexcept
Get message target address.
virtual bool TrySetPayload(const std::vector< uint8_t > &payload, uint32_t payloadLength) override
Try to set message payload.
uint16_t GetSourceAddress() const noexcept
Get message source address.
bool TryGetPreviousMessage(std::vector< uint8_t > &previousMessage)
Get previous diagnostic message.
DiagMessageAck(uint8_t protocolVersion, uint16_t sourceAddress, uint16_t targetAddress)
Constructor without previous message.
void GetPayload(std::vector< uint8_t > &payload) const override
Get message payload.
DoIP generic message.
Definition: message.h:12