diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 8308def7..0b7ac31d 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -902,6 +902,12 @@ int Transceiver::ctrl_sock_handle_rx(int chan) power = mRadioInterface->setPowerAttenuation(power, chan); mStates[chan].mPower = power; sprintf(response, "RSP ADJPOWER 0 %d", power); +} else if (match_cmd(command, "NOMTXPOWER", NULL)) { + int power = mRadioInterface->getNominalTxPower(chan); + if (power > 0) + sprintf(response, "RSP NOMTXPOWER 0 %d", power); + else + sprintf(response, "RSP NOMTXPOWER 1 %d", -power); } else if (match_cmd(command, "RXTUNE", ¶ms)) { // tune receiver int freqKhz; diff --git a/Transceiver52M/device/common/radioDevice.h b/Transceiver52M/device/common/radioDevice.h index 0dc38d5a..8dd8f49d 100644 --- a/Transceiver52M/device/common/radioDevice.h +++ b/Transceiver52M/device/common/radioDevice.h @@ -128,6 +128,9 @@ class RadioDevice { /** sets the transmit chan gain, returns the gain setting **/ virtual double setTxGain(double dB, size_t chan = 0) = 0; + /** returns the Nominal transmit output power of the transceiver in dBm, negative on error **/ + virtual int getNominalTxPower(size_t chan = 0) = 0; + /** get transmit gain */ virtual double getTxGain(size_t chan = 0) = 0; diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index 932817d2..355c8e48 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -530,6 +530,14 @@ double LMSDevice::setRxGain(double dB, size_t chan) return rx_gains[chan]; } +int LMSDevice::getNominalTxPower(size_t chan) +{ + /* TODO: return value based on some experimentally generated table depending on + * band/arfcn, which is known here thanks to TXTUNE + */ + return 23; +} + void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os) { lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */ diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h index 5b6330ab..78fd62a2 100644 --- a/Transceiver52M/device/lms/LMSDevice.h +++ b/Transceiver52M/device/lms/LMSDevice.h @@ -179,6 +179,8 @@ public: /** return minimum Rx Gain **/ double minTxGain(void); + int getNominalTxPower(size_t chan = 0); + /** sets the RX path to use, returns true if successful and false otherwise */ bool setRxAntenna(const std::string & ant, size_t chan = 0); diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp index ad562500..29701736 100644 --- a/Transceiver52M/device/uhd/UHDDevice.cpp +++ b/Transceiver52M/device/uhd/UHDDevice.cpp @@ -341,6 +341,14 @@ double uhd_device::getTxGain(size_t chan) return tx_gains[chan]; } +int uhd_device::getNominalTxPower(size_t chan) +{ + /* TODO: return value based on some experimentally generated table depending on + * band/arfcn, which is known here thanks to TXTUNE + */ + return 23; +} + /* 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 diff --git a/Transceiver52M/device/uhd/UHDDevice.h b/Transceiver52M/device/uhd/UHDDevice.h index 1e66246c..01d71a02 100644 --- a/Transceiver52M/device/uhd/UHDDevice.h +++ b/Transceiver52M/device/uhd/UHDDevice.h @@ -100,6 +100,8 @@ public: double maxTxGain(void) { return tx_gain_max; } double minTxGain(void) { return tx_gain_min; } + int getNominalTxPower(size_t chan = 0); + double getTxFreq(size_t chan); double getRxFreq(size_t chan); double getRxFreq(); diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp index 1a9a7e11..73117d2c 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.cpp +++ b/Transceiver52M/device/usrp1/USRPDevice.cpp @@ -314,6 +314,14 @@ double USRPDevice::setRxGain(double dB, size_t chan) return rxGain; } +int USRPDevice::getNominalTxPower(size_t chan) +{ + /* TODO: return value based on some experimentally generated table depending on + * band/arfcn, which is known here thanks to TXTUNE + */ + return 23; +} + bool USRPDevice::setRxAntenna(const std::string &ant, size_t chan) { if (chan >= rx_paths.size()) { diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h index a4a0886a..05491920 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.h +++ b/Transceiver52M/device/usrp1/USRPDevice.h @@ -180,6 +180,8 @@ private: /** return minimum Rx Gain **/ double minTxGain(void); + int getNominalTxPower(size_t chan = 0); + /** sets the RX path to use, returns true if successful and false otherwise */ bool setRxAntenna(const std::string &ant, size_t chan = 0); diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index fbcacf16..fb724d25 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -124,6 +124,16 @@ int RadioInterface::setPowerAttenuation(int atten, size_t chan) return atten; } +int RadioInterface::getNominalTxPower(size_t chan) +{ + if (chan >= mChans) { + LOG(ALERT) << "Invalid channel requested"; + return -1; + } + + return mDevice->getNominalTxPower(chan); +} + int RadioInterface::radioifyVector(signalVector &wVector, size_t chan, bool zero) { diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h index c75a983d..eb7ed3bc 100644 --- a/Transceiver52M/radioInterface.h +++ b/Transceiver52M/radioInterface.h @@ -117,6 +117,7 @@ public: int driveReceiveRadio(); int setPowerAttenuation(int atten, size_t chan = 0); + int getNominalTxPower(size_t chan = 0); /** returns the full-scale transmit amplitude **/ double fullScaleInputValue();