38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "Thing.h"
|
|
|
|
namespace RoboidControl {
|
|
|
|
/// @brief A sensor which can detect touches
|
|
class TouchSensor : public Thing {
|
|
// Why finishing this release (0.3), I notice that this is equivalent to a digital sensor
|
|
public:
|
|
/// @brief Create a touch sensor without communication abilities
|
|
//TouchSensor();
|
|
/// @brief Create a touch 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
|
|
TouchSensor(Participant* owner = nullptr, unsigned char thingId = 0);
|
|
/// @brief Create a new child touch sensor
|
|
/// @param parent The parent thing
|
|
/// @param thingId The ID of the thing, leave out or set to zero to generate
|
|
/// an ID
|
|
TouchSensor(Thing* parent, unsigned char thingId = 0);
|
|
|
|
/// @brief Value which is true when the sensor is touching something, false
|
|
/// otherwise
|
|
bool touchedSomething = false;
|
|
|
|
/// @brief Function used to generate binary data for this touch 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 touch sensor
|
|
/// @param bytes The binary data to process
|
|
virtual void ProcessBinary(char* bytes) override;
|
|
};
|
|
|
|
} // namespace RoboidControl
|