#pragma once
#include <qthread.h>
//#include <QFileDialog>
#include <QDateTime> 

#include <iostream>
#include <fstream>

#include "library.h"
#include "FiberSpectrometerOperationBase.h"

class OceanOpticsFiberImager :public QObject,public FiberSpectrometerOperationBase
{
	Q_OBJECT

public:
	OceanOpticsFiberImager(double * nonlinearityCoeffs, int numberOfCoeffs);
	~OceanOpticsFiberImager();

	OceanOptics_lib * m_FiberSpectrometer;

	void connectFiberSpectrometer(QString& sn, QString& pixelCount, QString& wavelengthInfo);
	void disconnectFiberSpectrometer();
	void getDeviceAttribute(DeviceAttribute& deviceAttribute);
	void getDeviceInfo(DeviceInfo& deviceInfo);

	void setExposureTime(int iExposureTimeInMS);

	void getExposureTime(int &iExposureTimeInMS);//ok
	void getDeviceTemperature(float &fTemperature);//ok
	
	void singleShot(DataFrame &dfData);

    void getNonlinearityCoeffs(coeffsFrame &coeffs);

    ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);

    //保存获取的仪器信息，不用每次都获取，这样程序更快
    DeviceInfo m_deviceInfo;
    DeviceAttribute m_deviceAttribute;

//	DataFrame m_IntegratingSphereData;
//	DataFrame m_DarkData;
protected:
private:
    double * m_nonlinearityCoeffs;
    int m_iNumberOfNonlinearityCoeffs;

//	ZZ_U32 m_MaxValueOfFiberSpectrometer;

public slots:
	void recordDark(QString path);
	void recordTarget(int recordTimes, QString path);
	void autoExpose();

signals:
	void sendExposureTimeSignal(int exposureTime);
};