#ifndef DUALCAMWRAPPER_H
#define DUALCAMWRAPPER_H

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


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

    ImageSettings getImageSettings(int camindex);
    uint32_t sensorWidth(int camindex);
    uint32_t sensorHeight(int camindex);
    bool isOpen();
    void terminate();
    bool openCameras(std::string &message);
    void closeCameras();
    bool grabFrame(MyImage &img, int camindex=0);
    bool frameRate(uint framerate, int camindex=-1);
    double frameRate(int camindex);
    double maxFrameRate(int camindex);
    double exposureTime(int camindex);
    bool exposureTime(double exposure_time, int camindex=-1);
    double gain(int camindex);
    bool gain(double gain_db, int camindex=-1);
    void enableSoftwareTrigger(int camindex);
    void disableSoftwareTrigger(int camindex);
    bool softwareTriggerEnabeled(int camindex);
    Pylon::CInstantCameraArray &getCameraArray();

private:
    void resetCamera(int camindex);
    Pylon::CInstantCameraArray cameras;
    GenApi::INodeMap& getNodemap(int camindex);
    void setROI();
    bool valid, withLayout;
    CameraLayout layout;

};

#endif // DUALCAMWRAPPER_H