当前位置: 首页>>代码示例>>C++>>正文


C++ sptr::get_rx_subdev_spec方法代码示例

本文整理汇总了C++中uhd::usrp::multi_usrp::sptr::get_rx_subdev_spec方法的典型用法代码示例。如果您正苦于以下问题:C++ sptr::get_rx_subdev_spec方法的具体用法?C++ sptr::get_rx_subdev_spec怎么用?C++ sptr::get_rx_subdev_spec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在uhd::usrp::multi_usrp::sptr的用法示例。


在下文中一共展示了sptr::get_rx_subdev_spec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

/***********************************************************************
 * Set standard defaults for devices
 **********************************************************************/
static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp){
    uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
    // Will work on 1st subdev, top-level must make sure it's the right one
    uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();

    const uhd::fs_path mb_path = "/mboards/0";
    const std::string mb_name = tree->access<std::string>(mb_path / "name").get();
    if (mb_name.find("USRP2") != std::string::npos or mb_name.find("N200") != std::string::npos or mb_name.find("N210") != std::string::npos  or mb_name.find("X300") != std::string::npos  or mb_name.find("X310") != std::string::npos){
        usrp->set_tx_rate(12.5e6);
        usrp->set_rx_rate(12.5e6);
    }
    else if (mb_name.find("B100") != std::string::npos){
        usrp->set_tx_rate(4e6);
        usrp->set_rx_rate(4e6);
    }
    else if (mb_name.find("E100") != std::string::npos or mb_name.find("E110") != std::string::npos){
        usrp->set_tx_rate(4e6);
        usrp->set_rx_rate(8e6);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

    const uhd::fs_path tx_fe_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/tx_frontends/0";
    const std::string tx_name = tree->access<std::string>(tx_fe_path / "name").get();
    if (tx_name.find("WBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("SBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("CBX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else if (tx_name.find("RFX") != std::string::npos){
        usrp->set_tx_gain(0);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

    const uhd::fs_path rx_fe_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/rx_frontends/0";
    const std::string rx_name = tree->access<std::string>(rx_fe_path / "name").get();
    if (rx_name.find("WBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("SBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("CBX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else if (rx_name.find("RFX") != std::string::npos){
        usrp->set_rx_gain(25);
    }
    else{
        throw std::runtime_error("self-calibration is not supported for this hardware");
    }

}
开发者ID:Bobakka,项目名称:uhd,代码行数:63,代码来源:usrp_cal_utils.hpp

示例2:

/***********************************************************************
 * Retrieve d'board serial
 **********************************************************************/
static std::string get_serial(
    uhd::usrp::multi_usrp::sptr usrp,
    const std::string &tx_rx)
{
    uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
    // Will work on 1st subdev, top-level must make sure it's the right one
    uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();
    const uhd::fs_path db_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/" + tx_rx + "_eeprom";
    const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get();
    return db_eeprom.serial;
}
开发者ID:dkozel,项目名称:uhd,代码行数:14,代码来源:usrp_cal_utils.hpp

示例3: check_for_empty_serial

/***********************************************************************
 * Check for empty serial
 **********************************************************************/
void check_for_empty_serial(uhd::usrp::multi_usrp::sptr usrp)
{
    // Will work on 1st subdev, top-level must make sure it's the right one
    uhd::usrp::subdev_spec_t subdev_spec = usrp->get_rx_subdev_spec();

    //extract eeprom
    uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
    // This only works with transceiver boards, so we can always check rx side
    const uhd::fs_path db_path = "/mboards/0/dboards/" + subdev_spec[0].db_name + "/rx_eeprom";
    const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get();

    std::string error_string = "This dboard has no serial!\n\nPlease see the Calibration documentation for details on how to fix this.";
    if (db_eeprom.serial.empty())
        throw std::runtime_error(error_string);
}
开发者ID:dkozel,项目名称:uhd,代码行数:18,代码来源:usrp_cal_utils.hpp

示例4: get_rx_parameters

void get_rx_parameters(uhd::usrp::multi_usrp::sptr usrp, size_t mboard , std::ostream & os)
{
	using namespace std;
	namespace radio = uhd::usrp;
	size_t nchan = 0;

	// Get sub device specification
	os << std::endl << "********** RX Sub Device ***********" << std::endl;
	os << std::endl << "-----> Get Rx Subdevice" << std::endl;
	radio::subdev_spec_t rx_subdev = usrp->get_rx_subdev_spec(mboard);
	os << "RX Subdevice Specification:" << endl;
	os << rx_subdev.to_pp_string() << endl;
	
	os << std::endl << "-----> Get number of RX channels" << std::endl;
	size_t num_rx = usrp->get_rx_num_channels();
	os << "Number of RX channels:" << endl;
	os << num_rx << endl;
	
	os << std::endl << "-----> Get RX Subdevice Name" << std::endl;
	string rx_name = usrp->get_rx_subdev_name(nchan);
	os << "RX Subdevice Name:" << endl;
	os << rx_name << endl;

	os << std::endl << "********** RX Sample Rate ***********" << std::endl;
	os << std::endl << "-----> Get RX Rate" << std::endl;
	double rx_rate = usrp->get_rx_rate(nchan);
	os << "RX Rate:" << endl;
	os << rx_rate << endl;
	
	os << std::endl << "-----> Get RX Rate List" << std::endl;
	uhd::meta_range_t rx_rates = usrp->get_rx_rates(nchan);
	os << "RX Rate List:" << endl;
	os << "Start: " << rx_rates.start() << "   Stop: " << rx_rates.stop() << "   Step: " << rx_rates.step() << endl;
	os << rx_rates.to_pp_string() << endl;
	
	// RX FREQUENCIES
	
	os << std::endl << "********** RX Frequencies ***********" << std::endl;
	os << std::endl << "-----> Get RX Center Frequency" << std::endl;
	double rx_freq = usrp->get_rx_freq(nchan);
	os << "RX Freq:" << endl;
	os << rx_freq << endl;

	os << std::endl << "-----> Get RX Center Frequency Range" << std::endl;
	uhd::freq_range_t rx_freq_range = usrp->get_rx_freq_range(nchan);
	os << "RX Frequency Range:" << endl;
	os << "Start: " << rx_freq_range.start() << "   Stop: " << rx_freq_range.stop() << "   Step: " << rx_freq_range.step() << endl;
	os << rx_freq_range.to_pp_string() << endl;
	
	// RX Front end frequencies
	os << std::endl << "-----> Get RX RF Front End Center Frequency Range" << std::endl;
	try
	{
		os << "RX Front End Frequency Range:" << endl;
		uhd::freq_range_t rx_fe_freq_range = usrp->get_fe_rx_freq_range(nchan);
		os << "Start: " << rx_fe_freq_range.start() << "   Stop: " << rx_fe_freq_range.stop() << "   Step: " << rx_fe_freq_range.step() << endl;
		os << rx_fe_freq_range.to_pp_string() << endl;
	}
		catch (uhd::runtime_error &e)
	{
		os << " Exception occurred : " << e.code() << endl;
	}
	
	// RX GAIN
	
	os << std::endl << "********** RX Gain  ***********" << std::endl;
	
	// Total combined gain
	os << endl << "-----> Get RX Total Gain" << endl;
	os << "RX Total Gain: " ;	
	try
	{
		double rx_total_gain = usrp->get_rx_gain(nchan);
		os << rx_total_gain << endl;
	}
	catch(uhd::runtime_error &e)
	{
		os << "Exception code: " << e.code() << endl;
	}
	
	// List of all gain elements
	os << std::endl << "-----> Get RX gain names" << std::endl;
	std::vector<std::string> rx_gain_names = usrp->get_rx_gain_names(nchan);
	os << "Rx Gain Names: " << std::endl;
	for (int index =0; index < rx_gain_names.size(); index++)
	{
		// Name
		os << "\t" << rx_gain_names[index] << endl;
	}
	for (int index =0; index < rx_gain_names.size(); index++)
	{
		// Name
		os << "\t" << "Name: " << rx_gain_names[index] << "  Value: ";
		// Value
		try
		{
		double element_gain = usrp->get_rx_gain(rx_gain_names[index], nchan);
		os << element_gain << endl;
		}
		catch(uhd::runtime_error &e)
//.........这里部分代码省略.........
开发者ID:Radioguy00,项目名称:E100_Og2Modem,代码行数:101,代码来源:uhd_utilities.cpp


注:本文中的uhd::usrp::multi_usrp::sptr::get_rx_subdev_spec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。