Merge commit '8c0a1a2688c9a9c75f7188cf2116d9751afcd488' into ControlCore
This commit is contained in:
commit
502888a934
@ -29,7 +29,7 @@ Participant::Participant(int port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Participant::Participant(const char* ipAddress, int port) {
|
Participant::Participant(const char* ipAddress, int port) {
|
||||||
this->ipAddress = ipAddress; // maybe this is not needed anymore, keeping it to "0.0.0.0"
|
this->ipAddress = ipAddress; // maybe this is not needed anymore, keeping it to "0.0.0.0"
|
||||||
this->port = port;
|
this->port = port;
|
||||||
this->site = new RemoteParticipant(ipAddress, port);
|
this->site = new RemoteParticipant(ipAddress, port);
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ void Participant::Process(RemoteParticipant* sender, PoseMsg* msg) {}
|
|||||||
void Participant::Process(RemoteParticipant* sender, BinaryMsg* msg) {
|
void Participant::Process(RemoteParticipant* sender, BinaryMsg* msg) {
|
||||||
// std::cout << this->name << ": process Binary [" << (int)this->networkId << "/"
|
// std::cout << this->name << ": process Binary [" << (int)this->networkId << "/"
|
||||||
// << (int)msg->networkId << "]\n";
|
// << (int)msg->networkId << "]\n";
|
||||||
Thing* thing = this->Get(msg->networkId, msg->thingId);
|
Thing* thing = sender->Get(msg->networkId, msg->thingId);
|
||||||
if (thing != nullptr)
|
if (thing != nullptr)
|
||||||
thing->ProcessBinary(msg->bytes);
|
thing->ProcessBinary(msg->bytes);
|
||||||
else
|
else
|
||||||
|
@ -33,8 +33,8 @@ Thing* RemoteParticipant::Get(unsigned char networkId, unsigned char thingId) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteParticipant::Add(Thing* thing) {
|
void RemoteParticipant::Add(Thing* thing, bool checkId) {
|
||||||
if (thing->id == 0) {
|
if (checkId && thing->id == 0) {
|
||||||
// allocate a new thing ID
|
// allocate a new thing ID
|
||||||
thing->id = this->things.size() + 1;
|
thing->id = this->things.size() + 1;
|
||||||
this->things.push_back(thing);
|
this->things.push_back(thing);
|
||||||
|
@ -19,7 +19,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Thing *Get(unsigned char networkId, unsigned char thingId);
|
Thing *Get(unsigned char networkId, unsigned char thingId);
|
||||||
void Add(Thing *thing);
|
void Add(Thing *thing, bool checkId = true);
|
||||||
void Remove(Thing *thing);
|
void Remove(Thing *thing);
|
||||||
void UpdateAll(unsigned long currentTimeMs);
|
void UpdateAll(unsigned long currentTimeMs);
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ Thing::Thing(RemoteParticipant* owner, unsigned char networkId, unsigned char th
|
|||||||
this->angularVelocity = Spherical16::zero;
|
this->angularVelocity = Spherical16::zero;
|
||||||
// std::cout << "Created thing " << (int)this->networkId << "/" << (int)this->id
|
// std::cout << "Created thing " << (int)this->networkId << "/" << (int)this->id
|
||||||
// << "\n";
|
// << "\n";
|
||||||
owner->Add(this);
|
owner->Add(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thing::Terminate() {
|
void Thing::Terminate() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user