127 lines
3.5 KiB
C
127 lines
3.5 KiB
C
|
#pragma once
|
|||
|
#include "IrisFiberSpectrometerBase.h"
|
|||
|
#include <QtSerialPort/QSerialPort>
|
|||
|
|
|||
|
#define CRC16_INIT 0xFFFF
|
|||
|
#define CRC16_POLYNOMIAL 0xa001
|
|||
|
|
|||
|
const uint8_t GET_ADDRESS[] = {0x01,0x03,0x00,0x01,0x00,0x01};
|
|||
|
const uint8_t GET_BANDRATE[] = {0x01,0x03,0x00,0x02,0x00,0x01};
|
|||
|
const uint8_t GET_INTEGRAL_TIME[] = {0x01,0x03,0x00,0x06,0x00,0x01};
|
|||
|
const uint8_t GET_AVERAGE_NUMBER[] = {0x01,0x03,0x00,0x07,0x00,0x01};
|
|||
|
const uint8_t GET_WAVELENTH_AT_BAND[] = {0x01,0x03,0x00,0x10,0x00,0x02};
|
|||
|
const uint8_t GET_VALUE_AT_BAND[] = {0x01,0x03,0x00,0x30,0x00,0x02};
|
|||
|
const uint8_t GET_SETTING_OF_LAMP[] = {0x01,0x03,0x00,0x04,0x00,0x01};
|
|||
|
const uint8_t GET_WAVELENTH_COEFF[] = {0x01,0x03,0x00,0x20,0x00,0x08};
|
|||
|
const uint8_t GET_ALL_DN[] = {0x01,0x03,0x01,0x00,0x10,0x00};
|
|||
|
const uint8_t GET_SERIAL_NUMBER[] = {0x01,0x03,0x00,0x40,0x00,0x00};
|
|||
|
const uint8_t GET_PRODUCT_NAME[] = {0x01,0x03,0x00,0x50,0x00,0x00};
|
|||
|
|
|||
|
const uint8_t SET_ADDRESS[] = {0x01,0x06,0x00,0x01};
|
|||
|
const uint8_t SET_BandRATE[] = {0x01,0x06,0x00,0x02};
|
|||
|
const uint8_t SET_INTEGRAL_TIME[] = {0x01,0x06,0x00,0x06};
|
|||
|
const uint8_t SET_AVERAGE_NUMBER[] = {0x01,0x06,0x00,0x07};
|
|||
|
const uint8_t SET_WORK_MODE[] = {0x01,0x06,0x00,0x01};
|
|||
|
|
|||
|
const uint8_t SET_WAVELENTH_COEFF[] = {0x01,0x10,0x00,0x20,0x00,0x08,0x16};
|
|||
|
|
|||
|
class IS11_Ctrl_Qt :public CIrisFSBase
|
|||
|
{
|
|||
|
Q_OBJECT
|
|||
|
public:
|
|||
|
IS11_Ctrl_Qt(QObject* parent = nullptr);
|
|||
|
virtual ~IS11_Ctrl_Qt();
|
|||
|
public:
|
|||
|
//do not call
|
|||
|
//int ReInit();
|
|||
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//int SetBaudRate(int iBaud);
|
|||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>豸
|
|||
|
int Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);
|
|||
|
|
|||
|
//<2F>ر<EFBFBD><D8B1>豸
|
|||
|
void Close();
|
|||
|
|
|||
|
//<2F><><EFBFBD>β<EFBFBD><CEB2>Բɼ<D4B2> <20><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//int SingleShot(int& iPixels);
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
|||
|
int SingleShot(DataFrame& dfData);
|
|||
|
|
|||
|
//<2F><><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
|||
|
//int SingleShotDark(ATPDataFrame &dfData);
|
|||
|
|
|||
|
//int SingleShotDeducted(ATPDataFrame &dfData);
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
int SetExposureTime(int iExposureTimeInMS);
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int GetExposureTime(int& iExposureTimeInMS);
|
|||
|
|
|||
|
//int GetWaveLength(float *pfWaveLength);
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
|||
|
int GetDeviceInfo(DeviceInfo& Info);
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int GetDeviceAttribute(DeviceAttribute& Attr);
|
|||
|
|
|||
|
//int GetDeviceListInfo(); //use type name to enum
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
int SetDeviceTemperature(float fTemperature);
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD>¶<EFBFBD>
|
|||
|
int GetDeviceTemperature(float& fTemperature);
|
|||
|
|
|||
|
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
|||
|
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime);
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
public:
|
|||
|
#else //
|
|||
|
private:
|
|||
|
#endif
|
|||
|
//port
|
|||
|
int m_iBaudRate;
|
|||
|
QSerialPort* m_pSerialPort;
|
|||
|
|
|||
|
//ATP
|
|||
|
DeviceInfo m_diDeviceInfo;
|
|||
|
DeviceAttribute m_daDeviceAttr;
|
|||
|
|
|||
|
//Attr
|
|||
|
int m_iExposureTime;
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
public:
|
|||
|
#else //
|
|||
|
private:
|
|||
|
#endif
|
|||
|
//unsigned short crc16(const uint8_t *pbdata, size_t sz);
|
|||
|
unsigned short CalCRC16(const uint8_t *pbData, size_t szLength);
|
|||
|
void Conv_LTB(char * pcData, int iLength);
|
|||
|
|
|||
|
int Write_IS11(char * pcCMD, size_t szCMDLength);
|
|||
|
int Read_IS11(QByteArray &qbaRecv);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int SendData_CMD03(char * pcCMD, size_t szCMDLength);
|
|||
|
int RecvData_CMD03(QByteArray &qbaRecv);
|
|||
|
int RecvData_CMD03(DataFrame& dfData);
|
|||
|
//int RecvData_CMD03(float& fWavelength);
|
|||
|
//int RecvData_CMD03(DeviceAttribute& Attr);
|
|||
|
|
|||
|
int SendData_CMD06(char *pcCMD, size_t szCMDLength, char *pcValue, size_t szValueLenth);
|
|||
|
int RecvData_CMD06(QByteArray &qbaRecv);
|
|||
|
|
|||
|
int SendData_CMD10(char * pcCMD, size_t szCMDLength);
|
|||
|
int RecvData_CMD10(QByteArray &qbaRecv);
|
|||
|
|
|||
|
int ParseHdr(QByteArray &qbaData,char cHdrType);
|
|||
|
|
|||
|
|
|||
|
};
|
|||
|
|