// +-------------------------------- 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"

// SSZN C Wrapper
#include "SR7Link/64bit/SR7Link.h"


// Device data
#define BIT_DEPTH 16


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

  // 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 GetDepthMap(Easy3D::EDepthMap& map);
  virtual void GetPointCloud(Easy3D::EPointCloud& pc);
  virtual void GetZMap(Easy3D::EZMap& zmap);

  // Parameter handling GUI
  virtual void InvokeParameterPanel();

protected:

  void ConvertHeightDataToZMap();

  char* ReadConfigurationFile(const std::string strPath, int& fileSize);

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

  // Last converted data
  Easy3D::EZMap16 zmap; // used to convert data to pointcloud
  int width, height;

  // Device user configuration
  unsigned int deviceID;
  SR7IF_Data dataObject;
  int* heightData;
  std::string camera_config;
  float profiles_distance; // distance between 2 profiles (in mm)
};
