// +-------------------------------- DISCLAIMER ---------------------------------+
// |                                                                             |
// | This program is provided to you free of charge "as such".                   |
// | You should not assume that this program is error-free or suitable for any   |
// | purpose whatsoever.                                                         |
// |                                                                             |
// | EURESYS does not give any representation, warranty or undertaking that this |
// | program is free of any defect or error or suitable for any purpose. EURESYS |
// | shall not be liable, in contract, in torts or otherwise, for any damages,   |
// | loss, costs, expenses or other claims for compensation, including those     |
// | asserted by third parties, arising out of or in connection with the use of  |
// | this program.                                                               |
// +-----------------------------------------------------------------------------+

#pragma once

#include "../Common/GrabberInterface.h"
#include "Mimic.hpp"
#include <string>


class HeliotisGrabber : public GrabberInterface
{
public:
  // Construction and destruction
  HeliotisGrabber(const std::string& device_name = "");
  ~HeliotisGrabber();

  // Acquisition control
  virtual void Start(int num_frame = 1);
  virtual long long int WaitFrame(int timeout_ms = -1);
  virtual void ReleaseFrame();
  virtual void Stop();

  // Bit depth for DepthMap and ZMap
  virtual int GetBitDepth();

  // Data retrieval
  virtual void GetPointCloud(Easy3D::EPointCloud& pc);
  virtual void GetZMap(Easy3D::EZMap& zmap);

  // Parameter handling GUI
  virtual void InvokeParameterPanel();

protected:
  // Grabbing state
  bool started;
  bool locked;
  long long int frame_counter;

  // mimic objects
  mimic::Mimic_Producer producer;
  std::unique_ptr<mimic::Mimic_Camera> camera;
  std::unique_ptr<mimic::Mimic_Buffer> buffer;

  // zmap's scale and offset
  float zScale;
  float zOffset;

  // Device user configuration
  float scan_speed;
  float scan_range;
  float target_vertical_spacing;
  float exposure_ratio;
  float scan_position;
  float pixel_side_length;
  bool filter_zmap;
};
