libdrmconf 0.14.1
A library to program DMR radios.
Loading...
Searching...
No Matches
DM32UVInterface Class Reference

Interface to Baofeng Dm-32UV devices. More...

#include <dm32uv_interface.hh>

Inheritance diagram for DM32UVInterface:
Collaboration diagram for DM32UVInterface:

Classes

struct  DeviceDetectionRequest
 Device detection request. More...
struct  DeviceDetectionResponse
 Device detection response. More...
struct  PasswordRequest
 Password request. More...
struct  PasswordResponse
 Passwort response. More...
struct  SysinfoRequest
 System info request. More...
struct  ACKResponse
 System info response. More...
struct  ValueRequest
 Value request. More...
struct  ValueResponse
 Value response. More...
struct  EnterProgramModeRequest
 Enter program mode request. More...
struct  Unknown02Request
 Unkown 02h request. More...
struct  Unknown02Response
 Unknown 02h response. More...
struct  PingRequest
 Ping request. More...
struct  ReadRequest
 Read request. More...
struct  ReadResponse
 Read response. More...
struct  WriteRequest
 Write request. More...

Public Member Functions

 DM32UVInterface (const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
 Constructs a new DM32UV interface for the given USB descriptor.
RadioInfo identifier (const ErrorStack &err=ErrorStack()) override
 Returns the radio info, after identifying the radio.
bool getAddressMap (DM32UV::AddressMap &map, const ErrorStack &err=ErrorStack(), void(*progress)(unsigned int percent)=nullptr)
 Reads the obfuscation address map from the device.
bool read_start (uint32_t bank, uint32_t address, const ErrorStack &err=ErrorStack()) override
 Starts the read process from the specified bank and at the given address.
bool read (uint32_t bank, uint32_t address, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack()) override
 Reads a chunk of data from the block-address bno (block number).
bool read_finish (const ErrorStack &err=ErrorStack()) override
 This function ends a series of read operations.
bool write_start (uint32_t bank, uint32_t address, const ErrorStack &err=ErrorStack()) override
 Starts the write process into the specified bank and at the given address.
bool write (uint32_t bank, uint32_t address, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack()) override
 Writes a chunk of data at the address addr.
bool write_finish (const ErrorStack &err=ErrorStack()) override
 This function ends a series of write operations.
Public Member Functions inherited from USBSerial
virtual ~USBSerial ()
 Destructor.
bool isOpen () const override
 If true, the device has been found and is open.
void close () override
 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.
virtual bool setDateTime (const QDateTime &datetime, const ErrorStack &err=ErrorStack())
 Some radios allow to set date and time of the internal clock during codeplug upload.

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 class  State {
  Closed , Open , Connected , SystemInfo ,
  Program , Error
}
 Possible states, the interface might be in.

Protected Member Functions

bool request_identifier (const ErrorStack &err=ErrorStack())
bool enter_program_mode (const ErrorStack &err=ErrorStack())
 Enters program mode.
template<class Request, class Response>
bool sendReceive (const Request &req, Response &res, const ErrorStack &err=ErrorStack())
 Helper function to send a request and receives the associated response.
bool send (const char *data, qint64 n, int timeout, const ErrorStack &err=ErrorStack())
 Send some data.
bool receive (char *data, qint64 n, int timeout, const ErrorStack &err=ErrorStack())
 Receives some data.
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.
QString formatPinoutSignals ()
 Serializes the pinout signals.
Protected Member Functions inherited from RadioInterface
 RadioInterface ()
 Hidden constructor.

Protected Attributes

State _state
 Current state, the interface is in.
RadioInfo _info
 Radio info, identifying the radio.
QString _firmwareVersion
 Firmware version string.
QPair< uint32_t, uint32_t > _codeplugMemory
 Codeplug memory range.
QPair< uint32_t, uint32_t > _callsignMemory
 Callsign memory range.

Additional Inherited Members

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

Interface to Baofeng Dm-32UV devices.

The protocol is documented in detail at https://github.com/infamy/DM32-Protocol-Spec/blob/main/02-CONNECTION-SEQUENCE.md

Constructor & Destructor Documentation

◆ DM32UVInterface()

DM32UVInterface::DM32UVInterface ( const USBDeviceDescriptor & descr,
const ErrorStack & err = ErrorStack(),
QObject * parent = nullptr )
explicit

Constructs a new DM32UV interface for the given USB descriptor.

The constructor also enters the SYSINFO state and identifies the radio.

Member Function Documentation

◆ identifier()

RadioInfo DM32UVInterface::identifier ( const ErrorStack & err = ErrorStack())
overridevirtual

Returns the radio info, after identifying the radio.

Implements RadioInterface.

◆ read()

bool DM32UVInterface::read ( uint32_t bank,
uint32_t addr,
uint8_t * data,
int nbytes,
const ErrorStack & err = ErrorStack() )
overridevirtual

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 DM32UVInterface::read_finish ( const ErrorStack & err = ErrorStack())
overridevirtual

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 DM32UVInterface::read_start ( uint32_t bank,
uint32_t addr,
const ErrorStack & err = ErrorStack() )
overridevirtual

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.

◆ write()

bool DM32UVInterface::write ( uint32_t bank,
uint32_t addr,
uint8_t * data,
int nbytes,
const ErrorStack & err = ErrorStack() )
overridevirtual

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 DM32UVInterface::write_finish ( const ErrorStack & err = ErrorStack())
overridevirtual

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 DM32UVInterface::write_start ( uint32_t bank,
uint32_t addr,
const ErrorStack & err = ErrorStack() )
overridevirtual

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:
  • /builddir/build/BUILD/qdmr-0.14.1-build/qdmr-0.14.1/lib/dm32uv_interface.hh
  • /builddir/build/BUILD/qdmr-0.14.1-build/qdmr-0.14.1/lib/dm32uv_interface.cc