10 #include <satcat5/ptp_header.h>
15 #ifndef SATCAT5_PTP_CACHE_SIZE
16 #define SATCAT5_PTP_CACHE_SIZE 4
89 : m_next_wr(0), m_buff{} {}
Internal buffer used by the Log class.
Searchable cache of recent Measurement objects.
satcat5::ptp::Measurement * find(const satcat5::ptp::Header &hdr, const satcat5::ptp::PortId &port)
Find the first matching measurement in the cache.
satcat5::ptp::Measurement * find(const satcat5::ptp::Header &hdr)
Shortcut for searches where port = hdr.src_port.
satcat5::ptp::Measurement * push(const satcat5::ptp::Header &hdr)
Create a new measurement, overwriting the oldest.
constexpr MeasurementCache()
Create an empty cache.
High-precision timestamp for use with PTP / IEEE1588.
constexpr satcat5::ptp::Measurement MEASUREMENT_NULL
Placeholder for an empty Measurement.
High-precision "Time" object for use with PTP / IEEE1588.
Timestamps and metadata for a two-way time-transfer handshake.
satcat5::ptp::Time t1
Timestamp T1 (A to B / Tx)
bool match(const satcat5::ptp::Header &hdr, const satcat5::ptp::PortId &port) const
Check if an incoming message matches this exchange.
void log_to(satcat5::log::LogBuffer &wr) const
Write all four timestamps to the log.
void reset(const satcat5::ptp::Header &hdr)
Reset this data structure for immediate reuse.
bool done() const
Is this measurement completed? (i.e., T1/T2/T3/T4 all known)
satcat5::ptp::Time mean_link_delay() const
Calculate PTP "meanLinkDelay".
satcat5::ptp::Header ref
Reference header is copied from the initiating PTP message (i.e., SYNC or PDELAY_REQ) and used to mat...
satcat5::ptp::Time mean_path_delay() const
Calculate PTP "meanPathDelay".
satcat5::ptp::Time t2
Timestamp T2 (A to B / Rx)
satcat5::ptp::Time t4
Timestamp T4 (B to A / Rx)
satcat5::ptp::Time t3
Timestamp T3 (B to A / Tx)
satcat5::ptp::Time offset_from_master() const
Calculate PTP "offsetFromMaster".
Struct used for sourcePortIdentity and requestingPortIdentity.