mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 03:19:43 +08:00
添加了位置定标程序 及位置移动相关程序源码
This commit is contained in:
45
html/config/calibrate.php
Normal file
45
html/config/calibrate.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
$a=$_GET["p"];
|
||||||
|
|
||||||
|
if ($a==0)
|
||||||
|
{
|
||||||
|
echo "error";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
set_time_limit(0);
|
||||||
|
ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲
|
||||||
|
ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用
|
||||||
|
//echo shell_exec("D:\\03MyGit\\linux\\movingliner\\cmake-build-debug-mingw\\movingliner.exe");
|
||||||
|
echo "application beging<br>";
|
||||||
|
//$cmd = 'ping 127.0.0.1';
|
||||||
|
|
||||||
|
system("sudo pkill ocean_optics_calibration_console");
|
||||||
|
system("sudo gpio write 1 1");
|
||||||
|
$cmd="";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($a==1)
|
||||||
|
{
|
||||||
|
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs ocean_optics.lmp --cfon FSNsdfsd'.$a.'.data -p '.$a;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs 4000nit.dat --cfon FSNsdfsd'.$a.'.data -p '.$a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while(@ ob_end_flush());
|
||||||
|
|
||||||
|
$proc = popen($cmd, 'r');
|
||||||
|
|
||||||
|
|
||||||
|
while(!feof($proc)){
|
||||||
|
echo fread($proc, 4096);
|
||||||
|
@ flush();
|
||||||
|
}
|
||||||
|
echo 'FINISH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
|
||||||
|
echo '<a href=/fileup/position.html>回到首页</a>';
|
48
html/config/location.php
Normal file
48
html/config/location.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$a=$_GET["p"];
|
||||||
|
|
||||||
|
if ($a==0)
|
||||||
|
{
|
||||||
|
echo "error";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
set_time_limit(0);
|
||||||
|
ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲
|
||||||
|
ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用
|
||||||
|
//echo shell_exec("D:\\03MyGit\\linux\\movingliner\\cmake-build-debug-mingw\\movingliner.exe");
|
||||||
|
//$cmd = 'ping 127.0.0.1';
|
||||||
|
//sy""
|
||||||
|
system("sudo pkill movingliner");
|
||||||
|
Echo $a;
|
||||||
|
$cmd = 'sudo /home/pi/liner/cmake-build-linux_release/movingliner '.$a;
|
||||||
|
|
||||||
|
while(@ ob_end_flush());
|
||||||
|
|
||||||
|
$proc = popen($cmd, 'r');
|
||||||
|
|
||||||
|
|
||||||
|
while(!feof($proc)){
|
||||||
|
echo fread($proc, 4096);
|
||||||
|
@ flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo '<p><a href="/fileup/calibrate.php?p='.$a.'">定标</a></p>';
|
||||||
|
echo '<a href=/fileup/position.html>回到首页</a>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
$i = 100;
|
||||||
|
while ($i<1000) {
|
||||||
|
++$i;
|
||||||
|
//部分浏览器需要内容达到一定长度了才输出
|
||||||
|
if ($i === 103) {
|
||||||
|
echo"<p>hello word".$i."</p>";;
|
||||||
|
} else {
|
||||||
|
echo"<p>hello word".$i."</p>";;
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
15
html/config/position.html
Normal file
15
html/config/position.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="/fileup/location.php?p=1">位置1</a>
|
||||||
|
<a href="/fileup/location.php?p=2">位置2</a>
|
||||||
|
<a href="/fileup/location.php?p=3">位置3</a>
|
||||||
|
<a href="/fileup/location.php?p=4">位置4</a>
|
||||||
|
<a href="/fileup/location.php?p=5">位置5</a>
|
||||||
|
<a href="/fileup/location.php?p=12">位置try</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
15
othersoft/install.sh
Normal file
15
othersoft/install.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
mkdir movingliner
|
||||||
|
cd movingliner
|
||||||
|
cmake ../../movingliner
|
||||||
|
make -j4
|
||||||
|
mkdir /home/pi/bin
|
||||||
|
cp ./movingliner /home/pi/bin
|
||||||
|
echo beging build shuttercali
|
||||||
|
cd ../
|
||||||
|
mkdir shuttercali
|
||||||
|
cd shuttercali
|
||||||
|
cmake ../../shuttercali
|
||||||
|
make -j4
|
||||||
|
cp ./shuttercali /home/pi/bin
|
32
othersoft/movingliner/CMakeLists.txt
Normal file
32
othersoft/movingliner/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(movingliner)
|
||||||
|
IF (WIN32)
|
||||||
|
|
||||||
|
#MESSAGE(STATUS "Now is windows")
|
||||||
|
|
||||||
|
ENDIF ()
|
||||||
|
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} C:/Qt/Qt5.12.7/5.12.7/mingw73_64)
|
||||||
|
#set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} C:/Qt/Qt5.9.0/5.9/msvc2017_64/ )
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
set(QT Core Gui Network WebSockets SerialPort Widgets)
|
||||||
|
|
||||||
|
find_package(Qt5 REQUIRED ${QT})
|
||||||
|
include_directories("source/LinearShutter")
|
||||||
|
add_executable(movingliner
|
||||||
|
main.cpp
|
||||||
|
source/LinearShutter/VSMD12XControl.cpp
|
||||||
|
source/LinearShutter/VSMD12XControl.h
|
||||||
|
source/LinearShutter/ZZ_SeiralPort.cpp
|
||||||
|
source/LinearShutter/ZZ_SeiralPort.h
|
||||||
|
|
||||||
|
)
|
||||||
|
qt5_use_modules(movingliner ${QT})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
27
othersoft/movingliner/DeviceSettings.ini
Normal file
27
othersoft/movingliner/DeviceSettings.ini
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
[DEVICE INFO]
|
||||||
|
TotalSpectrometer=1
|
||||||
|
[FS2]
|
||||||
|
Model=ISIF
|
||||||
|
Port=/dev/ttyS1
|
||||||
|
UID=QEP02975
|
||||||
|
[FS1]
|
||||||
|
Model=OSIFAlpha
|
||||||
|
Port=-1
|
||||||
|
UID=QEP02975
|
||||||
|
AEMax=0.85
|
||||||
|
AEMin=0.80
|
||||||
|
Depth=200000
|
||||||
|
[FS3]
|
||||||
|
Model=Null
|
||||||
|
[LINEAR SHUTTER]
|
||||||
|
Port=COM12
|
||||||
|
Type=1
|
||||||
|
DCID=1
|
||||||
|
TotalPosition=5
|
||||||
|
Position0=10000
|
||||||
|
Position1=91947
|
||||||
|
Position2=219299
|
||||||
|
Position3=347535
|
||||||
|
Position4=474904
|
||||||
|
[HUMITURE]
|
||||||
|
Port=/dev/ttyUSB3
|
52
othersoft/movingliner/main.cpp
Normal file
52
othersoft/movingliner/main.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include<VSMD12XControl.h>
|
||||||
|
#include "qtextstream.h"
|
||||||
|
QTextStream cout1(stdout, QIODevice::WriteOnly);
|
||||||
|
void logout(QString str){
|
||||||
|
std::cout<<str.toStdString()<<"<br>";
|
||||||
|
std::fflush(stdout);
|
||||||
|
}
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
int aaa=1000;
|
||||||
|
QString str(argv[1]);
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
CVSMD12XControl Motercontrol;
|
||||||
|
QString m_qstrDeviceConfigFilePath;
|
||||||
|
// cout1<<"adfasdfsadfsd"<<flush;
|
||||||
|
cout1<<"Your position number is "<<str<<"<br>"<<flush;
|
||||||
|
#ifdef WIN32
|
||||||
|
m_qstrDeviceConfigFilePath = ("D:\\03MyGit\\linux\\movingliner\\DeviceSettings.ini");
|
||||||
|
#else
|
||||||
|
m_qstrDeviceConfigFilePath = ("/home/data/Setting/DeviceSettings.ini");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QSettings *m_qsDeviceConfig;
|
||||||
|
m_qsDeviceConfig = new QSettings(m_qstrDeviceConfigFilePath, QSettings::IniFormat);
|
||||||
|
long positon =m_qsDeviceConfig->value("LINEAR SHUTTER/Position"+str).toLongLong();
|
||||||
|
if (positon==0)
|
||||||
|
{
|
||||||
|
logout("<b style=\"color:red\">Can not Find the position<\/b>");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cout1<<"Find Configfile in "<<m_qstrDeviceConfigFilePath<<" <br> The Port of Motor is "<<m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString()<<"<br>"<<flush;
|
||||||
|
cout1<<"Position Find Value is "<<m_qsDeviceConfig->value("LINEAR SHUTTER/Position"+str).toLongLong()<<"<br>"<<flush;
|
||||||
|
cout1<<"Configing The Motor <br>"<<flush;
|
||||||
|
// m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString()
|
||||||
|
Motercontrol.ILMES_InitializeComm(m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString());
|
||||||
|
ControllerParams cpTest;
|
||||||
|
Motercontrol.ILMES_InitializeParams(cpTest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logout("Moving to Zero");
|
||||||
|
Motercontrol.StartBackZero();
|
||||||
|
//std::cout<<"beging to move position";
|
||||||
|
logout("Moving to The Position");
|
||||||
|
Motercontrol.MoveTo(positon);
|
||||||
|
|
||||||
|
logout("<b style=\"color:green\">Finish the Task!!!<\/b> <br><b>Thanks For Using<\/b>");
|
||||||
|
return 0;
|
||||||
|
// return QCoreApplication::exec();
|
||||||
|
}
|
16
othersoft/movingliner/source/LinearShutter/AbstractPort.h
Normal file
16
othersoft/movingliner/source/LinearShutter/AbstractPort.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "VSMD12XMiscDefines.h"
|
||||||
|
#include <string>
|
||||||
|
class CAbstractPort
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void InitPort(PortInfo portinfo) = 0;
|
||||||
|
virtual bool SetPort() = 0;
|
||||||
|
virtual bool Open() = 0;
|
||||||
|
virtual void Close() = 0;
|
||||||
|
|
||||||
|
virtual std::string ReadAll(int waite=5000) = 0;
|
||||||
|
virtual int Write(const std::string strSend) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
1416
othersoft/movingliner/source/LinearShutter/VSMD12XControl.cpp
Normal file
1416
othersoft/movingliner/source/LinearShutter/VSMD12XControl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
146
othersoft/movingliner/source/LinearShutter/VSMD12XControl.h
Normal file
146
othersoft/movingliner/source/LinearShutter/VSMD12XControl.h
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include "AbstractPort.h"
|
||||||
|
using namespace std;
|
||||||
|
// #ifdef IRIS_API_EXPORTS
|
||||||
|
//
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// #define IRIS_API_FUNC extern "C" __declspec(dllexport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_FUNC __declspec(dllexport)
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// #else
|
||||||
|
//
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// #define IRIS_API_FUNC extern "C" __declspec(dllimport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_FUNC __declspec(dllimport)
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// #ifdef IRIS_API_EXPORTS
|
||||||
|
// #define IRIS_API_CLASS __declspec(dllexport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_CLASS __declspec(dllimport)
|
||||||
|
// #endif
|
||||||
|
#define MAXDISTANCE 1265000
|
||||||
|
class /*IRIS_API_CLASS*/ CVSMD12XControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CVSMD12XControl();
|
||||||
|
~CVSMD12XControl();
|
||||||
|
private:
|
||||||
|
int *m_piPositionInPulses;
|
||||||
|
|
||||||
|
CAbstractPort *m_pAbsPort;
|
||||||
|
unValue m_unValue;
|
||||||
|
MSInfo m_stuMSInfo;
|
||||||
|
ControllerParams m_stuControllerParams;
|
||||||
|
int m_iProtocolType;
|
||||||
|
int m_iCID;
|
||||||
|
std::string m_strCID;
|
||||||
|
public:
|
||||||
|
bool m_bIsSyncMove;
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//for IRIS Linear Motor - Electric Shutter
|
||||||
|
//Initialize communication setup iPortType(0:RS232 1:RS485) iCID(For RS485 device) bSyncMove(move mode)
|
||||||
|
bool ILMES_InitializeComm(QString portName,int bandrate=9600, int iPortType = 1, int iCID = 1, bool bSyncMove = true);
|
||||||
|
//Initialize communication setup iPortType(0:RS232 1:RS485) iCID(For RS485 device) bSyncMove(move mode)
|
||||||
|
bool ILMES_InitializeComm(PortInfo portinfo,int iPortType = 1,int iCID = 1, bool bSyncMove = true);
|
||||||
|
|
||||||
|
//Initialize Controller params
|
||||||
|
bool ILMES_InitializeParams(ControllerParams cpParams);
|
||||||
|
|
||||||
|
//Set the light hole position(pulses)
|
||||||
|
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
||||||
|
|
||||||
|
bool ILMES_MoveToPos(int iPositionIndex);
|
||||||
|
|
||||||
|
public:
|
||||||
|
int waitetime;
|
||||||
|
////init port
|
||||||
|
void SetProtocolType(int iProtocolType = 0);//0:RS232 1:RS485 call before send any command
|
||||||
|
void SetCID(int iID);//set device id when using RS485 protocol call before send any command
|
||||||
|
void SetSyncMode(bool bSyncMove = false);
|
||||||
|
bool InitAndOpenPort(PortInfo portinfo);//Init comport by PortInfo Struct
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////for debug or unsupported function
|
||||||
|
std::string ReadReceive();
|
||||||
|
int SendCommand(const std::string strSend); // return indicates how many char has been sent
|
||||||
|
//////////////////////////////////////////////////////////////////////////motor control
|
||||||
|
////init&misc
|
||||||
|
bool InitController(); //Init Motor controller hand shake
|
||||||
|
|
||||||
|
bool Enable(); //enbale
|
||||||
|
bool Disable(); //disable
|
||||||
|
|
||||||
|
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
||||||
|
////motion control
|
||||||
|
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool SetLogicZero(); //set logic zero
|
||||||
|
|
||||||
|
bool StartBackZero();//back zero
|
||||||
|
bool StopBackZero();// stop back zero & reset register
|
||||||
|
////Set&Get
|
||||||
|
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
||||||
|
int GetBaudRate(); // -1:should retry;
|
||||||
|
|
||||||
|
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
||||||
|
int GetMicroSteps();
|
||||||
|
|
||||||
|
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetAccSpeed();
|
||||||
|
|
||||||
|
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetRunSpeed();
|
||||||
|
|
||||||
|
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetDecSpeed();
|
||||||
|
|
||||||
|
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
||||||
|
|
||||||
|
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetHoldCurrent();
|
||||||
|
|
||||||
|
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetAccCurrent();
|
||||||
|
|
||||||
|
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetRunCurrent();
|
||||||
|
|
||||||
|
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
||||||
|
|
||||||
|
bool SetS1FETE(ZZ_U8 bS1FETE);//S1 register falling edge trigger event,see enum
|
||||||
|
ZZ_U8 GetS1FETE();
|
||||||
|
|
||||||
|
bool SetS1RETE(ZZ_U8 bS1RETE);//S1 register rising edge trigger event
|
||||||
|
ZZ_U8 GetS1RETE();
|
||||||
|
|
||||||
|
bool SetS2FETE(ZZ_U8 bS2FETE);//S2 register falling edge trigger event
|
||||||
|
ZZ_U8 GetS2FETE();
|
||||||
|
|
||||||
|
bool SetS2RETE(ZZ_U8 bS2RETE);//S2 register rising edge trigger event
|
||||||
|
ZZ_U8 GetS2RETE();
|
||||||
|
|
||||||
|
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
||||||
|
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
||||||
|
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
||||||
|
ZZ_U8 GetZeroMode();
|
||||||
|
ZZ_U8 GetSwitchOpenVoltageLevel();
|
||||||
|
ZZ_U8 GetZeroSensor();
|
||||||
|
int GetSafePosition();
|
||||||
|
float GetZeroVelocity();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ParseReturnedString(std::string &strRecv,int iType);
|
||||||
|
bool ParseReturnedParam(std::string &strRecv);
|
||||||
|
void VSMD_BitShift(ZZ_U8* src, unValue* dst);
|
||||||
|
char* VSMD_Split(char* cStr, char cSplit);
|
||||||
|
};
|
||||||
|
|
108
othersoft/movingliner/source/LinearShutter/VSMD12XMiscDefines.h
Normal file
108
othersoft/movingliner/source/LinearShutter/VSMD12XMiscDefines.h
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ZZ_Types.h"
|
||||||
|
#define MAXBUFFER 10240
|
||||||
|
#include<qstring.h>
|
||||||
|
using namespace ZZ_MISCDEF;
|
||||||
|
|
||||||
|
typedef struct tagTransportLayerInfomation
|
||||||
|
{
|
||||||
|
//Serial
|
||||||
|
int iPortType;
|
||||||
|
int iPortNumber;
|
||||||
|
int indexBaudRate;
|
||||||
|
int iBaudRate;
|
||||||
|
int indexParity, indexBytesize, indexStopBits; //Mode
|
||||||
|
bool Hw;
|
||||||
|
bool Sw;
|
||||||
|
bool Dtr, Rts;
|
||||||
|
QString FullPortName;
|
||||||
|
tagTransportLayerInfomation() {
|
||||||
|
iPortType = 0;
|
||||||
|
indexParity = 0;
|
||||||
|
iPortNumber = 8;
|
||||||
|
iBaudRate = 9600;
|
||||||
|
indexBytesize = 3;
|
||||||
|
indexStopBits = 0;
|
||||||
|
FullPortName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Bit
|
||||||
|
//Stop
|
||||||
|
//MODEM CONTROL setting
|
||||||
|
//MODEM LINE STATUS
|
||||||
|
|
||||||
|
//TCP UDP
|
||||||
|
|
||||||
|
}PortInfo;
|
||||||
|
|
||||||
|
typedef struct tagMotorStatusInfo
|
||||||
|
{
|
||||||
|
float fVelocity;
|
||||||
|
int iPosition;
|
||||||
|
ZZ_U32 uiFlags;
|
||||||
|
}MSInfo;
|
||||||
|
|
||||||
|
typedef struct tagControllerParams
|
||||||
|
{
|
||||||
|
int bdr; //baud
|
||||||
|
int mcs; //microsteps 0:full 1:half 2:4 3:8 4:16 5:32 6:64 7:128 8:256
|
||||||
|
float spd; //velocity
|
||||||
|
float acc; //acceleration
|
||||||
|
float dec; //deceleration
|
||||||
|
float cra; //acc state current
|
||||||
|
float crn; //normal state current
|
||||||
|
float crh; //hold state current
|
||||||
|
ZZ_U8 s1f;
|
||||||
|
ZZ_U8 s1r;
|
||||||
|
ZZ_U8 s2f;
|
||||||
|
ZZ_U8 s2r;
|
||||||
|
ZZ_U8 zmd; //zero mode
|
||||||
|
ZZ_U8 osv; //open state sensor value
|
||||||
|
ZZ_U8 snr; //zero sensor
|
||||||
|
ZZ_U8 zsp; //zero safe position
|
||||||
|
float zsd; //zero velocity
|
||||||
|
tagControllerParams() {
|
||||||
|
bdr = 9600;
|
||||||
|
|
||||||
|
cra = 0.8;
|
||||||
|
crh = 0.1;
|
||||||
|
crn = 0.8;
|
||||||
|
|
||||||
|
acc = 100000;
|
||||||
|
dec = 100000;
|
||||||
|
spd = 64000;
|
||||||
|
|
||||||
|
osv = 0;
|
||||||
|
snr = 0;
|
||||||
|
zmd = 3;
|
||||||
|
zsp = 20;
|
||||||
|
zsd = 50000;
|
||||||
|
|
||||||
|
mcs = 6;
|
||||||
|
}
|
||||||
|
}ControllerParams;
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
ZZ_U8 byteValue[4];
|
||||||
|
short i16Value[2];
|
||||||
|
ZZ_U16 u16Value[2];
|
||||||
|
int i32Value;
|
||||||
|
float fValue;
|
||||||
|
ZZ_U32 u32Value;
|
||||||
|
}unValue;
|
||||||
|
|
||||||
|
enum emVSMDTriggerEvent
|
||||||
|
{
|
||||||
|
NoAction =0, //<2F><EFBFBD><DEB6><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>״̬λ S1 <20>仯֪ͨ<CDA8><D6AA>
|
||||||
|
ResetZeroPosition, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
DecSpdStop, //<2F><><EFBFBD><EFBFBD>ֹͣ
|
||||||
|
DecSpdStopRZP, //<2F><><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
Stop, //<2F><><EFBFBD><EFBFBD>ֹͣ
|
||||||
|
StopRZP, //<2F><><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
RunningPosDirect, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>
|
||||||
|
RunningNegDirect, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>
|
||||||
|
OfflineModeOn, //<2F><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
||||||
|
OfflineModeOff //<2F><><EFBFBD><EFBFBD>ģʽֹͣ
|
||||||
|
};
|
||||||
|
|
147
othersoft/movingliner/source/LinearShutter/ZZ_SeiralPort.cpp
Normal file
147
othersoft/movingliner/source/LinearShutter/ZZ_SeiralPort.cpp
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "ZZ_SeiralPort.h"
|
||||||
|
|
||||||
|
CZZ_SeiralPort_QT::CZZ_SeiralPort_QT()
|
||||||
|
{
|
||||||
|
m_pSerialPort = new QSerialPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
CZZ_SeiralPort_QT::~CZZ_SeiralPort_QT()
|
||||||
|
{
|
||||||
|
if (m_pSerialPort != NULL)
|
||||||
|
{
|
||||||
|
delete m_pSerialPort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CZZ_SeiralPort_QT::InitPort(PortInfo portinfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_piSettings = portinfo;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CZZ_SeiralPort_QT::SetPort()
|
||||||
|
{
|
||||||
|
bool bRes = true;
|
||||||
|
// int iRes = sio_ioctl(m_piSettings.iPortNumber, m_piSettings.indexBaudRate,
|
||||||
|
// m_piSettings.indexParity | m_piSettings.indexBytesize | m_piSettings.indexStopBits);
|
||||||
|
// if (iRes != SIO_OK)
|
||||||
|
// {
|
||||||
|
// bRes = false;
|
||||||
|
// }
|
||||||
|
QString qstrPortName;
|
||||||
|
if (m_piSettings.FullPortName!="")
|
||||||
|
{
|
||||||
|
qstrPortName = m_piSettings.FullPortName;
|
||||||
|
qDebug() << m_piSettings.FullPortName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qstrPortName = QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||||
|
}
|
||||||
|
// qstrPortName = "COM4";
|
||||||
|
// QString qstrPortName = m_piSettings.FullPortName;//QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||||
|
m_pSerialPort->setPortName(qstrPortName);
|
||||||
|
m_pSerialPort->setReadBufferSize(512);
|
||||||
|
bRes = m_pSerialPort->setBaudRate(m_piSettings.iBaudRate);
|
||||||
|
return bRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CZZ_SeiralPort_QT::Open()
|
||||||
|
{
|
||||||
|
bool bRes = true;
|
||||||
|
// int iRes = sio_open(m_piSettings.iPortNumber);
|
||||||
|
// if (iRes!=SIO_OK)
|
||||||
|
// {
|
||||||
|
// bRes = false;
|
||||||
|
// }
|
||||||
|
bRes = m_pSerialPort->open(QIODevice::ReadWrite);
|
||||||
|
if (!bRes)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:open Failed.Exit Code:1";
|
||||||
|
//std::cout << "Err.open Failed" << std::endl;
|
||||||
|
return bRes;;
|
||||||
|
}
|
||||||
|
return bRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CZZ_SeiralPort_QT::Close()
|
||||||
|
{
|
||||||
|
m_pSerialPort->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CZZ_SeiralPort_QT::ReadAll(int waite)
|
||||||
|
{
|
||||||
|
if (!m_pSerialPort->waitForReadyRead(waite))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
m_pSerialPort->bytesAvailable() == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
qbaRecv.clear();
|
||||||
|
|
||||||
|
qbaRecv = m_pSerialPort->readAll();
|
||||||
|
|
||||||
|
|
||||||
|
std::string strRet(qbaRecv.constData(), qbaRecv.length());
|
||||||
|
return strRet;
|
||||||
|
|
||||||
|
// std::string strRet;
|
||||||
|
// char cBuf[MAXBUFFER];
|
||||||
|
// int iRet = sio_read(m_piSettings.iPortNumber,cBuf, MAXBUFFER);
|
||||||
|
// if (iRet==0)
|
||||||
|
// {
|
||||||
|
// strRet = "";
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// char *pRecv = new char[iRet];
|
||||||
|
// memcpy(pRecv, cBuf, iRet);
|
||||||
|
// //std::string strRet(pRecv);
|
||||||
|
// //delete pRecv;
|
||||||
|
// //return strRet;
|
||||||
|
//
|
||||||
|
// strRet.resize(iRet);
|
||||||
|
// for (int i=0;i<iRet;i++)
|
||||||
|
// {
|
||||||
|
// strRet[i] = pRecv[i];
|
||||||
|
// }
|
||||||
|
// delete pRecv;
|
||||||
|
// }
|
||||||
|
// return strRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CZZ_SeiralPort_QT::Write(const std::string strSend)
|
||||||
|
{
|
||||||
|
QByteArray qbaTest(strSend.c_str(),(int)strSend.length());
|
||||||
|
qint64 qi64Write = m_pSerialPort->write(qbaTest);
|
||||||
|
m_pSerialPort->waitForBytesWritten(5000);
|
||||||
|
if (qi64Write != qbaTest.size())
|
||||||
|
{
|
||||||
|
qDebug() << "Err:write Failed.Exit Code:1" << qi64Write;
|
||||||
|
return qi64Write;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
// char* pcSend = (char*)strSend.c_str();
|
||||||
|
// int iRet = sio_write(m_piSettings.iPortNumber, pcSend, (int)strSend.length());
|
||||||
|
//
|
||||||
|
// //delete pcSend;
|
||||||
|
// if (iRet!= (int)strSend.length())
|
||||||
|
// {
|
||||||
|
// return iRet;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// //sio_write();
|
||||||
|
}
|
26
othersoft/movingliner/source/LinearShutter/ZZ_SeiralPort.h
Normal file
26
othersoft/movingliner/source/LinearShutter/ZZ_SeiralPort.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "VSMD12XMiscDefines.h"
|
||||||
|
#include "AbstractPort.h"
|
||||||
|
#include"qobject.h"
|
||||||
|
class CZZ_SeiralPort_QT :public CAbstractPort,QObject
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
PortInfo m_piSettings;
|
||||||
|
QByteArray qbaSend, qbaRecv;
|
||||||
|
QSerialPort *m_pSerialPort;
|
||||||
|
public:
|
||||||
|
CZZ_SeiralPort_QT();
|
||||||
|
virtual ~CZZ_SeiralPort_QT();
|
||||||
|
public:
|
||||||
|
virtual void InitPort(PortInfo portinfo);
|
||||||
|
virtual bool SetPort();
|
||||||
|
virtual bool Open();
|
||||||
|
virtual void Close();
|
||||||
|
|
||||||
|
virtual std::string ReadAll(int waittime = 5000);
|
||||||
|
|
||||||
|
virtual int Write(const std::string strSend);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
297
othersoft/movingliner/source/LinearShutter/ZZ_Types.h
Normal file
297
othersoft/movingliner/source/LinearShutter/ZZ_Types.h
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//<2F><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ļ<EFBFBD>
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include <string>
|
||||||
|
#define MAX_DEVICENUMBER_FS 2
|
||||||
|
#define MAX_LINEARSHUTTER_POSITION 12
|
||||||
|
namespace ZZ_MISCDEF
|
||||||
|
{
|
||||||
|
typedef unsigned char ZZ_U8;
|
||||||
|
typedef unsigned short int ZZ_U16;
|
||||||
|
typedef unsigned long int ZZ_U32;
|
||||||
|
|
||||||
|
|
||||||
|
namespace IRIS
|
||||||
|
{
|
||||||
|
//Fiber Spectrometer
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
typedef struct tagDataFrame
|
||||||
|
{
|
||||||
|
ZZ_U16 usExposureTimeInMS;
|
||||||
|
ZZ_U16 usData[4096];
|
||||||
|
float fTemperature;
|
||||||
|
double dTimes = 0;
|
||||||
|
}DataFrame;
|
||||||
|
|
||||||
|
typedef struct tagDeviceInfo
|
||||||
|
{
|
||||||
|
std::string strPN;
|
||||||
|
std::string strSN;
|
||||||
|
}DeviceInfo;
|
||||||
|
|
||||||
|
typedef struct tagDeviceAttribute
|
||||||
|
{
|
||||||
|
int iPixels;
|
||||||
|
int iMaxIntegrationTimeInMS;
|
||||||
|
int iMinIntegrationTimeInMS;
|
||||||
|
float fWaveLengthInNM[4096];
|
||||||
|
|
||||||
|
}DeviceAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DeviceModel
|
||||||
|
{
|
||||||
|
OSIFAlpha=0,
|
||||||
|
OSIFBeta,
|
||||||
|
ISIF,
|
||||||
|
IS1,
|
||||||
|
IS2
|
||||||
|
};
|
||||||
|
|
||||||
|
// inline std::string GetDeviceModelName(int iModel)
|
||||||
|
// {
|
||||||
|
// switch (iModel)
|
||||||
|
// {
|
||||||
|
// case DeviceModel::OSIFAlpha: return "OSIFAlpha"; break;
|
||||||
|
// case DeviceModel::OSIFBeta: return "OSIFBeta"; break;
|
||||||
|
// case DeviceModel::ISIF: return "ISIF"; break;
|
||||||
|
// case DeviceModel::IS1: return "IS1"; break;
|
||||||
|
// case DeviceModel::IS2: return "IS2"; break;
|
||||||
|
// default: return "error"; break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// inline int GetIndex(std::string strDeviceModelName)
|
||||||
|
// {
|
||||||
|
// if (strDeviceModelName== "OSIFAlpha")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::OSIFAlpha;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "OSIFBeta")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::OSIFBeta;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "ISIF")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::ISIF;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "IS1")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::IS1;
|
||||||
|
// }
|
||||||
|
// else if(strDeviceModelName == "IS2")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::IS2;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//ATPָ<50><D6B8>ת<EFBFBD><D7AA>
|
||||||
|
namespace ATP
|
||||||
|
{
|
||||||
|
const int MAX_SPECTRUM_SIZE = 4096;
|
||||||
|
|
||||||
|
const int GET_MODULECIRCUIT_TEMP = 0x01;
|
||||||
|
const int GET_PN_NUMBER = 0x03;
|
||||||
|
const int GET_SN_NUMBER = 0x04;
|
||||||
|
const int GET_MANUFACTURE_DATA = 0x06;
|
||||||
|
const int GET_MANUFACTURE_INFO = 0x09;
|
||||||
|
const int GET_PIXEL_LENGTH = 0x0a;
|
||||||
|
const int GET_TEC_TEMP = 0x13;
|
||||||
|
const int SET_TEC_TEMP = 0x12;
|
||||||
|
const int GET_OPTICS_TEMP = 0x35;
|
||||||
|
const int GET_CIRCUITBOARD_TEMP = 0x36;
|
||||||
|
const int SET_INTEGRATION_TIME = 0x14;
|
||||||
|
const int GET_INTEGRATION_TIME = 0x41;
|
||||||
|
const int GET_MAX_INTEGRATION_TIME = 0x42;
|
||||||
|
const int GET_MIN_INTEGRATION_TIME = 0x43;
|
||||||
|
const int ASYNC_COLLECT_DARK = 0x23;
|
||||||
|
const int ASYNC_START_COLLECTION = 0x16;
|
||||||
|
const int ASYNC_READ_DATA = 0x17;
|
||||||
|
const int SET_AVERAGE_NUMBER = 0x28;
|
||||||
|
const int SYNC_GET_DATA = 0x1e;
|
||||||
|
const int SYNC_GET_DARK = 0x2f;
|
||||||
|
const int EXTERNAL_TRIGGER_ENABLE = 0x1f;
|
||||||
|
const int SET_XENON_LAMP_DELAY_TIME = 0x24;
|
||||||
|
const int GET_WAVELENGTH_CALIBRATION_COEF = 0x55;
|
||||||
|
const int GET_STAT_LAMPOUT = 0x60;
|
||||||
|
const int SET_GPIO = 0x61;
|
||||||
|
//const int SYNCHRONIZATION_GET_DARK = 0x23
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////device
|
||||||
|
enum Model
|
||||||
|
{
|
||||||
|
ATP1010 = 0,
|
||||||
|
ATP6500
|
||||||
|
};
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDataFrame
|
||||||
|
{
|
||||||
|
unsigned short usExposureTime;
|
||||||
|
ZZ_U16 usData[4096];
|
||||||
|
float fTemperature;
|
||||||
|
double dTimes = 0;
|
||||||
|
}ATPDataFrame;
|
||||||
|
|
||||||
|
//<2F>豸<EFBFBD><E8B1B8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDeviceInfo
|
||||||
|
{
|
||||||
|
std::string strPN;
|
||||||
|
std::string strSN;
|
||||||
|
}ATPDeviceInfo;
|
||||||
|
|
||||||
|
//<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDeviceAttribute
|
||||||
|
{
|
||||||
|
int iPixels;
|
||||||
|
int iMaxIntegrationTime;
|
||||||
|
int iMinIntegrationTime;
|
||||||
|
float fWaveLength[4096];
|
||||||
|
|
||||||
|
}ATPDeviceAttribute;
|
||||||
|
//////////////////////////////////////////////////////////////////////////config file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
||||||
|
namespace ZZ_RUNPARAMS
|
||||||
|
{
|
||||||
|
typedef struct tagFiberSpecContext
|
||||||
|
{
|
||||||
|
ZZ_U8 ucDeviceNumber;
|
||||||
|
ZZ_U8 ucDeviceModel[MAX_DEVICENUMBER_FS];
|
||||||
|
int iInterface[MAX_DEVICENUMBER_FS];
|
||||||
|
std::string strSN[MAX_DEVICENUMBER_FS];
|
||||||
|
}FSContext;
|
||||||
|
|
||||||
|
typedef struct tagLinearShutterContext
|
||||||
|
{
|
||||||
|
ZZ_U8 ucPort;
|
||||||
|
ZZ_U8 ucProtocolType;
|
||||||
|
ZZ_U8 ucCmdID;
|
||||||
|
}LSContext;
|
||||||
|
|
||||||
|
typedef struct tagAcquisitionTimeSettings
|
||||||
|
{
|
||||||
|
QTime qtStartTime;
|
||||||
|
QTime qtStopTime;
|
||||||
|
QTime qtInterval;
|
||||||
|
}AcqTimeSettings;
|
||||||
|
|
||||||
|
typedef struct tagAcquisitionPositionSettings
|
||||||
|
{
|
||||||
|
int iTotalPosition;
|
||||||
|
int iPosition[MAX_LINEARSHUTTER_POSITION];
|
||||||
|
}AcqPosSettings;
|
||||||
|
|
||||||
|
typedef struct tagRunTimeGrabberParams
|
||||||
|
{
|
||||||
|
LSContext lscParam;
|
||||||
|
FSContext fscParams;
|
||||||
|
AcqTimeSettings atsParams;
|
||||||
|
AcqPosSettings apsParams;
|
||||||
|
}RunTimeGrabberParams;
|
||||||
|
|
||||||
|
typedef struct tagATPCalibrationSettings
|
||||||
|
{
|
||||||
|
//Up0 Down1,2,3
|
||||||
|
QString qsISIF_CalibrationFilePath[4];
|
||||||
|
QString qsIS1_CalibrationFilePath[4];
|
||||||
|
}ATPCalibrationSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ṹ
|
||||||
|
namespace ZZ_DATAFILE
|
||||||
|
{
|
||||||
|
typedef struct tagEnvironmentalContext
|
||||||
|
{
|
||||||
|
QString qstrUTCDateTime;
|
||||||
|
QString qstrLocation;
|
||||||
|
QString qstrGPS_Longtitude;
|
||||||
|
QString qstrGPS_Latitude;
|
||||||
|
QString qstrGPS_Altitude;
|
||||||
|
QString qstrGPS_North;
|
||||||
|
QString qstrCaseTemperature;
|
||||||
|
QString qstrCaseHumidity;
|
||||||
|
|
||||||
|
}EContext;
|
||||||
|
|
||||||
|
typedef struct tagManmadeEnviromentalContext
|
||||||
|
{
|
||||||
|
QString qstrOriFileName;
|
||||||
|
QString qstrInstallationTime;
|
||||||
|
QString qstrISIFCalibrationTime;
|
||||||
|
QString qstrIS1CalibrationTime;
|
||||||
|
QString qstrNameOfMaintenanceStaff;
|
||||||
|
QString qstrPhoneNumberOfMaintenanceStaff;
|
||||||
|
QString qstrDownloadUserID;
|
||||||
|
QString qstrDownlaodAddress;
|
||||||
|
QString qstrHTTPServer;
|
||||||
|
}MEContext;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tagIS1Information
|
||||||
|
{
|
||||||
|
QString qstrSN_ATP;
|
||||||
|
QString qstrSN_IRIS;
|
||||||
|
|
||||||
|
QString qstrCalFile_U0;
|
||||||
|
QString qstrCalFile_D1;
|
||||||
|
QString qstrCalFile_D2;
|
||||||
|
QString qstrCalFile_D3;
|
||||||
|
|
||||||
|
int iPixelCount;
|
||||||
|
|
||||||
|
int iExposureTimeInMS_U0;
|
||||||
|
int iExposureTimeInMS_D1;
|
||||||
|
int iExposureTimeInMS_D2;
|
||||||
|
int iExposureTimeInMS_D3;
|
||||||
|
|
||||||
|
float fTemperature_U0;
|
||||||
|
float fTemperature_D1;
|
||||||
|
float fTemperature_D2;
|
||||||
|
float fTemperature_D3;
|
||||||
|
}IS1Info;
|
||||||
|
|
||||||
|
typedef struct tagISIFInformation
|
||||||
|
{
|
||||||
|
QString qstrSN_ATP;
|
||||||
|
QString qstrSN_IRIS;
|
||||||
|
|
||||||
|
QString qstrCalFile_U0;
|
||||||
|
QString qstrCalFile_D1;
|
||||||
|
QString qstrCalFile_D2;
|
||||||
|
QString qstrCalFile_D3;
|
||||||
|
|
||||||
|
int iPixelCount;
|
||||||
|
|
||||||
|
int iExposureTimeInMS_U0;
|
||||||
|
int iExposureTimeInMS_D1;
|
||||||
|
int iExposureTimeInMS_D2;
|
||||||
|
int iExposureTimeInMS_D3;
|
||||||
|
|
||||||
|
float fTemperature_U0;
|
||||||
|
float fTemperature_D1;
|
||||||
|
float fTemperature_D2;
|
||||||
|
float fTemperature_D3;
|
||||||
|
}ISIFInfo;
|
||||||
|
|
||||||
|
typedef struct tagATPDataHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}ATPDataHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
28
othersoft/movingliner/source/LinearShutter/pch.h
Normal file
28
othersoft/movingliner/source/LinearShutter/pch.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <iostream>
|
||||||
|
////////////////////////////setings
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMetaEnum>
|
||||||
|
////////////////////////////Basic
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QObject>
|
||||||
|
////////////////////////////Thread
|
||||||
|
#include <QThread>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
////////////////////////////json
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonValue>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
////////////////////////////time
|
||||||
|
#include <QtCore/QTime>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QTimer>
|
||||||
|
////////////////////////////Serial I/O
|
||||||
|
#include <QtSerialPort/QSerialPort>
|
||||||
|
#include <QtSerialPort/QSerialPortInfo>
|
191
othersoft/movingliner/source/Settings/SystemConfigger.cpp
Normal file
191
othersoft/movingliner/source/Settings/SystemConfigger.cpp
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
#include "SystemConfigger.h"
|
||||||
|
|
||||||
|
|
||||||
|
ZZ_SysConfigger::ZZ_SysConfigger(QObject *parent /*= nullptr*/)
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
m_qstrDeviceConfigFilePath = "E:/WorkSpace/TowerOptoSifAndSpectral/config/DeviceSettings.ini";
|
||||||
|
m_qstrJSONConfigFilePath = "E:/WorkSpace/TowerOptoSifAndSpectral/config/config.json";
|
||||||
|
#else
|
||||||
|
m_qstrJSONConfigFilePath = ("/home/data/Setting/config.json");
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
m_qsDeviceConfig = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZZ_SysConfigger::~ZZ_SysConfigger()
|
||||||
|
{
|
||||||
|
if (qfJConfig.isOpen())
|
||||||
|
{
|
||||||
|
qfJConfig.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::Initialize()
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////load device settings
|
||||||
|
using namespace ZZ_MISCDEF;
|
||||||
|
QMetaEnum enumDeviceModel = QMetaEnum::fromType<ConfiggerDeviceModel>();
|
||||||
|
|
||||||
|
if (m_qsDeviceConfig!=NULL)
|
||||||
|
{
|
||||||
|
delete m_qsDeviceConfig;
|
||||||
|
}
|
||||||
|
m_qsDeviceConfig = new QSettings(m_qstrDeviceConfigFilePath, QSettings::IniFormat);
|
||||||
|
m_struDeviceContext.ucDeviceNumber = m_qsDeviceConfig->value(QString("DEVICE INFO/TotalSpectrometer"),-1).toInt();
|
||||||
|
if (m_struDeviceContext.ucDeviceNumber == -1)
|
||||||
|
{
|
||||||
|
qDebug() << "DEVICE INFO TotalSpectrometer Value Err.";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
for (ZZ_U8 i=0;i< m_struDeviceContext.ucDeviceNumber;i++)
|
||||||
|
{
|
||||||
|
QString qstrTemp= m_qsDeviceConfig->value(QString("FS%1/Model").arg(i+1), "Null").toString();
|
||||||
|
m_struDeviceContext.ucDeviceModel[i]= enumDeviceModel.keysToValue(qstrTemp.toLatin1().data());
|
||||||
|
|
||||||
|
int iInterface= m_qsDeviceConfig->value(QString("FS%1/Port").arg(i + 1), -2).toInt();
|
||||||
|
m_struDeviceContext.iInterface[i] = iInterface;
|
||||||
|
|
||||||
|
qstrTemp = m_qsDeviceConfig->value(QString("FS%1/UID").arg(i + 1), "Null").toString();
|
||||||
|
m_struDeviceContext.strSN[i] = qstrTemp.toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_struAcqPosition.iTotalPosition = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/TotalPosition"), -1).toInt();
|
||||||
|
if (m_struAcqPosition.iTotalPosition == -1)
|
||||||
|
{
|
||||||
|
qDebug() << "LINEAR SHUTTER TotalPosition Value Err.";
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ZZ_U8 i = 0; i < m_struAcqPosition.iTotalPosition; i++)
|
||||||
|
{
|
||||||
|
int iPosition = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/Position%1").arg(i), -2).toInt();
|
||||||
|
m_struAcqPosition.iPosition[i] = iPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////load json settings
|
||||||
|
qfJConfig.setFileName(m_qstrJSONConfigFilePath);
|
||||||
|
bool bRes = qfJConfig.open(QIODevice::ReadOnly);
|
||||||
|
if (!bRes)
|
||||||
|
{
|
||||||
|
qDebug() << "QFile open config file Err.";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_qbaJData = qfJConfig.readAll();
|
||||||
|
m_qjdJDoc= QJsonDocument::fromJson(m_qbaJData, &m_qjpeJErr);
|
||||||
|
if (m_qjpeJErr.error != QJsonParseError::NoError)
|
||||||
|
{
|
||||||
|
qDebug() << m_qjpeJErr.errorString();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
m_qjoJObj = m_qjdJDoc.object();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::GetGrabberRunParams(RunTimeGrabberParams &struGrabberRTParams)
|
||||||
|
{
|
||||||
|
struGrabberRTParams.atsParams = m_struAcqTime;
|
||||||
|
struGrabberRTParams.fscParams = m_struDeviceContext;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::LoadSettingsFromFile_IS1()
|
||||||
|
{
|
||||||
|
m_struIS1Info.qstrCalFile_U0 = m_qjoJObj.value("IS1UpCalFile").toString();
|
||||||
|
m_struIS1Info.qstrCalFile_D1 = m_qjoJObj.value("IS1DownCalFile1").toString();
|
||||||
|
m_struIS1Info.qstrCalFile_D2 = m_qjoJObj.value("IS1DownCalFile2").toString();
|
||||||
|
m_struIS1Info.qstrCalFile_D3 = m_qjoJObj.value("IS1DownCalFile3").toString();
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::LoadSettingsFromFile_iSIF()
|
||||||
|
{
|
||||||
|
m_struISIFInfo.qstrCalFile_U0 = m_qjoJObj.value("SIFUpCalFile").toString();
|
||||||
|
m_struISIFInfo.qstrCalFile_D1 = m_qjoJObj.value("SIFDownCalFile1").toString();
|
||||||
|
m_struISIFInfo.qstrCalFile_D2 = m_qjoJObj.value("SIFDownCalFile2").toString();
|
||||||
|
m_struISIFInfo.qstrCalFile_D3 = m_qjoJObj.value("SIFDownCalFile3").toString();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::LoadSettingsFromFile_System()
|
||||||
|
{
|
||||||
|
// QString qstr = m_qjoJObj.value("IntervalTime").toString();
|
||||||
|
m_struAcqTime.qtStartTime=QTime::fromString(m_qjoJObj.value("BeginTime").toString(), "hh:mm");
|
||||||
|
if (!m_struAcqTime.qtStartTime.isValid())
|
||||||
|
{
|
||||||
|
qDebug() << "Invalid BeginTime";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "ss");
|
||||||
|
if (!m_struAcqTime.qtInterval.isValid())
|
||||||
|
{
|
||||||
|
qDebug() << "Invalid IntervalTime";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "mm");
|
||||||
|
if (!m_struAcqTime.qtInterval.isValid())
|
||||||
|
{
|
||||||
|
qDebug() << "Invalid IntervalTime";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_struAcqTime.qtStopTime = QTime::fromString(m_qjoJObj.value("EndTime").toString(), "hh:mm");
|
||||||
|
if (!m_struAcqTime.qtStopTime.isValid())
|
||||||
|
{
|
||||||
|
qDebug() << "Invalid EndTime";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::LoadSettingsFromFile_MISC()
|
||||||
|
{
|
||||||
|
m_struEC.qstrLocation = m_qjoJObj.value("Location").toString();
|
||||||
|
m_struEC.qstrGPS_Altitude = m_qjoJObj.value("GPS_Altitude").toString();
|
||||||
|
m_struEC.qstrGPS_Latitude = m_qjoJObj.value("GPS_Latitude").toString();
|
||||||
|
m_struEC.qstrGPS_Longtitude = m_qjoJObj.value("GPS_Longtitude").toString();
|
||||||
|
m_struEC.qstrGPS_North = m_qjoJObj.value("GPS_North").toString();
|
||||||
|
|
||||||
|
m_struMEC.qstrInstallationTime = m_qjoJObj.value("InstallationTime").toString();
|
||||||
|
m_struMEC.qstrISIFCalibrationTime = m_qjoJObj.value("ISIFCalibrationTime").toString();
|
||||||
|
m_struMEC.qstrIS1CalibrationTime = m_qjoJObj.value("IS1CalibrationTime").toString();
|
||||||
|
m_struMEC.qstrNameOfMaintenanceStaff = m_qjoJObj.value("NameOfMaintenanceStaff").toString();
|
||||||
|
m_struMEC.qstrPhoneNumberOfMaintenanceStaff = m_qjoJObj.value("PhoneNumberOfMaintenanceStaff").toString();
|
||||||
|
m_struMEC.qstrDownloadUserID = m_qjoJObj.value("DownloadUserID").toString();
|
||||||
|
m_struMEC.qstrDownlaodAddress = m_qjoJObj.value("DownlaodAddress").toString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_SysConfigger::LoadSettings_Test()
|
||||||
|
{
|
||||||
|
QFile qfTest(m_qstrJSONConfigFilePath);
|
||||||
|
|
||||||
|
qfTest.open(QFile::ReadOnly);
|
||||||
|
|
||||||
|
QByteArray qbJData = qfTest.readAll();
|
||||||
|
|
||||||
|
QJsonParseError jerr;
|
||||||
|
QJsonDocument jdoc(QJsonDocument::fromJson(qbJData, &jerr));
|
||||||
|
if (jerr.error!= QJsonParseError::NoError)
|
||||||
|
{
|
||||||
|
qDebug() << jerr.errorString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject rootobj = jdoc.object();
|
||||||
|
QStringList key = rootobj.keys();
|
||||||
|
QString qtest1 = rootobj.value(rootobj.keys().at(15)).toString();
|
||||||
|
return 0;
|
||||||
|
}
|
57
othersoft/movingliner/source/Settings/SystemConfigger.h
Normal file
57
othersoft/movingliner/source/Settings/SystemConfigger.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ZZ_Types.h"
|
||||||
|
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
|
||||||
|
using namespace ZZ_MISCDEF::ZZ_DATAFILE;
|
||||||
|
|
||||||
|
class ZZ_SysConfigger :public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ZZ_SysConfigger(QObject *parent = nullptr);
|
||||||
|
virtual ~ZZ_SysConfigger();
|
||||||
|
public:
|
||||||
|
int Initialize();
|
||||||
|
int GetGrabberRunParams(RunTimeGrabberParams &struGrabberRTParams);
|
||||||
|
|
||||||
|
int LoadSettingsFromFile_IS1();
|
||||||
|
int LoadSettingsFromFile_iSIF();
|
||||||
|
int LoadSettingsFromFile_System();
|
||||||
|
int LoadSettingsFromFile_MISC();
|
||||||
|
int LoadSettings_Test();
|
||||||
|
public:
|
||||||
|
enum ConfiggerDeviceModel
|
||||||
|
{
|
||||||
|
OSIFAlpha = 0,
|
||||||
|
OSIFBeta,
|
||||||
|
ISIF,
|
||||||
|
IS1,
|
||||||
|
IS2,
|
||||||
|
Null
|
||||||
|
};
|
||||||
|
Q_ENUM(ConfiggerDeviceModel);
|
||||||
|
//////////////////////////////////////////////////////////////////////////run-time settings
|
||||||
|
AcqTimeSettings m_struAcqTime;
|
||||||
|
FSContext m_struDeviceContext;
|
||||||
|
AcqPosSettings m_struAcqPosition;
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
EContext m_struEC;
|
||||||
|
MEContext m_struMEC;
|
||||||
|
IS1Info m_struIS1Info;
|
||||||
|
ISIFInfo m_struISIFInfo;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_qstrDeviceConfigFilePath;
|
||||||
|
QString m_qstrJSONConfigFilePath;
|
||||||
|
QFile qfJConfig/*,qfDeviceConfig*/;
|
||||||
|
QSettings *m_qsDeviceConfig;
|
||||||
|
|
||||||
|
QByteArray m_qbaJData;
|
||||||
|
QJsonParseError m_qjpeJErr;
|
||||||
|
QJsonObject m_qjoJObj;
|
||||||
|
QJsonDocument m_qjdJDoc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
46
othersoft/shuttercali/project/LocationCali/CMakeLists.txt
Normal file
46
othersoft/shuttercali/project/LocationCali/CMakeLists.txt
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.3)
|
||||||
|
|
||||||
|
project(shutter_calibrate)
|
||||||
|
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} C:/Qt/Qt5.12.7/5.12.7/mingw73_64)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(QT Core Gui Network WebSockets SerialPort Widgets)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
find_package(Qt5 REQUIRED ${QT})
|
||||||
|
|
||||||
|
|
||||||
|
file(GLOB_RECURSE HDR_LIST "../../source/*.h")
|
||||||
|
file(GLOB_RECURSE SRC_LIST "../../source/*.cpp")
|
||||||
|
file(GLOB_RECURSE HDR_LIST1 "../../source_rlx/*.h")
|
||||||
|
file(GLOB_RECURSE SRC_LIST1 "../../source_rlx/*.cpp")
|
||||||
|
|
||||||
|
include_directories("../../source")
|
||||||
|
include_directories("../../source/FS")
|
||||||
|
include_directories("../../source/Logger")
|
||||||
|
include_directories("../../source/ZZ_SDK")
|
||||||
|
include_directories("../../source/Settings")
|
||||||
|
include_directories("../../source/Thread")
|
||||||
|
include_directories("../../source/LinearShutter")
|
||||||
|
include_directories("../../source_rlx/ShutterCali")
|
||||||
|
include_directories("../../source_rlx/sensor")
|
||||||
|
include_directories("../../source/OSIF/include")
|
||||||
|
include_directories("D:/02Raspberry/2020-12-17/SeaBreeze/include")
|
||||||
|
link_directories("D:/02Raspberry/2020-12-17/SeaBreeze/lib")
|
||||||
|
link_directories("/home/pi/SeaBrease/lib")
|
||||||
|
add_executable( shutter_calibrate main.cpp
|
||||||
|
${HDR_LIST}
|
||||||
|
${SRC_LIST}
|
||||||
|
${HDR_LIST1}
|
||||||
|
${SRC_LIST1}
|
||||||
|
)
|
||||||
|
qt5_use_modules(shutter_calibrate ${QT})
|
||||||
|
target_link_libraries(shutter_calibrate SeaBreeze)
|
||||||
|
IF (WIN32)
|
||||||
|
target_link_libraries(shutter_calibrate SeaBreeze)
|
||||||
|
ELSE ()
|
||||||
|
target_link_libraries(shutter_calibrate seabreeze usb stdc++ m)
|
||||||
|
ENDIF ()
|
||||||
|
set_target_properties(shutter_calibrate PROPERTIES AUTOMOC ON)
|
||||||
|
|
||||||
|
|
BIN
othersoft/shuttercali/project/LocationCali/SeaBreeze.dll
Normal file
BIN
othersoft/shuttercali/project/LocationCali/SeaBreeze.dll
Normal file
Binary file not shown.
BIN
othersoft/shuttercali/project/LocationCali/SeaBreeze.lib
Normal file
BIN
othersoft/shuttercali/project/LocationCali/SeaBreeze.lib
Normal file
Binary file not shown.
202
othersoft/shuttercali/project/LocationCali/main.cpp
Normal file
202
othersoft/shuttercali/project/LocationCali/main.cpp
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include<VSMD12XControl.h>
|
||||||
|
#include "QTextCodec"
|
||||||
|
#include "SensorMannager.h"
|
||||||
|
#include"SensorOptoSky.h"
|
||||||
|
#include"SensorQExPRO.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <QTextstream>
|
||||||
|
QTextStream cout1(stdout, QIODevice::WriteOnly);
|
||||||
|
void logout(QString str){
|
||||||
|
std::cout<<str.toStdString()<<"<br>";
|
||||||
|
std::fflush(stdout);
|
||||||
|
}
|
||||||
|
vector<int> FindFeng(vector<int > point1ist, vector<float> valuelist);
|
||||||
|
vector<int> DengJianJu(int position, int distanc, int times = 10);
|
||||||
|
vector <float> PingHua(vector <float> value, int step = 2);
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication aaaaa(argc, argv);
|
||||||
|
cout1<<"Welcom to use the Auto Locate Application"<<"<br>"<<flush;
|
||||||
|
string hdrPath = "/home/data/test.csv";
|
||||||
|
std::ofstream outfile(hdrPath.c_str());
|
||||||
|
logout("Init Senser :QE");
|
||||||
|
SensorBase* aa = new SensorQExPRO(QE65PRO_QE);
|
||||||
|
//SensorBase* aa = new SensorOptoSky(ATP6500,"ttyUSB0");
|
||||||
|
|
||||||
|
aa->initSensor();
|
||||||
|
|
||||||
|
cout1<<"Get Tempratrue:"<<aa->GettingTempratrue()<<"<br>"<<flush;
|
||||||
|
STROnePlot oneplot;
|
||||||
|
aa->Settingshuttertime(20);
|
||||||
|
aa->GetOnePlot(oneplot);
|
||||||
|
cout1<<"Position"<< oneplot.Plot[1000];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CVSMD12XControl Motercontrol;
|
||||||
|
Motercontrol.ILMES_InitializeComm("COM16");
|
||||||
|
|
||||||
|
//Motercontrol.ILMES_InitializeComm("/dev/ttyUSB1");
|
||||||
|
ControllerParams cpTest;
|
||||||
|
bool res = Motercontrol.ILMES_InitializeParams(cpTest);
|
||||||
|
Motercontrol.StartBackZero();
|
||||||
|
Motercontrol.SetRunSpeed(10000);
|
||||||
|
Motercontrol.MoveTo_NoSyn(550000);
|
||||||
|
aa->GetOnePlot(oneplot);
|
||||||
|
MSInfo temp;
|
||||||
|
Motercontrol.GetStatus(temp);
|
||||||
|
vector<int > point1ist;
|
||||||
|
vector<float> valuelist;
|
||||||
|
int i = 0;
|
||||||
|
Motercontrol.GetStatus(temp);
|
||||||
|
//outfile <<i<<"," << oneplot.Plot[1024] << "," << temp.iPosition << std::endl;
|
||||||
|
|
||||||
|
point1ist.push_back(temp.iPosition);
|
||||||
|
valuelist.push_back(oneplot.Plot[1024]);
|
||||||
|
while (temp.fVelocity!=0)
|
||||||
|
{
|
||||||
|
aa->GetOnePlot(oneplot);
|
||||||
|
//qDebug() << oneplot.BandNum;
|
||||||
|
//std::cout << temp.iPosition << std::endl;
|
||||||
|
|
||||||
|
Motercontrol.GetStatus(temp);
|
||||||
|
i++;
|
||||||
|
//outfile << i << "," << oneplot.Plot[1024] << "," << temp.iPosition << std::endl;
|
||||||
|
point1ist.push_back(temp.iPosition);
|
||||||
|
valuelist.push_back(oneplot.Plot[1024]);
|
||||||
|
|
||||||
|
}
|
||||||
|
Motercontrol.StartBackZero();
|
||||||
|
vector<float> valuepinghua1 = PingHua(valuelist, 3);
|
||||||
|
vector<int>loction1=FindFeng(point1ist, valuepinghua1);
|
||||||
|
int lenth = loction1.size();
|
||||||
|
for (size_t i = 0; i < lenth; i++)
|
||||||
|
{
|
||||||
|
vector<int> location1point = DengJianJu(loction1[i], 5000, 25);
|
||||||
|
vector<float> valuepoint;
|
||||||
|
int lennow = location1point.size();
|
||||||
|
for (size_t ii = 0; ii < lennow; ii++)
|
||||||
|
{
|
||||||
|
Motercontrol.MoveTo(location1point[ii]);
|
||||||
|
aa->GetOnePlot(oneplot);
|
||||||
|
valuepoint.push_back(oneplot.Plot[1024]);
|
||||||
|
//outfile << ii << "," << oneplot.Plot[1024] << "," << location1point[ii] << std::endl;
|
||||||
|
}
|
||||||
|
vector<float> valuepinghua = PingHua(valuepoint,3);
|
||||||
|
vector<int>loction2 = FindFeng(location1point, valuepinghua);
|
||||||
|
if (loction2.size() == 1)
|
||||||
|
{
|
||||||
|
outfile <<i+1<<"," << loction2[0]<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cc = 10;
|
||||||
|
cc++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::cout<<"totle:" << i;
|
||||||
|
//Motercontrol.MoveTo(870000);
|
||||||
|
//Motercontrol.MoveTo(570000);
|
||||||
|
//Motercontrol.MoveTo(870000);
|
||||||
|
//Motercontrol.MoveTo(900000);
|
||||||
|
//Motercontrol.MoveTo(1270000);
|
||||||
|
outfile.close();
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
return aaaaa.exec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vector<int> FindFeng(vector<int > point1ist, vector<float> valuelist)
|
||||||
|
{
|
||||||
|
vector<int> ret;
|
||||||
|
int lenth = point1ist.size();
|
||||||
|
if (lenth<10)
|
||||||
|
{
|
||||||
|
ret.push_back(0);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
for (size_t i = 5; i < lenth-5; i++)
|
||||||
|
{
|
||||||
|
if (valuelist[i] > 5000&&valuelist[i]>valuelist[i-1]&& valuelist[i] > valuelist[i - 4]&& valuelist[i] >valuelist[i + 1]&& valuelist[i] > valuelist[i + 4]
|
||||||
|
&& valuelist[i-1] > 5000 && valuelist[i-4]&& valuelist[i +1] > 5000 && valuelist[i + 4])
|
||||||
|
{
|
||||||
|
if (ret.size()!=0)
|
||||||
|
{
|
||||||
|
if (point1ist[i]-ret[ret.size()-1]<5000)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ret.push_back(point1ist[i]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
vector<int> DengJianJu(int position, int distanc, int times )
|
||||||
|
{
|
||||||
|
int begin = position - distanc;
|
||||||
|
vector<int> ret;
|
||||||
|
int eachstep = distanc / times;
|
||||||
|
for (size_t i = 0; i < 2*times; i++)
|
||||||
|
{
|
||||||
|
ret.push_back(begin + i * eachstep);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
vector <float> PingHua(vector <float> value,int step)
|
||||||
|
{
|
||||||
|
vector <float> ret;
|
||||||
|
if (value.size()<2*step)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
int len = value.size();
|
||||||
|
for (size_t i = 0; i < step; i++)
|
||||||
|
{
|
||||||
|
ret.push_back(value[i]);
|
||||||
|
}
|
||||||
|
for (size_t i = step; i <len-step; i++)
|
||||||
|
{
|
||||||
|
float sumi = 0;
|
||||||
|
for (size_t ii = 0; ii < 2*step+1; ii++)
|
||||||
|
{
|
||||||
|
sumi += value[i - step + ii];
|
||||||
|
}
|
||||||
|
ret.push_back(sumi / (2 * step + 1));
|
||||||
|
}
|
||||||
|
for (size_t i = len - step; i < len; i++)
|
||||||
|
{
|
||||||
|
ret.push_back(value[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
591
othersoft/shuttercali/source/FS/ATPControl_Serial_QT.cpp
Normal file
591
othersoft/shuttercali/source/FS/ATPControl_Serial_QT.cpp
Normal file
@ -0,0 +1,591 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "ATPControl_Serial_QT.h"
|
||||||
|
#include "ZZ_Math_HDRONLY.h"
|
||||||
|
|
||||||
|
ZZ_ATPControl_Serial_Qt::ZZ_ATPControl_Serial_Qt()
|
||||||
|
{
|
||||||
|
m_pSerialPort = new QSerialPort;
|
||||||
|
//connect(m_pSerialPort, &QSerialPort::readyRead, this, &ZZ_ATPControl_Serial_Qt::ReadMessage);
|
||||||
|
m_iBaudRate = 115200;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
||||||
|
{
|
||||||
|
if (m_pSerialPort != NULL)
|
||||||
|
{
|
||||||
|
delete m_pSerialPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// int ZZ_ATPControl_Serial_Qt::SetBaudRate(int iBaud)
|
||||||
|
// {
|
||||||
|
// m_iBaudRate = iBaud;
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, ZZ_U8 ucPortNumber, std::string strDeviceName)
|
||||||
|
{
|
||||||
|
QString qstrPortName = QString("COM%1").arg(ucPortNumber);
|
||||||
|
|
||||||
|
m_pSerialPort->setPortName(qstrPortName);
|
||||||
|
m_pSerialPort->setReadBufferSize(512);
|
||||||
|
bool bRes = m_pSerialPort->setBaudRate(m_iBaudRate);
|
||||||
|
if (!bRes)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:setBaudRate Failed.Exit Code:1";
|
||||||
|
//std::cout << "Err.setBaudRate Failed" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bRes = m_pSerialPort->open(QIODevice::ReadWrite);
|
||||||
|
if (!bRes)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:open Failed.Exit Code:2";
|
||||||
|
//std::cout << "Err.open Failed" << std::endl;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZZ_ATPControl_Serial_Qt::Close()
|
||||||
|
{
|
||||||
|
m_pSerialPort->close();
|
||||||
|
}
|
||||||
|
int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo &Info)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_PN_NUMBER);
|
||||||
|
int iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
m_diDeviceInfo.strPN = qbRecv.data();
|
||||||
|
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_SN_NUMBER);
|
||||||
|
iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
m_diDeviceInfo.strSN = qbRecv.data();
|
||||||
|
|
||||||
|
|
||||||
|
Info = m_diDeviceInfo;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute &Attr)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_MIN_INTEGRATION_TIME);
|
||||||
|
int iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
m_daDeviceAttr.iMinIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||||
|
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_MAX_INTEGRATION_TIME);
|
||||||
|
iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
m_daDeviceAttr.iMaxIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||||
|
|
||||||
|
|
||||||
|
iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Call SetExposureTime error.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = SingleShot(m_daDeviceAttr.iPixels);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Call SingleShot error.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_WAVELENGTH_CALIBRATION_COEF);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
float fWaveLengthCoef[4];
|
||||||
|
memcpy(fWaveLengthCoef, qbRecv.data()+16, 4 * sizeof(float));
|
||||||
|
for (int i=0;i< m_daDeviceAttr.iPixels;i++)
|
||||||
|
{
|
||||||
|
m_daDeviceAttr.fWaveLengthInNM[i] = fWaveLengthCoef[0] * i*i*i + fWaveLengthCoef[1] * i*i + fWaveLengthCoef[2] * i + fWaveLengthCoef[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
Attr = m_daDeviceAttr;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::SetDeviceTemperature(float fTemperature)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::SendCommand(QByteArray qbCommand)
|
||||||
|
{
|
||||||
|
int iSize = qbCommand.size() + 3;
|
||||||
|
QByteArray qbSend;
|
||||||
|
qbSend.resize(4);
|
||||||
|
qbSend[0] = (ZZ_U8)0xAA;
|
||||||
|
qbSend[1] = 0x55;
|
||||||
|
qbSend[2] = iSize / 256;
|
||||||
|
qbSend[3] = iSize % 256;
|
||||||
|
qbSend.append(qbCommand);
|
||||||
|
|
||||||
|
int iSum = 0;
|
||||||
|
for (int i = 0; i < iSize - 1; i++)
|
||||||
|
{
|
||||||
|
iSum = iSum + qbSend[i + 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
qbSend.append(iSum % 256);
|
||||||
|
|
||||||
|
qint64 qi64Write= m_pSerialPort->write(qbSend);
|
||||||
|
if (qi64Write != qbSend.size())
|
||||||
|
{
|
||||||
|
qDebug() << "Err:write Failed.Exit Code:1"<< qi64Write;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
||||||
|
{
|
||||||
|
qbData.clear();
|
||||||
|
qbData = m_pSerialPort->readAll();
|
||||||
|
|
||||||
|
int iCounter = 0;
|
||||||
|
while (qbData.size() < 4)
|
||||||
|
{
|
||||||
|
m_pSerialPort->waitForReadyRead(50);
|
||||||
|
QByteArray qbTemp = m_pSerialPort->readAll();
|
||||||
|
qbData.append(qbTemp);
|
||||||
|
|
||||||
|
if (iCounter > 10)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1"<< qbData.size();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ZZ_U8)qbData[0] != (ZZ_U8)0xaa || (ZZ_U8)qbData[1] != (ZZ_U8)0x55)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:RecvData Failed,Wrong Header.Exit Code:2" << qbData.size();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
iCounter = 0;
|
||||||
|
int iLength = qbData[2] * 256 + qbData[3] + 2;
|
||||||
|
while (qbData.size() < iLength)
|
||||||
|
{
|
||||||
|
m_pSerialPort->waitForReadyRead(50);
|
||||||
|
qbData.append(m_pSerialPort->readAll());
|
||||||
|
|
||||||
|
if (iCounter > 100)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:RecvData Failed,Incomplete Data.Exit Code:3" << qbData.size();
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
iCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qbData.size() > iLength)
|
||||||
|
{
|
||||||
|
qbData.remove(iLength - 1, qbData.size() - iLength);
|
||||||
|
}
|
||||||
|
int iCheckSumLength = iLength - 3;
|
||||||
|
ZZ_U16 usCheckSum = 0;
|
||||||
|
for (int i = 0; i < iCheckSumLength; i++)
|
||||||
|
{
|
||||||
|
usCheckSum += qbData[i+2];
|
||||||
|
}
|
||||||
|
usCheckSum = usCheckSum % 256;
|
||||||
|
ZZ_U8 ucTemp = qbData[qbData.size() - 1];
|
||||||
|
if ((ZZ_U8)usCheckSum != ucTemp)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:RecvData Failed,Incorrect Check Sum.Exit Code:4" << qbData.size();
|
||||||
|
qbData.clear();
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::ParseData(QByteArray &qbData)
|
||||||
|
{
|
||||||
|
if (qbData.size() < 6)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:ParseData Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
qbData.remove(0, 5);
|
||||||
|
qbData.remove(qbData.size() - 1, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime)
|
||||||
|
{
|
||||||
|
using namespace ZZ_MATH;
|
||||||
|
int iDeviceDepth = 65535;
|
||||||
|
|
||||||
|
bool bFlagIsOverTrying = false;
|
||||||
|
bool bFlagIsLowerMinExposureTime = false;
|
||||||
|
bool bFlagIsOverMaxExposureTime = false;
|
||||||
|
bool bFlagIsAutoExposureOK = false;
|
||||||
|
bool bFlagIsAutoExposureFailed = false;
|
||||||
|
|
||||||
|
bool bIsValueOverflow = false;
|
||||||
|
bool bIsLastValueOverflow = false;
|
||||||
|
|
||||||
|
float fExposureTime = 0;
|
||||||
|
float fTempExposureTime = 0;
|
||||||
|
double fLastExposureTime = 0.1;
|
||||||
|
int iRepeatCount = 0;
|
||||||
|
|
||||||
|
int iRes = SetExposureTime(2000);//need change to load from files
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!bFlagIsAutoExposureOK && !bFlagIsAutoExposureFailed)
|
||||||
|
{
|
||||||
|
DataFrame dfTemp;
|
||||||
|
|
||||||
|
if (iRepeatCount++ > 30)
|
||||||
|
{
|
||||||
|
bFlagIsAutoExposureFailed = true;
|
||||||
|
bFlagIsOverTrying = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||||
|
fTempExposureTime = fExposureTime;
|
||||||
|
|
||||||
|
iRes = SingleShot(dfTemp);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapSort(dfTemp.usData, m_daDeviceAttr.iPixels);
|
||||||
|
|
||||||
|
double dSum = 0;
|
||||||
|
int iCount = m_daDeviceAttr.iPixels / 100;
|
||||||
|
for (int i = 0; i < iCount; i++)
|
||||||
|
{
|
||||||
|
dSum += dfTemp.usData[i];
|
||||||
|
}
|
||||||
|
double dTemp = dSum / iCount;
|
||||||
|
|
||||||
|
if (dTemp >= iDeviceDepth * 0.99)
|
||||||
|
{
|
||||||
|
bIsValueOverflow = true;
|
||||||
|
if (!bIsLastValueOverflow)
|
||||||
|
{
|
||||||
|
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fExposureTime = fExposureTime / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (iDeviceDepth * fMaxScaleFactor >= dTemp && dTemp >= iDeviceDepth * fMinScaleFactor)
|
||||||
|
{
|
||||||
|
bFlagIsAutoExposureOK = 1;
|
||||||
|
}
|
||||||
|
else if (dTemp > iDeviceDepth * fMaxScaleFactor)
|
||||||
|
{
|
||||||
|
bIsValueOverflow = true;
|
||||||
|
if (!bIsLastValueOverflow)
|
||||||
|
{
|
||||||
|
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fExposureTime = fExposureTime * 3 / 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dTemp < iDeviceDepth * fMinScaleFactor)
|
||||||
|
{
|
||||||
|
bIsValueOverflow = false;
|
||||||
|
if (bIsLastValueOverflow)
|
||||||
|
{
|
||||||
|
fExposureTime = (float)(fLastExposureTime + fExposureTime) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double dFactor;
|
||||||
|
dFactor = dTemp / (iDeviceDepth * fMaxScaleFactor);
|
||||||
|
fExposureTime = (float)(fExposureTime / dFactor);
|
||||||
|
}
|
||||||
|
if (/*fExposureTime > 100 || */fExposureTime < 10)
|
||||||
|
{
|
||||||
|
bFlagIsAutoExposureOK = false;
|
||||||
|
bFlagIsAutoExposureFailed = true;
|
||||||
|
bFlagIsLowerMinExposureTime = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bIsLastValueOverflow = bIsValueOverflow;
|
||||||
|
fLastExposureTime = fTempExposureTime;
|
||||||
|
|
||||||
|
if (fExposureTime > 13000)
|
||||||
|
{
|
||||||
|
bFlagIsAutoExposureOK = false;
|
||||||
|
bFlagIsAutoExposureFailed = true;
|
||||||
|
fPredictedExposureTime = 13000;
|
||||||
|
iRes = SetExposureTime(13000);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
bFlagIsOverMaxExposureTime = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
iRes = SetExposureTime((int)fExposureTime);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fPredictedExposureTime = fExposureTime;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// int ZZ_ATPControl_Serial_Qt::SetExtShutter(int iShutterUP0, int iShutterDOWN1, int iShutterDOWN2, int iShutterDOWN3)
|
||||||
|
// {
|
||||||
|
// qDebug() << "stub code not implemented";
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||||
|
{
|
||||||
|
QByteArray qbExposureTime,qbRecv;
|
||||||
|
qbExposureTime.append(SET_INTEGRATION_TIME);
|
||||||
|
qbExposureTime.resize(3);
|
||||||
|
qbExposureTime[1] = iExposureTimeInMS >> 8;
|
||||||
|
qbExposureTime[2] = iExposureTimeInMS & 0xFF;
|
||||||
|
|
||||||
|
SendCommand(qbExposureTime);
|
||||||
|
RecvData(qbRecv);
|
||||||
|
ParseData(qbRecv);
|
||||||
|
|
||||||
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SetExposureTime Failed.Exit Code:1" ;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::GetExposureTime(int &iExposureTimeInMS)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_INTEGRATION_TIME);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
SendCommand(qbSend);
|
||||||
|
RecvData(qbRecv);
|
||||||
|
ParseData(qbRecv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(SYNC_GET_DATA);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
SendCommand(qbSend);
|
||||||
|
RecvData(qbRecv);
|
||||||
|
ParseData(qbRecv);
|
||||||
|
|
||||||
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iDataSizeInPixel = (qbRecv.size() - 1) / 2;
|
||||||
|
memcpy(dfData.usData, qbRecv.data() + 1, iDataSizeInPixel * 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::SingleShot(int &iPixels)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(SYNC_GET_DATA);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
SendCommand(qbSend);
|
||||||
|
RecvData(qbRecv);
|
||||||
|
ParseData(qbRecv);
|
||||||
|
|
||||||
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iPixels = (qbRecv.size() - 1) / 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// int ZZ_ATPControl_Serial_Qt::SingleShotDark(ATPDataFrame &dfData)
|
||||||
|
// {
|
||||||
|
// SetExtShutter(0,0,0,0);
|
||||||
|
// SingleShot(dfData);
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::GetDeviceTemperature(float &fTemperature)
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_TEC_TEMP);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
SendCommand(qbSend);
|
||||||
|
RecvData(qbRecv);
|
||||||
|
ParseData(qbRecv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//void ZZ_ATPControl_Serial_Qt::ReadMessage()
|
||||||
|
//{
|
||||||
|
// QByteArray qbTemp, qbTemp1;
|
||||||
|
// qbTemp = m_pSerialPort->readAll();
|
||||||
|
// while (qbTemp.size()<2)
|
||||||
|
// {
|
||||||
|
// m_pSerialPort->waitForReadyRead(50);
|
||||||
|
// qbTemp1 = m_pSerialPort->readAll();
|
||||||
|
// qbTemp.append(qbTemp1);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//return;
|
||||||
|
// }
|
84
othersoft/shuttercali/source/FS/ATPControl_Serial_QT.h
Normal file
84
othersoft/shuttercali/source/FS/ATPControl_Serial_QT.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//ATP<54><50><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ZZ_Types.h"
|
||||||
|
#include "IrisFiberSpectrometerBase.h"
|
||||||
|
|
||||||
|
using namespace ZZ_MISCDEF;
|
||||||
|
using namespace ZZ_MISCDEF::ATP;
|
||||||
|
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||||
|
|
||||||
|
class ZZ_ATPControl_Serial_Qt:public CIrisFSBase
|
||||||
|
{
|
||||||
|
//Q_OBJECT
|
||||||
|
public:
|
||||||
|
ZZ_ATPControl_Serial_Qt();
|
||||||
|
virtual ~ZZ_ATPControl_Serial_Qt();
|
||||||
|
|
||||||
|
public:
|
||||||
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
//int SetBaudRate(int iBaud);
|
||||||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>豸
|
||||||
|
int Initialize(bool bIsUSBMode, ZZ_U8 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;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////shutter control stub code s
|
||||||
|
//int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
||||||
|
//////////////////////////////////////////////////////////////////////////shutter control stub code e
|
||||||
|
int SendCommand(QByteArray qbCommand);
|
||||||
|
int RecvData(QByteArray &qbData);
|
||||||
|
int ParseData(QByteArray &qbData);
|
||||||
|
//private slots :
|
||||||
|
//void ReadMessage();
|
||||||
|
};
|
1
othersoft/shuttercali/source/FS/ATPDataFileProcessor.h
Normal file
1
othersoft/shuttercali/source/FS/ATPDataFileProcessor.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#pragma once
|
42
othersoft/shuttercali/source/FS/IrisFiberSpectrometerBase.h
Normal file
42
othersoft/shuttercali/source/FS/IrisFiberSpectrometerBase.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <string>
|
||||||
|
#include "ZZ_Types.h"
|
||||||
|
#pragma once
|
||||||
|
using namespace ZZ_MISCDEF;
|
||||||
|
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||||
|
|
||||||
|
class CIrisFSBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//CIrisFSBase();
|
||||||
|
//virtual ~CIrisFSBase()= 0;
|
||||||
|
public:
|
||||||
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>豸
|
||||||
|
//<2F>˴<EFBFBD>stringΪָ<CEAA><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ocean<61><6E><EFBFBD><EFBFBD><EFBFBD>ǵIJ<C7B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>c/c++<2B><><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
||||||
|
//0Ϊ<30><EFBFBD><DEB4><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD>ز<EFBFBD>ֵͬ
|
||||||
|
virtual int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName) = 0;
|
||||||
|
|
||||||
|
//<2F>ر<EFBFBD><D8B1>豸
|
||||||
|
virtual void Close() = 0;
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||||
|
virtual int SingleShot(DataFrame &dfData) = 0;
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
|
virtual int SetExposureTime(int iExposureTimeInMS) = 0;
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
virtual int GetExposureTime(int &iExposureTimeInMS) = 0;
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
||||||
|
virtual int SetDeviceTemperature(float fTemperature) = 0;
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
virtual int GetDeviceTemperature(float &fTemperature) = 0;
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||||
|
virtual int GetDeviceInfo(DeviceInfo &Info) = 0;
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
virtual int GetDeviceAttribute(DeviceAttribute &Attr) = 0;
|
||||||
|
|
||||||
|
};
|
297
othersoft/shuttercali/source/FS/ZZ_Types.h
Normal file
297
othersoft/shuttercali/source/FS/ZZ_Types.h
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//<2F><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ļ<EFBFBD>
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include <string>
|
||||||
|
#define MAX_DEVICENUMBER_FS 2
|
||||||
|
#define MAX_LINEARSHUTTER_POSITION 12
|
||||||
|
namespace ZZ_MISCDEF
|
||||||
|
{
|
||||||
|
typedef unsigned char ZZ_U8;
|
||||||
|
typedef unsigned short int ZZ_U16;
|
||||||
|
typedef unsigned long int ZZ_U32;
|
||||||
|
|
||||||
|
|
||||||
|
namespace IRIS
|
||||||
|
{
|
||||||
|
//Fiber Spectrometer
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
typedef struct tagDataFrame
|
||||||
|
{
|
||||||
|
ZZ_U16 usExposureTimeInMS;
|
||||||
|
ZZ_U16 usData[4096];
|
||||||
|
float fTemperature;
|
||||||
|
double dTimes = 0;
|
||||||
|
}DataFrame;
|
||||||
|
|
||||||
|
typedef struct tagDeviceInfo
|
||||||
|
{
|
||||||
|
std::string strPN;
|
||||||
|
std::string strSN;
|
||||||
|
}DeviceInfo;
|
||||||
|
|
||||||
|
typedef struct tagDeviceAttribute
|
||||||
|
{
|
||||||
|
int iPixels;
|
||||||
|
int iMaxIntegrationTimeInMS;
|
||||||
|
int iMinIntegrationTimeInMS;
|
||||||
|
float fWaveLengthInNM[4096];
|
||||||
|
|
||||||
|
}DeviceAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DeviceModel
|
||||||
|
{
|
||||||
|
OSIFAlpha=0,
|
||||||
|
OSIFBeta,
|
||||||
|
ISIF,
|
||||||
|
IS1,
|
||||||
|
IS2
|
||||||
|
};
|
||||||
|
|
||||||
|
// inline std::string GetDeviceModelName(int iModel)
|
||||||
|
// {
|
||||||
|
// switch (iModel)
|
||||||
|
// {
|
||||||
|
// case DeviceModel::OSIFAlpha: return "OSIFAlpha"; break;
|
||||||
|
// case DeviceModel::OSIFBeta: return "OSIFBeta"; break;
|
||||||
|
// case DeviceModel::ISIF: return "ISIF"; break;
|
||||||
|
// case DeviceModel::IS1: return "IS1"; break;
|
||||||
|
// case DeviceModel::IS2: return "IS2"; break;
|
||||||
|
// default: return "error"; break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// inline int GetIndex(std::string strDeviceModelName)
|
||||||
|
// {
|
||||||
|
// if (strDeviceModelName== "OSIFAlpha")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::OSIFAlpha;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "OSIFBeta")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::OSIFBeta;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "ISIF")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::ISIF;
|
||||||
|
// }
|
||||||
|
// else if (strDeviceModelName == "IS1")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::IS1;
|
||||||
|
// }
|
||||||
|
// else if(strDeviceModelName == "IS2")
|
||||||
|
// {
|
||||||
|
// return DeviceModel::IS2;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//ATPָ<50><D6B8>ת<EFBFBD><D7AA>
|
||||||
|
namespace ATP
|
||||||
|
{
|
||||||
|
const int MAX_SPECTRUM_SIZE = 4096;
|
||||||
|
|
||||||
|
const int GET_MODULECIRCUIT_TEMP = 0x01;
|
||||||
|
const int GET_PN_NUMBER = 0x03;
|
||||||
|
const int GET_SN_NUMBER = 0x04;
|
||||||
|
const int GET_MANUFACTURE_DATA = 0x06;
|
||||||
|
const int GET_MANUFACTURE_INFO = 0x09;
|
||||||
|
const int GET_PIXEL_LENGTH = 0x0a;
|
||||||
|
const int GET_TEC_TEMP = 0x13;
|
||||||
|
const int SET_TEC_TEMP = 0x12;
|
||||||
|
const int GET_OPTICS_TEMP = 0x35;
|
||||||
|
const int GET_CIRCUITBOARD_TEMP = 0x36;
|
||||||
|
const int SET_INTEGRATION_TIME = 0x14;
|
||||||
|
const int GET_INTEGRATION_TIME = 0x41;
|
||||||
|
const int GET_MAX_INTEGRATION_TIME = 0x42;
|
||||||
|
const int GET_MIN_INTEGRATION_TIME = 0x43;
|
||||||
|
const int ASYNC_COLLECT_DARK = 0x23;
|
||||||
|
const int ASYNC_START_COLLECTION = 0x16;
|
||||||
|
const int ASYNC_READ_DATA = 0x17;
|
||||||
|
const int SET_AVERAGE_NUMBER = 0x28;
|
||||||
|
const int SYNC_GET_DATA = 0x1e;
|
||||||
|
const int SYNC_GET_DARK = 0x2f;
|
||||||
|
const int EXTERNAL_TRIGGER_ENABLE = 0x1f;
|
||||||
|
const int SET_XENON_LAMP_DELAY_TIME = 0x24;
|
||||||
|
const int GET_WAVELENGTH_CALIBRATION_COEF = 0x55;
|
||||||
|
const int GET_STAT_LAMPOUT = 0x60;
|
||||||
|
const int SET_GPIO = 0x61;
|
||||||
|
//const int SYNCHRONIZATION_GET_DARK = 0x23
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////device
|
||||||
|
enum Model
|
||||||
|
{
|
||||||
|
ATP1010 = 0,
|
||||||
|
ATP6500
|
||||||
|
};
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDataFrame
|
||||||
|
{
|
||||||
|
unsigned short usExposureTime;
|
||||||
|
ZZ_U16 usData[4096];
|
||||||
|
float fTemperature;
|
||||||
|
double dTimes = 0;
|
||||||
|
}ATPDataFrame;
|
||||||
|
|
||||||
|
//<2F>豸<EFBFBD><E8B1B8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDeviceInfo
|
||||||
|
{
|
||||||
|
std::string strPN;
|
||||||
|
std::string strSN;
|
||||||
|
}ATPDeviceInfo;
|
||||||
|
|
||||||
|
//<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
typedef struct tagATPDeviceAttribute
|
||||||
|
{
|
||||||
|
int iPixels;
|
||||||
|
int iMaxIntegrationTime;
|
||||||
|
int iMinIntegrationTime;
|
||||||
|
float fWaveLength[4096];
|
||||||
|
|
||||||
|
}ATPDeviceAttribute;
|
||||||
|
//////////////////////////////////////////////////////////////////////////config file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
||||||
|
namespace ZZ_RUNPARAMS
|
||||||
|
{
|
||||||
|
typedef struct tagFiberSpecContext
|
||||||
|
{
|
||||||
|
ZZ_U8 ucDeviceNumber;
|
||||||
|
ZZ_U8 ucDeviceModel[MAX_DEVICENUMBER_FS];
|
||||||
|
int iInterface[MAX_DEVICENUMBER_FS];
|
||||||
|
std::string strSN[MAX_DEVICENUMBER_FS];
|
||||||
|
}FSContext;
|
||||||
|
|
||||||
|
typedef struct tagLinearShutterContext
|
||||||
|
{
|
||||||
|
ZZ_U8 ucPort;
|
||||||
|
ZZ_U8 ucProtocolType;
|
||||||
|
ZZ_U8 ucCmdID;
|
||||||
|
}LSContext;
|
||||||
|
|
||||||
|
typedef struct tagAcquisitionTimeSettings
|
||||||
|
{
|
||||||
|
QTime qtStartTime;
|
||||||
|
QTime qtStopTime;
|
||||||
|
QTime qtInterval;
|
||||||
|
}AcqTimeSettings;
|
||||||
|
|
||||||
|
typedef struct tagAcquisitionPositionSettings
|
||||||
|
{
|
||||||
|
int iTotalPosition;
|
||||||
|
int iPosition[MAX_LINEARSHUTTER_POSITION];
|
||||||
|
}AcqPosSettings;
|
||||||
|
|
||||||
|
typedef struct tagRunTimeGrabberParams
|
||||||
|
{
|
||||||
|
LSContext lscParam;
|
||||||
|
FSContext fscParams;
|
||||||
|
AcqTimeSettings atsParams;
|
||||||
|
AcqPosSettings apsParams;
|
||||||
|
}RunTimeGrabberParams;
|
||||||
|
|
||||||
|
typedef struct tagATPCalibrationSettings
|
||||||
|
{
|
||||||
|
//Up0 Down1,2,3
|
||||||
|
QString qsISIF_CalibrationFilePath[4];
|
||||||
|
QString qsIS1_CalibrationFilePath[4];
|
||||||
|
}ATPCalibrationSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ṹ
|
||||||
|
namespace ZZ_DATAFILE
|
||||||
|
{
|
||||||
|
typedef struct tagEnvironmentalContext
|
||||||
|
{
|
||||||
|
QString qstrUTCDateTime;
|
||||||
|
QString qstrLocation;
|
||||||
|
QString qstrGPS_Longtitude;
|
||||||
|
QString qstrGPS_Latitude;
|
||||||
|
QString qstrGPS_Altitude;
|
||||||
|
QString qstrGPS_North;
|
||||||
|
QString qstrCaseTemperature;
|
||||||
|
QString qstrCaseHumidity;
|
||||||
|
|
||||||
|
}EContext;
|
||||||
|
|
||||||
|
typedef struct tagManmadeEnviromentalContext
|
||||||
|
{
|
||||||
|
QString qstrOriFileName;
|
||||||
|
QString qstrInstallationTime;
|
||||||
|
QString qstrISIFCalibrationTime;
|
||||||
|
QString qstrIS1CalibrationTime;
|
||||||
|
QString qstrNameOfMaintenanceStaff;
|
||||||
|
QString qstrPhoneNumberOfMaintenanceStaff;
|
||||||
|
QString qstrDownloadUserID;
|
||||||
|
QString qstrDownlaodAddress;
|
||||||
|
QString qstrHTTPServer;
|
||||||
|
}MEContext;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tagIS1Information
|
||||||
|
{
|
||||||
|
QString qstrSN_ATP;
|
||||||
|
QString qstrSN_IRIS;
|
||||||
|
|
||||||
|
QString qstrCalFile_U0;
|
||||||
|
QString qstrCalFile_D1;
|
||||||
|
QString qstrCalFile_D2;
|
||||||
|
QString qstrCalFile_D3;
|
||||||
|
|
||||||
|
int iPixelCount;
|
||||||
|
|
||||||
|
int iExposureTimeInMS_U0;
|
||||||
|
int iExposureTimeInMS_D1;
|
||||||
|
int iExposureTimeInMS_D2;
|
||||||
|
int iExposureTimeInMS_D3;
|
||||||
|
|
||||||
|
float fTemperature_U0;
|
||||||
|
float fTemperature_D1;
|
||||||
|
float fTemperature_D2;
|
||||||
|
float fTemperature_D3;
|
||||||
|
}IS1Info;
|
||||||
|
|
||||||
|
typedef struct tagISIFInformation
|
||||||
|
{
|
||||||
|
QString qstrSN_ATP;
|
||||||
|
QString qstrSN_IRIS;
|
||||||
|
|
||||||
|
QString qstrCalFile_U0;
|
||||||
|
QString qstrCalFile_D1;
|
||||||
|
QString qstrCalFile_D2;
|
||||||
|
QString qstrCalFile_D3;
|
||||||
|
|
||||||
|
int iPixelCount;
|
||||||
|
|
||||||
|
int iExposureTimeInMS_U0;
|
||||||
|
int iExposureTimeInMS_D1;
|
||||||
|
int iExposureTimeInMS_D2;
|
||||||
|
int iExposureTimeInMS_D3;
|
||||||
|
|
||||||
|
float fTemperature_U0;
|
||||||
|
float fTemperature_D1;
|
||||||
|
float fTemperature_D2;
|
||||||
|
float fTemperature_D3;
|
||||||
|
}ISIFInfo;
|
||||||
|
|
||||||
|
typedef struct tagATPDataHeader
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}ATPDataHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
16
othersoft/shuttercali/source/LinearShutter/AbstractPort.h
Normal file
16
othersoft/shuttercali/source/LinearShutter/AbstractPort.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "VSMD12XMiscDefines.h"
|
||||||
|
#include <string>
|
||||||
|
class CAbstractPort
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void InitPort(PortInfo portinfo) = 0;
|
||||||
|
virtual bool SetPort() = 0;
|
||||||
|
virtual bool Open() = 0;
|
||||||
|
virtual void Close() = 0;
|
||||||
|
|
||||||
|
virtual std::string ReadAll(int waite=5000) = 0;
|
||||||
|
virtual int Write(const std::string strSend) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
1415
othersoft/shuttercali/source/LinearShutter/VSMD12XControl.cpp
Normal file
1415
othersoft/shuttercali/source/LinearShutter/VSMD12XControl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
146
othersoft/shuttercali/source/LinearShutter/VSMD12XControl.h
Normal file
146
othersoft/shuttercali/source/LinearShutter/VSMD12XControl.h
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include "AbstractPort.h"
|
||||||
|
using namespace std;
|
||||||
|
// #ifdef IRIS_API_EXPORTS
|
||||||
|
//
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// #define IRIS_API_FUNC extern "C" __declspec(dllexport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_FUNC __declspec(dllexport)
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// #else
|
||||||
|
//
|
||||||
|
// #ifdef __cplusplus
|
||||||
|
// #define IRIS_API_FUNC extern "C" __declspec(dllimport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_FUNC __declspec(dllimport)
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// #ifdef IRIS_API_EXPORTS
|
||||||
|
// #define IRIS_API_CLASS __declspec(dllexport)
|
||||||
|
// #else
|
||||||
|
// #define IRIS_API_CLASS __declspec(dllimport)
|
||||||
|
// #endif
|
||||||
|
#define MAXDISTANCE 1265000
|
||||||
|
class /*IRIS_API_CLASS*/ CVSMD12XControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CVSMD12XControl();
|
||||||
|
~CVSMD12XControl();
|
||||||
|
private:
|
||||||
|
int *m_piPositionInPulses;
|
||||||
|
|
||||||
|
CAbstractPort *m_pAbsPort;
|
||||||
|
unValue m_unValue;
|
||||||
|
MSInfo m_stuMSInfo;
|
||||||
|
ControllerParams m_stuControllerParams;
|
||||||
|
int m_iProtocolType;
|
||||||
|
int m_iCID;
|
||||||
|
std::string m_strCID;
|
||||||
|
public:
|
||||||
|
bool m_bIsSyncMove;
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//for IRIS Linear Motor - Electric Shutter
|
||||||
|
//Initialize communication setup iPortType(0:RS232 1:RS485) iCID(For RS485 device) bSyncMove(move mode)
|
||||||
|
bool ILMES_InitializeComm(QString portName,int bandrate=9600, int iPortType = 1, int iCID = 1, bool bSyncMove = true);
|
||||||
|
//Initialize communication setup iPortType(0:RS232 1:RS485) iCID(For RS485 device) bSyncMove(move mode)
|
||||||
|
bool ILMES_InitializeComm(PortInfo portinfo,int iPortType = 1,int iCID = 1, bool bSyncMove = true);
|
||||||
|
|
||||||
|
//Initialize Controller params
|
||||||
|
bool ILMES_InitializeParams(ControllerParams cpParams);
|
||||||
|
|
||||||
|
//Set the light hole position(pulses)
|
||||||
|
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
||||||
|
|
||||||
|
bool ILMES_MoveToPos(int iPositionIndex);
|
||||||
|
|
||||||
|
public:
|
||||||
|
int waitetime;
|
||||||
|
////init port
|
||||||
|
void SetProtocolType(int iProtocolType = 0);//0:RS232 1:RS485 call before send any command
|
||||||
|
void SetCID(int iID);//set device id when using RS485 protocol call before send any command
|
||||||
|
void SetSyncMode(bool bSyncMove = false);
|
||||||
|
bool InitAndOpenPort(PortInfo portinfo);//Init comport by PortInfo Struct
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////for debug or unsupported function
|
||||||
|
std::string ReadReceive();
|
||||||
|
int SendCommand(const std::string strSend); // return indicates how many char has been sent
|
||||||
|
//////////////////////////////////////////////////////////////////////////motor control
|
||||||
|
////init&misc
|
||||||
|
bool InitController(); //Init Motor controller hand shake
|
||||||
|
|
||||||
|
bool Enable(); //enbale
|
||||||
|
bool Disable(); //disable
|
||||||
|
|
||||||
|
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
||||||
|
////motion control
|
||||||
|
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
|
bool SetLogicZero(); //set logic zero
|
||||||
|
|
||||||
|
bool StartBackZero();//back zero
|
||||||
|
bool StopBackZero();// stop back zero & reset register
|
||||||
|
////Set&Get
|
||||||
|
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
||||||
|
int GetBaudRate(); // -1:should retry;
|
||||||
|
|
||||||
|
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
||||||
|
int GetMicroSteps();
|
||||||
|
|
||||||
|
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetAccSpeed();
|
||||||
|
|
||||||
|
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetRunSpeed();
|
||||||
|
|
||||||
|
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
||||||
|
float GetDecSpeed();
|
||||||
|
|
||||||
|
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
||||||
|
|
||||||
|
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetHoldCurrent();
|
||||||
|
|
||||||
|
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetAccCurrent();
|
||||||
|
|
||||||
|
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
|
float GetRunCurrent();
|
||||||
|
|
||||||
|
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
||||||
|
|
||||||
|
bool SetS1FETE(ZZ_U8 bS1FETE);//S1 register falling edge trigger event,see enum
|
||||||
|
ZZ_U8 GetS1FETE();
|
||||||
|
|
||||||
|
bool SetS1RETE(ZZ_U8 bS1RETE);//S1 register rising edge trigger event
|
||||||
|
ZZ_U8 GetS1RETE();
|
||||||
|
|
||||||
|
bool SetS2FETE(ZZ_U8 bS2FETE);//S2 register falling edge trigger event
|
||||||
|
ZZ_U8 GetS2FETE();
|
||||||
|
|
||||||
|
bool SetS2RETE(ZZ_U8 bS2RETE);//S2 register rising edge trigger event
|
||||||
|
ZZ_U8 GetS2RETE();
|
||||||
|
|
||||||
|
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
||||||
|
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
||||||
|
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
||||||
|
ZZ_U8 GetZeroMode();
|
||||||
|
ZZ_U8 GetSwitchOpenVoltageLevel();
|
||||||
|
ZZ_U8 GetZeroSensor();
|
||||||
|
int GetSafePosition();
|
||||||
|
float GetZeroVelocity();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ParseReturnedString(std::string &strRecv,int iType);
|
||||||
|
bool ParseReturnedParam(std::string &strRecv);
|
||||||
|
void VSMD_BitShift(ZZ_U8* src, unValue* dst);
|
||||||
|
char* VSMD_Split(char* cStr, char cSplit);
|
||||||
|
};
|
||||||
|
|
108
othersoft/shuttercali/source/LinearShutter/VSMD12XMiscDefines.h
Normal file
108
othersoft/shuttercali/source/LinearShutter/VSMD12XMiscDefines.h
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ZZ_Types.h"
|
||||||
|
#define MAXBUFFER 10240
|
||||||
|
#include<qstring.h>
|
||||||
|
using namespace ZZ_MISCDEF;
|
||||||
|
|
||||||
|
typedef struct tagTransportLayerInfomation
|
||||||
|
{
|
||||||
|
//Serial
|
||||||
|
int iPortType;
|
||||||
|
int iPortNumber;
|
||||||
|
int indexBaudRate;
|
||||||
|
int iBaudRate;
|
||||||
|
int indexParity, indexBytesize, indexStopBits; //Mode
|
||||||
|
bool Hw;
|
||||||
|
bool Sw;
|
||||||
|
bool Dtr, Rts;
|
||||||
|
QString FullPortName;
|
||||||
|
tagTransportLayerInfomation() {
|
||||||
|
iPortType = 0;
|
||||||
|
indexParity = 0;
|
||||||
|
iPortNumber = 8;
|
||||||
|
iBaudRate = 9600;
|
||||||
|
indexBytesize = 3;
|
||||||
|
indexStopBits = 0;
|
||||||
|
FullPortName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Bit
|
||||||
|
//Stop
|
||||||
|
//MODEM CONTROL setting
|
||||||
|
//MODEM LINE STATUS
|
||||||
|
|
||||||
|
//TCP UDP
|
||||||
|
|
||||||
|
}PortInfo;
|
||||||
|
|
||||||
|
typedef struct tagMotorStatusInfo
|
||||||
|
{
|
||||||
|
float fVelocity;
|
||||||
|
int iPosition;
|
||||||
|
ZZ_U32 uiFlags;
|
||||||
|
}MSInfo;
|
||||||
|
|
||||||
|
typedef struct tagControllerParams
|
||||||
|
{
|
||||||
|
int bdr; //baud
|
||||||
|
int mcs; //microsteps 0:full 1:half 2:4 3:8 4:16 5:32 6:64 7:128 8:256
|
||||||
|
float spd; //velocity
|
||||||
|
float acc; //acceleration
|
||||||
|
float dec; //deceleration
|
||||||
|
float cra; //acc state current
|
||||||
|
float crn; //normal state current
|
||||||
|
float crh; //hold state current
|
||||||
|
ZZ_U8 s1f;
|
||||||
|
ZZ_U8 s1r;
|
||||||
|
ZZ_U8 s2f;
|
||||||
|
ZZ_U8 s2r;
|
||||||
|
ZZ_U8 zmd; //zero mode
|
||||||
|
ZZ_U8 osv; //open state sensor value
|
||||||
|
ZZ_U8 snr; //zero sensor
|
||||||
|
ZZ_U8 zsp; //zero safe position
|
||||||
|
float zsd; //zero velocity
|
||||||
|
tagControllerParams() {
|
||||||
|
bdr = 9600;
|
||||||
|
|
||||||
|
cra = 0.8;
|
||||||
|
crh = 0.4;
|
||||||
|
crn = 0.6;
|
||||||
|
|
||||||
|
acc = 100000;
|
||||||
|
dec = 100000;
|
||||||
|
spd = 64000;
|
||||||
|
|
||||||
|
osv = 0;
|
||||||
|
snr = 0;
|
||||||
|
zmd = 3;
|
||||||
|
zsp = 20;
|
||||||
|
zsd = 50000;
|
||||||
|
|
||||||
|
mcs = 6;
|
||||||
|
}
|
||||||
|
}ControllerParams;
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
ZZ_U8 byteValue[4];
|
||||||
|
short i16Value[2];
|
||||||
|
ZZ_U16 u16Value[2];
|
||||||
|
int i32Value;
|
||||||
|
float fValue;
|
||||||
|
ZZ_U32 u32Value;
|
||||||
|
}unValue;
|
||||||
|
|
||||||
|
enum emVSMDTriggerEvent
|
||||||
|
{
|
||||||
|
NoAction =0, //<2F><EFBFBD><DEB6><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>״̬λ S1 <20>仯֪ͨ<CDA8><D6AA>
|
||||||
|
ResetZeroPosition, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
DecSpdStop, //<2F><><EFBFBD><EFBFBD>ֹͣ
|
||||||
|
DecSpdStopRZP, //<2F><><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
Stop, //<2F><><EFBFBD><EFBFBD>ֹͣ
|
||||||
|
StopRZP, //<2F><><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>λ<EFBFBD><CEBB>
|
||||||
|
RunningPosDirect, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>
|
||||||
|
RunningNegDirect, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ٶȣ<D9B6>
|
||||||
|
OfflineModeOn, //<2F><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
||||||
|
OfflineModeOff //<2F><><EFBFBD><EFBFBD>ģʽֹͣ
|
||||||
|
};
|
||||||
|
|
147
othersoft/shuttercali/source/LinearShutter/ZZ_SeiralPort.cpp
Normal file
147
othersoft/shuttercali/source/LinearShutter/ZZ_SeiralPort.cpp
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "ZZ_SeiralPort.h"
|
||||||
|
|
||||||
|
CZZ_SeiralPort_QT::CZZ_SeiralPort_QT()
|
||||||
|
{
|
||||||
|
m_pSerialPort = new QSerialPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
CZZ_SeiralPort_QT::~CZZ_SeiralPort_QT()
|
||||||
|
{
|
||||||
|
if (m_pSerialPort != NULL)
|
||||||
|
{
|
||||||
|
delete m_pSerialPort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CZZ_SeiralPort_QT::InitPort(PortInfo portinfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_piSettings = portinfo;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CZZ_SeiralPort_QT::SetPort()
|
||||||
|
{
|
||||||
|
bool bRes = true;
|
||||||
|
// int iRes = sio_ioctl(m_piSettings.iPortNumber, m_piSettings.indexBaudRate,
|
||||||
|
// m_piSettings.indexParity | m_piSettings.indexBytesize | m_piSettings.indexStopBits);
|
||||||
|
// if (iRes != SIO_OK)
|
||||||
|
// {
|
||||||
|
// bRes = false;
|
||||||
|
// }
|
||||||
|
QString qstrPortName;
|
||||||
|
if (m_piSettings.FullPortName!="")
|
||||||
|
{
|
||||||
|
qstrPortName = m_piSettings.FullPortName;
|
||||||
|
qDebug() << m_piSettings.FullPortName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qstrPortName = QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||||
|
}
|
||||||
|
// qstrPortName = "COM4";
|
||||||
|
// QString qstrPortName = m_piSettings.FullPortName;//QString("COM%1").arg(m_piSettings.iPortNumber);
|
||||||
|
m_pSerialPort->setPortName(qstrPortName);
|
||||||
|
m_pSerialPort->setReadBufferSize(512);
|
||||||
|
bRes = m_pSerialPort->setBaudRate(m_piSettings.iBaudRate);
|
||||||
|
return bRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CZZ_SeiralPort_QT::Open()
|
||||||
|
{
|
||||||
|
bool bRes = true;
|
||||||
|
// int iRes = sio_open(m_piSettings.iPortNumber);
|
||||||
|
// if (iRes!=SIO_OK)
|
||||||
|
// {
|
||||||
|
// bRes = false;
|
||||||
|
// }
|
||||||
|
bRes = m_pSerialPort->open(QIODevice::ReadWrite);
|
||||||
|
if (!bRes)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:open Failed.Exit Code:1";
|
||||||
|
//std::cout << "Err.open Failed" << std::endl;
|
||||||
|
return bRes;;
|
||||||
|
}
|
||||||
|
return bRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CZZ_SeiralPort_QT::Close()
|
||||||
|
{
|
||||||
|
m_pSerialPort->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CZZ_SeiralPort_QT::ReadAll(int waite)
|
||||||
|
{
|
||||||
|
if (!m_pSerialPort->waitForReadyRead(waite))
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
m_pSerialPort->bytesAvailable() == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
qbaRecv.clear();
|
||||||
|
|
||||||
|
qbaRecv = m_pSerialPort->readAll();
|
||||||
|
|
||||||
|
|
||||||
|
std::string strRet(qbaRecv.constData(), qbaRecv.length());
|
||||||
|
return strRet;
|
||||||
|
|
||||||
|
// std::string strRet;
|
||||||
|
// char cBuf[MAXBUFFER];
|
||||||
|
// int iRet = sio_read(m_piSettings.iPortNumber,cBuf, MAXBUFFER);
|
||||||
|
// if (iRet==0)
|
||||||
|
// {
|
||||||
|
// strRet = "";
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// char *pRecv = new char[iRet];
|
||||||
|
// memcpy(pRecv, cBuf, iRet);
|
||||||
|
// //std::string strRet(pRecv);
|
||||||
|
// //delete pRecv;
|
||||||
|
// //return strRet;
|
||||||
|
//
|
||||||
|
// strRet.resize(iRet);
|
||||||
|
// for (int i=0;i<iRet;i++)
|
||||||
|
// {
|
||||||
|
// strRet[i] = pRecv[i];
|
||||||
|
// }
|
||||||
|
// delete pRecv;
|
||||||
|
// }
|
||||||
|
// return strRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CZZ_SeiralPort_QT::Write(const std::string strSend)
|
||||||
|
{
|
||||||
|
QByteArray qbaTest(strSend.c_str(),(int)strSend.length());
|
||||||
|
qint64 qi64Write = m_pSerialPort->write(qbaTest);
|
||||||
|
m_pSerialPort->waitForBytesWritten(5000);
|
||||||
|
if (qi64Write != qbaTest.size())
|
||||||
|
{
|
||||||
|
qDebug() << "Err:write Failed.Exit Code:1" << qi64Write;
|
||||||
|
return qi64Write;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
// char* pcSend = (char*)strSend.c_str();
|
||||||
|
// int iRet = sio_write(m_piSettings.iPortNumber, pcSend, (int)strSend.length());
|
||||||
|
//
|
||||||
|
// //delete pcSend;
|
||||||
|
// if (iRet!= (int)strSend.length())
|
||||||
|
// {
|
||||||
|
// return iRet;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// //sio_write();
|
||||||
|
}
|
26
othersoft/shuttercali/source/LinearShutter/ZZ_SeiralPort.h
Normal file
26
othersoft/shuttercali/source/LinearShutter/ZZ_SeiralPort.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "VSMD12XMiscDefines.h"
|
||||||
|
#include "AbstractPort.h"
|
||||||
|
#include"qobject.h"
|
||||||
|
class CZZ_SeiralPort_QT :public CAbstractPort,QObject
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
PortInfo m_piSettings;
|
||||||
|
QByteArray qbaSend, qbaRecv;
|
||||||
|
QSerialPort *m_pSerialPort;
|
||||||
|
public:
|
||||||
|
CZZ_SeiralPort_QT();
|
||||||
|
virtual ~CZZ_SeiralPort_QT();
|
||||||
|
public:
|
||||||
|
virtual void InitPort(PortInfo portinfo);
|
||||||
|
virtual bool SetPort();
|
||||||
|
virtual bool Open();
|
||||||
|
virtual void Close();
|
||||||
|
|
||||||
|
virtual std::string ReadAll(int waittime = 5000);
|
||||||
|
|
||||||
|
virtual int Write(const std::string strSend);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
28
othersoft/shuttercali/source/LinearShutter/pch.h
Normal file
28
othersoft/shuttercali/source/LinearShutter/pch.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <iostream>
|
||||||
|
////////////////////////////setings
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMetaEnum>
|
||||||
|
////////////////////////////Basic
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QObject>
|
||||||
|
////////////////////////////Thread
|
||||||
|
#include <QThread>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
////////////////////////////json
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonValue>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
////////////////////////////time
|
||||||
|
#include <QtCore/QTime>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QTimer>
|
||||||
|
////////////////////////////Serial I/O
|
||||||
|
#include <QtSerialPort/QSerialPort>
|
||||||
|
#include <QtSerialPort/QSerialPortInfo>
|
90
othersoft/shuttercali/source/Logger/Logger.h
Normal file
90
othersoft/shuttercali/source/Logger/Logger.h
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
//
|
||||||
|
// Created by xin on 2021/8/17.
|
||||||
|
//edit by zz.
|
||||||
|
//fixed code page problem;added a new initialize function; --20211101
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "qmutex.h"
|
||||||
|
#include "QtMsgHandler"
|
||||||
|
|
||||||
|
namespace QT_LOG
|
||||||
|
{
|
||||||
|
static int m_LogLevel = 1;
|
||||||
|
static QString m_LogFile = QString("%1.log").arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmss"));
|
||||||
|
QMutex m_LogMutex;
|
||||||
|
|
||||||
|
void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
|
{
|
||||||
|
if (type < m_LogLevel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString log_info;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case QtDebugMsg:
|
||||||
|
log_info = QString("%1:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QtWarningMsg:
|
||||||
|
log_info = QString("%1[Warning]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QtCriticalMsg:
|
||||||
|
log_info = QString("%1[Critical]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QtFatalMsg:
|
||||||
|
log_info = QString("%1[Fatal]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_LogMutex.lock();
|
||||||
|
|
||||||
|
QFile outFile(m_LogFile);
|
||||||
|
outFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
|
||||||
|
QTextStream ts(&outFile);
|
||||||
|
ts << log_info << endl;
|
||||||
|
outFile.close();
|
||||||
|
|
||||||
|
m_LogMutex.unlock();
|
||||||
|
}
|
||||||
|
void logInit(QString logFile = "",int logLevel = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
if ((logLevel < 0) || (logLevel > 3))
|
||||||
|
{
|
||||||
|
m_LogLevel = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_LogLevel = logLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!logFile.isEmpty())
|
||||||
|
{
|
||||||
|
m_LogFile = logFile+"/"+m_LogFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
qInstallMessageHandler(customMessageHandler);
|
||||||
|
//qInstallMsgHandler(customMessageHandler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//added by IRIS_ZZ initialize from main
|
||||||
|
void ZZ_InitLogger(QString qstrDir)
|
||||||
|
{
|
||||||
|
QDir qdLogFolder;
|
||||||
|
qdLogFolder.mkdir(qstrDir);
|
||||||
|
qDebug() << QT_LOG::m_LogFile;
|
||||||
|
QT_LOG::logInit(qstrDir);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
othersoft/shuttercali/source/OSIF/DLib/SeaBreeze.dll
Normal file
BIN
othersoft/shuttercali/source/OSIF/DLib/SeaBreeze.dll
Normal file
Binary file not shown.
BIN
othersoft/shuttercali/source/OSIF/DLib/SeaBreeze.lib
Normal file
BIN
othersoft/shuttercali/source/OSIF/DLib/SeaBreeze.lib
Normal file
Binary file not shown.
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DeviceFactory.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
*
|
||||||
|
* This class allows Device class instances to be created
|
||||||
|
* using just the name of the class as a string.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_DEVICE_FACTORY_H
|
||||||
|
#define SEABREEZE_DEVICE_FACTORY_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include "common/devices/Device.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class DeviceFactory {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static DeviceFactory* getInstance();
|
||||||
|
static DeviceFactory* instance;
|
||||||
|
static void shutdown();
|
||||||
|
|
||||||
|
Device *create(const std::string& name);
|
||||||
|
Device *create(int index);
|
||||||
|
int getNumberOfDeviceTypes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef Device *(*creatorFunction)(void);
|
||||||
|
DeviceFactory();
|
||||||
|
std::map<std::string, creatorFunction> nameToCreator;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
56
othersoft/shuttercali/source/OSIF/include/api/DllDecl.h
Normal file
56
othersoft/shuttercali/source/OSIF/include/api/DllDecl.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DllDecl.h
|
||||||
|
* @date September 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This class provides the DLL import/export decorations
|
||||||
|
* required for Windows DLLs. It is encapsulated to
|
||||||
|
* reduce copy-paste and to allow a single point of
|
||||||
|
* maintenance.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_DLL_DECL_H
|
||||||
|
#define SEABREEZE_DLL_DECL_H
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
#ifdef BUILD_DLL
|
||||||
|
#define DLL_DECL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL_DECL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// "STL member 'seabreeze::api::Foo::foo' needs to have dll-interface
|
||||||
|
// to be used by clients of class 'seabreeze::api::Foo'"
|
||||||
|
#pragma warning (disable: 4251)
|
||||||
|
|
||||||
|
// "non dll-interface class 'seabreeze::Foo' used as base for dll-interface
|
||||||
|
// class 'seabreeze::api::Bar'"
|
||||||
|
#pragma warning (disable: 4275)
|
||||||
|
#else
|
||||||
|
#define DLL_DECL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
864
othersoft/shuttercali/source/OSIF/include/api/SeaBreezeWrapper.h
Normal file
864
othersoft/shuttercali/source/OSIF/include/api/SeaBreezeWrapper.h
Normal file
@ -0,0 +1,864 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SeaBreezeWrapper.h
|
||||||
|
* @date July 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a trivial interface to SeaBreeze that allows
|
||||||
|
* the user to connect to devices over USB.
|
||||||
|
* This is intended as a usable and extensible API.
|
||||||
|
*
|
||||||
|
* This provides a C interface to help with linkage.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_WRAPPER_H
|
||||||
|
#define SEABREEZE_WRAPPER_H
|
||||||
|
|
||||||
|
#define SEABREEZE_API_VERSION "3.0.11" //!< current version of the SeaBreezeWrapper API
|
||||||
|
#define SEABREEZE_MAX_DEVICES 32 //!< how many different spectrometer types we support
|
||||||
|
|
||||||
|
#include "api/DllDecl.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encapsulates all SeaBreeze classes
|
||||||
|
*/
|
||||||
|
namespace seabreeze {
|
||||||
|
class Device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Original interface to SeaBreeze. SeaBreezeAPI represents a proposed architecture for
|
||||||
|
future development.
|
||||||
|
*/
|
||||||
|
class DLL_DECL SeaBreezeWrapper {
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! get handle to Singleton
|
||||||
|
static SeaBreezeWrapper *getInstance();
|
||||||
|
|
||||||
|
//! free some static memory under Microsoft profiler
|
||||||
|
static void shutdown();
|
||||||
|
|
||||||
|
// lifecycle
|
||||||
|
int openSpectrometer (int index, int *errorCode);
|
||||||
|
int closeSpectrometer (int index, int *errorCode);
|
||||||
|
|
||||||
|
// metadata
|
||||||
|
int getModel (int index, int *errorCode, char *buf, int len);
|
||||||
|
int getSerialNumber (int index, int *errorCode, char *buf, int len);
|
||||||
|
|
||||||
|
// basic acquisitions
|
||||||
|
void setIntegrationTimeMicrosec(int index, int *errorCode, unsigned long integration_time_micros);
|
||||||
|
int getWavelengths (int index, int *errorCode, double *wavelengths, int length);
|
||||||
|
int getFormattedSpectrum (int index, int *errorCode, double* buffer, int buffer_length);
|
||||||
|
int getUnformattedSpectrum (int index, int *errorCode, unsigned char *buffer, int buffer_length);
|
||||||
|
int getFormattedSpectrumLength(int index, int *errorCode);
|
||||||
|
int getUnformattedSpectrumLength(int index, int *errorCode);
|
||||||
|
long getMinIntegrationTimeMicrosec(int index, int *errorCode);
|
||||||
|
long getMaxIntegrationTimeMicrosec(int index, int *errorCode);
|
||||||
|
int getMaximumIntensity(int index, int *errorCode);
|
||||||
|
|
||||||
|
// advanced features
|
||||||
|
int getElectricDarkPixelIndices(int index, int *errorCode, int *indices, int length);
|
||||||
|
void setTriggerMode (int index, int *errorCode, int mode);
|
||||||
|
void setStrobeEnable (int index, int *errorCode, unsigned char strobe_enable);
|
||||||
|
void setShutterOpen (int index, int *errorCode, unsigned char opened);
|
||||||
|
void setContinuousStrobePeriodMicrosec(int index, int *errorCode, unsigned short strobe_id, unsigned long period_usec);
|
||||||
|
void setAcquisitionDelayMicrosec(int index, int *errorCode, unsigned long delay_usec);
|
||||||
|
|
||||||
|
// Buffering features
|
||||||
|
void clearBuffer (int index, int *errorCode);
|
||||||
|
unsigned long getBufferElementCount(int index, int *errorCode);
|
||||||
|
unsigned long getBufferCapacity (int index, int *errorCode);
|
||||||
|
unsigned long getBufferCapacityMaximum(int index, int *errorCode);
|
||||||
|
unsigned long getBufferCapacityMinimum(int index, int *errorCode);
|
||||||
|
void setBufferCapacity (int index, int *errorCode, unsigned long capacity);
|
||||||
|
|
||||||
|
// EEPROM access
|
||||||
|
int readEEPROMSlot (int index, int *errorCode, int slot_number, unsigned char *buffer, int buffer_length);
|
||||||
|
int writeEEPROMSlot (int index, int *errorCode, int slot_number, unsigned char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
// irradiance calibration
|
||||||
|
int readIrradCalibration (int index, int *errorCode, float *buffer, int buffer_length);
|
||||||
|
int writeIrradCalibration (int index, int *errorCode, float *buffer, int buffer_length);
|
||||||
|
int hasIrradCollectionArea (int index, int *errorCode);
|
||||||
|
float readIrradCollectionArea (int index, int *errorCode);
|
||||||
|
void writeIrradCollectionArea (int index, int *errorCode, float area);
|
||||||
|
|
||||||
|
// thermal-electric cooler
|
||||||
|
double readTECTemperature (int index, int *errorCode);
|
||||||
|
void setTECTemperature (int index, int *errorCode, double temperature_degrees_celsius);
|
||||||
|
void setTECEnable (int index, int *errorCode, unsigned char tec_enable);
|
||||||
|
void setTECFanEnable (int index, int *errorCode, unsigned char tec_fan_enable);
|
||||||
|
|
||||||
|
// Wrapper features
|
||||||
|
void setVerbose (bool flag);
|
||||||
|
void setLogfile (char *path, int length);
|
||||||
|
int getAPIVersionString (char *buffer, int length);
|
||||||
|
int getErrorString (int errorCode, char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
// raw USB access
|
||||||
|
int writeUSB (int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length);
|
||||||
|
int readUSB (int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length);
|
||||||
|
int getUSBDescriptorString (int index, int *errorCode, int id, unsigned char *buffer, int length);
|
||||||
|
|
||||||
|
// light sources (JAZ?)
|
||||||
|
int getLightSourceCount (int index, int *errorCode);
|
||||||
|
void setLightSourceEnable (int index, int *errorCode, int lightIndex, unsigned char enable);
|
||||||
|
void setLightSourceIntensity (int index, int *errorCode, int lightIndex, double intensity);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SeaBreezeWrapper();
|
||||||
|
virtual ~SeaBreezeWrapper();
|
||||||
|
|
||||||
|
//! Singleton
|
||||||
|
static SeaBreezeWrapper *instance;
|
||||||
|
|
||||||
|
//! types of supported Ocean Optics devices (not actual devices found enumerated on the USB bus)
|
||||||
|
seabreeze::Device *devices[SEABREEZE_MAX_DEVICES];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/* All of these C functions start with seabreeze_ to prevent namespace
|
||||||
|
* collisions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function opens a device attached to the system.
|
||||||
|
* @param index (Input) The index of a USB device to try to open.
|
||||||
|
* Valid values will range from 0 to N-1 for N connected devices.
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used
|
||||||
|
* for storing error codes.
|
||||||
|
* @return int: The function will return an integer of 0 if it opened a
|
||||||
|
* device successfully, or 1 if no device was opened (in which
|
||||||
|
* case the error_code variable will be set).
|
||||||
|
*
|
||||||
|
* This can be called repeatedly with incrementing index values (until
|
||||||
|
* it returns 1) to open all connected devices.
|
||||||
|
*
|
||||||
|
* Note that the index used to open a device with this function should also
|
||||||
|
* be used to communicate with that same device in the other functions
|
||||||
|
* provided here.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_open_spectrometer(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function closes the spectrometer attached to the system.
|
||||||
|
* @param index (Input) The index of a device previously opened with
|
||||||
|
* open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used
|
||||||
|
* for storing error codes.
|
||||||
|
* @return int: This function will return 1 no matter what! (MZ)
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_close_spectrometer(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns a description of the error denoted by
|
||||||
|
* error_code.
|
||||||
|
* @param error_code (Input) The integer error code to look up. Error
|
||||||
|
* codes not be zero, but can be any non-zero integer (positive or
|
||||||
|
* negative).
|
||||||
|
* @param buffer (Output) A character buffer allocated to contain at least
|
||||||
|
* 'buffer_length' bytes, which will be populated with the string
|
||||||
|
* description of the given error code.
|
||||||
|
* @param buffer_length (Input) allocated size of the output buffer
|
||||||
|
* @return int: Number of bytes written to buffer.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_error_string(int error_code, char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns a string denoting the type of the device.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes. This may be NULL.
|
||||||
|
* @param buffer (Output) A character buffer allocated to contain at least
|
||||||
|
* 'buffer_length' bytes, which will be populated with the
|
||||||
|
* spectrometer type.
|
||||||
|
* @param buffer_length (Input) allocated size of the buffer
|
||||||
|
* @return int: Number of bytes written to the buffer.
|
||||||
|
*
|
||||||
|
* The populated buffer will hold one of the following strings:
|
||||||
|
*
|
||||||
|
* \verbatim
|
||||||
|
* NONE: Used if no spectrometer is found (error_code will also be set)
|
||||||
|
* HR2000: Represents an HR2000 Spectrometer
|
||||||
|
* HR2000PLUS: Represents an HR2000+ Spectrometer
|
||||||
|
* HR4000: Represents an HR4000 Spectrometer
|
||||||
|
* JAZ: Represents a Jaz Spectrometer
|
||||||
|
* MAYA2000: Represents a Maya2000 Spectrometer
|
||||||
|
* MAYALSL: Represents a Maya-LSL Spectrometer
|
||||||
|
* MAYA2000PRO: Represents a Maya2000 Pro Spectrometer
|
||||||
|
* NIRQUEST256: Represents an NIRQuest256 Spectrometer
|
||||||
|
* NIRQUEST512: Represents an NIRQuest512 Spectrometer
|
||||||
|
* QE65000: Represents a QE65000 Spectrometer
|
||||||
|
* QE-PRO: Represents a QE-Pro Spectrometer
|
||||||
|
* STS: Represents an STS Spectrometer
|
||||||
|
* TORUS: Represents a Torus Spectrometer
|
||||||
|
* USB2000: Represents a USB2000 Spectrometer
|
||||||
|
* USB2000PLUS: Represents a USB2000+ Spectrometer
|
||||||
|
* USB4000: Represents a USB4000 Spectrometer
|
||||||
|
* \endverbatim
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_model(int index, int *error_code, char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the trigger mode for the specified device.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param mode (Input) a trigger mode (0 = normal, 1 = software, 2 = synchronization,
|
||||||
|
* 3 = external hardware, etc.)
|
||||||
|
*
|
||||||
|
* Note that requesting an unsupported mode will result in an error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_trigger_mode(int index, int *error_code, int mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the integration time for the specified device.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param integration_time_micros (Input) The new integration time in units of
|
||||||
|
* microseconds
|
||||||
|
*
|
||||||
|
* This function does not automatically perform a stability scan.
|
||||||
|
* If your application requires a stability scan following a change
|
||||||
|
* in integration time, you need to command that yourself.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_integration_time_microsec(int index, int *error_code,
|
||||||
|
unsigned long integration_time_micros);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the smallest integration time setting,
|
||||||
|
* in microseconds, that is valid for the spectrometer.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return Returns minimum legal integration time in microseconds if > 0.
|
||||||
|
* On error, returns -1 and error_code will be set accordingly.
|
||||||
|
*/
|
||||||
|
DLL_DECL long
|
||||||
|
seabreeze_get_min_integration_time_microsec(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the shutter state on the spectrometer.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param opened (Input) A logical boolean used for denoting the desired
|
||||||
|
* state (opened/closed) of the shutter. If the value of opened is
|
||||||
|
* non-zero, then the shutter will open. If the value of opened is
|
||||||
|
* zero, then the shutter will close.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_shutter_open(int index, int *error_code, unsigned char opened);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the strobe enable on the spectrometer. Note that
|
||||||
|
* this refers to a particular set of one or more digital pins on the
|
||||||
|
* device: lamp enable, single strobe, and continuous strobe may all
|
||||||
|
* be affected by this setting, and these generally control lamps
|
||||||
|
* that are external to the device. Note that this is related to, but
|
||||||
|
* different from, the light source interface which allows the intensity
|
||||||
|
* and/or enable status of individual light sources (e.g. lamp bulbs,
|
||||||
|
* LEDs, or lasers) in attached modules to be controlled. Refer to
|
||||||
|
* the seabreeze_xxx_light_source_ functions for finer control of
|
||||||
|
* certain light source modules that are more closely integrated with
|
||||||
|
* the spectrometer.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param strobe_enable (Input) A logical boolean used for denoting the
|
||||||
|
* desired value (high/low) of the strobe-enable pin. If the value of
|
||||||
|
* strobe_enable is zero, then the pin should be set low. If the value
|
||||||
|
* of strobe_enable is non-zero, then the pin should be set high.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_strobe_enable(int index, int *error_code, unsigned char strobe_enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function gets the number of attached light sources that can
|
||||||
|
* be programmatically controlled.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return The number of light sources that can be controlled
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_light_source_count(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the enable status on a connected light source.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param light_index (Input) The index of the light source. This will
|
||||||
|
* usually be zero, but if the light module contains multiple LEDs,
|
||||||
|
* bulbs, lasers, etc. then this may be higher. Use
|
||||||
|
* seabreeze_get_light_source_count() to bound the maximum value .
|
||||||
|
* @param enable (Input) A logical boolean used for denoting whether to enable
|
||||||
|
* the indicated light source. If the value of
|
||||||
|
* enable is zero, then the light source should be disabled. If the value
|
||||||
|
* of enable is non-zero, then the light source should be enabled.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_light_source_enable(int index, int *error_code,
|
||||||
|
int light_index, unsigned char enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the intensity of a connected light source.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param light_index (Input) The index of the light source. This will
|
||||||
|
* usually be zero, but if the light module contains multiple LEDs,
|
||||||
|
* bulbs, lasers, etc. then this may be higher. Use
|
||||||
|
* seabreeze_get_light_source_count() to bound the maximum value.
|
||||||
|
* @param intensity (Input) The desired intensity of the light source. The
|
||||||
|
* range of intensities is normalized over [0, 1], where 0 is the
|
||||||
|
* minimum controllable intensity of the light source, and 1 is the
|
||||||
|
* maximum.
|
||||||
|
*
|
||||||
|
* @warning SETTING THE INTENSITY TO ZERO MAY NOT CAUSE THE LIGHT SOURCE
|
||||||
|
* TO TURN OFF COMPLETELY. The light source will go to the
|
||||||
|
* dimmest level it can reach without changing its enable status.
|
||||||
|
* To switch the light source off, try using the
|
||||||
|
* seabreeze_set_light_source_enable() function or provide the
|
||||||
|
* operator with another way to disable or block the light source.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_light_source_intensity(int index, int *error_code,
|
||||||
|
int light_index, double intensity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function reads a string out of the spectrometer's EEPROM slot
|
||||||
|
* and returns the result.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param slot_number (Input) The number of the slot to read out. Possible
|
||||||
|
* values are 0 through 16*.
|
||||||
|
* @param buffer (Output) A buffer (with memory already allocated) to hold the
|
||||||
|
* value read out of the EEPROM slot
|
||||||
|
* @param buffer_length (Input) The length of the allocated output buffer (typically 16)
|
||||||
|
* @return int: The number of bytes read from the EEPROM slot into the buffer
|
||||||
|
*
|
||||||
|
* (*) Actual maximum slot count varies by spectrometer model. For the number of supported
|
||||||
|
* slots on your spectrometer, see EEPROMSlotFeature instantiation in appropriate
|
||||||
|
* device file under src/vendors/OceanOptics/devices.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_read_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer,
|
||||||
|
int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function writes a string to a spectrometer's EEPROM slot
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer for storing error codes.
|
||||||
|
* @param slot_number (Input) The number of the slot being written (e.g. 0-16*).
|
||||||
|
* @param buffer (Input) A buffer containing the text to write to the slot.
|
||||||
|
* @param buffer_length (Input) The length of the text to write (typically 15)
|
||||||
|
* @return number of bytes written
|
||||||
|
*
|
||||||
|
* @warning CARELESS USE OF THIS FUNCTION CAN RENDER YOUR SPECTROMETER INOPERABLE,
|
||||||
|
* POSSIBLY REQUIRING R.M.A. OR REFLASHING TO RESTORE FUNCTIONALITY.
|
||||||
|
* PLEASE READ YOUR SPECTROMETER'S DATA SHEET CAREFULLY BEFORE USE.
|
||||||
|
*
|
||||||
|
* (*) See note in seabreeze_read_eeprom_slot() regarding per-device slot limits.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_write_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer,
|
||||||
|
int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function reads out an irradiance calibration from the spectrometer's
|
||||||
|
* internal memory if that feature is supported.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param buffer (Output) array of floating point values into which calibration values are stored
|
||||||
|
* @param buffer_length (Input) maximum number of values to copy from the device into buffer
|
||||||
|
* @return int: the number of floats read from the device into the buffer
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_read_irrad_calibration(int index, int *error_code, float *buffer,
|
||||||
|
int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function writes an irradiance calibration to the spectrometer's
|
||||||
|
* internal memory if that feature is supported.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param buffer (Output) array of floating point values to store into the device
|
||||||
|
* @param buffer_length (Input) number of calibration factors to write
|
||||||
|
* @return int: the number of floats written from the buffer to the device
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_write_irrad_calibration(int index, int *error_code, float *buffer,
|
||||||
|
int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function checks for an irradiance collection area in the spectrometer's
|
||||||
|
* internal memory if that feature is supported.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return int: 0 if no collection area available, 1 if available.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_has_irrad_collection_area(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function reads an irradiance collection area from the spectrometer's
|
||||||
|
* internal memory if that feature is supported.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return float: collection area (typically in units of cm^2) read from device
|
||||||
|
*/
|
||||||
|
DLL_DECL float
|
||||||
|
seabreeze_read_irrad_collection_area(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function writes an irradiance collection area to the spectrometer's
|
||||||
|
* internal memory if that feature is supported.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param area (Input) collection area to save to the EEPROM (presumably cm^2)
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_write_irrad_collection_area(int index, int *error_code, float area);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function reads the value of the TEC and returns the value in
|
||||||
|
* degrees celsius.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return int: The TEC temperature in degrees Celsius.
|
||||||
|
*/
|
||||||
|
DLL_DECL double
|
||||||
|
seabreeze_read_tec_temperature(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets the TEC temperature.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param temperature_degrees_celsius (Input) The desired temperature, in degrees
|
||||||
|
* Celsius.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_tec_temperature(int index, int *error_code,
|
||||||
|
double temperature_degrees_celsius);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function enables the TEC feature on the spectrometer.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param tec_enable (Input) A logical boolean that denotes the desired TEC enable
|
||||||
|
* state. If the value of tec_enable is zero, the TEC should be disabled.
|
||||||
|
* If the value of tec_enable is non-zero, the TEC should be enabled.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_tec_enable(int index, int *error_code, unsigned char tec_enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function enables the TEC Fan on the spectrometer.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param tec_fan_enable (Input) A logical boolean that denotes the desired TEC fan enable
|
||||||
|
* state. If the value of tec_fan_enable is zero, the TEC fan should be disabled.
|
||||||
|
* If the value of tec_fan_enable is non-zero, the TEC fan should be enabled.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_tec_fan_enable(int index, int *error_code, unsigned char tec_fan_enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This acquires a spectrum and returns the answer in raw, unformatted bytes.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param buffer (Output) A buffer (with memory already allocated) to hold the
|
||||||
|
* spectral data
|
||||||
|
* @param buffer_length (Input) The length of the buffer in bytes (not pixels)
|
||||||
|
* @return int: The number of bytes read into the buffer
|
||||||
|
* @see sample-code/c/demo-unformatted-spectrum.c
|
||||||
|
*
|
||||||
|
* An unformatted spectrum is the raw sequence of bytes returned by the spectrometer to
|
||||||
|
* the PC over USB. The bytes have not been broken down into pixels, they're in the
|
||||||
|
* original endianness, absolutely nothing has been done to them. The caller is expected
|
||||||
|
* to know how many bytes are returned by each spectrometer model, which bytes indicate
|
||||||
|
* synchronization points or whatever, etc.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_unformatted_spectrum(int index, int *error_code,
|
||||||
|
unsigned char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This acquires a spectrum and returns the answer in formatted
|
||||||
|
* floats. In this mode, auto-nulling should be automatically
|
||||||
|
* performed for devices that support it.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param buffer (Output) A buffer (with memory already allocated) to hold the
|
||||||
|
* spectral data
|
||||||
|
* @param buffer_length (Input) The length of the buffer in floats (not bytes)
|
||||||
|
* @return int: The number of floats read into the buffer
|
||||||
|
*
|
||||||
|
* A formatted spectrum returns exactly one double-precision floating-point IEEE value
|
||||||
|
* per pixel, as opposed to a raw byte stream. It has also had autonulling (gain control)
|
||||||
|
* applied, meaning it has been scaled up to the spectrometer's full dynamic range using
|
||||||
|
* the gain setting recorded in that spectrometer’s EEPROM.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_formatted_spectrum(int index, int *error_code,
|
||||||
|
double* buffer, int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns an integer denoting the length of a raw spectrum
|
||||||
|
* (as returned by get_unformatted_spectrum(...)).
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return int: An integer denoting the length of an unformatted spectrum in bytes
|
||||||
|
*
|
||||||
|
* The caller is expected to know the number of bytes per pixel and the endian
|
||||||
|
* ordering, but it will normally be 2 bytes per pixel, LSB-MSB order.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_unformatted_spectrum_length(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns an integer denoting the number of pixels in a
|
||||||
|
* formatted spectrum (as returned by get_formatted_spectrum(...)).
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @return int: An integer denoting the length of a formatted spectrum (in pixels)
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_formatted_spectrum_length(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This computes the wavelengths for the spectrometer and fills in the
|
||||||
|
* provided array (up to the given length) with those values.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param wavelengths (Output) A pre-allocated array of doubles into which the
|
||||||
|
* wavelengths will be copied
|
||||||
|
* @param length (Input) The number of values to copy into the wavelength array (this should
|
||||||
|
* be no larger than the number of doubles allocated in the wavelengths
|
||||||
|
* array)
|
||||||
|
* @return int: An integer denoting the number of wavelengths written to the buffer
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_wavelengths(int index, int *error_code, double *wavelengths, int length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This reads the device's serial number and fills the
|
||||||
|
* provided array (up to the given length) with it.
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param buffer (Output) A pre-allocated array of characters into which the serial number
|
||||||
|
* will be copied
|
||||||
|
* @param buffer_length (Input) The number of values to copy into the buffer (this should
|
||||||
|
* be no larger than the number of chars allocated in the buffer) (typically 16)
|
||||||
|
* @return int: An integer denoting the number of bytes written into the buffer
|
||||||
|
*
|
||||||
|
* Note that "serial numbers" may include both digits and letters
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_serial_number(int index, int *error_code, char *buffer, int buffer_length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This fills in the provided array (up to the given length) with the indices
|
||||||
|
* of the pixels that are electrically active but optically masked
|
||||||
|
* (a.k.a. electric dark pixels).
|
||||||
|
* @param index (Input) The index of a device previously opened with open_spectrometer().
|
||||||
|
* @param error_code (Output) A pointer to an integer that can be used for storing
|
||||||
|
* error codes.
|
||||||
|
* @param indices (Output) A pre-allocated array of ints into which the pixel indices
|
||||||
|
* will be copied
|
||||||
|
* @param length (Input) The number of values to copy into the indices array (this should
|
||||||
|
* be no larger than the number of ints allocated in the indices array)
|
||||||
|
* @return int: An integer denoting the number of indices written into the indices buffer
|
||||||
|
*
|
||||||
|
* Note that not all detectors have optically masked pixels; in that case,
|
||||||
|
* this function will return zero.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_electric_dark_pixel_indices(int index, int *error_code,
|
||||||
|
int *indices, int length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shutdown SeaBreeze completely, releasing all resources and destroying
|
||||||
|
* any cached device handles.
|
||||||
|
*
|
||||||
|
* This function is not normally needed (Singletons are destroyed automatically
|
||||||
|
* at process end), but calling this explicitly can resolve some spurious warnings
|
||||||
|
* in highly paranoid memory leak profilers.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_shutdown();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write a raw array of bytes to a USB spectrometer.
|
||||||
|
* @param index (Input) index of an opened spectrometer
|
||||||
|
* @param errorCode (Output) pointer to an allocated integer field for receiving error codes
|
||||||
|
* @param endpoint (Input) USB endpoint for write operation
|
||||||
|
* (see src/vendors/OceanOptics/features/raw_bus_access/RawUSBBusAccessFeature.cpp)
|
||||||
|
* @param buffer (Input) array of bytes to send to USB spectrometer
|
||||||
|
* @param length (Input) number of bytes to write from buffer to spectrometer
|
||||||
|
* @return number of bytes written
|
||||||
|
*
|
||||||
|
* Write the bytes in the buffer according to the two command bytes at the
|
||||||
|
* start of the buffer.
|
||||||
|
*
|
||||||
|
* \section Endpoints
|
||||||
|
*
|
||||||
|
* You may wonder why the caller needs to specify an explicit endpoint for
|
||||||
|
* raw read and write operations; does not SeaBreeze already know the appro-
|
||||||
|
* priate endpoints for any open spectrometer, for example. Yes it does,
|
||||||
|
* but currently there is no easy way to extract endpoints from a generic
|
||||||
|
* spectrometer, due to the fact that OOIUSBCypressEndpointMap and
|
||||||
|
* OOIUSBSTSEndpointMap do not share a common base class (see
|
||||||
|
* OOIUSBEndpointMaps.h).
|
||||||
|
*
|
||||||
|
* We could attempt to extract them from the TransferHelpers held by
|
||||||
|
* OOIUSBInterface, but without a Hint to use as a key, we would likely
|
||||||
|
* obtain unmatched or inappropriate versions for control exchanges.
|
||||||
|
* As ControlHint and OBPControlHint share no common ancestor or type data
|
||||||
|
* to associate them while distinguishing from other hint types, we cannot
|
||||||
|
* automatically infer appropriate control endpoints.
|
||||||
|
*
|
||||||
|
* And finally, we have no way of knowing that the user really wants to
|
||||||
|
* use control endpoints anyway: they may actually desire high-speed
|
||||||
|
* spectral retrieval. So really, this needs to remain a manual external
|
||||||
|
* operation until such time as we provide a much richer, generic query
|
||||||
|
* interface over our internal endpoint lookup tables.
|
||||||
|
*
|
||||||
|
* \section Example
|
||||||
|
*
|
||||||
|
* For instance, for most USB spectrometers, the hex values <tt>05 00</tt> in
|
||||||
|
* the buffer means 'read EEPROM slot 0'. Writing this command, and following
|
||||||
|
* it with the \c seabreeze_read_usb command and the same hex <tt>05 00</tt>
|
||||||
|
* in the buffer, will result in the spectrometer's serial number, in ASCII
|
||||||
|
* characters, being delivered to the subsequent bytes in the buffer array.
|
||||||
|
* This would appear in the output buffer as:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* 05 00 55 53 42 32 2B 48 30 31 34 31 36 00 00 00 00 (hex)
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* (<tt>USB2+H01416</tt> ASCII, skipping the two command bytes)
|
||||||
|
*
|
||||||
|
* A C or C++ program could use the data as-is, but a C# program could
|
||||||
|
* append to a string, each byte, cast as char, stopping on the first null
|
||||||
|
* character:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* string serial = "";
|
||||||
|
* for (int i = 0; i < length && buffer[i] != '\0'; i++)
|
||||||
|
* serial += (char)buffer[i];
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* This is equivalent to:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* string serial = System.Text.ASCIIEncoding.ASCII.GetString(buffer).Trim('\0');
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* For C# and VB.NET, the trailing zero-fill must be removed. Those null
|
||||||
|
* characters would not print or display on a screen but would make a file
|
||||||
|
* name invalid.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_write_usb(int index, int *errorCode, unsigned char endpoint, unsigned char* buffer, unsigned int length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read a raw array of bytes from a USB spectrometer.
|
||||||
|
* @param index (Input) index of a previously opened spectrometer
|
||||||
|
* @param errorCode (Output) pointer to an allocated integer field for receiving error codes
|
||||||
|
* @param endpoint (Input) USB endpoint for read operation
|
||||||
|
* (see src/vendors/OceanOptics/features/raw_bus_access/RawUSBBusAccessFeature.cpp)
|
||||||
|
* @param buffer (Input) array of allocated bytes at which to recieve USB data
|
||||||
|
* @param length (Input) maximum number of bytes to read from spectrometer
|
||||||
|
* @return number of received bytes written to buffer
|
||||||
|
*
|
||||||
|
* Read bytes from the spectrometer into the buffer. The buffer starts with
|
||||||
|
* two bytes of command information that will be followed by the transferred
|
||||||
|
* bytes. The read and write USB functions allow low-level control of the
|
||||||
|
* spectrometer via USB commands. The higher-level SeaBreeze functions issue
|
||||||
|
* USB commands internally.
|
||||||
|
*
|
||||||
|
* Reading USB data takes two steps. First a seabreeze_write_usb call requests
|
||||||
|
* the transfer, then a seabreeze_read_usb call delivers the data. Writing a buffer
|
||||||
|
* to USB takes one step. The operating system handle for the spectrometer is
|
||||||
|
* managed by SeaBreeze. USB has a concept of "end points". These are implicitly
|
||||||
|
* addressed by the seabreeze_read_usb and seabreeze_write_usb functions.
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_read_usb(int index, int *errorCode, unsigned char endpoint, unsigned char* buffer, unsigned int length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the SeaBreeze library's internal version identifier.
|
||||||
|
* @param buffer (Output) pointer to an allocated character array
|
||||||
|
* to hold the returned version string
|
||||||
|
* @param len (Input) size of the allocated buffer
|
||||||
|
* @return number of bytes written to buffer
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_api_version_string(char *buffer, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get a USB descriptor string by number
|
||||||
|
* @param index (Input) Which spectrometer to set
|
||||||
|
* @param errorCode (Output) pointer to allocated integer to receive error code
|
||||||
|
* @param id (Input) numeric ID of the desired USB descriptor string
|
||||||
|
* @param buffer (Output) pointer to an allocated character array to hold
|
||||||
|
* the returned descriptor string
|
||||||
|
* @param len (Input) size of the allocated buffer
|
||||||
|
* @return number of bytes written to buffer
|
||||||
|
*/
|
||||||
|
DLL_DECL int
|
||||||
|
seabreeze_get_usb_descriptor_string(int index, int *errorCode, int id, unsigned char *buffer, int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the continuous strobe period in microseconds
|
||||||
|
* @param index (Input) Which spectrometer to set
|
||||||
|
* @param errorCode (Output) pointer to allocated integer to receive error code
|
||||||
|
* @param strobe_id (Input) index of the strobe generator (currently always zero)
|
||||||
|
* @param period_usec (Input) total period of the strobe, in microseconds
|
||||||
|
* @return zero (on success or failure; check errorCode)
|
||||||
|
*
|
||||||
|
* The resolution is 0.1 milliseconds (100 microseconds).
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_continuous_strobe_period_microsec(int index, int *errorCode,
|
||||||
|
unsigned short strobe_id, unsigned long period_usec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the acquisition delay (trigger delay) in microseconds. This
|
||||||
|
* controls the amount of time between a particular event
|
||||||
|
* (usually a request for spectrum or an external trigger pulse)
|
||||||
|
* and the start of acquisition.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_acquisition_delay_microsec(int index,
|
||||||
|
int *errorCode, unsigned long delay_usec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear the spectrum buffer (if equipped)
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer cleared
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_clear_buffer(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the number of spectra presently in the buffer (if equipped)
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer queried
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
* @return Number of spectra in the buffer
|
||||||
|
*/
|
||||||
|
DLL_DECL unsigned long
|
||||||
|
seabreeze_get_buffer_element_count(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the currently configured size of the data buffer (if equipped)
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer queried
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
* @return The present limit on the number of spectra that will be retained.
|
||||||
|
*/
|
||||||
|
DLL_DECL unsigned long
|
||||||
|
seabreeze_get_buffer_capacity(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the maximum possible configurable size for the data buffer (if equipped)
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer queried
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
* @return Maximum allowed value for the buffer size
|
||||||
|
*/
|
||||||
|
DLL_DECL unsigned long
|
||||||
|
seabreeze_get_buffer_capacity_maximum(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the minimum possible configurable size for the data buffer (if equipped)
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer queried
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
* @return Minimum allowed value for the buffer size
|
||||||
|
*/
|
||||||
|
DLL_DECL unsigned long
|
||||||
|
seabreeze_get_buffer_capacity_minimum(int index, int *error_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the number of spectra that the buffer should keep
|
||||||
|
* @param index (Input) Which spectrometer should have its buffer modified
|
||||||
|
* @param error_code (Output) Pointer to allocated integer to receive error code
|
||||||
|
* @param capacity (Input) Limit on number of spectra to store.
|
||||||
|
* Note that this must be within the range defined by the capacity minimum
|
||||||
|
* and maximum values.
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_buffer_capacity(int index, int *error_code, unsigned long capacity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Programmatically enable debug outputs to stderr
|
||||||
|
* @param flag (Input) zero to disable (default), non-zero to enable
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_verbose(int flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief redirect verbose logging to named file
|
||||||
|
* @param flag (Input) NULL for default behavior (stderr), non-null for valid OS path
|
||||||
|
*/
|
||||||
|
DLL_DECL void
|
||||||
|
seabreeze_set_logfile(char* pathname, int len);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_WRAPPER_H */
|
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file AcquisitionDelayFeatureAdapter.h
|
||||||
|
* @date November 2015
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows access to SeaBreeze
|
||||||
|
* DataBufferFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_ACQUISITION_DELAY_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_ACQUISITION_DELAY_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/acquisition_delay/AcquisitionDelayFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class AcquisitionDelayFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<AcquisitionDelayFeatureInterface> {
|
||||||
|
public:
|
||||||
|
AcquisitionDelayFeatureAdapter(AcquisitionDelayFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f, Protocol *p, Bus *b,
|
||||||
|
unsigned short instanceIndex);
|
||||||
|
|
||||||
|
virtual ~AcquisitionDelayFeatureAdapter();
|
||||||
|
|
||||||
|
/* Acquisition delay functions */
|
||||||
|
unsigned long getAcquisitionDelayIncrementMicroseconds(int *errorCode);
|
||||||
|
unsigned long getAcquisitionDelayMaximumMicroseconds(int *errorCode);
|
||||||
|
unsigned long getAcquisitionDelayMinimumMicroseconds(int *errorCode);
|
||||||
|
unsigned long getAcquisitionDelayMicroseconds(int *errorCode);
|
||||||
|
void setAcquisitionDelayMicroseconds(int *errorCode, const unsigned long delay_usec);
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* end namespace api */
|
||||||
|
} /* end namespace seabreeze */
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_ACQUISITION_DELAY_FEATURE_ADAPTER_H */
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file ContinuousStrobeFeatureAdapter.h
|
||||||
|
* @date October 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows access to SeaBreeze
|
||||||
|
* ContinuousStrobeFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_CONTINUOUS_STROBE_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_CONTINUOUS_STROBE_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/continuous_strobe/ContinuousStrobeFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class ContinuousStrobeFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<ContinuousStrobeFeatureInterface> {
|
||||||
|
public:
|
||||||
|
ContinuousStrobeFeatureAdapter(ContinuousStrobeFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~ContinuousStrobeFeatureAdapter();
|
||||||
|
|
||||||
|
void setContinuousStrobePeriodMicroseconds(int *errorCode, unsigned long period_usec);
|
||||||
|
void setContinuousStrobeEnable(int *errorCode, bool enable);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DataBufferFeatureAdapter.h
|
||||||
|
* @date October 2015
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows access to SeaBreeze
|
||||||
|
* DataBufferFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_DATA_BUFFER_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_DATA_BUFFER_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/data_buffer/DataBufferFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class DataBufferFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<DataBufferFeatureInterface> {
|
||||||
|
public:
|
||||||
|
DataBufferFeatureAdapter(DataBufferFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~DataBufferFeatureAdapter();
|
||||||
|
|
||||||
|
/* Data buffer functions */
|
||||||
|
void clearBuffer(int *errorCode);
|
||||||
|
unsigned long getNumberOfElements(int *errorCode);
|
||||||
|
unsigned long getBufferCapacity(int *errorCode);
|
||||||
|
unsigned long getBufferCapacityMaximum(int *errorCode);
|
||||||
|
unsigned long getBufferCapacityMinimum(int *errorCode);
|
||||||
|
void setBufferCapacity(int *errorCode, unsigned long capacity);
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* end namespace api */
|
||||||
|
} /* end namespace seabreeze */
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_DATA_BUFFER_FEATURE_ADAPTER_H */
|
||||||
|
|
@ -0,0 +1,308 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DeviceAdapter.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze Device instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
#ifndef DEVICEADAPTER_H
|
||||||
|
#define DEVICEADAPTER_H
|
||||||
|
|
||||||
|
/* Includes */
|
||||||
|
#include "common/devices/Device.h"
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include "api/seabreezeapi/EEPROMFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/IrradCalFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/RawUSBBusAccessFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/NonlinearityCoeffsFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/TemperatureFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/RevisionFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/OpticalBenchFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/SpectrumProcessingFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/SerialNumberFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/ShutterFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/SpectrometerFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/StrayLightCoeffsFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/StrobeLampFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/ContinuousStrobeFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/ThermoElectricCoolerFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/LightSourceFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/PixelBinningFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/DataBufferFeatureAdapter.h"
|
||||||
|
#include "api/seabreezeapi/AcquisitionDelayFeatureAdapter.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class DeviceAdapter {
|
||||||
|
public:
|
||||||
|
DeviceAdapter(Device *dev, unsigned long id);
|
||||||
|
~DeviceAdapter();
|
||||||
|
|
||||||
|
int open(int *errorCode);
|
||||||
|
void close();
|
||||||
|
|
||||||
|
DeviceLocatorInterface *getLocation();
|
||||||
|
|
||||||
|
/* An for weak association to this object */
|
||||||
|
unsigned long getID();
|
||||||
|
|
||||||
|
/* Get a string that describes the type of device */
|
||||||
|
int getDeviceType(int *errorCode, char *buffer, unsigned int maxLength);
|
||||||
|
|
||||||
|
/* Get a usb endpoint for the device according to the enumerator */
|
||||||
|
/* endpointType. A 0 is returned if the endpoint requested is not in use. */
|
||||||
|
unsigned char getDeviceEndpoint(int *errorCode, usbEndpointType anEndpointType);
|
||||||
|
|
||||||
|
/* Get one or more raw USB access features */
|
||||||
|
int getNumberOfRawUSBBusAccessFeatures();
|
||||||
|
int getRawUSBBusAccessFeatures(long *buffer, int maxFeatures);
|
||||||
|
int rawUSBBusAccessRead(long featureID,
|
||||||
|
int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
|
||||||
|
int rawUSBBusAccessWrite(long featureID,
|
||||||
|
int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
|
||||||
|
|
||||||
|
/* Get one or more serial number features */
|
||||||
|
int getNumberOfSerialNumberFeatures();
|
||||||
|
int getSerialNumberFeatures(long *buffer, int maxFeatures);
|
||||||
|
int getSerialNumber(long featureID, int *errorCode,
|
||||||
|
char *buffer, int bufferLength);
|
||||||
|
unsigned char getSerialNumberMaximumLength(long featureID, int *errorCode);
|
||||||
|
|
||||||
|
/* Get one or more spectrometer acquisition features */
|
||||||
|
int getNumberOfSpectrometerFeatures();
|
||||||
|
int getSpectrometerFeatures(long *buffer, int maxFeatures);
|
||||||
|
void spectrometerSetTriggerMode(long spectrometerFeatureID, int *errorCode, int mode);
|
||||||
|
void spectrometerSetIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode,
|
||||||
|
unsigned long integrationTimeMicros);
|
||||||
|
unsigned long spectrometerGetMinimumIntegrationTimeMicros(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
unsigned long spectrometerGetMaximumIntegrationTimeMicros(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
double spectrometerGetMaximumIntensity(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
int spectrometerGetUnformattedSpectrumLength(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
int spectrometerGetUnformattedSpectrum(long spectrometerFeatureID,
|
||||||
|
int *errorCode, unsigned char *buffer, int bufferLength);
|
||||||
|
int spectrometerGetFormattedSpectrumLength(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
int spectrometerGetFormattedSpectrum(long spectrometerFeatureID, int *errorCode,
|
||||||
|
double *buffer, int bufferLength);
|
||||||
|
int spectrometerGetWavelengths(long spectrometerFeatureID, int *errorCode,
|
||||||
|
double *wavelengths, int length);
|
||||||
|
int spectrometerGetElectricDarkPixelCount(
|
||||||
|
long spectrometerFeatureID, int *errorCode);
|
||||||
|
int spectrometerGetElectricDarkPixelIndices(
|
||||||
|
long spectrometerFeatureID, int *errorCode, int *indices, int length);
|
||||||
|
|
||||||
|
|
||||||
|
/* Get one or more pixel binning features */
|
||||||
|
int getNumberOfPixelBinningFeatures();
|
||||||
|
int getPixelBinningFeatures(long *buffer, int maxFeatures);
|
||||||
|
void binningSetPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
|
||||||
|
unsigned char binningGetPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
|
||||||
|
void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
|
||||||
|
void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
|
||||||
|
unsigned char binningGetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
|
||||||
|
unsigned char binningGetMaxPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
|
||||||
|
|
||||||
|
/* Get one or more TEC features */
|
||||||
|
int getNumberOfThermoElectricFeatures();
|
||||||
|
int getThermoElectricFeatures(long *buffer, int maxFeatures);
|
||||||
|
double tecReadTemperatureDegreesC(long featureID, int *errorCode);
|
||||||
|
void tecSetTemperatureSetpointDegreesC(long featureID, int *errorCode,
|
||||||
|
double temperatureDegreesCelsius);
|
||||||
|
void tecSetEnable(long featureID, int *errorCode, bool tecEnable);
|
||||||
|
|
||||||
|
/* Get one or more irradiance calibration features */
|
||||||
|
int getNumberOfIrradCalFeatures();
|
||||||
|
int getIrradCalFeatures(long *buffer, int maxFeatures);
|
||||||
|
int irradCalibrationRead(long featureID,
|
||||||
|
int *errorCode, float *buffer, int bufferLength);
|
||||||
|
int irradCalibrationWrite(long featureID,
|
||||||
|
int *errorCode, float *buffer, int bufferLength);
|
||||||
|
int irradCalibrationHasCollectionArea(long featureID, int *errorCode);
|
||||||
|
float irradCalibrationReadCollectionArea(long featureID, int *errorCode);
|
||||||
|
void irradCalibrationWriteCollectionArea(long featureID,
|
||||||
|
int *errorCode, float area);
|
||||||
|
|
||||||
|
/* Get one or more EEPROM features */
|
||||||
|
int getNumberOfEEPROMFeatures();
|
||||||
|
int getEEPROMFeatures(long *buffer, int maxFeatures);
|
||||||
|
int eepromReadSlot(long featureID, int *errorCode, int slotNumber,
|
||||||
|
unsigned char *buffer, int length);
|
||||||
|
|
||||||
|
/* Get one or more light source features */
|
||||||
|
int getNumberOfLightSourceFeatures();
|
||||||
|
int getLightSourceFeatures(long *buffer, int maxFeatures);
|
||||||
|
int lightSourceGetCount(long featureID, int *errorCode);
|
||||||
|
bool lightSourceHasEnable(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex);
|
||||||
|
bool lightSourceIsEnabled(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex);
|
||||||
|
void lightSourceSetEnable(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex, bool enable);
|
||||||
|
bool lightSourceHasVariableIntensity(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex);
|
||||||
|
double lightSourceGetIntensity(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex);
|
||||||
|
void lightSourceSetIntensity(long featureID, int *errorCode,
|
||||||
|
int lightSourceIndex, double intensity);
|
||||||
|
|
||||||
|
/* Get one or more strobe lamp enable features */
|
||||||
|
int getNumberOfStrobeLampFeatures();
|
||||||
|
int getStrobeLampFeatures(long *buffer, int maxFeatures);
|
||||||
|
void lampSetStrobeEnable(long featureID, int *errorCode, bool strobeEnable);
|
||||||
|
|
||||||
|
/* Get one or more continuous strobe features */
|
||||||
|
int getNumberOfContinuousStrobeFeatures();
|
||||||
|
int getContinuousStrobeFeatures(long *buffer, int maxFeatures);
|
||||||
|
void continuousStrobeSetPeriodMicroseconds(long featureID, int *errorCode,
|
||||||
|
unsigned long period_usec);
|
||||||
|
void continuousStrobeSetEnable(long featureID, int *errorCode, bool enable);
|
||||||
|
|
||||||
|
/* Get one or more shutter features */
|
||||||
|
int getNumberOfShutterFeatures();
|
||||||
|
int getShutterFeatures(long *buffer, int maxFeatures);
|
||||||
|
void shutterSetShutterOpen(long featureID, int *errorCode, bool opened);
|
||||||
|
|
||||||
|
/* Get one or more nonlinearity coefficients features */
|
||||||
|
int getNumberOfNonlinearityCoeffsFeatures();
|
||||||
|
int getNonlinearityCoeffsFeatures(long *buffer, int maxFeatures);
|
||||||
|
int nonlinearityCoeffsGet(long featureID, int *errorCode,
|
||||||
|
double *buffer, int bufferLength);
|
||||||
|
|
||||||
|
/* Get one or more temperature features */
|
||||||
|
int getNumberOfTemperatureFeatures();
|
||||||
|
int getTemperatureFeatures(long *buffer, int maxFeatures);
|
||||||
|
unsigned char temperatureCountGet(long temperatureFeatureID, int *errorCode);
|
||||||
|
double temperatureGet(long temperatureFeatureID, int *errorCode, int index);
|
||||||
|
int temperatureGetAll(long temperatureFeatureID, int *errorCode,
|
||||||
|
double *buffer, int bufferLength);
|
||||||
|
|
||||||
|
/* Get one or more revision features */
|
||||||
|
int getNumberOfRevisionFeatures();
|
||||||
|
int getRevisionFeatures(long *buffer, int maxFeatures);
|
||||||
|
unsigned char revisionHardwareGet(long revisionFeatureID, int *errorCode);
|
||||||
|
unsigned short int revisionFirmwareGet(long revisionFeatureID, int *errorCode);
|
||||||
|
|
||||||
|
/* Get one or more spectrum processing features */
|
||||||
|
int getNumberOfSpectrumProcessingFeatures();
|
||||||
|
int getSpectrumProcessingFeatures(long *buffer, int maxFeatures);
|
||||||
|
unsigned short int spectrumProcessingScansToAverageGet(long spectrumProcessingFeatureID, int *errorCode);
|
||||||
|
unsigned char spectrumProcessingBoxcarWidthGet(long spectrumProcessingFeatureID, int *errorCode);
|
||||||
|
void spectrumProcessingBoxcarWidthSet(long featureID, int *errorCode, unsigned char boxcarWidth);
|
||||||
|
void spectrumProcessingScansToAverageSet(long featureID, int *errorCode, unsigned short int scansToAverage);
|
||||||
|
|
||||||
|
/* Get one or more optical bench features */
|
||||||
|
int getNumberOfOpticalBenchFeatures();
|
||||||
|
int getOpticalBenchFeatures(long *buffer, int maxFeatures);
|
||||||
|
unsigned short int opticalBenchGetFiberDiameterMicrons(long opticalBenchFeatureID, int *errorCode);
|
||||||
|
unsigned short int opticalBenchGetSlitWidthMicrons(long opticalBenchFeatureID, int *errorCode);
|
||||||
|
int opticalBenchGetID(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
|
||||||
|
int opticalBenchGetSerialNumber(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
|
||||||
|
int opticalBenchGetCoating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
|
||||||
|
int opticalBenchGetFilter(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
|
||||||
|
int opticalBenchGetGrating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
|
||||||
|
|
||||||
|
|
||||||
|
/* Get one or more stray light coefficients features */
|
||||||
|
int getNumberOfStrayLightCoeffsFeatures();
|
||||||
|
int getStrayLightCoeffsFeatures(long *buffer, int maxFeatures);
|
||||||
|
int strayLightCoeffsGet(long featureID, int *errorCode,
|
||||||
|
double *buffer, int bufferLength);
|
||||||
|
|
||||||
|
/* Get one or more data buffer features */
|
||||||
|
int getNumberOfDataBufferFeatures();
|
||||||
|
int getDataBufferFeatures(long *buffer, int maxFeatures);
|
||||||
|
void dataBufferClear(long featureID, int *errorCode);
|
||||||
|
unsigned long dataBufferGetNumberOfElements(long featureID, int *errorCode);
|
||||||
|
unsigned long dataBufferGetBufferCapacity(long featureID, int *errorCode);
|
||||||
|
unsigned long dataBufferGetBufferCapacityMaximum(long featureID, int *errorCode);
|
||||||
|
unsigned long dataBufferGetBufferCapacityMinimum(long featureID, int *errorCode);
|
||||||
|
void dataBufferSetBufferCapacity(long featureID, int *errorCode, unsigned long capacity);
|
||||||
|
|
||||||
|
/* Get one or more acquisition delay features */
|
||||||
|
int getNumberOfAcquisitionDelayFeatures();
|
||||||
|
int getAcquisitionDelayFeatures(long *buffer, int maxFeatures);
|
||||||
|
void acquisitionDelaySetDelayMicroseconds(long featureID, int *errorCode,
|
||||||
|
unsigned long delay_usec);
|
||||||
|
unsigned long acquisitionDelayGetDelayMicroseconds(long featureID, int *errorCode);
|
||||||
|
unsigned long acquisitionDelayGetDelayIncrementMicroseconds(long featureID, int *errorCode);
|
||||||
|
unsigned long acquisitionDelayGetDelayMaximumMicroseconds(long featureID, int *errorCode);
|
||||||
|
unsigned long acquisitionDelayGetDelayMinimumMicroseconds(long featureID, int *errorCode);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
unsigned long instanceID;
|
||||||
|
seabreeze::Device *device;
|
||||||
|
std::vector<RawUSBBusAccessFeatureAdapter *> rawUSBBusAccessFeatures;
|
||||||
|
std::vector<SerialNumberFeatureAdapter *> serialNumberFeatures;
|
||||||
|
std::vector<SpectrometerFeatureAdapter *> spectrometerFeatures;
|
||||||
|
std::vector<ThermoElectricCoolerFeatureAdapter *> tecFeatures;
|
||||||
|
std::vector<IrradCalFeatureAdapter *> irradCalFeatures;
|
||||||
|
std::vector<EEPROMFeatureAdapter *> eepromFeatures;
|
||||||
|
std::vector<LightSourceFeatureAdapter *> lightSourceFeatures;
|
||||||
|
std::vector<StrobeLampFeatureAdapter *> strobeLampFeatures;
|
||||||
|
std::vector<ContinuousStrobeFeatureAdapter *> continuousStrobeFeatures;
|
||||||
|
std::vector<ShutterFeatureAdapter *> shutterFeatures;
|
||||||
|
std::vector<NonlinearityCoeffsFeatureAdapter *> nonlinearityFeatures;
|
||||||
|
std::vector<TemperatureFeatureAdapter *> temperatureFeatures;
|
||||||
|
std::vector<RevisionFeatureAdapter *> revisionFeatures;
|
||||||
|
std::vector<OpticalBenchFeatureAdapter *> opticalBenchFeatures;
|
||||||
|
std::vector<SpectrumProcessingFeatureAdapter *> spectrumProcessingFeatures;
|
||||||
|
std::vector<StrayLightCoeffsFeatureAdapter *> strayLightFeatures;
|
||||||
|
std::vector<PixelBinningFeatureAdapter *> pixelBinningFeatures;
|
||||||
|
std::vector<DataBufferFeatureAdapter *> dataBufferFeatures;
|
||||||
|
std::vector<AcquisitionDelayFeatureAdapter *> acquisitionDelayFeatures;
|
||||||
|
|
||||||
|
RawUSBBusAccessFeatureAdapter *getRawUSBBusAccessFeatureByID(long featureID);
|
||||||
|
SerialNumberFeatureAdapter *getSerialNumberFeatureByID(long featureID);
|
||||||
|
SpectrometerFeatureAdapter *getSpectrometerFeatureByID(long featureID);
|
||||||
|
ThermoElectricCoolerFeatureAdapter *getTECFeatureByID(long featureID);
|
||||||
|
IrradCalFeatureAdapter *getIrradCalFeatureByID(long featureID);
|
||||||
|
EEPROMFeatureAdapter *getEEPROMFeatureByID(long featureID);
|
||||||
|
LightSourceFeatureAdapter *getLightSourceFeatureByID(long featureID);
|
||||||
|
StrobeLampFeatureAdapter *getStrobeLampFeatureByID(long featureID);
|
||||||
|
ContinuousStrobeFeatureAdapter *getContinuousStrobeFeatureByID(long featureID);
|
||||||
|
ShutterFeatureAdapter *getShutterFeatureByID(long featureID);
|
||||||
|
NonlinearityCoeffsFeatureAdapter *getNonlinearityCoeffsFeatureByID(long featureID);
|
||||||
|
TemperatureFeatureAdapter *getTemperatureFeatureByID(long featureID);
|
||||||
|
RevisionFeatureAdapter *getRevisionFeatureByID(long featureID);
|
||||||
|
OpticalBenchFeatureAdapter *getOpticalBenchFeatureByID(long featureID);
|
||||||
|
SpectrumProcessingFeatureAdapter *getSpectrumProcessingFeatureByID(long featureID);
|
||||||
|
StrayLightCoeffsFeatureAdapter *getStrayLightCoeffsFeatureByID(long featureID);
|
||||||
|
PixelBinningFeatureAdapter *getPixelBinningFeatureByID(long featureID);
|
||||||
|
DataBufferFeatureAdapter *getDataBufferFeatureByID(long featureID);
|
||||||
|
AcquisitionDelayFeatureAdapter *getAcquisitionDelayFeatureByID(long featureID);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file EEPROMFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze EEPROMFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_EEPROMFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_EEPROMFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/eeprom_slots/EEPROMSlotFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class EEPROMFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<EEPROMSlotFeatureInterface> {
|
||||||
|
public:
|
||||||
|
EEPROMFeatureAdapter(EEPROMSlotFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~EEPROMFeatureAdapter();
|
||||||
|
|
||||||
|
/* EEPROM functions */
|
||||||
|
int readEEPROMSlot(int *errorCode, int slotNumber,
|
||||||
|
unsigned char *buffer, int bufferLength);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureAdapterInterface.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This interface allows device features to be treated
|
||||||
|
* consistently regardless of the actual capabilities.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_FEATUREADAPTERINTERFACE_H
|
||||||
|
#define SEABREEZE_FEATUREADAPTERINTERFACE_H
|
||||||
|
|
||||||
|
#include "common/features/FeatureFamily.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class FeatureAdapterInterface {
|
||||||
|
public:
|
||||||
|
virtual ~FeatureAdapterInterface() = 0;
|
||||||
|
|
||||||
|
/* This gets a semi-unique integer ID for this feature instance */
|
||||||
|
virtual long getID() = 0;
|
||||||
|
|
||||||
|
/* Gets the general category of the feature, if any */
|
||||||
|
virtual FeatureFamily &getFeatureFamily() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Default empty destructor for otherwise abstract class */
|
||||||
|
inline FeatureAdapterInterface::~FeatureAdapterInterface() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,87 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureAdapterTemplate.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a templated wrapper around SeaBreeze Feature
|
||||||
|
* instances. This should make it easier to obtain a
|
||||||
|
* particular Feature to call methods against.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef FEATUREADAPTERTEMPLATE_H
|
||||||
|
#define FEATUREADAPTERTEMPLATE_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterInterface.h"
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "common/exceptions/IllegalArgumentException.h"
|
||||||
|
#include "common/features/FeatureFamily.h"
|
||||||
|
#include "common/protocols/Protocol.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
template <class T> class FeatureAdapterTemplate
|
||||||
|
: public FeatureAdapterInterface {
|
||||||
|
public:
|
||||||
|
FeatureAdapterTemplate(T *featureInterface, const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex) {
|
||||||
|
this->feature = featureInterface;
|
||||||
|
this->family = f;
|
||||||
|
this->protocol = p;
|
||||||
|
this->bus = b;
|
||||||
|
this->index = instanceIndex;
|
||||||
|
|
||||||
|
/* Create a unique ID based on the feature type and index. This
|
||||||
|
* might be expanded in the future to use one of the bytes for
|
||||||
|
* the feature type or index as a module number.
|
||||||
|
*/
|
||||||
|
this->ID = (family.getType() << 16) | (instanceIndex & 0x00FFFF);
|
||||||
|
|
||||||
|
if(0 == this->feature || 0 == this->protocol || 0 == this->bus) {
|
||||||
|
std::string error("Null feature interface, protocol, or bus is not allowed.");
|
||||||
|
throw IllegalArgumentException(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
virtual ~FeatureAdapterTemplate() { /* Do nothing -- others delete feature */ }
|
||||||
|
T *getFeature() { return this->feature; }
|
||||||
|
|
||||||
|
virtual FeatureFamily &getFeatureFamily() { return this->family; }
|
||||||
|
|
||||||
|
virtual long getID() { return this->ID; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
T *feature;
|
||||||
|
FeatureFamily family;
|
||||||
|
Protocol *protocol;
|
||||||
|
Bus *bus;
|
||||||
|
unsigned short index;
|
||||||
|
unsigned long ID;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,200 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureFamilies.h
|
||||||
|
* @date February 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This provides a way to get references to different kinds
|
||||||
|
* of features (e.g. spectrometer, TEC) generically.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_FEATUREFAMILIES_H
|
||||||
|
#define SEABREEZE_FEATUREFAMILIES_H
|
||||||
|
|
||||||
|
#include "common/features/FeatureFamily.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class UndefinedFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
UndefinedFeatureFamily();
|
||||||
|
virtual ~UndefinedFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class SerialNumberFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
SerialNumberFeatureFamily();
|
||||||
|
virtual ~SerialNumberFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpectrometerFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
SpectrometerFeatureFamily();
|
||||||
|
virtual ~SpectrometerFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ThermoElectricFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
ThermoElectricFeatureFamily();
|
||||||
|
virtual ~ThermoElectricFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class IrradCalFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
IrradCalFeatureFamily();
|
||||||
|
virtual ~IrradCalFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EEPROMFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
EEPROMFeatureFamily();
|
||||||
|
virtual ~EEPROMFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class LightSourceFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
LightSourceFeatureFamily();
|
||||||
|
virtual ~LightSourceFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class StrobeLampFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
StrobeLampFeatureFamily();
|
||||||
|
virtual ~StrobeLampFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ContinuousStrobeFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
ContinuousStrobeFeatureFamily();
|
||||||
|
virtual ~ContinuousStrobeFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ShutterFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
ShutterFeatureFamily();
|
||||||
|
virtual ~ShutterFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class WaveCalFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
WaveCalFeatureFamily();
|
||||||
|
virtual ~WaveCalFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class NonlinearityCoeffsFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
NonlinearityCoeffsFeatureFamily();
|
||||||
|
virtual ~NonlinearityCoeffsFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TemperatureFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
TemperatureFeatureFamily();
|
||||||
|
virtual ~TemperatureFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RevisionFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
RevisionFeatureFamily();
|
||||||
|
virtual ~RevisionFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpticalBenchFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
OpticalBenchFeatureFamily();
|
||||||
|
virtual ~OpticalBenchFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpectrumProcessingFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
SpectrumProcessingFeatureFamily();
|
||||||
|
virtual ~SpectrumProcessingFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class StrayLightCoeffsFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
StrayLightCoeffsFeatureFamily();
|
||||||
|
virtual ~StrayLightCoeffsFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RawUSBBusAccessFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
RawUSBBusAccessFeatureFamily();
|
||||||
|
virtual ~RawUSBBusAccessFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class DataBufferFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
DataBufferFeatureFamily();
|
||||||
|
virtual ~DataBufferFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class AcquisitionDelayFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
AcquisitionDelayFeatureFamily();
|
||||||
|
virtual ~AcquisitionDelayFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class PixelBinningFeatureFamily : public FeatureFamily {
|
||||||
|
public:
|
||||||
|
PixelBinningFeatureFamily();
|
||||||
|
virtual ~PixelBinningFeatureFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class FeatureFamilies {
|
||||||
|
public:
|
||||||
|
const UndefinedFeatureFamily UNDEFINED;
|
||||||
|
const SerialNumberFeatureFamily SERIAL_NUMBER;
|
||||||
|
const SpectrometerFeatureFamily SPECTROMETER;
|
||||||
|
const ThermoElectricFeatureFamily THERMOELECTRIC;
|
||||||
|
const IrradCalFeatureFamily IRRAD_CAL;
|
||||||
|
const EEPROMFeatureFamily EEPROM;
|
||||||
|
const LightSourceFeatureFamily LIGHT_SOURCE;
|
||||||
|
const StrobeLampFeatureFamily STROBE_LAMP_ENABLE;
|
||||||
|
const ContinuousStrobeFeatureFamily CONTINUOUS_STROBE;
|
||||||
|
const ShutterFeatureFamily SHUTTER;
|
||||||
|
const WaveCalFeatureFamily WAVELENGTH_CAL;
|
||||||
|
const NonlinearityCoeffsFeatureFamily NONLINEARITY_COEFFS;
|
||||||
|
const TemperatureFeatureFamily TEMPERATURE;
|
||||||
|
const RevisionFeatureFamily REVISION;
|
||||||
|
const OpticalBenchFeatureFamily OPTICAL_BENCH;
|
||||||
|
const SpectrumProcessingFeatureFamily SPECTRUM_PROCESSING;
|
||||||
|
const StrayLightCoeffsFeatureFamily STRAY_LIGHT_COEFFS;
|
||||||
|
const RawUSBBusAccessFeatureFamily RAW_USB_BUS_ACCESS;
|
||||||
|
const DataBufferFeatureFamily DATA_BUFFER;
|
||||||
|
const AcquisitionDelayFeatureFamily ACQUISITION_DELAY;
|
||||||
|
const PixelBinningFeatureFamily PIXEL_BINNING;
|
||||||
|
|
||||||
|
FeatureFamilies();
|
||||||
|
~FeatureFamilies();
|
||||||
|
std::vector<FeatureFamily *> getAllFeatureFamilies();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file IrradCalFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze IrradCalFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_IRRADCALFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_IRRADCALFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/irradcal/IrradCalFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class IrradCalFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<IrradCalFeatureInterface> {
|
||||||
|
public:
|
||||||
|
IrradCalFeatureAdapter(IrradCalFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~IrradCalFeatureAdapter();
|
||||||
|
|
||||||
|
int readIrradCalibration(int *errorCode, float *buffer,
|
||||||
|
int bufferLength);
|
||||||
|
int writeIrradCalibration(int *errorCode, float *buffer,
|
||||||
|
int bufferLength);
|
||||||
|
int hasIrradCollectionArea(int *errorCode);
|
||||||
|
float readIrradCollectionArea(int *errorCode);
|
||||||
|
void writeIrradCollectionArea(int *errorCode, float area);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,69 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file LightSourceFeatureAdapter.h
|
||||||
|
* @date May 2013
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze LightSourceFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_LIGHTSOURCEFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_LIGHTSOURCEFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/light_source/LightSourceFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class LightSourceFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<LightSourceFeatureInterface> {
|
||||||
|
public:
|
||||||
|
LightSourceFeatureAdapter(LightSourceFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~LightSourceFeatureAdapter();
|
||||||
|
|
||||||
|
int getLightSourceCount(int *errorCode);
|
||||||
|
|
||||||
|
bool hasLightSourceEnable(int *errorCode, int lightSourceIndex);
|
||||||
|
bool isLightSourceEnabled(int *errorCode, int lightSourceIndex);
|
||||||
|
void setLightSourceEnable(int *errorCode, int lightSourceIndex,
|
||||||
|
bool enable);
|
||||||
|
|
||||||
|
/* The intensity is normalized over the range [0, 1] where 0 is
|
||||||
|
* the minimum programmable intensity and 1 is the maximum
|
||||||
|
*/
|
||||||
|
bool hasVariableIntensity(int *errorCode, int lightSourceIndex);
|
||||||
|
double getLightSourceIntensity(int *errorCode, int lightSourceIndex);
|
||||||
|
void setLightSourceIntensity(int *errorCode, int lightSourceIndex,
|
||||||
|
double intensity);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file NonlinearityCoeffsFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze NonlinearityCoeffFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_NONLINEARITYCOEFFSFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_NONLINEARITYCOEFFSFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/nonlinearity/NonlinearityCoeffsFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class NonlinearityCoeffsFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<NonlinearityCoeffsFeatureInterface> {
|
||||||
|
public:
|
||||||
|
NonlinearityCoeffsFeatureAdapter(NonlinearityCoeffsFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~NonlinearityCoeffsFeatureAdapter();
|
||||||
|
|
||||||
|
int readNonlinearityCoeffs(int *errorCode, double *buffer,
|
||||||
|
int bufferLength);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file OpticalBenchFeatureAdapter.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze TemperatureFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_OPTICALBENCHFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_OPTICALBENCHFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/optical_bench/OpticalBenchFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class OpticalBenchFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<OpticalBenchFeatureInterface> {
|
||||||
|
public:
|
||||||
|
OpticalBenchFeatureAdapter(OpticalBenchFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~OpticalBenchFeatureAdapter();
|
||||||
|
|
||||||
|
unsigned short int readOpticalBenchFiberDiameterMicrons(int *errorCode);
|
||||||
|
unsigned short int readOpticalBenchSlitWidthMicrons(int *errorCode);
|
||||||
|
int readOpticalBenchID(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
int readOpticalBenchSerialNumber(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
int readOpticalBenchCoating(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
int readOpticalBenchFilter(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
int readOpticalBenchGrating(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,68 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file PixelBinningFeatureAdapter.h
|
||||||
|
* @date October 2015
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows access to SeaBreeze
|
||||||
|
* TECFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_PIXEL_BINNING_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_PIXEL_BINNING_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/pixel_binning/PixelBinningFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class PixelBinningFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<PixelBinningFeatureInterface> {
|
||||||
|
public:
|
||||||
|
PixelBinningFeatureAdapter(PixelBinningFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~PixelBinningFeatureAdapter();
|
||||||
|
|
||||||
|
/* Thermoelectric cooler functions */
|
||||||
|
unsigned char getPixelBinningFactor(int *errorCode);
|
||||||
|
|
||||||
|
void setPixelBinningFactor(int *errorCode,
|
||||||
|
const unsigned char binningFactor);
|
||||||
|
|
||||||
|
unsigned char getDefaultPixelBinningFactor(int *errorCode);
|
||||||
|
|
||||||
|
void setDefaultPixelBinningFactor(int *errorCode,
|
||||||
|
const unsigned char binningFactor);
|
||||||
|
|
||||||
|
void setDefaultPixelBinningFactor(int *errorCode);
|
||||||
|
|
||||||
|
unsigned char getMaxPixelBinningFactor(int *errorCode);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,87 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file ProtocolFamilies.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides a way to describe different kinds
|
||||||
|
* protocols (e.g. OOI, OBP) generically.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_PROTOCOLFAMILIES_H
|
||||||
|
#define SEABREEZE_PROTOCOLFAMILIES_H
|
||||||
|
|
||||||
|
#include "common/protocols/ProtocolFamily.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class UndefinedProtocolFamily : public ProtocolFamily {
|
||||||
|
public:
|
||||||
|
UndefinedProtocolFamily();
|
||||||
|
virtual ~UndefinedProtocolFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class OOIProtocolFamily : public ProtocolFamily {
|
||||||
|
public:
|
||||||
|
OOIProtocolFamily();
|
||||||
|
virtual ~OOIProtocolFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class OceanBinaryProtocolFamily : public ProtocolFamily {
|
||||||
|
public:
|
||||||
|
OceanBinaryProtocolFamily();
|
||||||
|
virtual ~OceanBinaryProtocolFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class JazMessagingProtocolFamily : public ProtocolFamily {
|
||||||
|
public:
|
||||||
|
JazMessagingProtocolFamily();
|
||||||
|
virtual ~JazMessagingProtocolFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class VirtualProtocolFamily : public ProtocolFamily {
|
||||||
|
public:
|
||||||
|
VirtualProtocolFamily();
|
||||||
|
virtual ~VirtualProtocolFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProtocolFamilies {
|
||||||
|
public:
|
||||||
|
const UndefinedProtocolFamily UNDEFINED_PROTOCOL;
|
||||||
|
const OOIProtocolFamily OOI_PROTOCOL;
|
||||||
|
const OceanBinaryProtocolFamily OCEAN_BINARY_PROTOCOL;
|
||||||
|
const JazMessagingProtocolFamily JAZ_MESSAGING_PROTOCOL;
|
||||||
|
const VirtualProtocolFamily VIRTUAL_PROTOCOL;
|
||||||
|
|
||||||
|
ProtocolFamilies();
|
||||||
|
~ProtocolFamilies();
|
||||||
|
std::vector<ProtocolFamily *> getAllProtocolFamilies();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file RawUSBBusAccessFeatureAdapter.h
|
||||||
|
* @date February 2015
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze RawUSBBusAccessFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_RAWUSBBUSACCESSFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_RAWUSBBUSACCESSFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/raw_bus_access/RawUSBBusAccessFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class RawUSBBusAccessFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<RawUSBBusAccessFeatureInterface> {
|
||||||
|
public:
|
||||||
|
RawUSBBusAccessFeatureAdapter(RawUSBBusAccessFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~RawUSBBusAccessFeatureAdapter();
|
||||||
|
|
||||||
|
int readUSB(int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char usbEndpoint);
|
||||||
|
int writeUSB(int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char usbEndpoint);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file RevisionFeatureAdapter.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze RevisionFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_REVISIONFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_REVISIONFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/revision/RevisionFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class RevisionFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<RevisionFeatureInterface> {
|
||||||
|
public:
|
||||||
|
RevisionFeatureAdapter(RevisionFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~RevisionFeatureAdapter();
|
||||||
|
|
||||||
|
unsigned char readHardwareRevision(int *errorCode);
|
||||||
|
unsigned short int readFirmwareRevision(int *errorCode);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SeaBreezeAPIConstants.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This file defines constants for use with SeaBreeze API
|
||||||
|
* implementations.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
#ifndef SEABREEZEAPICONSTANTS_H
|
||||||
|
#define SEABREEZEAPICONSTANTS_H
|
||||||
|
|
||||||
|
/* Macros and constants */
|
||||||
|
#define SET_ERROR_CODE(code) do { if(NULL != errorCode) { *errorCode = code; } } while(0)
|
||||||
|
|
||||||
|
#ifdef ERROR_SUCCESS
|
||||||
|
#undef ERROR_SUCCESS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Constants */
|
||||||
|
#define ERROR_SUCCESS 0
|
||||||
|
#define ERROR_INVALID_ERROR 1
|
||||||
|
#define ERROR_NO_DEVICE 2
|
||||||
|
#define ERROR_FAILED_TO_CLOSE 3
|
||||||
|
#define ERROR_NOT_IMPLEMENTED 4
|
||||||
|
#define ERROR_FEATURE_NOT_FOUND 5
|
||||||
|
#define ERROR_TRANSFER_ERROR 6
|
||||||
|
#define ERROR_BAD_USER_BUFFER 7
|
||||||
|
#define ERROR_INPUT_OUT_OF_BOUNDS 8
|
||||||
|
#define ERROR_SPECTROMETER_SATURATED 9
|
||||||
|
#define ERROR_VALUE_NOT_FOUND 10
|
||||||
|
|
||||||
|
#endif /* SEABREEZEAPICONSTANTS_H */
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SerialNumberFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze SerialNumberFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_SERIALNUMBERFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_SERIALNUMBERFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/serial_number/SerialNumberFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class SerialNumberFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<SerialNumberFeatureInterface> {
|
||||||
|
public:
|
||||||
|
SerialNumberFeatureAdapter(SerialNumberFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~SerialNumberFeatureAdapter();
|
||||||
|
|
||||||
|
int getSerialNumber(int *errorCode, char *buffer, int buffer_length);
|
||||||
|
unsigned char getSerialNumberMaximumLength(int *errorCode);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file ShutterFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze ShutterFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_SHUTTERFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_SHUTTERFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/shutter/ShutterFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class ShutterFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<ShutterFeatureInterface> {
|
||||||
|
public:
|
||||||
|
ShutterFeatureAdapter(ShutterFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~ShutterFeatureAdapter();
|
||||||
|
|
||||||
|
void setShutterOpen(int *errorCode, bool open);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,74 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SpectrometerFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze OOISpectrometerFeature instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_SPECTROMETER_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_SPECTROMETER_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "common/protocols/Protocol.h"
|
||||||
|
#include "vendors/OceanOptics/features/spectrometer/OOISpectrometerFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class SpectrometerFeatureAdapter : public FeatureAdapterTemplate<OOISpectrometerFeatureInterface> {
|
||||||
|
public:
|
||||||
|
SpectrometerFeatureAdapter(
|
||||||
|
OOISpectrometerFeatureInterface *spec,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~SpectrometerFeatureAdapter();
|
||||||
|
|
||||||
|
/* Spectrometer commands */
|
||||||
|
int getUnformattedSpectrum(int *errorCode,
|
||||||
|
unsigned char *buffer, int bufferLength);
|
||||||
|
int getFormattedSpectrum(int *errorCode,
|
||||||
|
double* buffer, int bufferLength);
|
||||||
|
int getUnformattedSpectrumLength(int *errorCode);
|
||||||
|
int getFormattedSpectrumLength(int *errorCode);
|
||||||
|
void setTriggerMode(int *errorCode, int mode);
|
||||||
|
int getWavelengths(int *errorCode, double *wavelengths, int length);
|
||||||
|
int getElectricDarkPixelCount(int *errorCode);
|
||||||
|
int getElectricDarkPixelIndices(int *errorCode,
|
||||||
|
int *indices, int length);
|
||||||
|
void setIntegrationTimeMicros(int *errorCode,
|
||||||
|
unsigned long integrationTimeMicros);
|
||||||
|
long getMinimumIntegrationTimeMicros(int *errorCode);
|
||||||
|
long getMaximumIntegrationTimeMicros(int *errorCode);
|
||||||
|
double getMaximumIntensity(int *errorCode);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,60 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SpectrumProcessingFeatureAdapter.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze SpectrumProcessingFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_SPECTRUMPROCESSINGFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_SPECTRUMPROCESSINGFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/spectrum_processing/SpectrumProcessingFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class SpectrumProcessingFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<SpectrumProcessingFeatureInterface> {
|
||||||
|
public:
|
||||||
|
SpectrumProcessingFeatureAdapter(SpectrumProcessingFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~SpectrumProcessingFeatureAdapter();
|
||||||
|
|
||||||
|
unsigned char readSpectrumProcessingBoxcarWidth(int *errorCode);
|
||||||
|
unsigned short int readSpectrumProcessingScansToAverage(int *errorCode);
|
||||||
|
void writeSpectrumProcessingBoxcarWidth(int *errorCode, unsigned char boxcarWidth);
|
||||||
|
void writeSpectrumProcessingScansToAverage(int *errorCode, unsigned short int scansToAverage);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file StrayLightCoeffsFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze StrayLightCoeffFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_STRAYLIGHTCOEFFSFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_STRAYLIGHTCOEFFSFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/stray_light/StrayLightCoeffsFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class StrayLightCoeffsFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<StrayLightCoeffsFeatureInterface> {
|
||||||
|
public:
|
||||||
|
StrayLightCoeffsFeatureAdapter(StrayLightCoeffsFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~StrayLightCoeffsFeatureAdapter();
|
||||||
|
|
||||||
|
int readStrayLightCoeffs(int *errorCode, double *buffer,
|
||||||
|
int bufferLength);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file StrobeLampFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze StrobeLampFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_STROBELAMPFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_STROBELAMPFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/light_source/StrobeLampFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class StrobeLampFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<StrobeLampFeatureInterface> {
|
||||||
|
public:
|
||||||
|
StrobeLampFeatureAdapter(StrobeLampFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~StrobeLampFeatureAdapter();
|
||||||
|
|
||||||
|
void setStrobeLampEnable(int *errorCode, bool enable);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file TemperatureFeatureAdapter.h
|
||||||
|
* @date January 2015
|
||||||
|
* @author Ocean Optics, Inc., Kirk Clendinning, Heliospectra
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows
|
||||||
|
* access to SeaBreeze TemperatureFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2015, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_TEMPERATUREFEATUREADAPTER_H
|
||||||
|
#define SEABREEZE_TEMPERATUREFEATUREADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/temperature/TemperatureFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class TemperatureFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<TemperatureFeatureInterface> {
|
||||||
|
public:
|
||||||
|
TemperatureFeatureAdapter(TemperatureFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~TemperatureFeatureAdapter();
|
||||||
|
|
||||||
|
unsigned char readTemperatureCount(int *errorCode);
|
||||||
|
double readTemperature(int *errorCode, int index);
|
||||||
|
int readAllTemperatures(int *errorCode, double *buffer, int bufferLength);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,61 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file ThermoElectricCoolerFeatureAdapter.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a wrapper that allows access to SeaBreeze
|
||||||
|
* TECFeatureInterface instances.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_THERMO_ELECTRIC_COOLER_FEATURE_ADAPTER_H
|
||||||
|
#define SEABREEZE_THERMO_ELECTRIC_COOLER_FEATURE_ADAPTER_H
|
||||||
|
|
||||||
|
#include "api/seabreezeapi/FeatureAdapterTemplate.h"
|
||||||
|
#include "vendors/OceanOptics/features/thermoelectric/ThermoElectricFeatureInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
namespace api {
|
||||||
|
|
||||||
|
class ThermoElectricCoolerFeatureAdapter
|
||||||
|
: public FeatureAdapterTemplate<ThermoElectricFeatureInterface> {
|
||||||
|
public:
|
||||||
|
ThermoElectricCoolerFeatureAdapter(ThermoElectricFeatureInterface *intf,
|
||||||
|
const FeatureFamily &f,
|
||||||
|
Protocol *p, Bus *b, unsigned short instanceIndex);
|
||||||
|
virtual ~ThermoElectricCoolerFeatureAdapter();
|
||||||
|
|
||||||
|
/* Thermoelectric cooler functions */
|
||||||
|
double readTECTemperature(int *errorCode);
|
||||||
|
void setTECTemperature(int *errorCode,
|
||||||
|
double temperature_degrees_celsius);
|
||||||
|
void setTECEnable(int *errorCode, bool tecEnable);
|
||||||
|
void setTECFanEnable(int *errorCode, bool tecFanEnable);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file ByteVector.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_BYTEVECTOR_H
|
||||||
|
#define SEABREEZE_BYTEVECTOR_H
|
||||||
|
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/Data.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class ByteVector : public Data {
|
||||||
|
public:
|
||||||
|
ByteVector();
|
||||||
|
/* Constructor that makes a copy of the given vector for internal use */
|
||||||
|
ByteVector(const std::vector<byte> &that);
|
||||||
|
virtual ~ByteVector();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
|
||||||
|
/* Get the data associated with this instance */
|
||||||
|
std::vector<byte> &getByteVector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<byte> *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
62
othersoft/shuttercali/source/OSIF/include/common/Data.h
Normal file
62
othersoft/shuttercali/source/OSIF/include/common/Data.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file Data.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a sort of a wrapper class that can encapsulate
|
||||||
|
* different kinds of data that may be returned as the
|
||||||
|
* result of a protocol transfer. The idea is that the
|
||||||
|
* data being passed back up from the device probably needs
|
||||||
|
* to be in some specific form, but we need to be able
|
||||||
|
* to convert it to whatever the receiver can use.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_DATA_H
|
||||||
|
#define SEABREEZE_DATA_H
|
||||||
|
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/UnitDescriptor.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
public:
|
||||||
|
Data();
|
||||||
|
virtual ~Data();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DoubleVector.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_DOUBLEVECTOR_H
|
||||||
|
#define SEABREEZE_DOUBLEVECTOR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/Data.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class DoubleVector : public Data {
|
||||||
|
public:
|
||||||
|
DoubleVector();
|
||||||
|
DoubleVector(const std::vector<double> &that);
|
||||||
|
virtual ~DoubleVector();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
|
||||||
|
/* Get the data associated with this instance */
|
||||||
|
std::vector<double> &getDoubleVector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<double> *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FloatVector.h
|
||||||
|
* @date March 2010
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_FLOATVECTOR_H
|
||||||
|
#define SEABREEZE_FLOATVECTOR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/Data.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class FloatVector : public Data {
|
||||||
|
public:
|
||||||
|
FloatVector();
|
||||||
|
FloatVector(const std::vector<float> &that);
|
||||||
|
virtual ~FloatVector();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
|
||||||
|
/* Get the data associated with this instance */
|
||||||
|
std::vector<float> &getFloatVector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<float> *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
132
othersoft/shuttercali/source/OSIF/include/common/Log.h
Normal file
132
othersoft/shuttercali/source/OSIF/include/common/Log.h
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/**
|
||||||
|
@file Log.h
|
||||||
|
@brief Interface to Log
|
||||||
|
@author Mark Zieg <mark.zieg@oceanoptics.com>
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
|
||||||
|
SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject
|
||||||
|
to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_LOG_H
|
||||||
|
#define SEABREEZE_LOG_H
|
||||||
|
|
||||||
|
#include "api/DllDecl.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stack>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef OOI_DEBUG
|
||||||
|
#define OOI_LOG_PRINT 1
|
||||||
|
#else
|
||||||
|
#define OOI_LOG_PRINT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief instantiate logger in the current function
|
||||||
|
* @param s (Input) function name (typically __FUNCTION__)
|
||||||
|
*/
|
||||||
|
#define LOG(s) Log logger(s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief log a printf string (and optional arguments) if debugging is enabled
|
||||||
|
* @note double parens: call as LOG_DEBUG(("variable x is %d, y is %f", x, y));
|
||||||
|
* @see http://stackoverflow.com/questions/1644868/c-define-macro-for-debug-printing
|
||||||
|
*/
|
||||||
|
#define LOG_DEBUG(s) do { if (OOI_LOG_PRINT) logger.debug s; } while (0)
|
||||||
|
|
||||||
|
//! @see LOG_DEBUG
|
||||||
|
#define LOG_INFO(s) do { if (OOI_LOG_PRINT) logger.info s; } while (0)
|
||||||
|
|
||||||
|
//! @see LOG_DEBUG
|
||||||
|
#define LOG_WARN(s) do { if (OOI_LOG_PRINT) logger.warn s; } while (0)
|
||||||
|
|
||||||
|
//! @see LOG_DEBUG
|
||||||
|
#define LOG_ERROR(s) do { if (OOI_LOG_PRINT) logger.error s; } while (0)
|
||||||
|
|
||||||
|
#define OOI_LOG_LEVEL_NEVER 0
|
||||||
|
#define OOI_LOG_LEVEL_ERROR 1
|
||||||
|
#define OOI_LOG_LEVEL_WARN 2
|
||||||
|
#define OOI_LOG_LEVEL_INFO 3
|
||||||
|
#define OOI_LOG_LEVEL_DEBUG 4
|
||||||
|
#define OOI_LOG_LEVEL_TRACE 5
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Simple logger for OOI applications.
|
||||||
|
* @todo Provide better thread support (hard to tell what thread model
|
||||||
|
* the caller may be using...)
|
||||||
|
* @todo Provide flat C interface (e.g. for NativeUSBWinUSB.c, test apps)
|
||||||
|
*
|
||||||
|
* Provides automatic heirarchical call-stack indentation.
|
||||||
|
*/
|
||||||
|
class DLL_DECL Log
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Log(const char *s);
|
||||||
|
~Log();
|
||||||
|
|
||||||
|
// public class methods
|
||||||
|
static void setLogLevel(int lvl);
|
||||||
|
static void setLogLevel(const std::string& s);
|
||||||
|
static void setLogFile(void *f);
|
||||||
|
|
||||||
|
// public instance methods
|
||||||
|
void debug(const char *fmt, ...);
|
||||||
|
void info (const char *fmt, ...);
|
||||||
|
void warn (const char *fmt, ...);
|
||||||
|
void error(const char *fmt, ...);
|
||||||
|
|
||||||
|
// these must be public for C interface to work
|
||||||
|
static unsigned logLevel;
|
||||||
|
void formatAndSend(int lvl, const char *lvlName,
|
||||||
|
const char *separator, const char *fmt, va_list args);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// private class attributes
|
||||||
|
static FILE *logFile;
|
||||||
|
static std::stack<std::string>* callstack;
|
||||||
|
|
||||||
|
// private instance methods
|
||||||
|
void trace(const char *fmt, ...);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
// We need the flattened C interface if we want to call from Cygwin (mainly
|
||||||
|
// to set log level)...see http://cygwin.com/ml/cygwin/2006-04/msg00251.html
|
||||||
|
void DLL_DECL seabreeze_log_set_level_int(int lvl);
|
||||||
|
void DLL_DECL seabreeze_log_set_level_string(const char *s);
|
||||||
|
void DLL_DECL seabreeze_log_debug(const char *fmt, ...);
|
||||||
|
void DLL_DECL seabreeze_log_info (const char *fmt, ...);
|
||||||
|
void DLL_DECL seabreeze_log_warn (const char *fmt, ...);
|
||||||
|
void DLL_DECL seabreeze_log_error(const char *fmt, ...);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif
|
45
othersoft/shuttercali/source/OSIF/include/common/SeaBreeze.h
Normal file
45
othersoft/shuttercali/source/OSIF/include/common/SeaBreeze.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file SeaBreeze.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides some project-wide constants and definitions.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_H
|
||||||
|
#define SEABREEZE_H
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
|
/* Visual studio does not implement declared exception
|
||||||
|
* specification but accepts it with a warning. This
|
||||||
|
* suppresses the warning (4290).
|
||||||
|
*/
|
||||||
|
#pragma warning( disable : 4290 )
|
||||||
|
#endif /* WINDOWS */
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_H */
|
77
othersoft/shuttercali/source/OSIF/include/common/U32Vector.h
Normal file
77
othersoft/shuttercali/source/OSIF/include/common/U32Vector.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file U32Vector.h
|
||||||
|
* @date September 2013
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_U32VECTOR_H
|
||||||
|
#define SEABREEZE_U32VECTOR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/Data.h"
|
||||||
|
|
||||||
|
/* This class requires a 32-bit integer type. This will need a little help
|
||||||
|
* to know what the target machine is, so this tries to work it out.
|
||||||
|
*/
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* Visual Studio */
|
||||||
|
typedef __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
#else
|
||||||
|
/* C99 compatible */
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class U32Vector : public Data {
|
||||||
|
public:
|
||||||
|
U32Vector();
|
||||||
|
/* Constructor that makes a copy of the given vector for internal use */
|
||||||
|
U32Vector(const std::vector<uint32_t> &that);
|
||||||
|
U32Vector(unsigned int length);
|
||||||
|
virtual ~U32Vector();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
|
||||||
|
/* Get the data associated with this instance */
|
||||||
|
std::vector<uint32_t> &getU32Vector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<uint32_t> *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,64 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file UShortVector.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_USHORTVECTOR_H
|
||||||
|
#define SEABREEZE_USHORTVECTOR_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/Data.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class UShortVector : public Data {
|
||||||
|
public:
|
||||||
|
UShortVector();
|
||||||
|
/* Constructor that makes a copy of the given vector for internal use */
|
||||||
|
UShortVector(const std::vector<unsigned short> &that);
|
||||||
|
UShortVector(unsigned int length);
|
||||||
|
virtual ~UShortVector();
|
||||||
|
/* Dimensionality of data. 0 for scalar, 1 for vector,
|
||||||
|
* 2 for a pair of related vectors (e.g. [X, Y] or matrix),
|
||||||
|
* 3 for 3D, etc.
|
||||||
|
*/
|
||||||
|
virtual int getNumberOfDimensions();
|
||||||
|
|
||||||
|
/* Get all of the unit descriptors associated with this Data. */
|
||||||
|
virtual std::vector<UnitDescriptor *> *getUnits();
|
||||||
|
|
||||||
|
/* Get the data associated with this instance */
|
||||||
|
std::vector<unsigned short> &getUShortVector();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<unsigned short> *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,46 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file UnitDescriptor.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_UNITDESCRIPTOR_H
|
||||||
|
#define SEABREEZE_UNITDESCRIPTOR_H
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class UnitDescriptor {
|
||||||
|
public:
|
||||||
|
UnitDescriptor();
|
||||||
|
~UnitDescriptor();
|
||||||
|
|
||||||
|
/* FIXME: need to define unit property getters */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
66
othersoft/shuttercali/source/OSIF/include/common/buses/Bus.h
Normal file
66
othersoft/shuttercali/source/OSIF/include/common/buses/Bus.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file Bus.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides a base class for all sorts of buses. A bus
|
||||||
|
* is a mechanism for transferring a stream of data from one
|
||||||
|
* point to another. The bus does not concern itself with the
|
||||||
|
* contents of the data stream. At most, it may use hints to
|
||||||
|
* determine how a particular message will be moved if this
|
||||||
|
* is necessary to complete the operation.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_BUS_H
|
||||||
|
#define SEABREEZE_BUS_H
|
||||||
|
|
||||||
|
#include "common/protocols/ProtocolHint.h"
|
||||||
|
#include "common/buses/TransferHelper.h"
|
||||||
|
#include "common/buses/BusFamily.h"
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include "common/exceptions/IllegalArgumentException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class Bus {
|
||||||
|
public:
|
||||||
|
Bus();
|
||||||
|
virtual ~Bus();
|
||||||
|
virtual TransferHelper *getHelper(const std::vector<ProtocolHint *> &hints) const = 0;
|
||||||
|
virtual BusFamily getBusFamily() const = 0;
|
||||||
|
/* Associate this Bus instance with a particular device location.
|
||||||
|
* This MUST be done before open or close can be used.
|
||||||
|
*/
|
||||||
|
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||||
|
throw (IllegalArgumentException) = 0;
|
||||||
|
virtual bool open() = 0;
|
||||||
|
virtual void close() = 0;
|
||||||
|
virtual DeviceLocatorInterface *getLocation() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,86 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file BusFamilies.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides a way to get references to different kinds of buses
|
||||||
|
* (e.g. USB, Ethernet, serial) generically.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef BUSFAMILIES_H
|
||||||
|
#define BUSFAMILIES_H
|
||||||
|
|
||||||
|
#include "common/buses/BusFamily.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class USBBusFamily : public BusFamily {
|
||||||
|
public:
|
||||||
|
USBBusFamily();
|
||||||
|
virtual ~USBBusFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EthernetBusFamily : public BusFamily {
|
||||||
|
public:
|
||||||
|
EthernetBusFamily();
|
||||||
|
virtual ~EthernetBusFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class RS232BusFamily : public BusFamily {
|
||||||
|
public:
|
||||||
|
RS232BusFamily();
|
||||||
|
virtual ~RS232BusFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TCPIPv4BusFamily : public BusFamily {
|
||||||
|
public:
|
||||||
|
TCPIPv4BusFamily();
|
||||||
|
virtual ~TCPIPv4BusFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class UDPIPv4BusFamily : public BusFamily {
|
||||||
|
public:
|
||||||
|
UDPIPv4BusFamily();
|
||||||
|
virtual ~UDPIPv4BusFamily();
|
||||||
|
};
|
||||||
|
|
||||||
|
class BusFamilies {
|
||||||
|
public:
|
||||||
|
const USBBusFamily USB;
|
||||||
|
const EthernetBusFamily ETHERNET;
|
||||||
|
const RS232BusFamily RS232;
|
||||||
|
const TCPIPv4BusFamily TCPIPv4;
|
||||||
|
const UDPIPv4BusFamily UDPIPv4;
|
||||||
|
|
||||||
|
BusFamilies();
|
||||||
|
~BusFamilies();
|
||||||
|
std::vector<BusFamily *> getAllBusFamilies();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BUSFAMILIES_H */
|
@ -0,0 +1,54 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file BusFamily.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides a way to describe different kinds of buses
|
||||||
|
* (e.g. USB, Ethernet, serial) generically.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
#ifndef BUSFAMILY_H
|
||||||
|
#define BUSFAMILY_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
class BusFamily {
|
||||||
|
public:
|
||||||
|
virtual ~BusFamily();
|
||||||
|
virtual std::string getName() const;
|
||||||
|
virtual bool equals(const BusFamily &that);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BusFamily(std::string name, int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string busName;
|
||||||
|
int type;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BUSFAMILY_H */
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DeviceLocationProberInterface.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* DeviceLocatorInterface provides a base interface for
|
||||||
|
* classes that allow the location of a device to be
|
||||||
|
* probed in a bus-specific way.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef DEVICELOCATIONPROBERINTERFACE_H
|
||||||
|
#define DEVICELOCATIONPROBERINTERFACE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class DeviceLocationProberInterface {
|
||||||
|
public:
|
||||||
|
virtual ~DeviceLocationProberInterface() = 0;
|
||||||
|
|
||||||
|
/* Report how many devices of this type are available */
|
||||||
|
virtual std::vector<DeviceLocatorInterface *> *probeDevices() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DeviceLocationProberInterface();
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Default implementation for (otherwise) pure virtual destructor */
|
||||||
|
inline DeviceLocationProberInterface::~DeviceLocationProberInterface() {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DEVICELOCATIONPROBERINTERFACE_H */
|
@ -0,0 +1,82 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file DeviceLocatorInterface.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* DeviceLocatorInterface provides a base interface for
|
||||||
|
* classes that allow the location of a device to be
|
||||||
|
* specified in a bus-specific way. For instance, a
|
||||||
|
* USB DeviceLocator might include a device path or
|
||||||
|
* index, and a socket DeviceLocator might include an
|
||||||
|
* IP address and port number. This allows
|
||||||
|
* devices that cannot be identified by probing to still
|
||||||
|
* be found easily.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef DEVICELOCATORINTERFACE_H
|
||||||
|
#define DEVICELOCATORINTERFACE_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "common/buses/BusFamily.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class DeviceLocatorInterface {
|
||||||
|
public:
|
||||||
|
virtual ~DeviceLocatorInterface() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a unique identifier for this location. This can be any value
|
||||||
|
* as long as it is globally unique.
|
||||||
|
*/
|
||||||
|
virtual unsigned long getUniqueLocation() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether this DeviceLocator refers to the same device
|
||||||
|
* as another.
|
||||||
|
*/
|
||||||
|
virtual bool equals(DeviceLocatorInterface &that) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a human-readable string that describes the location
|
||||||
|
*/
|
||||||
|
virtual std::string getDescription() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a description of the type of bus that the device is associated with
|
||||||
|
*/
|
||||||
|
virtual BusFamily getBusFamily() const = 0;
|
||||||
|
|
||||||
|
/* Get an exact copy of this instance */
|
||||||
|
virtual DeviceLocatorInterface *clone() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Default implementation for (otherwise) pure virtual destructor */
|
||||||
|
inline DeviceLocatorInterface::~DeviceLocatorInterface() {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DEVICELOCATORINTERFACE_H */
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file TransferHelper.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is effectively an interface for wrappers around bus
|
||||||
|
* activity. These wrappers may be selected from a Bus
|
||||||
|
* based on certain hints provided by a Protocol or its
|
||||||
|
* various Exchanges. All that this specifies is that a
|
||||||
|
* given object must be able to send() and receive() data
|
||||||
|
* across its particular (encapsulated) Bus.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_TRANSFERHELPER_H
|
||||||
|
#define SEABREEZE_TRANSFERHELPER_H
|
||||||
|
|
||||||
|
#include "common/SeaBreeze.h"
|
||||||
|
#include "common/exceptions/BusTransferException.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class TransferHelper {
|
||||||
|
public:
|
||||||
|
TransferHelper();
|
||||||
|
virtual ~TransferHelper();
|
||||||
|
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||||
|
throw (BusTransferException) = 0;
|
||||||
|
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||||
|
throw (BusTransferException) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,75 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file IPv4NetworkProtocol.h
|
||||||
|
* @date February 2016
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2016, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_IPV4NETWORKPROTOCOL_H
|
||||||
|
#define SEABREEZE_IPV4NETWORKPROTOCOL_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
class IPv4NetworkProtocol {
|
||||||
|
public:
|
||||||
|
virtual ~IPv4NetworkProtocol();
|
||||||
|
virtual std::string getName() const;
|
||||||
|
virtual bool equals(const IPv4NetworkProtocol &that) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IPv4NetworkProtocol(std::string name, int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string protocolName;
|
||||||
|
int type;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TCP_IPv4 : public IPv4NetworkProtocol {
|
||||||
|
public:
|
||||||
|
TCP_IPv4();
|
||||||
|
virtual ~TCP_IPv4();
|
||||||
|
};
|
||||||
|
|
||||||
|
class UDP_IPv4 : public IPv4NetworkProtocol {
|
||||||
|
public:
|
||||||
|
UDP_IPv4();
|
||||||
|
virtual ~UDP_IPv4();
|
||||||
|
};
|
||||||
|
|
||||||
|
class IPv4NetworkProtocols {
|
||||||
|
public:
|
||||||
|
const TCP_IPv4 TCP_IP4;
|
||||||
|
const UDP_IPv4 UDP_IP4;
|
||||||
|
|
||||||
|
IPv4NetworkProtocols();
|
||||||
|
~IPv4NetworkProtocols();
|
||||||
|
std::vector<IPv4NetworkProtocol *> getAllIPv4NetworkProtocols();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_IPV4NETWORKPROTOCOL_H */
|
||||||
|
|
@ -0,0 +1,66 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file IPv4SocketDeviceLocator.h
|
||||||
|
* @date February 2016
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2016, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_IPV4SOCKETDEVICELOCATOR_H
|
||||||
|
#define SEABREEZE_IPV4SOCKETDEVICELOCATOR_H
|
||||||
|
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include "common/buses/network/IPv4NetworkProtocol.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
class IPv4SocketDeviceLocator : public DeviceLocatorInterface {
|
||||||
|
public:
|
||||||
|
IPv4SocketDeviceLocator(const IPv4NetworkProtocol &proto, std::string ip,
|
||||||
|
int portNumber);
|
||||||
|
virtual ~IPv4SocketDeviceLocator();
|
||||||
|
|
||||||
|
std::string getIPv4Address();
|
||||||
|
int getPort();
|
||||||
|
IPv4NetworkProtocol getIPv4NetworkProtocol();
|
||||||
|
|
||||||
|
/* Inherited from DeviceLocatorInterface */
|
||||||
|
virtual unsigned long getUniqueLocation() const;
|
||||||
|
virtual bool equals(DeviceLocatorInterface &that);
|
||||||
|
virtual std::string getDescription();
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
virtual DeviceLocatorInterface *clone() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
unsigned long computeLocationHash();
|
||||||
|
|
||||||
|
IPv4NetworkProtocol protocol;
|
||||||
|
std::string ipAddr;
|
||||||
|
int port;
|
||||||
|
unsigned long locationHash;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_IPV4SOCKETDEVICELOCATOR_H */
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file TCPIPv4SocketBus.h
|
||||||
|
* @date February 2016
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2016, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_TCPIPV4SOCKETBUS_H
|
||||||
|
#define SEABREEZE_TCPIPV4SOCKETBUS_H
|
||||||
|
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "common/exceptions/IllegalArgumentException.h"
|
||||||
|
#include "native/network/Socket.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
class TCPIPv4SocketBus : public Bus {
|
||||||
|
public:
|
||||||
|
TCPIPv4SocketBus();
|
||||||
|
virtual ~TCPIPv4SocketBus();
|
||||||
|
|
||||||
|
virtual Socket *getSocketDescriptor();
|
||||||
|
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
|
||||||
|
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||||
|
throw (IllegalArgumentException);
|
||||||
|
virtual DeviceLocatorInterface *getLocation();
|
||||||
|
virtual TransferHelper *getHelper(
|
||||||
|
const std::vector<ProtocolHint *> &hints) const;
|
||||||
|
|
||||||
|
/* Pure virtual methods */
|
||||||
|
virtual bool open() = 0;
|
||||||
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void addHelper(ProtocolHint *hint, TransferHelper *helper);
|
||||||
|
void clearHelpers();
|
||||||
|
|
||||||
|
Socket *socket;
|
||||||
|
DeviceLocatorInterface *deviceLocator;
|
||||||
|
|
||||||
|
/* These vectors should really be in a map, but that didn't want to
|
||||||
|
* work easily. Since there will likely be about 2 entries in here,
|
||||||
|
* storing in a pair of vectors for now won't hurt anything.
|
||||||
|
*/
|
||||||
|
std::vector<ProtocolHint *> helperKeys;
|
||||||
|
std::vector<TransferHelper *> helperValues;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_TCPIPV4SOCKETBUS_H */
|
@ -0,0 +1,52 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file TCPIPv4SocketTransferHelper.h
|
||||||
|
* @date February 2016
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2016, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_TCPIPV4SOCKETTRANSFERHELPER_H
|
||||||
|
#define SEABREEZE_TCPIPV4SOCKETTRANSFERHELPER_H
|
||||||
|
|
||||||
|
#include "common/buses/TransferHelper.h"
|
||||||
|
#include "native/network/Socket.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
class TCPIPv4SocketTransferHelper : public TransferHelper {
|
||||||
|
public:
|
||||||
|
TCPIPv4SocketTransferHelper(Socket *sock);
|
||||||
|
virtual ~TCPIPv4SocketTransferHelper();
|
||||||
|
|
||||||
|
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||||
|
throw (BusTransferException);
|
||||||
|
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||||
|
throw (BusTransferException);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Socket *socket;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SEABREEZE_TCPIPV4SOCKETTRANSFERHELPER_H */
|
@ -0,0 +1,65 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file RS232DeviceLocator.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This class encapsulates the information needed to open
|
||||||
|
* a device on an RS232 bus.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef RS232DEVICELOCATOR_H
|
||||||
|
#define RS232DEVICELOCATOR_H
|
||||||
|
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class RS232DeviceLocator : public DeviceLocatorInterface {
|
||||||
|
public:
|
||||||
|
RS232DeviceLocator(std::string devicePath, int baudRate);
|
||||||
|
virtual ~RS232DeviceLocator();
|
||||||
|
|
||||||
|
std::string &getDevicePath();
|
||||||
|
int getBaudRate();
|
||||||
|
|
||||||
|
/* Inherited from DeviceLocatorInterface */
|
||||||
|
virtual unsigned long getUniqueLocation() const;
|
||||||
|
virtual bool equals(DeviceLocatorInterface &that);
|
||||||
|
virtual std::string getDescription();
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
virtual DeviceLocatorInterface *clone() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void computeLocationHash();
|
||||||
|
std::string devicePath;
|
||||||
|
int baudRate;
|
||||||
|
unsigned long locationHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* RS232DEVICELOCATOR_H */
|
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file RS232Interface.h
|
||||||
|
* @date April 2011
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef RS232INTERFACE_H
|
||||||
|
#define RS232INTERFACE_H
|
||||||
|
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "native/rs232/NativeRS232.h"
|
||||||
|
#include "native/rs232/RS232.h"
|
||||||
|
#include "common/exceptions/IllegalArgumentException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class RS232Interface : public Bus {
|
||||||
|
public:
|
||||||
|
RS232Interface();
|
||||||
|
virtual ~RS232Interface();
|
||||||
|
virtual RS232 *getRS232Descriptor();
|
||||||
|
virtual DeviceLocatorInterface *getLocation();
|
||||||
|
virtual void setLocation(const DeviceLocatorInterface &location)
|
||||||
|
throw (IllegalArgumentException);
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
|
||||||
|
/* Pure virtual methods */
|
||||||
|
virtual TransferHelper *getHelper(
|
||||||
|
const std::vector<ProtocolHint *> &hints) const = 0;
|
||||||
|
virtual bool open() = 0;
|
||||||
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
RS232 *rs232;
|
||||||
|
DeviceLocatorInterface *deviceLocator;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* RS232INTERFACE_H */
|
@ -0,0 +1,65 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file RS232TransferHelper.h
|
||||||
|
* @date April 2011
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This provides an abstraction around the RS232 bus.
|
||||||
|
* RS232 is pretty simple once the port is opened and
|
||||||
|
* configured, so this mostly just takes care of ensuring
|
||||||
|
* that all bytes are sent and received as required.
|
||||||
|
*
|
||||||
|
* This will effectively block on reads and writes until
|
||||||
|
* they are complete. A non-blocking transfer helper
|
||||||
|
* could be created to complement this if there was
|
||||||
|
* some need, but it is not clear who would be responsible
|
||||||
|
* for delayed reads or retransmits.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef RS232TRANSFERHELPER_H
|
||||||
|
#define RS232TRANSFERHELPER_H
|
||||||
|
|
||||||
|
#include "common/buses/TransferHelper.h"
|
||||||
|
#include "native/rs232/RS232.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class RS232TransferHelper : public TransferHelper {
|
||||||
|
public:
|
||||||
|
RS232TransferHelper(RS232 *rs232Descriptor);
|
||||||
|
virtual ~RS232TransferHelper();
|
||||||
|
|
||||||
|
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||||
|
throw (BusTransferException);
|
||||||
|
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||||
|
throw (BusTransferException);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
RS232 *rs232;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USBTRANSFERHELPER_H */
|
@ -0,0 +1,59 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file USBDeviceLocator.h
|
||||||
|
* @date February 2012
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This class encapsulates the information needed to open
|
||||||
|
* a device on a USB bus.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef USBDEVICELOCATOR_H
|
||||||
|
#define USBDEVICELOCATOR_H
|
||||||
|
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class USBDeviceLocator : public DeviceLocatorInterface {
|
||||||
|
public:
|
||||||
|
USBDeviceLocator(unsigned long ID);
|
||||||
|
virtual ~USBDeviceLocator();
|
||||||
|
|
||||||
|
/* Inherited from DeviceLocatorInterface */
|
||||||
|
virtual unsigned long getUniqueLocation() const;
|
||||||
|
virtual bool equals(DeviceLocatorInterface &that);
|
||||||
|
virtual std::string getDescription();
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
virtual DeviceLocatorInterface *clone() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned long deviceID;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USBDEVICELOCATOR_H */
|
@ -0,0 +1,64 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file USBInterface.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is an abstract base class intended to be an interface
|
||||||
|
* for USB control objects. This allows USB devices to
|
||||||
|
* be opened generically (just by providing the index of
|
||||||
|
* the device on the bus) without any concern for
|
||||||
|
* the vendor ID, product ID, or underlying USB implementation.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef USBINTERFACE_H
|
||||||
|
#define USBINTERFACE_H
|
||||||
|
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "native/usb/NativeUSB.h"
|
||||||
|
#include "native/usb/USB.h"
|
||||||
|
#include "common/exceptions/IllegalArgumentException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class USBInterface : public Bus {
|
||||||
|
public:
|
||||||
|
USBInterface();
|
||||||
|
virtual ~USBInterface();
|
||||||
|
virtual USB *getUSBDescriptor() const;
|
||||||
|
virtual DeviceLocatorInterface *getLocation();
|
||||||
|
virtual void setLocation(const DeviceLocatorInterface &location) throw (IllegalArgumentException);
|
||||||
|
virtual BusFamily getBusFamily() const;
|
||||||
|
virtual bool open() = 0;
|
||||||
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
USB *usb;
|
||||||
|
DeviceLocatorInterface *deviceLocator;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USBINTERFACE_H */
|
@ -0,0 +1,66 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file USBTransferHelper.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a TransferHelper intended for USB communications.
|
||||||
|
* Each USBTransferHelper must specify a sending and
|
||||||
|
* receiving endpoint, which will tend to vary according to
|
||||||
|
* the type of data transfer being conducted. This adapts
|
||||||
|
* the send() and receive() methods required of a TransferHelper
|
||||||
|
* according to a particular type of transfer, which may be
|
||||||
|
* inferred from a ProtocolHint.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef USBTRANSFERHELPER_H
|
||||||
|
#define USBTRANSFERHELPER_H
|
||||||
|
|
||||||
|
#include "common/buses/TransferHelper.h"
|
||||||
|
#include "native/usb/USB.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class USBTransferHelper : public TransferHelper {
|
||||||
|
public:
|
||||||
|
USBTransferHelper(USB *usbDescriptor, int sendEndpoint,
|
||||||
|
int receiveEndpoint);
|
||||||
|
USBTransferHelper(USB *usbDescriptor);
|
||||||
|
virtual ~USBTransferHelper();
|
||||||
|
|
||||||
|
virtual int receive(std::vector<byte> &buffer, unsigned int length)
|
||||||
|
throw (BusTransferException);
|
||||||
|
virtual int send(const std::vector<byte> &buffer, unsigned int length) const
|
||||||
|
throw (BusTransferException);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
USB *usb;
|
||||||
|
int sendEndpoint;
|
||||||
|
int receiveEndpoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USBTRANSFERHELPER_H */
|
@ -0,0 +1,129 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file Device.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a base class for all sorts of devices. A
|
||||||
|
* device is really just an aggregation of features
|
||||||
|
* with the protocols and buses required to access them.
|
||||||
|
* A Device is intended to represent a single discrete
|
||||||
|
* piece of equipment that may have several capabilities
|
||||||
|
* (features) inside. The device may communicate to the
|
||||||
|
* outside world via seqences of bytes (a protocol) that
|
||||||
|
* are transferred across a physical medium (the bus).
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef DEVICE_H
|
||||||
|
#define DEVICE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "common/buses/Bus.h"
|
||||||
|
#include "common/buses/BusFamily.h"
|
||||||
|
#include "common/buses/DeviceLocatorInterface.h"
|
||||||
|
#include "common/features/Feature.h"
|
||||||
|
#include "common/features/FeatureFamily.h"
|
||||||
|
#include "common/protocols/Protocol.h"
|
||||||
|
|
||||||
|
|
||||||
|
// usb endpoints are associated with a particular device.
|
||||||
|
typedef enum usbEndpointType
|
||||||
|
{
|
||||||
|
kEndpointTypePrimaryOut, // slow speed
|
||||||
|
kEndpointTypePrimaryIn, // slow speed
|
||||||
|
kEndpointTypeSecondaryOut, // could be high speed
|
||||||
|
kEndpointTypeSecondaryIn, // could be high speed
|
||||||
|
kEndpointTypeSecondaryIn2 // generally high speed
|
||||||
|
} usbEndpointType;
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class Device {
|
||||||
|
public:
|
||||||
|
Device();
|
||||||
|
virtual ~Device();
|
||||||
|
std::vector<Bus *> &getBuses();
|
||||||
|
std::vector<Feature *> &getFeatures();
|
||||||
|
std::vector<Protocol *> &getProtocols();
|
||||||
|
std::string &getName();
|
||||||
|
|
||||||
|
// get the usb endpoints, according to the endpointType enumerator,
|
||||||
|
// if the endpoint type is not used, a 0 is returned
|
||||||
|
// TODO: this should be delegated down into a Bus instance
|
||||||
|
// (e.g. found by getBusesByFamily()) for USB. It is inappropriate here.
|
||||||
|
unsigned char getEndpoint(int *errorCode, usbEndpointType endpointType);
|
||||||
|
|
||||||
|
/* This will allow the driver to probe the device and initialize itself
|
||||||
|
* based on what it finds there. This should be called shortly after
|
||||||
|
* open(). The Device instance should use the indicated Bus instance to
|
||||||
|
* communicate with the hardware and get everything set up. It can
|
||||||
|
* use any appropriate protocol or protocols that are valid for the Bus.
|
||||||
|
*/
|
||||||
|
virtual bool initialize(const Bus &bus);
|
||||||
|
|
||||||
|
/* Each instance of a device is assumed to be associated with a unique
|
||||||
|
* location on a bus. If the device is connected via multiple buses, then
|
||||||
|
* a special DeviceLocator and TransferHelper will have to hide those
|
||||||
|
* details. Otherwise, each connection to the device will be considered
|
||||||
|
* independent of all others.
|
||||||
|
*/
|
||||||
|
virtual DeviceLocatorInterface *getLocation();
|
||||||
|
virtual void setLocation(const DeviceLocatorInterface &loc);
|
||||||
|
|
||||||
|
virtual int open();
|
||||||
|
|
||||||
|
virtual void close();
|
||||||
|
|
||||||
|
virtual std::vector<Bus *> getBusesByFamily(BusFamily &family);
|
||||||
|
|
||||||
|
virtual seabreeze::ProtocolFamily getSupportedProtocol(
|
||||||
|
seabreeze::FeatureFamily family, BusFamily bus) = 0;
|
||||||
|
|
||||||
|
virtual std::vector<Protocol *> getProtocolsByFamily(
|
||||||
|
seabreeze::ProtocolFamily &family);
|
||||||
|
|
||||||
|
virtual Bus *getOpenedBus();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<Bus *> buses;
|
||||||
|
std::vector<Feature *> features;
|
||||||
|
std::vector<Protocol *> protocols;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
unsigned char usbEndpoint_primary_out;
|
||||||
|
unsigned char usbEndpoint_primary_in;
|
||||||
|
unsigned char usbEndpoint_secondary_out;
|
||||||
|
unsigned char usbEndpoint_secondary_in;
|
||||||
|
unsigned char usbEndpoint_secondary_in2;
|
||||||
|
|
||||||
|
|
||||||
|
DeviceLocatorInterface *location;
|
||||||
|
Bus *openedBus;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DEVICE_H */
|
@ -0,0 +1,49 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file BusConnectException.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This exception should be used when an error is
|
||||||
|
* encountered when trying to connect to a bus,
|
||||||
|
* generally a failed open() or socket connect() call, or
|
||||||
|
* a failed read() or write() due to an EOF.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef BUSCONNECTEXCEPTION_H
|
||||||
|
#define BUSCONNECTEXCEPTION_H
|
||||||
|
|
||||||
|
#include "common/exceptions/BusException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class BusConnectException : public BusException {
|
||||||
|
public:
|
||||||
|
BusConnectException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BUSCONNECTEXCEPTION_H */
|
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file BusException.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a base class for a family of exceptions that
|
||||||
|
* arise from errors in bus transfers. These may be thrown
|
||||||
|
* at the bus layer, and all exceptions thrown at
|
||||||
|
* that layer must extend this class so that they can be
|
||||||
|
* uniformly handled.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_BUSEXCEPTION_H
|
||||||
|
#define SEABREEZE_BUSEXCEPTION_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class BusException : public std::runtime_error {
|
||||||
|
public:
|
||||||
|
BusException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,48 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file BusTransferException.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This exception should be used when an error is
|
||||||
|
* encountered when trying to read from or write to
|
||||||
|
* a bus.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef BUSTRANSFEREXCEPTION_H
|
||||||
|
#define BUSTRANSFEREXCEPTION_H
|
||||||
|
|
||||||
|
#include "common/exceptions/BusException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class BusTransferException : public BusException {
|
||||||
|
public:
|
||||||
|
BusTransferException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BUSTRANSFEREXCEPTION_H */
|
@ -0,0 +1,47 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureControlException.h
|
||||||
|
* @date March 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This exception should be used when an error is
|
||||||
|
* encountered when trying to interact with a feature.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef FEATURECONTROLEXCEPTION_H
|
||||||
|
#define FEATURECONTROLEXCEPTION_H
|
||||||
|
|
||||||
|
#include "common/exceptions/FeatureException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class FeatureControlException : public FeatureException {
|
||||||
|
public:
|
||||||
|
FeatureControlException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FEATURECONTROLEXCEPTION_H */
|
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureException.h
|
||||||
|
* @date March 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is a base class for a family of exceptions that
|
||||||
|
* arise from errors in feature interaction. These may be thrown
|
||||||
|
* at the feature layer, and all exceptions thrown at
|
||||||
|
* that layer must extend this class so that they can be
|
||||||
|
* uniformly handled.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_FEATUREEXCEPTION_H
|
||||||
|
#define SEABREEZE_FEATUREEXCEPTION_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class FeatureException : public std::runtime_error {
|
||||||
|
public:
|
||||||
|
FeatureException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,48 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file FeatureProtocolNotFoundException.h
|
||||||
|
* @date February 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This exception should be used when a protocol is
|
||||||
|
* specified, but no matching implementation of that
|
||||||
|
* protocol can be found for a particular feature.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef FEATUREPROTOCOLNOTFOUNDEXCEPTION_H
|
||||||
|
#define FEATUREPROTOCOLNOTFOUNDEXCEPTION_H
|
||||||
|
|
||||||
|
#include "common/exceptions/FeatureException.h"
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class FeatureProtocolNotFoundException : public FeatureException {
|
||||||
|
public:
|
||||||
|
FeatureProtocolNotFoundException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FEATUREPROTOCOLNOTFOUNDEXCEPTION_H */
|
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file IllegalArgumentException.h
|
||||||
|
* @date March 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is an exception for use when a value is passed to
|
||||||
|
* a method that is not permitted. This may include
|
||||||
|
* specifying a parameter that is out of bounds or of
|
||||||
|
* the wrong type.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_ILLEGALARGUMENTEXCEPTION_H
|
||||||
|
#define SEABREEZE_ILLEGALARGUMENTEXCEPTION_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class IllegalArgumentException : public std::invalid_argument {
|
||||||
|
public:
|
||||||
|
IllegalArgumentException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,49 @@
|
|||||||
|
/***************************************************//**
|
||||||
|
* @file NumberFormatException.h
|
||||||
|
* @date March 2009
|
||||||
|
* @author Ocean Optics, Inc.
|
||||||
|
*
|
||||||
|
* This is an exception for use when a string is to be
|
||||||
|
* parsed into a number but the string does not contain
|
||||||
|
* a recognizable number.
|
||||||
|
*
|
||||||
|
* LICENSE:
|
||||||
|
*
|
||||||
|
* SeaBreeze Copyright (C) 2014, Ocean Optics Inc
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject
|
||||||
|
* to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
#ifndef SEABREEZE_NUMBERFORMATEXCEPTION_H
|
||||||
|
#define SEABREEZE_NUMBERFORMATEXCEPTION_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace seabreeze {
|
||||||
|
|
||||||
|
class NumberFormatException : public std::runtime_error {
|
||||||
|
public:
|
||||||
|
NumberFormatException(const std::string &error);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user