19 using std::stringstream;
50 this->time = Time::getCurrentMillis();
65 this->time = Time::getCurrentMillis();
196 Console::println(
"LogicNetworkPacket::getByte(): position out of range");
209 Console::println(
"LogicNetworkPacket::putByte(): position out of range");
241 value+= (uint32_t)
getByte() << 8;
263 value+= (uint32_t)
getByte() << 8;
264 value+= (uint32_t)
getByte() << 16;
265 value+= (uint32_t)
getByte() << 24;
289 value+= (uint16_t)
getByte() << 8;
309 uint32_t floatAsInt =
getInt();
310 return *((
float*)&floatAsInt);
319 uint32_t* floatAsInt = ((uint32_t*)&value);
331 for (
auto i = 0; i < length; i++) value+=
getByte();
342 for (
auto i = 0; i < value.size(); i++) {
uint8_t getByte()
Get a byte from packet.
bool isReinjected() const
LogicNetworkPacket & putInt16(uint16_t value)
Puts a int16 into packet.
LogicNetworkPacket & putQuaternion(const Quaternion &value)
Puts a quaternion into packet.
void setSender(const string &sender)
Set sender.
float getFloat()
Get a float from packet.
LogicNetworkPacket & putInt(uint32_t value)
Puts a int into packet.
uint16_t getSmallInt()
Get a small int from packet.
LogicNetworkPacket & putVector3(const Vector3 &value)
Puts a vector3 into packet.
uint32_t getLogicTypeId()
Quaternion getQuaternion()
Get a quaternion from packet.
LogicNetworkPacket & putString(const string &value)
Puts a string into packet.
void setProcessed(bool processed)
Set if packet has been processed.
LogicNetworkPacket & putFloat(float value)
Puts a float into packet.
uint8_t getPosition()
Get position.
LogicNetworkPacket(uint32_t messageId, bool safe, uint8_t retryCount, uint32_t logicTypeId, const UDPPacket *packet, uint8_t size)
Public constructor.
uint32_t getInt()
Get a int from packet.
const string & getSender()
set< string > & getRecipients()
void setLogicTypeId(uint32_t logicTypeId)
Set logic type id.
uint16_t getInt16()
Get a int16 from packet.
void setReinjected()
Set reinjected.
void addRecipient(const string &recipient)
Add recipients, no recipients means broadcast, multiple recipients means multi cast,...
Vector3 getVector3()
Get a vector3 from packet.
uint8_t * getData()
Get data.
LogicNetworkPacket & putSmallInt(uint16_t value)
Puts a small int into packet.
void reset()
Reset position for read.
LogicNetworkPacket & putBool(bool value)
Puts a bool into packet.
LogicNetworkPacket & putByte(uint8_t value)
Puts a byte into packet.
static constexpr uint32_t LOGIC_TYPEID_NONE
LogicNetworkPacket(bool safe, uint32_t logicTypeId=LOGIC_TYPEID_NONE)
Public constructor, used to create a network packet.
bool getBool()
Get a bool from packet.
string getString()
Get a string value.
Quaternion class representing quaternion mathematical structure and operations with x,...
Quaternion & setY(float y)
Sets y component.
Quaternion & setW(float w)
Sets w component.
Quaternion & setZ(float z)
Sets z component.
Quaternion & setX(float x)
Sets x component.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & setX(float x)
Sets x component.
Vector3 & setY(float y)
Sets y component.
Vector3 & setZ(float z)
Sets z component.
const UDPPacket * getBytes(uint8_t *bytes, uint16_t byteCount) const
Get raw bytes from packet.