libdrmconf  0.10.4
A library to program DMR radios.
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DFUDevice Class Reference

This class implements DFU protocol to access radios. More...

#include <dfu_libusb.hh>

Inheritance diagram for DFUDevice:
Inheritance graph
[legend]
Collaboration diagram for DFUDevice:
Collaboration graph
[legend]

Classes

class  Descriptor
 Specialization to address a DFU device uniquely. More...
 

Public Member Functions

 DFUDevice (const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 Opens a connection to the USB-DFU device at vendor vid and product pid.
 
virtual ~DFUDevice ()
 Destructor.
 
bool isOpen () const
 Returns true if the DFU device interface is open.
 
void close ()
 Closes the DFU interface.
 
int download (unsigned block, uint8_t *data, unsigned len, const ErrorStack &err=ErrorStack())
 Downloads some data to the device.
 
int upload (unsigned block, uint8_t *data, unsigned len, const ErrorStack &err=ErrorStack())
 Uploads some data from the device.
 

Static Public Member Functions

static QList< USBDeviceDescriptordetect (uint16_t vid, uint16_t pid)
 Finds all DFU interfaces with the specified VID/PID combination.
 

Protected Member Functions

int detach (int timeout, const ErrorStack &err=ErrorStack())
 Internal used function to detach the device.
 
int get_status (const ErrorStack &err=ErrorStack())
 Internal used function to read the current status.
 
int clear_status (const ErrorStack &err=ErrorStack())
 Internal used function to clear the status.
 
int get_state (int &pstate, const ErrorStack &err=ErrorStack())
 Internal used function to read the state.
 
int abort (const ErrorStack &err=ErrorStack())
 Internal used function to abort the current operation.
 
int wait_idle (const ErrorStack &err=ErrorStack())
 Internal used function to busy-wait for a response from the device.
 

Protected Attributes

libusb_context * _ctx
 USB context.
 
libusb_device_handle * _dev
 USB device object.
 
status_t _status
 Device status.
 

Detailed Description

This class implements DFU protocol to access radios.

Many manufactures use the standardized DFU protocol to program codeplugs and update the firmware of their radios. This class implements this protocol, see https://www.usb.org/sites/default/files/DFU_1.1.pdf for details.


The documentation for this class was generated from the following files: