6 #include "errorstack.hh"
7 #include "radiointerface.hh"
25 Packet(uint8_t command, uint8_t sub, uint8_t flags=0x0f,
const QByteArray &payload=QByteArray());
27 Packet(
const QByteArray &buffer);
35 uint8_t flags()
const;
36 uint8_t command()
const;
37 uint8_t subcommand()
const;
38 uint16_t payloadSize()
const;
39 QByteArray payload()
const;
40 const QByteArray &encoded()
const;
71 static QList<USBDeviceDescriptor>
detect(
bool saveOnly=
true);
81 libusb_device_handle *
_dev;
Specialization to address a DFU device uniquely.
Definition: c7000device.hh:50
Descriptor(const USBDeviceInfo &info, uint8_t bus, uint8_t device)
Constructor from interface info, bus number and device address.
Definition: c7000device.cc:111
Base class for all C7000 based radios.
Definition: c7000device.hh:13
libusb_context * _ctx
USB context.
Definition: c7000device.hh:79
virtual ~C7000Device()
Destructor.
Definition: c7000device.cc:204
bool isOpen() const
Returns true if the C7000 interface is open.
Definition: c7000device.cc:257
void close()
Closes the C7000 interface.
Definition: c7000device.cc:262
static USBDeviceInfo interfaceInfo()
Returns some information about the interface.
Definition: c7000device.cc:209
bool sendRecv(const Packet &request, Packet &response, const ErrorStack &err=ErrorStack())
Sends the given request to the device and receives the response.
Definition: c7000device.cc:275
static QList< USBDeviceDescriptor > detect(bool saveOnly=true)
Finds all C7000 interfaces.
Definition: c7000device.cc:215
libusb_device_handle * _dev
USB device object.
Definition: c7000device.hh:81
C7000Device(const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
Opens a connection to the C7000 device.
Definition: c7000device.cc:121
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Base class for all radio interface descriptors representing a unique interface to a connected radio.
Definition: usbdevice.hh:197
const QVariant & device() const
Returns the device information identifying the interface uniquely.
Definition: usbdevice.cc:290
Generic information about a possible radio interface.
Definition: usbdevice.hh:121
Request/response packet.
Definition: c7000device.hh:18
bool isValid() const
Returns true, if the packet is valid.
Definition: c7000device.cc:54
Packet & operator=(const Packet &other)=default
Assignment.
Packet()
Default constructor.
Definition: c7000device.cc:13
QByteArray _encoded
Holds the encoded packet.
Definition: c7000device.hh:44
Packet(const Packet &other)=default
Copy constructor.