diff --git a/.gitignore b/.gitignore index aeaa683..6f373e1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ ################################################################################ /build +/.vs diff --git a/CmakeLists.txt b/CmakeLists.txt index 9e67dba..0d49eab 100644 --- a/CmakeLists.txt +++ b/CmakeLists.txt @@ -1,11 +1,26 @@ cmake_minimum_required(VERSION 3.3) + project(TowerOptoSifAndSpectral) + set(QT Core Network WebSockets SerialPort) + find_package(Qt5 REQUIRED ${QT}) -include_directories(./source/test) + + +file(GLOB_RECURSE HDR_LIST "source/*.h") +file(GLOB_RECURSE SRC_LIST "source/*.cpp") + + +include_directories("source/ATP") + add_executable( TowerOptoSifAndSpectral - main.cpp - ./source/test/test.cpp - ./source/test/test.h + main.cpp + ${HDR_LIST} + ${SRC_LIST} ) -qt5_use_modules(TowerOptoSifAndSpectral ${QT}) \ No newline at end of file +qt5_use_modules(TowerOptoSifAndSpectral ${QT}) + + + +#Qt5_DIR("C:\Qt\Qt5.9.0") +#include_directories("C:/Qt/Qt5.9.0/5.9/msvc2017_64/include") \ No newline at end of file diff --git a/main.cpp b/main.cpp index f84efa1..3d5f3bc 100644 --- a/main.cpp +++ b/main.cpp @@ -1,10 +1,19 @@ #include #include -#include "test.h" -int main() +#include +#include "ATPControl_Serial_QT.h" +#include +using namespace std; + +int main(int argc, char *argv[]) { - std::cout << "hello"; - int a=10; - QString ss; - std::cin >> a; -} \ No newline at end of file + QCoreApplication a(argc, argv); + + QString qstrTest="This is a test message"; + qDebug() << qstrTest; + + return a.exec(); +} + + + diff --git a/source/ATP/ATPControl_Serial_QT.cpp b/source/ATP/ATPControl_Serial_QT.cpp new file mode 100644 index 0000000..6ff2311 --- /dev/null +++ b/source/ATP/ATPControl_Serial_QT.cpp @@ -0,0 +1,11 @@ +#include "ATPControl_Serial_QT.h" + +ZZ_ATPControl_Serial_Qt::ZZ_ATPControl_Serial_Qt() +{ + +} + +ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt() +{ + +} diff --git a/source/ATP/ATPControl_Serial_QT.h b/source/ATP/ATPControl_Serial_QT.h new file mode 100644 index 0000000..4d11ee7 --- /dev/null +++ b/source/ATP/ATPControl_Serial_QT.h @@ -0,0 +1,31 @@ +#pragma once +#include "ZZ_Types.h" +using namespace ZZ_MISCDEF; +using namespace ZZ_MISCDEF::ATP; + +class ZZ_ATPControl_Serial_Qt +{ +public: + ZZ_ATPControl_Serial_Qt(); + virtual ~ZZ_ATPControl_Serial_Qt(); + +public: + int ATPInitialize( ZZ_U8 usIndex); + int ATPClose(); + + int SingleShot(ATPDataFrame &dfData); + int SingleShotDark(ATPDataFrame &dfData); + int SingleShotDeducted(ATPDataFrame &dfData); + + int SetExposureTime(int iExposureTimeInMS); + + int GetWaveLength(float *pfWaveLength); + int GetAttribute(); + int GetDeviceListInfo(); //use type name to enum + int GetDeviceTemperature(float &fTemperature); + + int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime); + +private: + int SendCommand(); +}; \ No newline at end of file diff --git a/source/ATP/ZZ_Types.h b/source/ATP/ZZ_Types.h new file mode 100644 index 0000000..e525b3b --- /dev/null +++ b/source/ATP/ZZ_Types.h @@ -0,0 +1,57 @@ +#pragma once + + +namespace ZZ_MISCDEF +{ + typedef unsigned char ZZ_U8; + typedef unsigned short int ZZ_U16; + typedef unsigned long int ZZ_U32; + + + namespace ATP + { + const int MAX_SPECTRUM_SIZE = 4096; + + const int GET_MODEBOARD_TEMP = 0x01; + const int GET_PN_NUMBER = 0x03; + const int GET_SN_NUMBER = 0x04; + const int GET_MANUFACTURE_DATA = 0x06; + const int GET_MANUFACTOR_INFO = 0x09; + const int GET_PIXEL_LENGTH = 0x0a; + const int GET_TEC_TEMP = 0x13; + const int SET_TEC_TEMP = 0x12; + const int GET_OPTICFLAT_TEMP = 0x35; + const int GET_CIRCUIT_BOARD_TEMP = 0x36; + const int SET_INTEGRAL_TIME = 0x14; + const int GET_INTEGRAL_TIME = 0x41; + const int GET_MAX_INTEGRAL_TIME = 0x42; + const int GET_MIN_INTEGRAL_TIME = 0x43; + const int ASYNCHRONOUS_COLLECT_DARK = 0x23; + const int ASYNCHRONOUS_START_COLLECTION = 0x16; + const int ASYNCHRONOUS_READ_DATA = 0x17; + const int SET_AVERAGE_NUMBER = 0x28; + const int SYNCHRONIZATION_GET_DATA = 0x1e; + const int SYNCHRONIZATION_GET_DARK = 0x2f; + const int EXTERNAL_TRIGGER_ENABLE = 0x1f; + const int SET_XENON_LAMP_DELAY_TIME = 0x24; + const int GET_WAVELENGTH_CALIBRATION_COFF = 0x55; + const int GET_STAT_OF_LAMPOUT = 0x60; + const int SET_GPIO = 0x61; + //const int SYNCHRONIZATION_GET_DARK = 0x23 + + enum Model + { + ATP1010 = 0, + ATP6500 + }; + + typedef struct tagATPDataFrame + { + unsigned short usExposureTime; + int iData[4096]; + float fTemperature; + double dTimes = 0; + }ATPDataFrame; + } + +}