RoboidControl-cpp/Things/TouchSensor.h
2025-03-06 11:06:43 +01:00

35 lines
1.1 KiB
C++

#pragma once
#include "Thing.h"
namespace RoboidControl {
/// @brief A sensor which can detect touches
class TouchSensor : public Thing {
public:
/// @brief Create a touch sensor with isolated participant
TouchSensor();
/// @brief Create a touch sensor
TouchSensor(Participant* participant);
/// @brief Create a temperature sensor with the given ID
/// @param networkId The network ID of the sensor
/// @param thingId The ID of the thing
TouchSensor(Thing* parent);
// TouchSensor(RemoteParticipant* participant, unsigned char networkId,
// unsigned char thingId);
/// @brief Value which is true when the sensor is touching something, false
/// otherwise
bool touchedSomething = false;
/// @brief Function to create a binary message with the temperature
/// @param buffer The byte array for thw binary data
/// @param ix The starting position for writing the binary data
void GenerateBinary(char* bytes, unsigned char* ix) override;
/// @brief Function to extract the temperature received in the binary message
/// @param bytes The binary data
virtual void ProcessBinary(char* bytes) override;
};
} // namespace RoboidControl