-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathusbbulk.h
More file actions
83 lines (72 loc) · 2.14 KB
/
usbbulk.h
File metadata and controls
83 lines (72 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef USBBULK_H
#define USBBULK_H
#include <QObject>
#include <QThread>
#include <QMainwindow>
#include "data_struct.h"
#include "libusb.h"
#include "usb_helper_functions.h"
#include "global_defines.h"
#include "mainwindow.h"
#include "calcfilt.h"
#include "fifo.h"
class USBbulk : public QThread {
Q_OBJECT
public:
USBbulk(MainWindow* w, fifo* Fifo);
~USBbulk();
signals:
void dataAvailable();
void sendWarning(QString str);
public slots:
void restart_stream(void);
void start_stream(void);
void stop_stream(void);
void sendPIsettings(PI_section_t &PIsection , int channel);
void sendEQsettings(EQ_section_t &EQ , int channel , int section );
void resetPIintegrator(int channel);
void sendFuseCurrent(float current);
void sendFuseReset();
void sendSignalSource(int source);
void sendSignalGenerator(int index);
private:
enum message_e{streamIN, PIsection , EQsection , resetPI , resetEQsec , resetEQ , FuseCurrent , FuseStatus , SignalSource , SignalGenerator};
struct USB_PIsection_t{
int header = USBbulk::PIsection;
int channel;
PI_section_t section;
};
struct USB_EQsection_t{
qint32 header = USBbulk::EQsection;
quint32 channel;
quint32 section;
quint32 _padding;
EQ_section_t data;
};
struct tx_t{
int header;
int stream;
};
void run();
static void callback(struct libusb_transfer *transfer);
static void empty_callback(struct libusb_transfer *transfer);
void testHandleMsg();
libusb_device **list;
struct libusb_transfer* In_transfer[BUFFERS] = {nullptr};
struct libusb_transfer* Out_transfer={nullptr};
int err = 0;
struct USBmem_t mem[BUFFERS][ABUFFERS]={0};
struct libusb_device_handle *handle = NULL;
int block=0;
unsigned packets=0;
int do_exit=0;
tx_t streamON= {USBbulk::streamIN, true};
tx_t streamOFF={USBbulk::streamIN, false};
MainWindow* mainWindow;
const int VID=0x20b1;
const int PID=0x00da;
//struct USBmem_t* buffer;
const quint64 pi=3141592543358979324ull;
fifo* Fifo;
};
#endif // USBBULK_H