#ifndef PYLONRECORDER_H
#define PYLONRECORDER_H

#include <pylon/PylonIncludes.h>
#include <pylon/BaslerUniversalInstantCamera.h>
#include "mylogger.h"
#include "util.h"
#include "myimage.h"

struct ImageSettings {
  int64_t width = 0;
  int64_t height = 0;
  Pylon::EPixelType pixelType;
  Pylon::EImageOrientation orientation;
};

class PylonWrapper
{
public:
    PylonWrapper(const std::string &name);
    PylonWrapper(const CameraLayout &layout);
    ~PylonWrapper();

    ImageSettings getImageSettings();
    bool isOpen();
    void terminate();
    bool openCamera(std::string &message);
    void closeCamera();
    bool grabFrame(MyImage &img);
    bool frameRate(uint framerate);
    double frameRate();
    double maxFrameRate();
    double exposureTime();
    bool exposureTime(double exposure_time);
    double gain();
    bool gain(double gain_db);
    Pylon::CInstantCamera *getCamera();
    void resetCamera();

private:
    Pylon::CInstantCamera *camera;
    bool valid, withLayout;
    std::string fullName;
    CameraLayout layout;



};

#endif // PYLONRECORDER_H