44 std::string IpAddress,
const int UDPPort,
const int TCPPort,
const DetectorType detector_type,
const ReadoutType readout_type,
efu_time p =
efu_time(1),
efu_time t =
efu_time()
45 ): detector_type(detector_type),
46 readout_type(readout_type),
47 ipaddr(std::move(IpAddress)),
52 sender{ipaddr,
static_cast<uint16_t
>(UDPPort)}
55 auto prev = time - period;
56 setPulseTime(time.high(), time.low(), prev.high(), prev.low());
61 :
Sender(config.ip_address, config.
udp_port, config.
tcp_port, config.detector_type, config.readout_type, p, t) {}
65 if (DataSize >
static_cast<int>(
sizeof(
struct PacketHeaderV0))) {
73 void addReadout(uint8_t Ring, uint8_t FEN,
double tof,
double weight,
const void * data);
91 void setPulseTime(uint32_t PHI, uint32_t PLO, uint32_t PPHI, uint32_t PPLO);
102 void fold_tof(
const bool fold) { fold_tof_ = fold; }
105 [[nodiscard]] std::pair<uint32_t, uint32_t> lastPulseTime()
const;
106 [[nodiscard]] std::pair<uint32_t, uint32_t> prevPulseTime()
const;
107 [[nodiscard]] std::pair<uint32_t, uint32_t> lastEventTime()
const;
118 case Verbosity::details: verbosity=3;
break;
119 case Verbosity::info: verbosity=2;
break;
120 case Verbosity::warnings: verbosity=1;
break;
121 case Verbosity::errors: verbosity=0;
break;
122 case Verbosity::silent: verbosity=-1;
break;
123 default: verbosity=0;
127 int verbose(
const int v){verbosity = v;
return verbosity;}
130 void check_size_and_send();
134 void maybe_advance_pulse();
147 DetectorType detector_type;
148 ReadoutType readout_type;
153 const int MaxDataSize{8950};
160 bool fold_tof_{
false};
163 cluon::UDPSender sender;
165 std::mutex time_mutex, send_mutex;
void addReadout(uint8_t Ring, uint8_t FEN, efu_time t, const void *data)
Add a single readout with an explicit event time.
void setPulseTime(uint32_t PHI, uint32_t PLO, uint32_t PPHI, uint32_t PPLO)
Update the pulse and previous pulse times (high/low pairs).
void addReadout(uint8_t Ring, uint8_t FEN, double tof, double weight, const void *data)
Add one readout with its event time set to the current pulse time plus tof; the weight is ignored (st...