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

Implements the actual interface to the DR-1801UV, which builds upon the AuctusA6Interface. More...

#include <dr1801uv_interface.hh>

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

Classes

struct  CodeplugWriteResponse
 Response to a codeplug write. More...
 
struct  PrepareReadRequest
 Request to set transfer speed and load codeplug into RAM for transfer. More...
 
struct  PrepareReadResponse
 Response to a PREPARE_CODEPLUG_READ command. More...
 
struct  PrepareWriteRequest
 Request to prepare a codeplug write. More...
 
struct  PrepareWriteResponse
 Response to a prepare-write request. More...
 

Public Member Functions

 DR1801UVInterface (const USBDeviceDescriptor &descriptor, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 Constructs an interface to the BTECH DR-1801UV from the specifeid USB descriptor.
 
RadioInfo identifier (const ErrorStack &err)
 Returns a device identifier.
 
bool readCodeplug (Codeplug &codeplug, std::function< void(unsigned int, unsigned int)> progress, const ErrorStack &err=ErrorStack())
 Reads the codeplug from the device blocking.
 
bool writeCodeplug (const Codeplug &codeplug, std::function< void(unsigned int, unsigned int)> progress, const ErrorStack &err=ErrorStack())
 Writes the codeplug to the device blocking.
 
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...
 
- Public Member Functions inherited from AuctusA6Interface
State state () const
 Returns the interface state.
 
- Public Member Functions inherited from USBSerial
virtual ~USBSerial ()
 Destructor.
 
bool isOpen () const
 If true, the device has been found and is open.
 
void close ()
 Closes the interface to the device.
 
- Public Member Functions inherited from RadioInterface
virtual ~RadioInterface ()
 Destructor.
 
virtual bool reboot (const ErrorStack &err=ErrorStack())
 Some radios need to be rebooted after being read or programmed. More...
 

Static Public Member Functions

static USBDeviceInfo interfaceInfo ()
 Returns some information about this interface.
 
static QList< USBDeviceDescriptordetect (bool saveOnly=true)
 Tries to find all interfaces connected AnyTone radios.
 
- Static Public Member Functions inherited from USBSerial
static QList< USBDeviceDescriptordetect (uint16_t vid, uint16_t pid, bool isSave=true)
 Searches for all USB serial ports with the specified VID/PID.
 
static QList< USBDeviceDescriptordetect ()
 Searches for all USB serial ports.
 

Protected Types

enum  DefaultTransferSpeed { DefaultSpeed = QSerialPort::Baud9600 , ReadSpeed = QSerialPort::Baud115200 , WriteSpeed = QSerialPort::Baud9600 }
 Some default speeds. More...
 
enum  Command {
  REQUEST_INFO = 0x0000 , ENTER_PROGRAMMING_MODE = 0x0104 , CHECK_PROG_PASSWORD = 0x002b , PREPARE_CODEPLUG_READ = 0x0100 ,
  START_READ_DATA = 0x0101 , PREPARE_CODEPLUG_WRITE = 0x0102 , CODEPLUG_WRITTEN = 0x0103
}
 Implemented commands. More...
 

Protected Member Functions

bool enterProgrammingMode (const ErrorStack &err=ErrorStack())
 Puts the device into programming mode.
 
bool getDeviceInfo (QString &info, const ErrorStack &err=ErrorStack())
 Reads some information about the device.
 
bool checkProgrammingPassword (const ErrorStack &err=ErrorStack())
 Checks the if a programming password is set.
 
bool prepareReading (uint32_t baudrate, PrepareReadResponse &response, const ErrorStack &err=ErrorStack())
 Prepares reading the codeplug.
 
bool startReading (const ErrorStack &err=ErrorStack())
 Starts the read operation. More...
 
bool prepareWriting (uint32_t size, uint32_t baudrate, uint16_t crc, const ErrorStack &err=ErrorStack())
 Repares the codeplug write.
 
bool receiveWriteACK (const ErrorStack &err=ErrorStack())
 Receives the ACK for writing the codeplug.
 
- Protected Member Functions inherited from AuctusA6Interface
 AuctusA6Interface (const USBDeviceDescriptor &descriptor, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 Hidden constructor.
 
bool send_receive (uint16_t command, const uint8_t *params, uint8_t plen, uint8_t *response, uint8_t &rlen, const ErrorStack &err=ErrorStack())
 Internal used method to send messages to and receive responses from radio.
 
bool send (uint16_t command, const uint8_t *params, uint8_t plen, const ErrorStack &err=ErrorStack())
 Internal used method to send a command.
 
bool receive (uint16_t &command, uint8_t *response, uint8_t &rlen, const ErrorStack &err=ErrorStack())
 Internal used method to receive a response.
 
bool read (uint8_t *data, qint64 n, unsigned int timeout_ms, const ErrorStack &err=ErrorStack())
 Reads exactly n bytes or timeouts.
 
- Protected Member Functions inherited from USBSerial
 USBSerial (const USBDeviceDescriptor &descriptor, QSerialPort::BaudRate rate=QSerialPort::Baud115200, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 Constructs an opens new serial interface to the devices identified by the given vendor and product IDs. More...
 
QString formatPinoutSignals ()
 Serializes the pinout singals.
 
- Protected Member Functions inherited from RadioInterface
 RadioInterface ()
 Hidden constructor.
 

Protected Attributes

QString _identifier
 Holds the device identifier, once read.
 
- Protected Attributes inherited from AuctusA6Interface
State _state
 Holds the state of the interface.
 

Additional Inherited Members

- Public Types inherited from AuctusA6Interface
enum  State {
  CLOSED , IDLE , READ_THROUGH , WRITE_THROUGH ,
  ERROR
}
 Possible states of the interface. More...
 
- Protected Slots inherited from USBSerial
void onError (QSerialPort::SerialPortError error_t)
 Callback for serial interface errors.
 
void onClose ()
 Callback when closing interface.
 
void signalingChanged ()
 Signaling callback.
 

Detailed Description

Implements the actual interface to the DR-1801UV, which builds upon the AuctusA6Interface.

Member Enumeration Documentation

◆ Command

Implemented commands.

Enumerator
REQUEST_INFO 

Returns some information about the device.

ENTER_PROGRAMMING_MODE 

Puts the device into the programming mode.

CHECK_PROG_PASSWORD 

Checks the programming password.

PREPARE_CODEPLUG_READ 

Sets baud rate and prepares codeplug read.

START_READ_DATA 

Actually starts reading the codeplug.

PREPARE_CODEPLUG_WRITE 

Prepares writing the codeplug.

CODEPLUG_WRITTEN 

Send by the device once the codeplug was written.

◆ DefaultTransferSpeed

Some default speeds.

Enumerator
DefaultSpeed 

Initial speed, used to send commands.

ReadSpeed 

Speed for reading the codeplug.

WriteSpeed 

Speed for writing the codeplug.

Member Function Documentation

◆ read()

bool DR1801UVInterface::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 DR1801UVInterface::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 DR1801UVInterface::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.

◆ startReading()

bool DR1801UVInterface::startReading ( const ErrorStack err = ErrorStack())
protected

Starts the read operation.

Once the operation is complete, the device will close the connection.

◆ write()

bool DR1801UVInterface::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 DR1801UVInterface::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 DR1801UVInterface::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: