RoboidControl-cpp/Things/DigitalSensor.h

37 lines
1.3 KiB
C++

#pragma once
#include "Thing.h"
namespace RoboidControl {
/// @brief A digital (on/off, 1/0, true/false) sensor
class DigitalSensor : public Thing {
public:
/// @brief Create a digital sensor without communication abilities
//DigitalSensor();
/// @brief Create a digital sensor for a participant
/// @param owner The owning participant
/// @param thingId The ID of the thing, leave out or set to zero to generate
/// an ID
DigitalSensor(Participant* owner = nullptr); //, unsigned char thingId = 0);
/// @brief Create a new child digital sensor
/// @param parent The parent thing
/// @param thingId The ID of the thing, leave out or set to zero to generate
/// an ID
DigitalSensor(Thing* parent); //, unsigned char thingId = 0);
/// @brief The sigital state
bool state = 0;
/// @brief Function used to generate binary data for this digital sensor
/// @param buffer The byte array for thw binary data
/// @param ix The starting position for writing the binary data
int GenerateBinary(char* bytes, unsigned char* ix) override;
/// @brief Function used to process binary data received for this digital
/// sensor
/// @param bytes The binary data to process
virtual void ProcessBinary(char* bytes) override;
};
} // namespace RoboidControl