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( uint8_t( LIBUSB_REQUEST_TYPE_VENDOR ) | uint8_t( LIBUSB_ENDPOINT_OUT ), uint8_t( command->code ),
120 const_cast< unsigned char *
>( command->data() ),
unsigned( command->size() ), command->value, 0,
128 return controlTransfer( uint8_t( LIBUSB_REQUEST_TYPE_VENDOR ) | uint8_t( 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 );
Describes a device This is the central class to describe a hantek compatible DSO. It contains all usb...
Definition dsomodel.h:17
bool stopTransfer
Definition scopedevice.h:204
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:199
unsigned int getFwVersion() const
Definition scopedevice.h:69
bool needsFirmware()
Definition scopedevice.cpp:173
unsigned getFindIteration() const
Definition scopedevice.h:91
int nInterface
Definition scopedevice.h:170
ScopeDevice()
Definition scopedevice.cpp:65
libusb_device_handle * handle
Definition scopedevice.h:167
void deviceDisconnected()
The device has been disconnected.
void overwriteInPacketLength(unsigned len)
Definition scopedevice.h:156
libusb_device * device
The USB handle for the oscilloscope.
Definition scopedevice.h:166
bool hasStopped()
Definition scopedevice.h:55
ScopeDevice(const ScopeDevice &)=delete
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:285
QString readUSBdescriptor(libusb_device_handle *handle, uint8_t index)
readUSBdescriptor
Definition scopedevice.cpp:312
libusb_device * getUSBDevice() const
Definition scopedevice.h:136
bool connectDevice(QString &errorMessage)
Definition scopedevice.cpp:68
ScopeDevice(DSOModel *model, libusb_device *device, unsigned findIteration=0)
Definition scopedevice.cpp:58
int claimInterface(const libusb_interface_descriptor *interfaceDescriptor)
Definition scopedevice.cpp:124
const DSOModel * getModel() const
Get the oscilloscope model.
Definition scopedevice.h:149
QString serialNumber
Definition scopedevice.h:206
void disconnectFromDevice()
Definition scopedevice.cpp:147
int controlRead(const T *command)
Control read to the oscilloscope.
Definition scopedevice.h:127
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:179
UniqueUSBid getUniqueUSBDeviceID() const
Definition scopedevice.h:141
~ScopeDevice() override
Definition scopedevice.cpp:114
int controlWrite(const T *command)
Control write to the oscilloscope.
Definition scopedevice.h:118
bool realHW
Definition scopedevice.h:203
bool isConnected()
Check if the oscilloscope is connected.
Definition scopedevice.cpp:170
unsigned inPacketLength
Packet length for the IN endpoint.
Definition scopedevice.h:172
const UniqueUSBid uniqueUSBdeviceID
Definition scopedevice.h:169
bool isRealHW() const
Distinguish between real hw or demo device.
Definition scopedevice.h:49
static UniqueUSBid computeUSBdeviceID(libusb_device *device)
Definition scopedevice.cpp:27
const QString getSerialNumber() const
getSerialNumber
Definition scopedevice.h:75
int bulkRead(const T *command, int attempts=HANTEK_ATTEMPTS)
Bulk read from the oscilloscope.
Definition scopedevice.h:199
unsigned findIteration
Definition scopedevice.h:168
void setFindIteration(unsigned iteration)
Definition scopedevice.h:90
struct libusb_device_descriptor descriptor
Definition scopedevice.h:165
int bulkWrite(const unsigned char *data, unsigned int length, int attempts=HANTEK_ATTEMPTS)
Bulk write to the oscilloscope.
Definition scopedevice.h:190
bool disconnected
Definition scopedevice.h:205
bool isDemoDevice() const
Definition scopedevice.h:50
void stopSampling()
Stop a long running (interruptible) bulk transfer.
Definition scopedevice.h:53
unsigned outPacketLength
Packet length for the OUT endpoint.
Definition scopedevice.h:171
DSOModel * model
Definition scopedevice.h:162
int verboseLevel
Definition main.cpp:62
uint64_t UniqueUSBid
Definition scopedevice.h:22
const QString libUsbErrorString(int error)
Returns string representation for libusb errors.
Definition scopedevice.cpp:24
#define HANTEK_ATTEMPTS
The number of transfer attempts.
Definition usbdevicedefinitions.h:7
#define HANTEK_TIMEOUT
Timeout for USB transfers in ms.
Definition usbdevicedefinitions.h:5
#define HANTEK_EP_IN
IN Endpoint for bulk transfers.
Definition usbdevicedefinitions.h:11
#define HANTEK_ATTEMPTS_MULTI
The number of multi packet transfer attempts.
Definition usbdevicedefinitions.h:8
#define HANTEK_EP_OUT
OUT Endpoint for bulk transfers.
Definition usbdevicedefinitions.h:10