19 lines
382 B
C++
19 lines
382 B
C++
#include "DigitalSensor.h"
|
|
|
|
namespace RoboidControl {
|
|
|
|
DigitalSensor::DigitalSensor(Thing* parent) : Thing(parent) {
|
|
this->type = Type::Switch;
|
|
}
|
|
|
|
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
|