source: uhd/print_addr/print_addr.cpp @ 86

Last change on this file since 86 was 86, checked in by cbwithersp42, 6 years ago

uhd: program to pretty print usrp's IP

File size: 527 bytes
Line 
1#include <uhd/usrp/device.hpp>
2#include <iostream>
3
4int main (int argc, char *argv[]) {
5  //Find all available USRP2 devices
6  uhd::device_addr_t hint;
7  hint["type"] = "usrp2";
8  uhd::device_addrs_t addrs = uhd::device::find(hint);
9
10  if (addrs.size() == 0) {
11    std::cerr << "Unable to find any UHD devices" << std::endl;
12    return 1;
13  }
14
15  std::cout << "Found UHD devices:" << std::endl << std::endl;
16  for (size_t i = 0; i < addrs.size(); i++) {
17    std::cout << addrs[i].to_pp_string() << std::endl;
18  }
19
20  return 0;
21}
Note: See TracBrowser for help on using the repository browser.