LibDMRConf  0.5.0
A library to program DMR radios.
All Classes Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
Public Member Functions | Protected Member Functions | List of all members
RadioInterface Class Referenceabstract

Abstract radio interface. More...

#include <radiointerface.hh>

Inheritance diagram for RadioInterface:
DFUDevice HID USBSerial AnytoneInterface OpenGD77Interface

Public Member Functions

virtual ~RadioInterface ()
 Destructor.
 
virtual bool isOpen () const =0
 Return true if a connection to the device has been established.
 
virtual void close ()=0
 Closes the connection to the device.
 
virtual QString identifier ()=0
 Returns a device identifier.
 
virtual bool write_start (uint32_t bank, uint32_t addr)=0
 Starts the write process into the specified bank and at the given address. More...
 
virtual bool write (uint32_t bank, uint32_t addr, uint8_t *data, int nbytes)=0
 Writes a chunk of data at the address addr. More...
 
virtual bool write_finish ()=0
 This function ends a series of write operations. More...
 
virtual bool read_start (uint32_t bank, uint32_t addr)=0
 Starts the read process from the specified bank and at the given address. More...
 
virtual bool read (uint32_t bank, uint32_t addr, uint8_t *data, int nbytes)=0
 Reads a chunk of data from the block-address bno (block number). More...
 
virtual bool read_finish ()=0
 This function ends a series of read operations. More...
 
virtual bool reboot ()
 Some radios need to be rebooted after being read or programmed. More...
 
virtual const QString & errorMessage () const =0
 Returns the last error message.
 

Protected Member Functions

 RadioInterface ()
 Hidden constructor.
 

Detailed Description

Abstract radio interface.

A radion interface must provide means to communicate with the device. That is, open a connection to the device, allow for reading and writing specific memory blocks.

This class defines the common interface for all radio-interface classes, irrespective of the actual communication protocol being used by the device.

Member Function Documentation

◆ read()

virtual bool RadioInterface::read ( uint32_t  bank,
uint32_t  addr,
uint8_t *  data,
int  nbytes 
)
pure 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.
Returns
true on success.

Implemented in DFUDevice, OpenGD77Interface, and AnytoneInterface.

◆ read_finish()

bool RadioInterface::read_finish ( )
pure 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).

Implemented in HID, DFUDevice, OpenGD77Interface, and AnytoneInterface.

◆ read_start()

virtual bool RadioInterface::read_start ( uint32_t  bank,
uint32_t  addr 
)
pure 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.

Implemented in DFUDevice, OpenGD77Interface, HID, and AnytoneInterface.

◆ reboot()

bool RadioInterface::reboot ( )
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.

Reimplemented in DFUDevice, OpenGD77Interface, and AnytoneInterface.

◆ write()

virtual bool RadioInterface::write ( uint32_t  bank,
uint32_t  addr,
uint8_t *  data,
int  nbytes 
)
pure 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.
Returns
true on success.

Implemented in DFUDevice, OpenGD77Interface, and AnytoneInterface.

◆ write_finish()

bool RadioInterface::write_finish ( )
pure 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).

Implemented in HID, DFUDevice, OpenGD77Interface, and AnytoneInterface.

◆ write_start()

virtual bool RadioInterface::write_start ( uint32_t  bank,
uint32_t  addr 
)
pure 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.

Implemented in HID, DFUDevice, OpenGD77Interface, and AnytoneInterface.


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