/** ****************************************************************************** * @file : IS11_INST.cpp * @author : xin * @brief : None * @attention : None * @date : 2024/8/14 ****************************************************************************** */ // // Created by xin on 2024/8/14. // #include "SensorIS3.h" #include "IS3_INST.h" #include "iostream" #include "cstring" SensorIS3 *thissensorIS3; int IS3SensorInit() { std::cout<< "IS3SensorInit" << std::endl; thissensorIS3 = new SensorIS3(); thissensorIS3->initSensor(1); return 1; } void IS3Set_Serial_FUN(SERIALWRITE writefunc,SERIALWRITE readfunc) { InitFunction(writefunc,readfunc); } STRsensorinfo_C IS3Get_SensorInfo() { STRSensorInfo sensorinfo= thissensorIS3->SensorInfo; STRsensorinfo_C sensorinfo_c; //把sensorname 拷贝到sensorinfo_c strcpy_s(sensorinfo_c.SensorName,sensorinfo.SensorName.c_str()); sensorinfo_c.BandNum = sensorinfo.BandNum; sensorinfo_c.maxValue = sensorinfo.maxValue; strcpy_s(sensorinfo_c.serialnumber,sensorinfo.serialnumber.c_str()); sensorinfo_c.a1 = sensorinfo.a1; sensorinfo_c.a2 = sensorinfo.a2; sensorinfo_c.a3 = sensorinfo.a3; sensorinfo_c.a4 = sensorinfo.a4; sensorinfo_c.issensorinit= sensorinfo.isSensorInit; return sensorinfo_c; } int IS3OptSnenser(int percent) { return thissensorIS3->OptSnenser(percent); } int IS3GetData(uint16_t *outdata, int shuttertime) { thissensorIS3->GetOneDate(shuttertime); memcpy(outdata,thissensorIS3->DATABUFF, sizeof(int16_t)*thissensorIS3->SensorInfo.BandNum); float averageofdrift=(thissensorIS3->DATABUFF[thissensorIS3->SensorInfo.BandNum-1]+thissensorIS3->DATABUFF[thissensorIS3->SensorInfo.BandNum-0]+thissensorIS3->DATABUFF[thissensorIS3->SensorInfo.BandNum+1])/3; // for(int i=0;iSensorInfo.BandNum;i++) // { // outdata[i]-=averageofdrift; // if (outdata[i]<0) // outdata[i]=0; // } return thissensorIS3->SensorInfo.BandNum; } int IS3SetWeaveLenthCoeff(double *a,int lenth) { // printf("IS3SetWeaveLenthCoeff\n"); // printf("lenth=%d\n",lenth); // printf("a[0]=%f\n",a[0]); thissensorIS3->SetWeaveLenthCoeff(a,lenth); return 1; } void IS3SetShutterOpen(int isopen) { thissensorIS3->SetShutter(isopen); // printf("IS3SetShutterOpen\n"); // printf("isopen=%d\n",isopen); }