LibDMRConf
0.5.0
A library to program DMR radios.
|
Implements the interface to Anytone D868UV, D878UV, etc radios. More...
#include <anytone_interface.hh>
Classes | |
struct | ReadRequest |
Binary representation of a read request to the radio. More... | |
struct | ReadResponse |
Binary representation of a read response from the radio. More... | |
struct | WriteRequest |
Binary representation of a write request to the radio. More... | |
Public Member Functions | |
AnytoneInterface (QObject *parent=nullptr) | |
Constructs a new interface to Anyton radios. More... | |
virtual | ~AnytoneInterface () |
Destructor. | |
void | close () |
Closes the interface to the device. | |
QString | identifier () |
Returns an identifier of the radio. | |
bool | read_start (uint32_t bank, uint32_t addr) |
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) |
Reads a chunk of data from the block-address bno (block number). More... | |
bool | read_finish () |
This function ends a series of read operations. More... | |
bool | write_start (uint32_t bank, uint32_t addr) |
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) |
Writes a chunk of data at the address addr . More... | |
bool | write_finish () |
This function ends a series of write operations. More... | |
bool | reboot () |
Some radios need to be rebooted after being read or programmed. More... | |
![]() | |
virtual | ~USBSerial () |
Destrutor. | |
bool | isOpen () const |
If true , the device has been found and is open. | |
void | close () |
Closes the interface to the device. | |
const QString & | errorMessage () const |
Returns the last error message. | |
![]() | |
virtual | ~RadioInterface () |
Destructor. | |
Protected Types | |
enum | State { STATE_INITIALIZED, STATE_OPEN, STATE_PROGRAM, STATE_CLOSED, STATE_ERROR } |
Possible states of the radio interface. More... | |
Protected Member Functions | |
bool | enter_program_mode () |
Send command message to radio to ender program state. | |
bool | request_identifier (QString &radio, QString &version) |
Sends a request to radio to identify itself. | |
bool | leave_program_mode () |
Sends a command message to radio to leave program state and reboot. | |
bool | send_receive (const char *cmd, int clen, char *resp, int rlen) |
Internal used method to send messages to and receive responses from radio. | |
![]() | |
USBSerial (unsigned vid, unsigned pid, QObject *parent=nullptr) | |
Constructs an opens new serial interface to the devices identified by the given vendor and product IDs. More... | |
![]() | |
RadioInterface () | |
Hidden constructor. | |
Protected Attributes | |
State | _state |
Holds the state of the interface. | |
QString | _identifier |
Holds the identifyer string of the radio. | |
![]() | |
QString | _errorMessage |
Holds the last error message. | |
Additional Inherited Members | |
![]() | |
void | onError (QSerialPort::SerialPortError error_t) |
Callback for serial interface errors. | |
void | onClose () |
Callback when closing interface. | |
Implements the interface to Anytone D868UV, D878UV, etc radios.
This interface uses a USB serial-port to comunicate with the device. To find the corresponding port, the device-specific VID 0x28e9
and PID 0x018a
are used. Hence no udev rules are needed to access these devices. The user, however, should be a member of the dialout
group to get access to the serial interfaces.
|
protected |
Possible states of the radio interface.
Enumerator | |
---|---|
STATE_INITIALIZED | Initial state. |
STATE_OPEN | Interface to radio is open. |
STATE_PROGRAM | Radio is in program mode. |
STATE_CLOSED | Interface to radio is closed (captive final state). |
STATE_ERROR | An error occurred (captive final state), use |
|
explicit |
Constructs a new interface to Anyton radios.
If a matching device was found, isOpen
returns true
.
|
virtual |
Reads a chunk of data from the block-address bno
(block number).
bank | Specifies 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. |
addr | Specifies the address to read from. |
data | Pointer where to store the read data. |
nbytes | Specifies the number of bytes to read. |
true
on success. Implements RadioInterface.
|
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).
Implements RadioInterface.
|
virtual |
Starts the read process from the specified bank and at the given address.
bank | Specifies 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. |
addr | Specifies the address to read from. |
Implements RadioInterface.
|
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 from RadioInterface.
|
virtual |
Writes a chunk of data
at the address addr
.
bank | Specifies 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. |
addr | Specifies the address to write to. |
data | Pointer to the actual data to be written. |
nbytes | Specifies the number of bytes to write. |
true
on success. Implements RadioInterface.
|
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).
Implements RadioInterface.
|
virtual |
Starts the write process into the specified bank and at the given address.
bank | Specifies 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. |
addr | Specifies the address to write to. |
Implements RadioInterface.