#pragma once
#include <QThread>
#include <QDebug>
#include <QDateTime>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/types_c.h>
#include <atomic>
#include <mutex>
#include "common.h"
#include "SyncQueue.h"

#include <QUdpSocket>

class threadReceive : public QThread
{
	Q_OBJECT
public:
	QString ip;
	threadReceive(QObject* o = nullptr) :QThread(o)
	{
		isLoop = true;
	}

	~threadReceive()
	{
		stop();
		quit();
		wait();
	}
	void stop();
	void init(std::string IP,int port);
	void start_work();

private slots:
	void processPendingDatagram();
	void fileprocessPendingDatagram();

signals:
	void sendMsgToCigratte(QString data);

public:
	std::atomic_bool isLoop = { 0 };
	QUdpSocket *mSocket;
	QUdpSocket *filemSocket;
};
