ESP32 ant following trail
This commit is contained in:
parent
6cfa481548
commit
c7650f1be1
@ -120,20 +120,23 @@ RemoteParticipant* Participant::AddParticipant(const char* ipAddress, int port)
|
||||
|
||||
#pragma region Send
|
||||
|
||||
void Participant::SendThingInfo(RemoteParticipant* owner, Thing* thing) {
|
||||
void Participant::SendThingInfo(RemoteParticipant* remoteParticipant, Thing* thing) {
|
||||
std::cout << "Send thing info " << (int)thing->id << " \n";
|
||||
ThingMsg* thingMsg = new ThingMsg(this->networkId, thing);
|
||||
this->Send(owner, thingMsg);
|
||||
this->Send(remoteParticipant, thingMsg);
|
||||
delete thingMsg;
|
||||
NameMsg* nameMsg = new NameMsg(this->networkId, thing);
|
||||
this->Send(owner, nameMsg);
|
||||
this->Send(remoteParticipant, nameMsg);
|
||||
delete nameMsg;
|
||||
ModelUrlMsg* modelMsg = new ModelUrlMsg(this->networkId, thing);
|
||||
this->Send(owner, modelMsg);
|
||||
this->Send(remoteParticipant, modelMsg);
|
||||
delete modelMsg;
|
||||
PoseMsg* poseMsg = new PoseMsg(this->networkId, thing, true);
|
||||
this->Send(owner, poseMsg);
|
||||
this->Send(remoteParticipant, poseMsg);
|
||||
delete poseMsg;
|
||||
BinaryMsg* customMsg = new BinaryMsg(this->networkId, thing);
|
||||
this->Send(remoteParticipant, customMsg);
|
||||
delete customMsg;
|
||||
}
|
||||
|
||||
bool Participant::Send(RemoteParticipant* remoteParticipant, IMessage* msg) {
|
||||
@ -166,6 +169,9 @@ void Participant::PublishThingInfo(Thing* thing) {
|
||||
ModelUrlMsg* modelMsg = new ModelUrlMsg(this->networkId, thing);
|
||||
this->Publish(modelMsg);
|
||||
delete modelMsg;
|
||||
PoseMsg* poseMsg = new PoseMsg(this->networkId, thing, true);
|
||||
this->Publish(poseMsg);
|
||||
delete poseMsg;
|
||||
BinaryMsg* customMsg = new BinaryMsg(this->networkId, thing);
|
||||
this->Publish(customMsg);
|
||||
delete customMsg;
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include "Messages/InvestigateMsg.h"
|
||||
#include "Messages/ModelUrlMsg.h"
|
||||
#include "Messages/NameMsg.h"
|
||||
#include "Messages/SiteMsg.h"
|
||||
#include "Messages/ParticipantMsg.h"
|
||||
#include "Messages/PoseMsg.h"
|
||||
#include "Messages/SiteMsg.h"
|
||||
#include "Messages/ThingMsg.h"
|
||||
#include "RemoteParticipant.h"
|
||||
|
||||
@ -33,7 +33,7 @@ class Participant : public RemoteParticipant {
|
||||
|
||||
const char* name = "Participant";
|
||||
|
||||
//int localPort = 0;
|
||||
// int localPort = 0;
|
||||
RemoteParticipant* site = nullptr;
|
||||
|
||||
#if defined(ARDUINO)
|
||||
@ -72,9 +72,9 @@ class Participant : public RemoteParticipant {
|
||||
void ReceiveData(unsigned char bufferSize, char* senderIpAddress, unsigned int senderPort);
|
||||
void ReceiveData(unsigned char bufferSize, RemoteParticipant* remoteParticipant);
|
||||
|
||||
protected:
|
||||
std::list<RemoteParticipant*> senders;
|
||||
|
||||
protected:
|
||||
unsigned long nextPublishMe = 0;
|
||||
|
||||
void SetupUDP(int localPort, const char* remoteIpAddress, int remotePort);
|
||||
|
@ -13,6 +13,7 @@ TouchSensor::TouchSensor(RemoteParticipant* participant) : Thing(participant) {
|
||||
// }
|
||||
|
||||
void TouchSensor::GenerateBinary(char* bytes, unsigned char* ix) {}
|
||||
|
||||
void TouchSensor::ProcessBinary(char* bytes) {
|
||||
this->touchedSomething = (bytes[0] == 1);
|
||||
// if (this->touchedSomething)
|
||||
|
Loading…
x
Reference in New Issue
Block a user