63 lines
1.9 KiB
C++
63 lines
1.9 KiB
C++
/**
|
|
******************************************************************************
|
|
* @file : IS11_INST.cpp
|
|
* @author : xin
|
|
* @brief : None
|
|
* @attention : None
|
|
* @date : 2024/8/14
|
|
******************************************************************************
|
|
*/
|
|
|
|
//
|
|
// Created by xin on 2024/8/14.
|
|
//
|
|
#include "SensorIS11.h"
|
|
#include "IS11_INST.h"
|
|
#include "iostream"
|
|
#include "cstring"
|
|
#include <cstdio> // 对于 snprintf
|
|
SensorIS11 *thissensorIS11;
|
|
int IS11SensorInit()
|
|
{
|
|
std::cout<< "IS11SensorInit" << std::endl;
|
|
thissensorIS11 = new SensorIS11();
|
|
thissensorIS11->initSensor(1);
|
|
return 1;
|
|
}
|
|
|
|
void Set_Serial_FUN(SERIALWRITE writefunc,SERIALWRITE readfunc)
|
|
{
|
|
InitFunction(writefunc,readfunc);
|
|
}
|
|
|
|
STRsensorinfo_C Get_SensorInfo() {
|
|
STRSensorInfo sensorinfo= thissensorIS11->SensorInfo;
|
|
STRsensorinfo_C sensorinfo_c;
|
|
//把sensorname 拷贝到sensorinfo_c
|
|
//strcpy_s(sensorinfo_c.SensorName,sensorinfo.SensorName.c_str());
|
|
snprintf(sensorinfo_c.SensorName, sizeof(sensorinfo_c.SensorName), "%s", sensorinfo.SensorName.c_str());
|
|
sensorinfo_c.BandNum = sensorinfo.BandNum;
|
|
sensorinfo_c.maxValue = sensorinfo.maxValue;
|
|
//strcpy_s(sensorinfo_c.serialnumber,sensorinfo.serialnumber.c_str());
|
|
snprintf(sensorinfo_c.serialnumber, sizeof(sensorinfo_c.serialnumber), "%s", 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 IS11OptSnenser(int percent) {
|
|
return thissensorIS11->OptSnenser(percent);
|
|
}
|
|
|
|
int IS11GetData(uint16_t *outdata, int shuttertime) {
|
|
thissensorIS11->GetOneDate(shuttertime);
|
|
memcpy(outdata,thissensorIS11->DATABUFF, sizeof(int16_t)*thissensorIS11->SensorInfo.BandNum);
|
|
return thissensorIS11->SensorInfo.BandNum;
|
|
|
|
}
|