radioDevice: Introduce getTxGain() API

It will be used in later commits by radioInterfaceMulti.

Change-Id: Ie3caca8971ed1e5370dfed6fb60716a24e7d82a5
This commit is contained in:
Pau Espin 2019-09-13 17:05:02 +02:00
parent 752055c7c1
commit 2ab921812e
5 changed files with 25 additions and 0 deletions

View File

@ -131,6 +131,9 @@ class RadioDevice {
/** sets the transmit chan gain, returns the gain setting **/
virtual double setTxGain(double dB, size_t chan = 0) = 0;
/** get transmit gain */
virtual double getTxGain(size_t chan = 0) = 0;
/** return maximum Tx Gain **/
virtual double maxTxGain(void) = 0;

View File

@ -162,6 +162,11 @@ public:
/** sets the transmit chan gain, returns the gain setting **/
double setTxGain(double dB, size_t chan = 0);
/** get transmit gain */
double getTxGain(size_t chan = 0) {
return tx_gains[chan];
}
/** return maximum Tx Gain **/
double maxTxGain(void);

View File

@ -310,6 +310,19 @@ double uhd_device::getRxGain(size_t chan)
return rx_gains[chan];
}
double uhd_device::getTxGain(size_t chan)
{
if (iface == MULTI_ARFCN)
chan = 0;
if (chan >= tx_gains.size()) {
LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
return 0.0f;
}
return tx_gains[chan];
}
/*
Parse the UHD device tree and mboard name to find out what device we're
dealing with. We need the window type so that the transceiver knows how to

View File

@ -96,6 +96,7 @@ public:
double minRxGain(void) { return rx_gain_min; }
double setTxGain(double db, size_t chan);
double getTxGain(size_t chan = 0);
double maxTxGain(void) { return tx_gain_max; }
double minTxGain(void) { return tx_gain_min; }

View File

@ -171,6 +171,9 @@ private:
/** sets the transmit chan gain, returns the gain setting **/
double setTxGain(double dB, size_t chan = 0);
/** get transmit gain */
double getTxGain(size_t chan = 0) { return txGain; }
/** return maximum Tx Gain **/
double maxTxGain(void);