Set correct initial thingId
This commit is contained in:
parent
1d89b5401d
commit
3e4ed82cbe
@ -106,9 +106,9 @@ void Participant::SendThingInfo(Thing *thing) {
|
||||
}
|
||||
|
||||
void Passer::Control::Participant::PublishThingInfo(Thing *thing) {
|
||||
std::cout << "Publish thing info\n";
|
||||
// Strange, when publishing, the network id is irrelevant, because it is
|
||||
// connected to a specific site...
|
||||
// std::cout << "Publish thing info" << thing->networkId << "\n";
|
||||
// Strange, when publishing, the network id is irrelevant, because it is
|
||||
// connected to a specific site...
|
||||
ThingMsg *thingMsg = new ThingMsg(this->networkId, thing);
|
||||
this->Publish(thingMsg);
|
||||
delete thingMsg;
|
||||
|
18
Sensors/TemperatureSensor.cpp
Normal file
18
Sensors/TemperatureSensor.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "TemperatureSensor.h"
|
||||
|
||||
#include "LowLevelMessages.h"
|
||||
|
||||
namespace Passer {
|
||||
namespace Control {
|
||||
|
||||
TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {}
|
||||
|
||||
void TemperatureSensor::SetTemperature(float temp) { this->temp = temp; }
|
||||
|
||||
void TemperatureSensor::SendBytes(char *buffer, unsigned char *ix) {
|
||||
std::cout << "Send temperature: " << this->temp << "\n";
|
||||
LowLevelMessages::SendFloat16(buffer, ix, this->temp);
|
||||
}
|
||||
|
||||
} // namespace Control
|
||||
} // namespace Passer
|
21
Sensors/TemperatureSensor.h
Normal file
21
Sensors/TemperatureSensor.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "Thing.h"
|
||||
|
||||
namespace Passer {
|
||||
namespace Control {
|
||||
|
||||
class TemperatureSensor : public Thing {
|
||||
public:
|
||||
TemperatureSensor();
|
||||
|
||||
virtual void SetTemperature(float temp);
|
||||
|
||||
void SendBytes(char *buffer, unsigned char *ix) override;
|
||||
|
||||
protected:
|
||||
float temp = 0;
|
||||
};
|
||||
|
||||
} // namespace Control
|
||||
} // namespace Passer
|
Loading…
x
Reference in New Issue
Block a user