Communication Library for Autonomous Systems v1.0
Reliable and secure communication library for autonomous vehicle systems
Loading...
Searching...
No Matches
Message< Channel > Class Template Reference

Template class for network messages with Clock integration. More...

#include <message.h>

Public Types

enum class  Type : std::uint8_t {
  UNKNOWN = 0 , INVALID = 1 , INTEREST , RESPONSE ,
  STATUS , REQ , KEY_RESPONSE
}
 
typedef Channel::Address Origin
 
typedef Channel::Physical_Address Physical_Address
 
typedef Channel::Port Port
 
typedef std::uint32_t Unit
 
typedef std::vector< std::uint8_t > Array
 
typedef std::chrono::microseconds Microseconds
 

Public Member Functions

 Message (Type message_type, const Origin &origin, Unit unit, Microseconds period=ZERO, const void *value_data=nullptr, const unsigned int value_size=0)
 
 Message (const Message &other)
 
 Message ()=default
 
 ~Message ()=default
 
const Typemessage_type () const
 
const Originorigin () const
 
const Microsecondstimestamp () const
 
const Unitunit () const
 
const Microsecondsperiod () const
 
const std::uint8_t * value () const
 
const unsigned int value_size () const
 
const voiddata () const
 
const unsigned int size () const
 
const bool external () const
 
void message_type (const Type message_type)
 
void origin (const Origin addr)
 
void timestamp (const Microseconds timestamp)
 
void unit (const Unit type)
 
void period (const Microseconds period)
 
void value (const void *data, const unsigned int size)
 
void external (const bool external)
 

Static Public Member Functions

static Message deserialize (const void *serialized, const unsigned int size)
 
static Microseconds getSynchronizedTimestamp ()
 
static bool isClockSynchronized ()
 

Static Public Attributes

static constexpr Microseconds ZERO = Microseconds::zero()
 

Detailed Description

template<typename Channel>
class Message< Channel >

Template class for network messages with Clock integration.

This Message class is integrated with the Clock singleton to provide synchronized timestamps across the distributed system. When messages are created, they automatically use the Clock's getSynchronizedTime() method instead of local system time, ensuring temporal consistency in a PTP-synchronized network.

Clock Integration Features:

  • Automatic synchronized timestamping in constructor
  • Static utility methods for getting synchronized timestamps
  • Clock synchronization status checking
Template Parameters
ProtocolThe network protocol type (e.g., Ethernet)

Member Typedef Documentation

◆ Array

template<typename Channel >
typedef std::vector<std::uint8_t> Message< Channel >::Array

◆ Microseconds

template<typename Channel >
typedef std::chrono::microseconds Message< Channel >::Microseconds

◆ Origin

template<typename Channel >
typedef Channel::Address Message< Channel >::Origin

◆ Physical_Address

template<typename Channel >
typedef Channel::Physical_Address Message< Channel >::Physical_Address

◆ Port

template<typename Channel >
typedef Channel::Port Message< Channel >::Port

◆ Unit

template<typename Channel >
typedef std::uint32_t Message< Channel >::Unit

Member Enumeration Documentation

◆ Type

template<typename Channel >
enum class Message::Type : std::uint8_t
strong
Enumerator
UNKNOWN 
INVALID 
INTEREST 
RESPONSE 
STATUS 
REQ 
KEY_RESPONSE 

Constructor & Destructor Documentation

◆ Message() [1/3]

template<typename Channel >
Message< Channel >::Message ( Type  message_type,
const Origin origin,
Unit  unit,
Microseconds  period = ZERO,
const void value_data = nullptr,
const unsigned int  value_size = 0 
)

◆ Message() [2/3]

template<typename Channel >
Message< Channel >::Message ( const Message< Channel > &  other)

◆ Message() [3/3]

template<typename Channel >
Message< Channel >::Message ( )
default

◆ ~Message()

template<typename Channel >
Message< Channel >::~Message ( )
default

Member Function Documentation

◆ data()

template<typename Channel >
const void * Message< Channel >::data ( ) const

◆ deserialize()

template<typename Channel >
Message< Channel > Message< Channel >::deserialize ( const void serialized,
const unsigned int  size 
)
static

◆ external() [1/2]

template<typename Channel >
const bool Message< Channel >::external ( ) const

◆ external() [2/2]

template<typename Channel >
void Message< Channel >::external ( const bool  external)

◆ getSynchronizedTimestamp()

template<typename Protocol >
Message< Protocol >::Microseconds Message< Protocol >::getSynchronizedTimestamp ( )
static

◆ isClockSynchronized()

template<typename Protocol >
bool Message< Protocol >::isClockSynchronized ( )
static

◆ message_type() [1/2]

template<typename Channel >
const Message< Channel >::Type & Message< Channel >::message_type ( ) const

◆ message_type() [2/2]

template<typename Channel >
void Message< Channel >::message_type ( const Type  message_type)

◆ origin() [1/2]

template<typename Channel >
const Message< Channel >::Origin & Message< Channel >::origin ( ) const

◆ origin() [2/2]

template<typename Channel >
void Message< Channel >::origin ( const Origin  addr)

◆ period() [1/2]

template<typename Channel >
const Message< Channel >::Microseconds & Message< Channel >::period ( ) const

◆ period() [2/2]

template<typename Channel >
void Message< Channel >::period ( const Microseconds  period)

◆ size()

template<typename Channel >
const unsigned int Message< Channel >::size ( ) const

◆ timestamp() [1/2]

template<typename Channel >
const Message< Channel >::Microseconds & Message< Channel >::timestamp ( ) const

◆ timestamp() [2/2]

template<typename Channel >
void Message< Channel >::timestamp ( const Microseconds  timestamp)

◆ unit() [1/2]

template<typename Channel >
const Message< Channel >::Unit & Message< Channel >::unit ( ) const

◆ unit() [2/2]

template<typename Channel >
void Message< Channel >::unit ( const Unit  type)

◆ value() [1/2]

template<typename Channel >
const std::uint8_t * Message< Channel >::value ( ) const

◆ value() [2/2]

template<typename Channel >
void Message< Channel >::value ( const void data,
const unsigned int  size 
)

◆ value_size()

template<typename Channel >
const unsigned int Message< Channel >::value_size ( ) const

Member Data Documentation

◆ ZERO

template<typename Channel >
constexpr Microseconds Message< Channel >::ZERO = Microseconds::zero()
staticconstexpr

The documentation for this class was generated from the following file: