29 lines
909 B
C++
29 lines
909 B
C++
#include "TemperatureSensor.h"
|
|
|
|
#include "LowLevelMessages.h"
|
|
|
|
namespace Passer {
|
|
namespace RoboidControl {
|
|
|
|
// TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {}
|
|
|
|
TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {}
|
|
|
|
TemperatureSensor::TemperatureSensor(unsigned char networkId,
|
|
unsigned char thingId)
|
|
: Thing(nullptr, networkId, thingId, Type::TemperatureSensor) {}
|
|
|
|
void TemperatureSensor::SetTemperature(float temp) { this->temp = temp; }
|
|
|
|
void TemperatureSensor::GenerateBinary(char *buffer, unsigned char *ix) {
|
|
std::cout << "Send temperature: " << this->temp << "\n";
|
|
LowLevelMessages::SendFloat16(buffer, ix, this->temp);
|
|
}
|
|
|
|
void TemperatureSensor::ProcessBinary(char *bytes) {
|
|
unsigned char ix = 0;
|
|
this->temp = LowLevelMessages::ReceiveFloat16(bytes, &ix);
|
|
}
|
|
|
|
} // namespace Control
|
|
} // namespace Passer
|