78 lines
2.4 KiB
C++
78 lines
2.4 KiB
C++
#ifndef Hd_CameraModule_Basler_LineSweep_H
|
|||
|
|
#define Hd_CameraModule_Basler_LineSweep_H
|
||
|
|
#include <QtCore/qglobal.h>
|
||
|
|
#include <Windows.h>
|
||
|
|
#include <QDebug>
|
||
|
|
#include <QQueue>
|
||
|
|
#include <QMutex>
|
||
|
|
#include <pylon/PylonIncludes.h>
|
||
|
|
//#include <pylon/InstantCamera.h>
|
||
|
|
//#include <pylon/InstantInterface.h>
|
||
|
|
//#include <pylon/gige/BaslerGigECamera.h>
|
||
|
|
#include <pylon/BaslerUniversalInstantCamera.h>
|
||
|
|
#include <opencv2/opencv.hpp>
|
||
|
|
|
||
|
|
#include <subModuleBase.h>
|
||
|
|
|
||
|
|
using namespace cv;
|
||
|
|
using namespace std;
|
||
|
|
using namespace Pylon;
|
||
|
|
#pragma execution_character_set("utf-8")
|
||
|
|
|
||
|
|
static QByteArray mv_Status = "connected";//0106 新增相机断联报警
|
||
|
|
//static void* handle;
|
||
|
|
static string Username="";
|
||
|
|
static bool m_flag = false;
|
||
|
|
static cv::Mat srcImage;
|
||
|
|
static bool moduleStatus = true;
|
||
|
|
static int index=-1;
|
||
|
|
class Hd_CameraModule_Basler_hard :public subModuleBase
|
||
|
|
, public Pylon::CImageEventHandler // Allows you to get notified about images received and grab errors.
|
||
|
|
, public Pylon::CConfigurationEventHandler // Allows you to get notified about device removal.
|
||
|
|
, public Pylon::CCameraEventHandler
|
||
|
|
//, public CInstantInterface
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
Hd_CameraModule_Basler_hard();
|
||
|
|
virtual ~Hd_CameraModule_Basler_hard();
|
||
|
|
//从类中读数据到实例对象
|
||
|
|
bool readData(std::vector<cv::Mat>& mat, QByteArray& data, nlohmann::json& json);
|
||
|
|
//实例对象把数据写入到类
|
||
|
|
bool writeData(std::vector<cv::Mat>& mat, QByteArray& data, nlohmann::json& json);
|
||
|
|
bool initParas(QByteArray&, nlohmann::json& json = nlohmann::json());
|
||
|
|
bool run();
|
||
|
|
bool checkStatus();
|
||
|
|
|
||
|
|
int SearchDevice();
|
||
|
|
|
||
|
|
//关闭设备
|
||
|
|
void CloseDevice();
|
||
|
|
//连接设备
|
||
|
|
bool ConnctDevice();
|
||
|
|
//重连设备
|
||
|
|
bool reConnctDevice();
|
||
|
|
//回调函数?
|
||
|
|
virtual void OnImageGrabbed(Pylon::CInstantCamera& camera, const Pylon::CGrabResultPtr& grabResult);
|
||
|
|
//断线回调
|
||
|
|
void OnCameraDeviceRemoved(Pylon::CInstantCamera& camera);
|
||
|
|
//错误
|
||
|
|
void OnGrabError(Pylon::CInstantCamera& camera, const char* errorMessage);
|
||
|
|
|
||
|
|
void OnCameraEvent(Pylon::CInstantCamera& camera, intptr_t userProvidedId, GenApi::INode* pNode);
|
||
|
|
|
||
|
|
private:
|
||
|
|
//MyThread *m_thread = nullptr;
|
||
|
|
QMutex* m_mutex;
|
||
|
|
|
||
|
|
Pylon::CBaslerUniversalInstantCamera *m_camera;
|
||
|
|
};
|
||
|
|
|
||
|
|
extern "C"
|
||
|
|
{
|
||
|
|
Q_DECL_EXPORT Hd_CameraModule_Basler_hard* create();
|
||
|
|
Q_DECL_EXPORT void destory(Hd_CameraModule_Basler_hard* ptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // Hd_CameraModule_Basler_LineSweep_H
|
||
|
|
//Hd_CameraModule_Basler_hard
|