完成框架目录和模块重构;新增核心、单例、工具、加密及框架 SDK;统一任务、相机和 RPC 接口,并增加离线检测、相机标定、备份恢复、版本管理、崩溃守护和心跳监控功能。
112 lines
3.7 KiB
C++
112 lines
3.7 KiB
C++
#ifndef Hd_CameraModule_3DKeyence_H
|
|
#define Hd_CameraModule_3DKeyence_H
|
|
|
|
#include <QtCore/qglobal.h>
|
|
#include <QByteArray>
|
|
#include <QDebug>
|
|
#include<iostream>
|
|
#include <Windows.h>
|
|
|
|
#include "LJX8_IF.h"
|
|
#include "LJX8_ErrorCode.h"
|
|
|
|
#include <subModuleBase.h>
|
|
|
|
#pragma comment(lib, "winmm.lib")
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
typedef struct {
|
|
int y_linenum;
|
|
float y_pitch_um;
|
|
int timeout_ms;
|
|
int use_external_batchStart;
|
|
} LJXA_ACQ_SETPARAM;
|
|
|
|
typedef struct {
|
|
int luminance_enabled;
|
|
int x_pointnum;
|
|
int y_linenum_acquired;
|
|
float x_pitch_um;
|
|
float y_pitch_um;
|
|
float z_pitch_um;
|
|
} LJXA_ACQ_GETPARAM;
|
|
|
|
|
|
const int MAX_LJXA_DEVICENUM = 6;
|
|
const int MAX_LJXA_XDATANUM = 3200;
|
|
const unsigned int BUFFER_FULL_COUNT = 30000;
|
|
|
|
static int _imageAvailable[MAX_LJXA_DEVICENUM] = { 0 };
|
|
static unsigned short* _luminanceBuf[MAX_LJXA_DEVICENUM] = { 0 };
|
|
static unsigned short* _heightBuf[MAX_LJXA_DEVICENUM] = { 0 };
|
|
static int _lastImageSizeHeight[MAX_LJXA_DEVICENUM];
|
|
|
|
class Hd_CameraModule_3DKeyence :public dsModuleBase
|
|
{
|
|
public:
|
|
Hd_CameraModule_3DKeyence();
|
|
virtual ~Hd_CameraModule_3DKeyence();
|
|
//从类中读数据到实例对象
|
|
bool readData(std::vector<cv::Mat>& mats, QByteArray& data);
|
|
//实例对象把数据写入到类
|
|
bool writeData(std::vector<cv::Mat>& mat, QByteArray& data);
|
|
bool initParas(QByteArray& initData);
|
|
bool run();
|
|
|
|
int LJXA_ACQ_OpenDevice(int lDeviceId, LJX8IF_ETHERNET_CONFIG* EthernetConfig, int HighSpeedPortNo);
|
|
//int LJXA_ACQ_StartAsync(int lDeviceId, LJXA_ACQ_SETPARAM* setParam);
|
|
//int LJXA_ACQ_AcquireAsync(int lDeviceId, unsigned short* heightImage, unsigned short* luminanceImage, LJXA_ACQ_SETPARAM* setParam, LJXA_ACQ_GETPARAM* getParam);
|
|
void LJXA_ACQ_CloseDevice(int lDeviceId);
|
|
|
|
bool decodeInitData(QByteArray byteArray, QVector<QByteArray>& vector_data);
|
|
bool InitHighSpeed();
|
|
bool checkStatus() {
|
|
return true;
|
|
}
|
|
private:
|
|
//int LJXA_ACQ_Acquire(int lDeviceId, unsigned short* heightImage, unsigned short* luminanceImage, LJXA_ACQ_SETPARAM* setParam, LJXA_ACQ_GETPARAM* getParam);
|
|
LJX8IF_HIGH_SPEED_PRE_START_REQ* startReq_ptr = nullptr;
|
|
LJX8IF_PROFILE_INFO* profileInfo_ptr = nullptr;
|
|
|
|
// Static variable
|
|
LJX8IF_ETHERNET_CONFIG _ethernetConfig[MAX_LJXA_DEVICENUM];
|
|
int _highSpeedPortNo[MAX_LJXA_DEVICENUM];
|
|
|
|
LJXA_ACQ_GETPARAM _getParam[MAX_LJXA_DEVICENUM];
|
|
|
|
int deviceId = 0; // Set "0" if you use only 1 head.
|
|
int xImageSize = 0; // Number of X points.
|
|
int yImageSize = 0; // Number of Y lines.
|
|
float y_pitch_um = 0; // Data pitch of Y data. (e.g. your encoder setting)
|
|
int timeout_ms = 0; // Timeout value for the acquiring image (in milisecond).
|
|
int use_external_batchStart = 1; // Set "1" if you controll the batch start timing externally. (e.g. terminal input) 0内部触发,1外部触发
|
|
std::string outputFilePath1 = "sample_height.csv";
|
|
std::string outputFilePath2 = "sample_height.tif";
|
|
std::string outputFilePath3 = "sample_luminance.tif";
|
|
|
|
//std::vector< cv::Mat> vector_mat;
|
|
unsigned short zUnit = 0;
|
|
|
|
unsigned short* heightImage = nullptr; // Height image
|
|
unsigned short* luminanceImage = nullptr; // Luminance image
|
|
|
|
LJXA_ACQ_SETPARAM* setParam_Ptr = nullptr;
|
|
LJXA_ACQ_GETPARAM* getParam_Ptr = nullptr;
|
|
int HighSpeedPortNo = 24692; // Port number for high-speed communication
|
|
bool isopen = false;
|
|
int errCode;
|
|
|
|
LJX8IF_ETHERNET_CONFIG EthernetConfig;
|
|
|
|
QString camera_name; // 相机名称
|
|
int recontimeout_ms = 3000;
|
|
};
|
|
|
|
extern "C"
|
|
{
|
|
Q_DECL_EXPORT Hd_CameraModule_3DKeyence* create();
|
|
Q_DECL_EXPORT void destory(Hd_CameraModule_3DKeyence* ptr);
|
|
}
|
|
|
|
#endif // HD_MVCAMERA_MODULE_H
|