gaps-online-software 0.10
online software for the TOF system for the GAPS experiment
Loading...
Searching...
No Matches
TofPacket Struct Reference

#include <tof_packet.h>

Public Member Functions

auto to_string () const -> std::string
 
template<HasFromByteStream T>
unpack ()
 

Static Public Member Functions

static auto from_bytestream (const Vec< u8 > &bytestream, u64 &pos) -> r::Result< TofPacket, Gaps::IOError >
 

Public Attributes

u16 head = 0xAAAA
 
u16 tail = 0x5555
 
PacketType packet_type
 
u32 payload_size
 
Vec< u8 > payload
 

Static Public Attributes

static constexpr u16 HEAD = 0xAAAA
 
static constexpr u16 TAIL = 0x5555
 

Detailed Description

The most basic of all packets

A wrapper packet for an arbitrary bytestream

It looks like the following

HEAD : u16 = 0xAAAA TYPE : u8 = PacketType SIZE : u64 PAYLOAD : [u8;6-SIZE] TAIL : u16 = 0x5555 => The packet has a fixed size of 9 bytes => The packet has a size of 9 + PAYLOAD.size()

Member Function Documentation

◆ from_bytestream()

static auto TofPacket::from_bytestream ( const Vec< u8 > &  bytestream,
u64 &  pos 
) -> r::Result< TofPacket, Gaps::IOError >
static

Transcode the bytestream into the respective TofPacket

◆ to_string()

auto TofPacket::to_string ( ) const -> std::string

A representative representation of the TofPacket very usefule for debugging

◆ unpack()

template<HasFromByteStream T>
T TofPacket::unpack ( )
inline

A generic unpacking method - unpack everything which is stored within the payload This requires that T has a from_bytestream method, which is enforced at compile time by the concept HasFromByteStream


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