wfview/shuttle.h

69 wiersze
1.2 KiB
C++

#ifndef SHUTTLE_H
#define SHUTTLE_H
#include <iostream>
#include <QThread>
#include <QCoreApplication>
#include <QTimer>
#include <QDateTime>
#ifndef Q_OS_WIN
#include "hidapi/hidapi.h"
#else
#include "hidapi.h"
#endif
#ifndef Q_OS_WIN
//Headers needed for sleeping.
#include <unistd.h>
#endif
using namespace std;
#define HIDDATALENGTH 64
#define MAX_STR 255
class shuttle : public QObject
{
Q_OBJECT
public:
shuttle();
~shuttle();
int hidApiWrite(unsigned char* data, unsigned char length);
public slots:
void init();
void run();
void runTimer();
void ledControl(bool on, unsigned char num);
signals:
void jogPlus();
void jogMinus();
void doShuttle(bool plus, quint8 level);
void button(bool,unsigned char num);
void newDevice(unsigned char devType);
private:
hid_device* handle;
enum { NONE, shuttleXpress, shuttlePro2, RC28 }usbDevice;
bool isOpen=false;
unsigned int buttons=0;
unsigned char jogpos=0;
unsigned char shutpos=0;
unsigned char shutMult = 0;
QTime lastShuttle = QTime::currentTime();
QByteArray lastData="";
unsigned char lastDialPos=0;
protected:
};
#endif