radioInterface: Rename mRadio to mDevice

Previous naming is ready confusing, because "Radio" is actually the
common term between radioInterface and radioDevice, and it looks like
it's referring to radioInterface rather than radioDevice. On the other
hand, mDevice cleary states it refers to the radioDevice item.

Change-Id: I708bb1992a156fb63334f5590f2c6648ca27495e
This commit is contained in:
Pau Espin 2019-09-13 15:59:29 +02:00
parent 923b4bc9a2
commit a801ae5d94
4 changed files with 37 additions and 37 deletions

View File

@ -32,10 +32,10 @@ extern "C" {
#define CHUNK 625
#define NUMCHUNKS 4
RadioInterface::RadioInterface(RadioDevice *wRadio, size_t tx_sps,
RadioInterface::RadioInterface(RadioDevice *wDevice, size_t tx_sps,
size_t rx_sps, size_t chans,
int wReceiveOffset, GSM::Time wStartTime)
: mRadio(wRadio), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans),
: mDevice(wDevice), mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans),
underrun(false), overrun(false), writeTimestamp(0), readTimestamp(0),
receiveOffset(wReceiveOffset), mOn(false)
{
@ -93,11 +93,11 @@ void RadioInterface::close()
}
double RadioInterface::fullScaleInputValue(void) {
return mRadio->fullScaleInputValue();
return mDevice->fullScaleInputValue();
}
double RadioInterface::fullScaleOutputValue(void) {
return mRadio->fullScaleOutputValue();
return mDevice->fullScaleOutputValue();
}
int RadioInterface::setPowerAttenuation(int atten, size_t chan)
@ -112,8 +112,8 @@ int RadioInterface::setPowerAttenuation(int atten, size_t chan)
if (atten < 0.0)
atten = 0.0;
rfGain = mRadio->setTxGain(mRadio->maxTxGain() - (double) atten, chan);
digAtten = (double) atten - mRadio->maxTxGain() + rfGain;
rfGain = mDevice->setTxGain(mDevice->maxTxGain() - (double) atten, chan);
digAtten = (double) atten - mDevice->maxTxGain() + rfGain;
if (digAtten < 1.0)
powerScaling[chan] = 1.0;
@ -148,12 +148,12 @@ int RadioInterface::unRadioifyVector(signalVector *newVector, size_t chan)
bool RadioInterface::tuneTx(double freq, size_t chan)
{
return mRadio->setTxFreq(freq, chan);
return mDevice->setTxFreq(freq, chan);
}
bool RadioInterface::tuneRx(double freq, size_t chan)
{
return mRadio->setRxFreq(freq, chan);
return mDevice->setRxFreq(freq, chan);
}
/** synchronization thread loop */
@ -169,7 +169,7 @@ void *AlignRadioServiceLoopAdapter(RadioInterface *radioInterface)
}
void RadioInterface::alignRadio() {
mRadio->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
mDevice->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
}
bool RadioInterface::start()
@ -178,12 +178,12 @@ bool RadioInterface::start()
return true;
LOG(INFO) << "Starting radio device";
if (mRadio->requiresRadioAlign())
if (mDevice->requiresRadioAlign())
mAlignRadioServiceLoopThread.start(
(void * (*)(void*))AlignRadioServiceLoopAdapter,
(void*)this);
if (!mRadio->start())
if (!mDevice->start())
return false;
for (size_t i = 0; i < mChans; i++) {
@ -191,11 +191,11 @@ bool RadioInterface::start()
recvBuffer[i]->reset();
}
writeTimestamp = mRadio->initialWriteTimestamp();
readTimestamp = mRadio->initialReadTimestamp();
writeTimestamp = mDevice->initialWriteTimestamp();
readTimestamp = mDevice->initialReadTimestamp();
mRadio->updateAlignment(writeTimestamp-10000);
mRadio->updateAlignment(writeTimestamp-10000);
mDevice->updateAlignment(writeTimestamp-10000);
mDevice->updateAlignment(writeTimestamp-10000);
mOn = true;
LOG(INFO) << "Radio started";
@ -211,7 +211,7 @@ bool RadioInterface::start()
*/
bool RadioInterface::stop()
{
if (!mOn || !mRadio->stop())
if (!mOn || !mDevice->stop())
return false;
mOn = false;
@ -304,12 +304,12 @@ VectorFIFO* RadioInterface::receiveFIFO(size_t chan)
double RadioInterface::setRxGain(double dB, size_t chan)
{
return mRadio->setRxGain(dB, chan);
return mDevice->setRxGain(dB, chan);
}
double RadioInterface::getRxGain(size_t chan)
{
return mRadio->getRxGain(chan);
return mDevice->getRxGain(chan);
}
/* Receive a timestamped chunk from the device */
@ -323,7 +323,7 @@ int RadioInterface::pullBuffer()
return -1;
/* Outer buffer access size is fixed */
numRecv = mRadio->readSamples(convertRecvBuffer,
numRecv = mDevice->readSamples(convertRecvBuffer,
segmentLen,
&overrun,
readTimestamp,
@ -362,7 +362,7 @@ bool RadioInterface::pushBuffer()
}
/* Send the all samples in the send buffer */
numSent = mRadio->writeSamples(convertSendBuffer,
numSent = mDevice->writeSamples(convertSendBuffer,
segmentLen,
&local_underrun,
writeTimestamp);

View File

@ -36,7 +36,7 @@ protected:
std::vector<VectorFIFO> mReceiveFIFO; ///< FIFO that holds receive bursts
RadioDevice *mRadio; ///< the USRP object
RadioDevice *mDevice; ///< the USRP object
size_t mSPSTx;
size_t mSPSRx;
@ -84,7 +84,7 @@ public:
virtual void close();
/** constructor */
RadioInterface(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps,
RadioInterface(RadioDevice* wDevice, size_t tx_sps, size_t rx_sps,
size_t chans = 1, int receiveOffset = 3,
GSM::Time wStartTime = GSM::Time(0));
@ -128,10 +128,10 @@ public:
double fullScaleOutputValue();
/** get transport window type of attached device */
enum RadioDevice::TxWindowType getWindowType() { return mRadio->getWindowType(); }
enum RadioDevice::TxWindowType getWindowType() { return mDevice->getWindowType(); }
/** Minimum latency that the device can achieve */
GSM::Time minLatency() { return mRadio->minLatency(); }
GSM::Time minLatency() { return mDevice->minLatency(); }
protected:
/** drive synchronization of Tx/Rx of USRP */
@ -149,7 +149,7 @@ private:
int pullBuffer();
public:
RadioInterfaceResamp(RadioDevice* wRadio, size_t tx_sps, size_t rx_sps);
RadioInterfaceResamp(RadioDevice* wDevice, size_t tx_sps, size_t rx_sps);
~RadioInterfaceResamp();
bool init(int type);

View File

@ -238,7 +238,7 @@ int RadioInterfaceMulti::pullBuffer()
return -1;
/* Outer buffer access size is fixed */
num = mRadio->readSamples(convertRecvBuffer,
num = mDevice->readSamples(convertRecvBuffer,
outerRecvBuffer->size(),
&overrun,
readTimestamp,
@ -339,7 +339,7 @@ bool RadioInterfaceMulti::pushBuffer()
(float *) outerSendBuffer->begin(),
1.0 / (float) mChans, 2 * outerSendBuffer->size());
size_t num = mRadio->writeSamples(convertSendBuffer,
size_t num = mDevice->writeSamples(convertSendBuffer,
outerSendBuffer->size(),
&underrun,
writeTimestamp);
@ -368,9 +368,9 @@ bool RadioInterfaceMulti::tuneTx(double freq, size_t chan)
double shift = (double) getFreqShift(mChans);
if (!chan)
return mRadio->setTxFreq(freq + shift * MCBTS_SPACING);
return mDevice->setTxFreq(freq + shift * MCBTS_SPACING);
double center = mRadio->getTxFreq();
double center = mDevice->getTxFreq();
if (!fltcmp(freq, center + (double) (chan - shift) * MCBTS_SPACING)) {
LOG(NOTICE) << "Channel " << chan << " RF frequency offset is "
<< freq / 1e6 << " MHz";
@ -387,9 +387,9 @@ bool RadioInterfaceMulti::tuneRx(double freq, size_t chan)
double shift = (double) getFreqShift(mChans);
if (!chan)
return mRadio->setRxFreq(freq + shift * MCBTS_SPACING);
return mDevice->setRxFreq(freq + shift * MCBTS_SPACING);
double center = mRadio->getRxFreq();
double center = mDevice->getRxFreq();
if (!fltcmp(freq, center + (double) (chan - shift) * MCBTS_SPACING)) {
LOG(NOTICE) << "Channel " << chan << " RF frequency offset is "
<< freq / 1e6 << " MHz";
@ -401,7 +401,7 @@ bool RadioInterfaceMulti::tuneRx(double freq, size_t chan)
double RadioInterfaceMulti::setRxGain(double db, size_t chan)
{
if (!chan)
return mRadio->setRxGain(db);
return mDevice->setRxGain(db);
else
return mRadio->getRxGain();
return mDevice->getRxGain();
}

View File

@ -59,9 +59,9 @@ static size_t resamp_inchunk = 0;
static size_t resamp_outrate = 0;
static size_t resamp_outchunk = 0;
RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wRadio,
RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wDevice,
size_t tx_sps, size_t rx_sps)
: RadioInterface(wRadio, tx_sps, rx_sps, 1),
: RadioInterface(wDevice, tx_sps, rx_sps, 1),
outerSendBuffer(NULL), outerRecvBuffer(NULL)
{
}
@ -171,7 +171,7 @@ int RadioInterfaceResamp::pullBuffer()
return -1;
/* Outer buffer access size is fixed */
num_recv = mRadio->readSamples(convertRecvBuffer,
num_recv = mDevice->readSamples(convertRecvBuffer,
resamp_outchunk,
&overrun,
readTimestamp,
@ -223,7 +223,7 @@ bool RadioInterfaceResamp::pushBuffer()
(float *) outerSendBuffer->begin(),
powerScaling[0], 2 * resamp_outchunk);
numSent = mRadio->writeSamples(convertSendBuffer,
numSent = mDevice->writeSamples(convertSendBuffer,
resamp_outchunk,
&underrun,
writeTimestamp);