#ifndef HIDREADER_H
#define HIDREADER_H

#include <QObject>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <hidapi-win/include/hidapi.h>
#include <hidapi-win/include/hidapi_winapi.h>

class HIDReader : public QThread {
    Q_OBJECT

public:
    HIDReader(QObject *parent = nullptr);
    ~HIDReader();

    void startReading();
    void stopReading();

signals:
    void dataRead(const QByteArray &data);

protected:
    void run() override;

private:
    QMutex mutex;
    QWaitCondition condition;
    bool quit;
    hid_device *device;
};

#endif // HIDREADER_H
