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);
|
Process(msg);
|
||||||
delete msg;
|
delete msg;
|
||||||
} break;
|
} break;
|
||||||
|
case NameMsg::id: {
|
||||||
|
NameMsg *msg = new NameMsg(this->buffer);
|
||||||
|
Process(msg);
|
||||||
|
delete msg;
|
||||||
|
} break;
|
||||||
case PoseMsg::id: {
|
case PoseMsg::id: {
|
||||||
PoseMsg *msg = new PoseMsg(this->buffer);
|
PoseMsg *msg = new PoseMsg(this->buffer);
|
||||||
Process(msg);
|
Process(msg);
|
||||||
@ -219,6 +224,15 @@ void Participant::Process(InvestigateMsg *msg) {}
|
|||||||
|
|
||||||
void Participant::Process(ThingMsg *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(PoseMsg *msg) {}
|
||||||
|
|
||||||
void Participant::Process(CustomMsg *msg) {
|
void Participant::Process(CustomMsg *msg) {
|
||||||
|
@ -87,6 +87,7 @@ protected:
|
|||||||
virtual void Process(Participant *sender, NetworkIdMsg *msg);
|
virtual void Process(Participant *sender, NetworkIdMsg *msg);
|
||||||
virtual void Process(InvestigateMsg *msg);
|
virtual void Process(InvestigateMsg *msg);
|
||||||
virtual void Process(ThingMsg *msg);
|
virtual void Process(ThingMsg *msg);
|
||||||
|
virtual void Process(NameMsg *msg);
|
||||||
virtual void Process(PoseMsg *msg);
|
virtual void Process(PoseMsg *msg);
|
||||||
virtual void Process(CustomMsg *msg);
|
virtual void Process(CustomMsg *msg);
|
||||||
};
|
};
|
||||||
|
2
Thing.h
2
Thing.h
@ -73,7 +73,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
/// @brief The type of Thing
|
/// @brief The type of Thing
|
||||||
unsigned char type = 0;
|
unsigned char type = 0;
|
||||||
const char *name = nullptr;
|
char *name = nullptr;
|
||||||
const char *modelUrl = nullptr;
|
const char *modelUrl = nullptr;
|
||||||
float modelScale = 1;
|
float modelScale = 1;
|
||||||
// protected Sensor sensor;
|
// protected Sensor sensor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user