예제 #1
0
std::string mboard_sensors_string(multi_usrp::sptr usrp, const size_t mb_idx)
{
    std::stringstream ss;
    ss << "Sensors for motherboard " << mb_idx << ": \n" << std::endl;
    const auto mboard_sensors = usrp->get_mboard_sensor_names(mb_idx);
    for (const auto& mboard_sensor : mboard_sensors) {
        const auto sensor_value =
            usrp->get_mboard_sensor(mboard_sensor, mb_idx);
        ss << "* " << sensor_value.to_pp_string() << std::endl;
    }
    ss << make_border(db_sensors_string("RX", usrp, mb_idx)) << std::endl;
    ss << make_border(db_sensors_string("TX", usrp, mb_idx)) << std::endl;

    return ss.str();
}
예제 #2
0
void wait_for_pps(multi_usrp::sptr usrp, size_t chan, double timeout){
    time_t last_pps_time = usrp->get_time_last_pps(chan).get_full_secs();
    time_t system_time = uhd::time_spec_t::get_system_time().get_full_secs();
    time_t exit_time = system_time + time_t(timeout);
    bool detected_pps = false;

    //Otherwise, this would hang if the USRP doesn't detect any PPS
    while(uhd::time_spec_t::get_system_time().get_full_secs() < exit_time){
        time_t time_now = usrp->get_time_last_pps(chan).get_full_secs();
        if(last_pps_time < time_now){
            detected_pps = true;
            break;
        }
        else last_pps_time = time_now;
    }
    if(not detected_pps) throw uhd::runtime_error(str(boost::format("%s did not detect a PPS signal.")
                                                      % usrp->get_usrp_tx_info()["mboard_serial"]));

}
예제 #3
0
std::string db_sensors_string(
        const std::string& tx_rx,
        multi_usrp::sptr usrp,
        const size_t mb_idx
) {
    std::stringstream ss;

    ss << tx_rx << " Sensors: \n" << std::endl;
    const size_t num_chans = (tx_rx == "RX")
        ?  usrp->get_rx_subdev_spec(mb_idx).size()
        :  usrp->get_tx_subdev_spec(mb_idx).size()
    ;

    for (size_t chan_idx = 0; chan_idx < num_chans; chan_idx++) {
        ss << "Chan " << chan_idx << ": " << std::endl;
        const auto sensors = (tx_rx == "RX")
            ? usrp->get_rx_sensor_names(chan_idx)
            : usrp->get_tx_sensor_names(chan_idx);
        for (const auto& sensor : sensors) {
            const auto sensor_value = (tx_rx == "RX")
                ? usrp->get_rx_sensor(sensor, chan_idx)
                : usrp->get_tx_sensor(sensor, chan_idx)
            ;
            ss << "* " << sensor_value.to_pp_string() << std::endl;
        }
        ss << std::endl;
    }

    return ss.str();
}
예제 #4
0
void get_usrp_time(multi_usrp::sptr usrp, size_t mboard, std::vector<time_t> *times){
    (*times)[mboard] = usrp->get_time_now(mboard).get_full_secs();
}
예제 #5
0
void get_usrp_time(multi_usrp::sptr usrp, size_t chan, std::vector<time_t> *times){
    wait_for_pps(usrp, chan, 2);
    (*times)[chan] = usrp->get_time_now(chan).get_full_secs();
}