You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.3 KiB
78 lines
1.3 KiB
#ifndef USBTHREAD_H |
|
#define USBTHREAD_H |
|
//#include "Windows.h" |
|
|
|
#include "qt_windows.h" |
|
|
|
#include <QObject> |
|
#include <QThread> |
|
|
|
#include <QByteArray> |
|
|
|
#include <QTimer> |
|
#include <chrono> |
|
|
|
#include "datathread.h" |
|
#include <CyAPI.h> |
|
|
|
#include <opencv2/opencv.hpp> |
|
using namespace cv; |
|
|
|
class usbthread:public QThread{ |
|
Q_OBJECT |
|
public: |
|
explicit usbthread(QObject* parent = nullptr); |
|
~usbthread(); |
|
void SetImageInfo(int _type, int _rows, int _cols); |
|
void stopProcessData(); |
|
void setStatu(bool _run); |
|
// void setcallback(void(*func)(cv::Mat)); |
|
|
|
int getUsbStatus();/// 0 初始化 1 正常工作 2 无设备 3 接插不稳定 |
|
void settest(); |
|
QString getid(); |
|
signals: |
|
|
|
void signalGetImage(cv::Mat); |
|
void signalMessage(QString msg); |
|
|
|
void signalSetImageInfo(int type, int rows, int cols); |
|
|
|
void signalAppendData(char* data,int len); |
|
|
|
protected: |
|
void run()override; |
|
|
|
protected slots: |
|
void logout(); |
|
|
|
void slotGetImage(cv::Mat ); |
|
void slotSetID(QString); |
|
|
|
private: |
|
datathread* newProcess; |
|
|
|
unsigned char* usbData; |
|
int datalen; |
|
int type; |
|
int rows; |
|
int cols; |
|
bool isRun; |
|
CCyUSBDevice *device; |
|
|
|
// void(*imageCallback)(cv::Mat image); |
|
|
|
QTimer* tg; |
|
int lensum; |
|
|
|
|
|
int usbstatus; |
|
|
|
QString id; |
|
|
|
bool b_test; |
|
|
|
}; |
|
|
|
|
|
#endif // USBTHREAD_H
|
|
|