#pragma once #if !NO_STD #include #endif #include "Thing.h" namespace RoboidControl { /// @brief A sensor measuring distance class DistanceSensor : public Thing { 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 DistanceSensor(Thing* parent = Thing::LocalRoot()); /// @brief Get the current distance float GetDistance(); /// @brief Function used to generate binary data for this 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 sensor /// @param bytes The binary data to process virtual void ProcessBinary(char* bytes) override; protected: #if ARDUNIO float internalDistance = INFINITY; float externalDistance = INFINITY; #else float internalDistance = std::numeric_limits::infinity(); float externalDistance = std::numeric_limits::infinity(); #endif }; } // namespace RoboidControl