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.
76 lines
1.4 KiB
76 lines
1.4 KiB
4 years ago
|
#ifndef QUEUEREADER_H
|
||
|
#define QUEUEREADER_H
|
||
|
|
||
|
#include <QElapsedTimer>
|
||
|
#include <QSemaphore>
|
||
|
#include <QThread>
|
||
|
#include <QtDebug>
|
||
|
#include <QtMath>
|
||
|
#include <QMutex>
|
||
|
|
||
|
#include "model/ultrasoundModule/UsPacket.h"
|
||
|
|
||
|
/*****************************************************************************/
|
||
|
/**
|
||
|
* @brief This class is reader part of player engine. This is a hook for player
|
||
|
* bufer and pull frame from player buffer and send that to Core.
|
||
|
* @author Mohammad Mohsen Talaie
|
||
|
* @date 14 nov 2020
|
||
|
*/
|
||
|
/*****************************************************************************/
|
||
|
class QueueReader : public QThread
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
private:
|
||
|
static QElapsedTimer _timer;
|
||
|
static QMutex _locker;
|
||
|
|
||
|
bool _reset = false;
|
||
|
bool* _play;
|
||
|
|
||
|
int _circleBufferSize;
|
||
|
int _iteration;
|
||
|
int* _delay;
|
||
|
|
||
|
UsPacket* _circleBuffer;
|
||
|
|
||
|
QSemaphore* _usedCells;
|
||
|
QSemaphore* _freeCells;
|
||
|
|
||
|
public:
|
||
|
QueueReader(QObject* parent = NULL) : QThread(parent)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void initParams(QSemaphore* used,
|
||
|
QSemaphore* free,
|
||
|
UsPacket* circleBuffer,
|
||
|
const int circleBufferSize,
|
||
|
int* delay,
|
||
|
bool* play);
|
||
|
|
||
|
void run() override;
|
||
|
|
||
|
void Play();
|
||
|
|
||
|
void reset();
|
||
|
|
||
|
void resetIteration();
|
||
|
|
||
|
void setPlay(bool* play);
|
||
|
|
||
|
void waitUntilPacketAvailable();
|
||
|
|
||
|
void watiForCompleteFPSCycleDlaye();
|
||
|
|
||
|
void waitUntilIncomePlayOrder();
|
||
|
|
||
|
void fetchImage();
|
||
|
|
||
|
signals:
|
||
|
void sendPacketToCore(const UsPacket& output);
|
||
|
};
|
||
|
|
||
|
#endif //QUEUEREADER_H
|