libdrmconf  0.10.4
A library to program DMR radios.
Public Member Functions | List of all members
OpenRTXInterface Class Reference

Implements the communication interface to radios running the OpenRTX firmware. More...

#include <openrtx_interface.hh>

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

Public Member Functions

 OpenRTXInterface (const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 
bool isOpen () const
 Return true if a connection to the device has been established.
 
void close ()
 Closes the connection to the device.
 
RadioInfo identifier (const ErrorStack &err=ErrorStack())
 Returns a device identifier.
 
bool read_start (uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack())
 Starts the read process from the specified bank and at the given address. More...
 
bool read (uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack())
 Reads a chunk of data from the block-address bno (block number). More...
 
bool read_finish (const ErrorStack &err=ErrorStack())
 This function ends a series of read operations. More...
 
bool write_start (uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack())
 Starts the write process into the specified bank and at the given address. More...
 
bool write (uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack())
 Writes a chunk of data at the address addr. More...
 
bool write_finish (const ErrorStack &err=ErrorStack())
 This function ends a series of write operations. More...
 
bool reboot (const ErrorStack &err=ErrorStack())
 Some radios need to be rebooted after being read or programmed. More...
 
- Public Member Functions inherited from DFUDevice
 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.
 
- Public Member Functions inherited from RadioInterface
virtual ~RadioInterface ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from DFUDevice
static QList< USBDeviceDescriptordetect (uint16_t vid, uint16_t pid)
 Finds all DFU interfaces with the specified VID/PID combination.
 
- Protected Member Functions inherited from DFUDevice
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 Member Functions inherited from RadioInterface
 RadioInterface ()
 Hidden constructor.
 
- Protected Attributes inherited from DFUDevice
libusb_context * _ctx
 USB context.
 
libusb_device_handle * _dev
 USB device object.
 
status_t _status
 Device status.
 

Detailed Description

Implements the communication interface to radios running the OpenRTX firmware.

Member Function Documentation

◆ read()

bool OpenRTXInterface::read ( uint32_t  bank,
uint32_t  addr,
uint8_t *  data,
int  nbytes,
const ErrorStack err = ErrorStack() 
)
virtual

Reads a chunk of data from the block-address bno (block number).

Parameters
bankSpecifies the memory bank to read from. Usually there is only one bank. Some radios, however, to have several memory banks to hold the codeplug. For example the Open GD77 has EEPROM and Flash memory banks with independent addresses.
addrSpecifies the address to read from.
dataPointer where to store the read data.
nbytesSpecifies the number of bytes to read.
errPasses an error stack to put error messages on.
Returns
true on success.

Implements RadioInterface.

◆ read_finish()

bool OpenRTXInterface::read_finish ( const ErrorStack err = ErrorStack())
virtual

This function ends a series of read operations.

This function will be re-implemented by certain interfaces that need completion of read operations (e.g., HID).

Parameters
errPasses an error stack to put error messages on.

Implements RadioInterface.

◆ read_start()

bool OpenRTXInterface::read_start ( uint32_t  bank,
uint32_t  addr,
const ErrorStack err = ErrorStack() 
)
virtual

Starts the read process from the specified bank and at the given address.

Parameters
bankSpecifies the memory bank to read from. Usually there is only one bank. Some radios, however, to have several memory banks to hold the codeplug. For example the Open GD77 has EEPROM and Flash memory banks with independent addresses.
addrSpecifies the address to read from.
errPasses an error stack to put error messages on.

Implements RadioInterface.

◆ reboot()

bool OpenRTXInterface::reboot ( const ErrorStack err = ErrorStack())
virtual

Some radios need to be rebooted after being read or programmed.

This function will be re-implemented by some interfaces (e.g., DFUDevice) to reboot the radio. By default this function does nothing.

Parameters
errPasses an error stack to put error messages on.

Reimplemented from RadioInterface.

◆ write()

bool OpenRTXInterface::write ( uint32_t  bank,
uint32_t  addr,
uint8_t *  data,
int  nbytes,
const ErrorStack err = ErrorStack() 
)
virtual

Writes a chunk of data at the address addr.

Parameters
bankSpecifies the memory bank to write to. Usually there is only one bank. Some radios, however, to have several memory banks to hold the codeplug. For example the Open GD77 has EEPROM and Flash memory banks with independent addresses.
addrSpecifies the address to write to.
dataPointer to the actual data to be written.
nbytesSpecifies the number of bytes to write.
errPasses an error stack to put error messages on.
Returns
true on success.

Implements RadioInterface.

◆ write_finish()

bool OpenRTXInterface::write_finish ( const ErrorStack err = ErrorStack())
virtual

This function ends a series of write operations.

This function will be implemented by certain interfaces that need completion of write operations (e.g., HID).

Parameters
errPasses an error stack to put error messages on.

Implements RadioInterface.

◆ write_start()

bool OpenRTXInterface::write_start ( uint32_t  bank,
uint32_t  addr,
const ErrorStack err = ErrorStack() 
)
virtual

Starts the write process into the specified bank and at the given address.

Parameters
bankSpecifies the memory bank to write to. Usually there is only one bank. Some radios, however, to have several memory banks to hold the codeplug. For example the Open GD77 has EEPROM and Flash memory banks with independent addresses.
addrSpecifies the address to write to.
errPasses an error stack to put error messages on.

Implements RadioInterface.


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