23#include "UniSetTypes.h"
46 const uint32_t UNETUDP_MAGICNUM = 0x1348A5F;
60 } __attribute__((packed));
62 std::ostream& operator<<( std::ostream& os,
UDPHeader& p );
63 std::ostream& operator<<( std::ostream& os,
UDPHeader* p );
65 const size_t MaxPacketNum = std::numeric_limits<size_t>::max();
70 UDPAData(int32_t
id, int64_t val)
noexcept: id(
id), val(val) {}
75 } __attribute__((packed));
77 std::ostream& operator<<( std::ostream& os,
UDPAData& p );
83 static const size_t MaxACount = 2000;
84 static const size_t MaxDCount = 4000;
85 static const size_t MaxDDataCount = 1 + MaxDCount / (8 *
sizeof(uint8_t));
94 size_t addDData( int32_t
id,
bool val )
noexcept;
97 bool setDData(
size_t index,
bool val )
noexcept;
100 long dID(
size_t index )
const noexcept;
103 bool dValue(
size_t index )
const noexcept;
107 size_t addAData(
const UDPAData& dat )
noexcept;
108 size_t addAData( int32_t
id, int64_t val )
noexcept;
111 bool setAData(
size_t index, int64_t val )
noexcept;
115 inline bool isAFull()
const noexcept
117 return (header.
acount >= MaxACount);
119 inline bool isDFull()
const noexcept
121 return (header.
dcount >= MaxDCount);
124 inline bool isFull()
const noexcept
126 return !((header.
dcount < MaxDCount) && (header.
acount < MaxACount));
129 inline size_t dsize()
const noexcept
134 inline size_t asize()
const noexcept
139 uint16_t calcDcrc()
const noexcept;
140 uint16_t calcAcrc()
const noexcept;
141 void updatePacketCrc()
noexcept;
147 } __attribute__((packed));
149 std::ostream& operator<<( std::ostream& os,
UDPMessage& p );
151 uint16_t makeCRC(
unsigned char* buf,
size_t len )
noexcept;
Definition Calibration.h:27
const ObjectId DefaultObjectId
Definition UniSetTypes.h:71
Definition UDPPacket.h:68
Definition UDPPacket.h:88
long dID(size_t index) const noexcept
Definition UDPPacket.cc:246
int32_t d_id[MaxDCount]
Definition UDPPacket.h:145
uint8_t d_dat[MaxDDataCount]
Definition UDPPacket.h:146
long getDataID() const noexcept
Definition UDPPacket.cc:265
bool setDData(size_t index, bool val) noexcept
Definition UDPPacket.cc:226
UDPAData a_dat[MaxACount]
Definition UDPPacket.h:144
bool setAData(size_t index, int64_t val) noexcept
Definition UDPPacket.cc:196
bool dValue(size_t index) const noexcept
Definition UDPPacket.cc:254