1、添加ximea官方库的错误代码(以注释形式)到自己写的ximea相机控制类中;
2、修改相机状态码,兼容ximea官方库的错误代码;
This commit is contained in:
@ -24,7 +24,7 @@ UdpServer::UdpServer()
|
||||
m_CopyFileThread->start();
|
||||
|
||||
//系统采集步骤1:打开sbg串口并采集数据,打开光谱仪
|
||||
// connect(this, SIGNAL(systemStart()),m_sbgRecorder, SLOT(startRecordSbg()));
|
||||
connect(this, SIGNAL(systemStart()),m_sbgRecorder, SLOT(startRecordSbg()));
|
||||
connect(this, SIGNAL(systemStart()),m_imager, SLOT(openImger()));
|
||||
|
||||
connect(this, SIGNAL(systemStop()),m_sbgRecorder, SLOT(closeSerialPort()));//
|
||||
@ -103,7 +103,7 @@ void UdpServer::processPendingDatagrams()
|
||||
}
|
||||
|
||||
|
||||
if(m_imager->getImagerState()>=1)
|
||||
if(m_imager->getImagerState()>=101)
|
||||
{
|
||||
m_imager->stopRecord();
|
||||
}
|
||||
@ -133,7 +133,7 @@ void UdpServer::processPendingDatagrams()
|
||||
{
|
||||
std::cout<<"4代表系统停止采集高光谱影像!"<<std::endl;
|
||||
|
||||
if(m_imager->getImagerState()>=1 && m_imager->getImagerState()<=4)
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=104)
|
||||
{
|
||||
m_imager->stopRecord();
|
||||
}
|
||||
@ -142,7 +142,7 @@ void UdpServer::processPendingDatagrams()
|
||||
}
|
||||
case 5://
|
||||
{
|
||||
if(m_imager->getImagerState()>=1 && m_imager->getImagerState()<=3)
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=103)
|
||||
{
|
||||
std::cout<<"5代表设置帧率!"<<std::endl;
|
||||
m_imager->setFramerate(datagramList[1].toFloat());
|
||||
@ -152,7 +152,7 @@ void UdpServer::processPendingDatagrams()
|
||||
}
|
||||
case 6://
|
||||
{
|
||||
if(m_imager->getImagerState()>=1 && m_imager->getImagerState()<=3)
|
||||
if(m_imager->getImagerState()>=101 && m_imager->getImagerState()<=103)
|
||||
{
|
||||
std::cout<<"6代表自动曝光!"<<std::endl;
|
||||
m_imager->autoExposure();
|
||||
|
@ -5,14 +5,14 @@ XimeaImager::XimeaImager()
|
||||
m_buffer=nullptr;
|
||||
m_bRecordControl=false;
|
||||
m_iFrameCounter=0;
|
||||
m_iImagerState=0;
|
||||
m_iImagerState=100;
|
||||
|
||||
//connect(this, SIGNAL(recordFinished()),this, SLOT());
|
||||
}
|
||||
|
||||
void XimeaImager::openImger()
|
||||
{
|
||||
if(m_iImagerState>0)
|
||||
if(m_iImagerState != 100)//如果相机已经打开或者已经出错,就直接返回
|
||||
{
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
@ -65,7 +65,7 @@ void XimeaImager::openImger()
|
||||
|
||||
m_buffer = new unsigned short[m_iFrameSizeInByte];
|
||||
|
||||
m_iImagerState = 1;
|
||||
m_iImagerState = 101;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
}
|
||||
catch(int xiApiErrorCodes)
|
||||
@ -82,7 +82,7 @@ void XimeaImager::openImger()
|
||||
|
||||
void XimeaImager::closeImger()
|
||||
{
|
||||
if(m_iImagerState==0)
|
||||
if(m_iImagerState==100)
|
||||
{
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
@ -93,7 +93,7 @@ void XimeaImager::closeImger()
|
||||
{
|
||||
m_imager.disconnect();
|
||||
|
||||
m_iImagerState=0;
|
||||
m_iImagerState=100;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
}
|
||||
catch(int xiApiErrorCodes)
|
||||
@ -113,7 +113,7 @@ void XimeaImager::setFramerate(double framerate)
|
||||
setExposureTime(maxExposureTimeInUs);
|
||||
// setExposureTime(1000);
|
||||
|
||||
m_iImagerState=2;
|
||||
m_iImagerState=102;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
}
|
||||
catch(int xiApiErrorCodes)
|
||||
@ -224,7 +224,7 @@ double XimeaImager::autoExposure()
|
||||
// float suitableExposureTime=baseExposureTime_in_us * scale;
|
||||
// exposureTime=setExposureTime(suitableExposureTime);
|
||||
|
||||
m_iImagerState=3;
|
||||
m_iImagerState=103;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
}
|
||||
catch(int xiApiErrorCodes)
|
||||
@ -385,7 +385,7 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
|
||||
{
|
||||
try
|
||||
{
|
||||
if(m_iImagerState==4 || m_iImagerState==0 || m_iImagerState>=21)
|
||||
if(m_iImagerState <= 99 || m_iImagerState==100 || m_iImagerState==104)
|
||||
{
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
@ -394,7 +394,7 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base
|
||||
|
||||
m_iImagerStateTemp=m_iImagerState;
|
||||
|
||||
m_iImagerState=4;
|
||||
m_iImagerState=104;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
printf("开始采集!\n");
|
||||
@ -527,6 +527,70 @@ void XimeaImager::writeHdr()
|
||||
hdrFileHandle.close();
|
||||
}
|
||||
|
||||
/*
|
||||
#define MM40_OK 0 //!< Function call succeeded
|
||||
#define MM40_INVALID_HANDLE 1 //!< Invalid handle
|
||||
#define MM40_READREG 2 //!< Register read error
|
||||
#define MM40_WRITEREG 3 //!< Register write error
|
||||
#define MM40_FREE_RESOURCES 4 //!< Freeing resources error
|
||||
#define MM40_FREE_CHANNEL 5 //!< Freeing channel error
|
||||
#define MM40_FREE_BANDWIDTH 6 //!< Freeing bandwith error
|
||||
#define MM40_READBLK 7 //!< Read block error
|
||||
#define MM40_WRITEBLK 8 //!< Write block error
|
||||
#define MM40_NO_IMAGE 9 //!< No image
|
||||
#define MM40_TIMEOUT 10 //!< Timeout
|
||||
#define MM40_INVALID_ARG 11 //!< Invalid arguments supplied
|
||||
#define MM40_NOT_SUPPORTED 12 //!< Not supported
|
||||
#define MM40_ISOCH_ATTACH_BUFFERS 13 //!< Attach buffers error
|
||||
#define MM40_GET_OVERLAPPED_RESULT 14 //!< Overlapped result
|
||||
#define MM40_MEMORY_ALLOCATION 15 //!< Memory allocation error
|
||||
#define MM40_DLLCONTEXTISNULL 16 //!< DLL context is NULL
|
||||
#define MM40_DLLCONTEXTISNONZERO 17 //!< DLL context is non zero
|
||||
#define MM40_DLLCONTEXTEXIST 18 //!< DLL context exists
|
||||
#define MM40_TOOMANYDEVICES 19 //!< Too many devices connected
|
||||
#define MM40_ERRORCAMCONTEXT 20 //!< Camera context error
|
||||
#define MM40_UNKNOWN_HARDWARE 21 //!< Unknown hardware
|
||||
#define MM40_INVALID_TM_FILE 22 //!< Invalid TM file
|
||||
#define MM40_INVALID_TM_TAG 23 //!< Invalid TM tag
|
||||
#define MM40_INCOMPLETE_TM 24 //!< Incomplete TM
|
||||
#define MM40_BUS_RESET_FAILED 25 //!< Bus reset error
|
||||
#define MM40_NOT_IMPLEMENTED 26 //!< Not implemented
|
||||
#define MM40_SHADING_TOOBRIGHT 27 //!< Shading is too bright
|
||||
#define MM40_SHADING_TOODARK 28 //!< Shading is too dark
|
||||
#define MM40_TOO_LOW_GAIN 29 //!< Gain is too low
|
||||
#define MM40_INVALID_BPL 30 //!< Invalid sensor defect correction list
|
||||
#define MM40_BPL_REALLOC 31 //!< Error while sensor defect correction list reallocation
|
||||
#define MM40_INVALID_PIXEL_LIST 32 //!< Invalid pixel list
|
||||
#define MM40_INVALID_FFS 33 //!< Invalid Flash File System
|
||||
#define MM40_INVALID_PROFILE 34 //!< Invalid profile
|
||||
#define MM40_INVALID_CALIBRATION 35 //!< Invalid calibration
|
||||
#define MM40_INVALID_BUFFER 36 //!< Invalid buffer
|
||||
#define MM40_INVALID_DATA 38 //!< Invalid data
|
||||
#define MM40_TGBUSY 39 //!< Timing generator is busy
|
||||
#define MM40_IO_WRONG 40 //!< Wrong operation open/write/read/close
|
||||
#define MM40_ACQUISITION_ALREADY_UP 41 //!< Acquisition already started
|
||||
#define MM40_OLD_DRIVER_VERSION 42 //!< Old version of device driver installed to the system.
|
||||
#define MM40_GET_LAST_ERROR 43 //!< To get error code please call GetLastError function.
|
||||
#define MM40_CANT_PROCESS 44 //!< Data cannot be processed
|
||||
#define MM40_ACQUISITION_STOPED 45 //!< Acquisition is stopped. It needs to be started to perform operation.
|
||||
#define MM40_ACQUISITION_STOPED_WERR 46 //!< Acquisition has been stopped with an error.
|
||||
#define MM40_INVALID_INPUT_ICC_PROFILE 47 //!< Input ICC profile missing or corrupted
|
||||
#define MM40_INVALID_OUTPUT_ICC_PROFILE 48 //!< Output ICC profile missing or corrupted
|
||||
#define MM40_DEVICE_NOT_READY 49 //!< Device not ready to operate
|
||||
#define MM40_SHADING_TOOCONTRAST 50 //!< Shading is too contrast
|
||||
#define MM40_ALREADY_INITIALIZED 51 //!< Module already initialized
|
||||
#define MM40_NOT_ENOUGH_PRIVILEGES 52 //!< Application does not have enough privileges (one or more app)
|
||||
#define MM40_NOT_COMPATIBLE_DRIVER 53 //!< Installed driver is not compatible with current software
|
||||
#define MM40_TM_INVALID_RESOURCE 54 //!< TM file was not loaded successfully from resources
|
||||
#define MM40_DEVICE_HAS_BEEN_RESETED 55 //!< Device has been reset, abnormal initial state
|
||||
#define MM40_NO_DEVICES_FOUND 56 //!< No Devices Found
|
||||
#define MM40_RESOURCE_OR_FUNCTION_LOCKED 57 //!< Resource (device) or function locked by mutex
|
||||
#define MM40_BUFFER_SIZE_TOO_SMALL 58 //!< Buffer provided by user is too small
|
||||
#define MM40_COULDNT_INIT_PROCESSOR 59 //!< Could not initialize processor.
|
||||
#define MM40_NOT_INITIALIZED 60 //!< The object/module/procedure/process being referred to has not been started.
|
||||
#define MM40_RESOURCE_NOT_FOUND 61 //!< Resource not found(could be processor, file, item...).
|
||||
*/
|
||||
|
||||
void XimeaImager::processXiApiErrorCodes(int xiApiErrorCodes)
|
||||
{
|
||||
using namespace std;
|
||||
@ -534,19 +598,25 @@ void XimeaImager::processXiApiErrorCodes(int xiApiErrorCodes)
|
||||
{
|
||||
case 1:
|
||||
std::cout<<"XimeaImager::processXiApiErrorCodes-----------:Invalid handle!"<<std::endl;
|
||||
m_iImagerState=0;
|
||||
m_iImagerState=xiApiErrorCodes;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
break;
|
||||
case 15:
|
||||
std::cout<<"XimeaImager::processXiApiErrorCodes-----------:Memory allocation error!"<<std::endl;
|
||||
m_iImagerState=xiApiErrorCodes;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
break;
|
||||
case 56:
|
||||
std::cout<<"XimeaImager::processXiApiErrorCodes-----------:NO_DEVICES_FOUND!"<<std::endl;
|
||||
m_iImagerState=0;
|
||||
m_iImagerState=xiApiErrorCodes;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
break;
|
||||
case 57:
|
||||
std::cout<<"XimeaImager::processXiApiErrorCodes-----------:RESOURCE_OR_FUNCTION_LOCKED!"<<std::endl;
|
||||
m_iImagerState=22;
|
||||
m_iImagerState=xiApiErrorCodes;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
|
||||
break;
|
||||
@ -560,7 +630,7 @@ void XimeaImager::processXiApiErrorCodes(int xiApiErrorCodes)
|
||||
|
||||
|
||||
|
||||
m_iImagerState=21;
|
||||
m_iImagerState=99;
|
||||
emit ximeaImageStatus(m_iImagerState);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user