7 #include <QReadWriteLock> 13 #include <libusb-1.0/libusb.h> 100 int bulkReadMulti(
unsigned char *data,
unsigned length,
bool captureSmallBlocks,
unsigned &received,
112 int controlTransfer(
unsigned char type,
unsigned char request,
unsigned char *data,
unsigned int length,
int value,
int index,
119 return controlTransfer( LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT, uint8_t( command->code ),
120 const_cast< unsigned char * >( command->data() ),
unsigned( command->size() ), command->value, 0,
128 return controlTransfer( LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN, uint8_t( command->code ),
129 const_cast< unsigned char * >( command->data() ),
unsigned( command->size() ), command->value, 0,
159 int claimInterface(
const libusb_interface_descriptor *interfaceDescriptor );
unsigned findIteration
Definition: scopedevice.h:168
#define HANTEK_EP_OUT
OUT Endpoint for bulk transfers.
Definition: usbdevicedefinitions.h:10
UniqueUSBid getUniqueUSBDeviceID() const
Definition: scopedevice.h:141
DSOModel * model
Definition: scopedevice.h:162
#define HANTEK_ATTEMPTS
The number of transfer attempts.
Definition: usbdevicedefinitions.h:7
int nInterface
Definition: scopedevice.h:170
const QString getSerialNumber() const
getSerialNumber
Definition: scopedevice.h:75
libusb_device_handle * handle
Definition: scopedevice.h:167
bool connectDevice(QString &errorMessage)
Definition: scopedevice.cpp:66
~ScopeDevice()
Definition: scopedevice.cpp:111
void setFindIteration(unsigned iteration)
Definition: scopedevice.h:90
bool hasStopped()
Definition: scopedevice.h:55
bool realHW
Definition: scopedevice.h:203
int controlWrite(const T *command)
Control write to the oscilloscope.
Definition: scopedevice.h:118
ScopeDevice()
Definition: scopedevice.cpp:63
const DSOModel * getModel() const
Get the oscilloscope model.
Definition: scopedevice.h:149
int claimInterface(const libusb_interface_descriptor *interfaceDescriptor)
Definition: scopedevice.cpp:121
unsigned verboseLevel
Definition: main.cpp:72
void deviceDisconnected()
The device has been disconnected.
int controlRead(const T *command)
Control read to the oscilloscope.
Definition: scopedevice.h:127
unsigned getFindIteration() const
Definition: scopedevice.h:91
void disconnectFromDevice()
Definition: scopedevice.cpp:144
bool isRealHW() const
Distinguish between real hw or demo device.
Definition: scopedevice.h:49
unsigned int getFwVersion() const
Definition: scopedevice.h:69
#define HANTEK_EP_IN
IN Endpoint for bulk transfers.
Definition: usbdevicedefinitions.h:11
This class handles the USB communication with an usb device that has one in and one out endpoint...
Definition: scopedevice.h:33
Describes a device This is the central class to describe a hantek compatible DSO. It contains all usb...
Definition: dsomodel.h:17
void stopSampling()
Stop a long running (interruptable) bulk transfer.
Definition: scopedevice.h:53
bool isConnected()
Check if the oscilloscope is connected.
Definition: scopedevice.cpp:167
int bulkRead(const T *command, int attempts=HANTEK_ATTEMPTS)
Bulk read from the oscilloscope.
Definition: scopedevice.h:199
unsigned outPacketLength
Packet length for the OUT endpoint.
Definition: scopedevice.h:171
libusb_device * device
The USB handle for the oscilloscope.
Definition: scopedevice.h:166
int controlTransfer(unsigned char type, unsigned char request, unsigned char *data, unsigned int length, int value, int index, int attempts=HANTEK_ATTEMPTS)
Control transfer to the oscilloscope.
Definition: scopedevice.cpp:238
static UniqueUSBid computeUSBdeviceID(libusb_device *device)
Definition: scopedevice.cpp:25
bool needsFirmware()
Definition: scopedevice.cpp:170
QString serialNumber
Definition: scopedevice.h:206
struct libusb_device_descriptor descriptor
Definition: scopedevice.h:165
uint64_t UniqueUSBid
Definition: scopedevice.h:20
int bulkWrite(const unsigned char *data, unsigned int length, int attempts=HANTEK_ATTEMPTS)
Bulk write to the oscilloscope.
Definition: scopedevice.h:190
#define HANTEK_TIMEOUT
Timeout for USB transfers in ms.
Definition: usbdevicedefinitions.h:5
bool stopTransfer
Definition: scopedevice.h:204
#define HANTEK_ATTEMPTS_MULTI
The number of multi packet transfer attempts.
Definition: usbdevicedefinitions.h:8
int bulkTransfer(unsigned char endpoint, const unsigned char *data, unsigned int length, int attempts=HANTEK_ATTEMPTS, unsigned int timeout=HANTEK_TIMEOUT)
Bulk transfer to/from the oscilloscope.
Definition: scopedevice.cpp:176
void overwriteInPacketLength(unsigned len)
Definition: scopedevice.h:156
int bulkReadMulti(unsigned char *data, unsigned length, bool captureSmallBlocks, unsigned &received, int attempts=HANTEK_ATTEMPTS_MULTI)
Multi packet bulk read from the oscilloscope.
Definition: scopedevice.cpp:196
const QString libUsbErrorString(int error)
Returns string representation for libusb errors.
Definition: scopedevice.cpp:22
QString readUSBdescriptor(libusb_device_handle *handle, uint8_t index)
readUSBdescriptor
Definition: scopedevice.cpp:259
libusb_device * getUSBDevice() const
Definition: scopedevice.h:136
unsigned inPacketLength
Packet length for the IN endpoint.
Definition: scopedevice.h:172
const UniqueUSBid uniqueUSBdeviceID
Definition: scopedevice.h:169
bool isDemoDevice() const
Definition: scopedevice.h:50
bool disconnected
Definition: scopedevice.h:205