2014-07-31 19:02:31 +00:00
|
|
|
/*
|
|
|
|
|
* CameraTcpClient.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2014-07-31
|
|
|
|
|
* Author: mathieu
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef CAMERATCPCLIENT_H_
|
|
|
|
|
#define CAMERATCPCLIENT_H_
|
|
|
|
|
|
2014-08-02 06:09:27 +00:00
|
|
|
#include <QtNetwork/QTcpServer>
|
2014-07-31 19:02:31 +00:00
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
2014-08-02 06:09:27 +00:00
|
|
|
class CameraTcpServer : public QTcpServer
|
2014-07-31 19:02:31 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT;
|
|
|
|
|
public:
|
2014-08-02 06:09:27 +00:00
|
|
|
CameraTcpServer(quint16 port = 0, QObject * parent = 0);
|
2014-07-31 19:02:31 +00:00
|
|
|
cv::Mat getImage();
|
|
|
|
|
int imagesBuffered() const {return images_.size();}
|
2014-08-02 06:09:27 +00:00
|
|
|
bool isConnected() const;
|
|
|
|
|
|
|
|
|
|
QHostAddress getHostAddress() const;
|
|
|
|
|
quint16 getPort() const;
|
2014-07-31 19:02:31 +00:00
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
|
void readReceivedData();
|
|
|
|
|
void displayError(QAbstractSocket::SocketError socketError);
|
|
|
|
|
void connectionLost();
|
|
|
|
|
|
2014-08-02 06:09:27 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
|
void addClient();
|
|
|
|
|
|
2014-07-31 19:02:31 +00:00
|
|
|
private:
|
|
|
|
|
quint64 blockSize_;
|
|
|
|
|
QVector<cv::Mat> images_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* CAMERATCPCLIENT_H_ */
|