Binary msg sending fix

This commit is contained in:
Pascal Serrarens 2025-04-23 17:50:40 +02:00
parent 693c9b8b33
commit fe69419010
2 changed files with 4 additions and 5 deletions

View File

@ -6,7 +6,7 @@ BinaryMsg::BinaryMsg(unsigned char networkId, Thing* thing) {
this->networkId = networkId;
this->thingId = thing->id;
this->thing = thing;
unsigned char ix = BinaryMsg::length;
unsigned char ix = 0; //BinaryMsg::length;
this->data = new char[255];
this->dataLength = this->thing->GenerateBinary(this->data, &ix);
}
@ -41,6 +41,8 @@ unsigned char BinaryMsg::Serialize(char* buffer) {
buffer[ix++] = this->networkId;
buffer[ix++] = this->thingId;
buffer[ix++] = this->dataLength;
for (int dataIx = 0; dataIx < this->dataLength; dataIx++)
buffer[ix++] = this->data[dataIx];
return this->length + this->dataLength;
}

View File

@ -474,7 +474,7 @@ void ParticipantUDP::Process(Participant* sender, PoseMsg* msg) {
void ParticipantUDP::Process(Participant* sender, BinaryMsg* msg) {
#if defined(DEBUG)
std::cout << this->name << ": process BinaryMsg [" << (int)msg->networkId
<< "/" << (int)msg->thingId << "] ";
<< "/" << (int)msg->thingId << "]\n";
#endif
Participant* owner = Participant::GetParticipant(msg->networkId);
@ -489,9 +489,6 @@ void ParticipantUDP::Process(Participant* sender, BinaryMsg* msg) {
<< (int)msg->thingId << "]";
#endif
}
#if defined(DEBUG)
std::cout << std::endl;
#endif
#endif
}
}