27 CAN_OverloadFrame = 13,
59 IBusMessage() =
default;
68 virtual ~IBusMessage() =
default;
88 virtual void ToRaw(std::vector<uint8_t>& dest)
const;
95 virtual void FromRaw(
const std::vector<uint8_t>& source);
111 void Version(uint16_t version) { version_ = version; }
118 [[nodiscard]] uint16_t
Version()
const {
return version_; }
126 [[nodiscard]] uint32_t
Size()
const {
return size_;};
134 [[nodiscard]]
bool Valid()
const {
return valid_;};
144 void Timestamp(uint64_t timestamp) { timestamp_ = timestamp; }
153 [[nodiscard]] uint64_t
Timestamp()
const {
return timestamp_; }
173 void BusChannel(uint16_t channel) { bus_channel_ = channel; }
193 [[nodiscard]] uint16_t
BusChannel()
const {
return bus_channel_; }
204 void Size(uint32_t size)
const {size_ = size; }
213 void Valid(
bool valid)
const { valid_ = valid;}
216 uint64_t timestamp_ = 0;
218 uint16_t version_ = 0;
219 uint8_t bus_channel_ = 0;
221 mutable uint32_t size_ = 18;
222 mutable bool valid_ =
true;
virtual void FromRaw(const std::vector< uint8_t > &source)
Deserialize the message.
uint64_t Timestamp() const
Retuns the timestampe.
Definition ibusmessage.h:153
bool Valid() const
Returns true if the message is valid.
Definition ibusmessage.h:134
static std::shared_ptr< IBusMessage > Create(BusMessageType type)
Creates a message by its type.
IBusMessage(BusMessageType type)
void Valid(bool valid) const
Sets the message valid or invalid.
Definition ibusmessage.h:213
uint16_t Version() const
Returns the version number of the message.
Definition ibusmessage.h:118
BusMessageType Type() const
Returns type of message.
Definition ibusmessage.h:101
void Version(uint16_t version)
Sets the vewrsion number for a message.
Definition ibusmessage.h:111
void Size(uint32_t size) const
Sets the total size of the message.
Definition ibusmessage.h:204
void Timestamp(uint64_t timestamp)
Sets the absolute time.
Definition ibusmessage.h:144
uint16_t BusChannel() const
Returns the bus channel number.
Definition ibusmessage.h:193
uint32_t Size() const
Returns the total size of the message.
Definition ibusmessage.h:126
virtual void ToRaw(std::vector< uint8_t > &dest) const
Serialize the message.
void BusChannel(uint16_t channel)
Sets the source channel.
Definition ibusmessage.h:173
Main namespace for the MDF library.
Definition buslogstream.h:24
BusMessageType
Defines all message types.
Definition ibusmessage.h:21