#ifndef COMPLIB_SERVER_IRSENSORS_HPP
#define COMPLIB_SERVER_IRSENSORS_HPP

#include <array>
#include <cstdint>

#include "include/Cache.hpp"
#include "include/Robot.hpp"

class IRSensors {
public:
  static IRSensors &getInstance() {
    static IRSensors instance;
    return instance;
  }

  IRSensors(IRSensors const &) = delete;

  void operator=(IRSensors const &) = delete;

  static void enable();

  static void disable();

  std::array<uint16_t, ROBOT_IR_SENSOR_COUNT> read();

private:

  IRSensors() = default;

  Cache cache{ROBOT_IR_RATE_HZ};

  std::array<uint16_t, ROBOT_IR_SENSOR_COUNT> cached_values = {0};
};


#endif //COMPLIB_SERVER_IRSENSORS_HPP
