libdrmconf  0.10.4
A library to program DMR radios.
radiointerface.hh
1 
4 #ifndef RADIOINFERFACE_HH
5 #define RADIOINFERFACE_HH
6 
7 #include <QString>
8 #include "usbdevice.hh"
9 #include "radioinfo.hh"
10 #include "errorstack.hh"
11 
21 {
22 protected:
24  explicit RadioInterface();
25 
26 public:
28  virtual ~RadioInterface();
29 
31  virtual bool isOpen() const = 0;
33  virtual void close() = 0;
34 
36  virtual RadioInfo identifier(const ErrorStack &err=ErrorStack()) = 0;
37 
44  virtual bool write_start(uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack())=0;
45 
55  virtual bool write(uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack()) = 0;
56 
61  virtual bool write_finish(const ErrorStack &err=ErrorStack()) = 0;
62 
69  virtual bool read_start(uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack()) = 0;
70 
80  virtual bool read(uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack()) = 0;
81 
86  virtual bool read_finish(const ErrorStack &err=ErrorStack()) = 0;
87 
92  virtual bool reboot(const ErrorStack &err=ErrorStack());
93 };
94 
95 #endif // RADIOINFERFACE_HH
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Provides some information about a radio model.
Definition: radioinfo.hh:16
Abstract radio interface.
Definition: radiointerface.hh:21
virtual RadioInfo identifier(const ErrorStack &err=ErrorStack())=0
Returns a device identifier.
virtual ~RadioInterface()
Destructor.
Definition: radiointerface.cc:16
virtual bool reboot(const ErrorStack &err=ErrorStack())
Some radios need to be rebooted after being read or programmed.
Definition: radiointerface.cc:27
virtual void close()=0
Closes the connection to the device.
virtual bool write(uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack())=0
Writes a chunk of data at the address addr.
RadioInterface()
Hidden constructor.
Definition: radiointerface.cc:11
virtual bool write_finish(const ErrorStack &err=ErrorStack())=0
This function ends a series of write operations.
Definition: radiointerface.cc:21
virtual bool write_start(uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack())=0
Starts the write process into the specified bank and at the given address.
virtual bool read(uint32_t bank, uint32_t addr, uint8_t *data, int nbytes, const ErrorStack &err=ErrorStack())=0
Reads a chunk of data from the block-address bno (block number).
virtual bool read_start(uint32_t bank, uint32_t addr, const ErrorStack &err=ErrorStack())=0
Starts the read process from the specified bank and at the given address.
virtual bool isOpen() const =0
Return true if a connection to the device has been established.
virtual bool read_finish(const ErrorStack &err=ErrorStack())=0
This function ends a series of read operations.