28 lines
822 B
C++
28 lines
822 B
C++
#include "DigitalSensor.h"
|
|
|
|
namespace RoboidControl {
|
|
|
|
//DigitalSensor::DigitalSensor() : Thing(Type::Switch) {}
|
|
|
|
// DigitalSensor::DigitalSensor(Participant* owner, unsigned char thingId)
|
|
// : Thing(owner, Type::Switch, thingId) {}
|
|
|
|
// DigitalSensor::DigitalSensor(Thing* parent, unsigned char thingId)
|
|
// : Thing(parent, Type::Switch) {}
|
|
|
|
DigitalSensor::DigitalSensor(Participant* owner) : Thing(owner, Type::Switch) {}
|
|
|
|
// DigitalSensor::DigitalSensor(Thing* parent) : Thing(parent, Type::Switch) {}
|
|
DigitalSensor::DigitalSensor(Thing& parent) : Thing(Type::Switch, parent) {}
|
|
|
|
int DigitalSensor::GenerateBinary(char* bytes, unsigned char* ix) {
|
|
bytes[(*ix)++] = state ? 1 : 0;
|
|
return 1;
|
|
}
|
|
|
|
void DigitalSensor::ProcessBinary(char* bytes) {
|
|
this->state |= (bytes[0] == 1);
|
|
}
|
|
|
|
} // namespace RoboidControl
|