#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 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 = Thing::LocalRoot()); /// @brief Value which is true when the sensor is touching something, false /// otherwise bool touchedSomething = false; virtual void PrepareForUpdate() override; virtual void Update(bool recursive) override; /// @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; protected: bool externalTouch = false; }; } // namespace RoboidControl