thing name -> source id
This commit is contained in:
parent
7867c3c8cf
commit
a8a09dbebf
@ -181,6 +181,11 @@ void Participant::ReceiveData(unsigned char bufferSize,
|
||||
Process(msg);
|
||||
delete msg;
|
||||
} break;
|
||||
case NameMsg::id: {
|
||||
NameMsg *msg = new NameMsg(this->buffer);
|
||||
Process(msg);
|
||||
delete msg;
|
||||
} break;
|
||||
case PoseMsg::id: {
|
||||
PoseMsg *msg = new PoseMsg(this->buffer);
|
||||
Process(msg);
|
||||
@ -219,6 +224,15 @@ void Participant::Process(InvestigateMsg *msg) {}
|
||||
|
||||
void Participant::Process(ThingMsg *msg) {}
|
||||
|
||||
void Participant::Process(NameMsg *msg) {
|
||||
Thing *thing = Thing::Get(msg->networkId, msg->thingId);
|
||||
if (thing != nullptr) {
|
||||
thing->name = new char[strlen(msg->name)];
|
||||
strcpy(thing->name, msg->name);
|
||||
std::cout << "thing name = " << thing->name << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void Participant::Process(PoseMsg *msg) {}
|
||||
|
||||
void Participant::Process(CustomMsg *msg) {
|
||||
|
@ -87,6 +87,7 @@ protected:
|
||||
virtual void Process(Participant *sender, NetworkIdMsg *msg);
|
||||
virtual void Process(InvestigateMsg *msg);
|
||||
virtual void Process(ThingMsg *msg);
|
||||
virtual void Process(NameMsg *msg);
|
||||
virtual void Process(PoseMsg *msg);
|
||||
virtual void Process(CustomMsg *msg);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user