USRP Hardware Driver and USRP Manual: uhd::device_addr_t Class Reference

| USRP Hardware Driver and USRP Manual Version: 4.9.0.makepkg-0-g9ec1f582 UHD and USRP Manual |

Loading...
Searching...
No Matches
uhd::device_addr_t Class Reference

`#include <uhd/types/device_addr.hpp>`

Inheritance diagram for uhd::device_addr_t:

## Public Member Functions
| device_addr_t (const std::string &args="")
| device_addr_t (const char *args)
| device_addr_t (const std::map< std::string, std::string > &info)
std::string | to_pp_string (void) const
std::string | to_string (void) const
template<typename T>
T | cast (const std::string &key, const T &def) const

## Detailed Description

Mapping of key/value pairs for locating devices on the system. When left empty, the device discovery routines will search all available transports on the system (ethernet, usb...).

To narrow down the discovery process to a particular device, specify a transport key/value pair specific to your device.

- Ex, to find a usrp2: my_dev_addr["addr"] = [resolvable_hostname_or_ip]

The device address can also be used to pass arguments into the transport layer control to set (for example) buffer sizes.

An arguments string, is a way to represent a device address using a single string with delimiter characters.

- Ex: addr=192.168.10.2
- Ex: addr=192.168.10.2, recv_buff_size=1e6

## Constructor & Destructor Documentation

## ◆ device_addr_t() [1/3]

uhd::device_addr_t::device_addr_t | ( | const std::string & | args = "" | ) |

Create a device address from an args string.

Parameters

  args | the arguments string

## ◆ device_addr_t() [2/3]

uhd::device_addr_t::device_addr_t | ( | const char * | args | ) |

Create a device address from an args string.

Parameters

  args | the arguments string

## ◆ device_addr_t() [3/3]

uhd::device_addr_t::device_addr_t | ( | const std::map< std::string, std::string > & | info | ) |

Create a device address from a std::map

Parameters

  info | the device info map

## Member Function Documentation

## ◆ cast()

template<typename T>

T uhd::device_addr_t::cast | ( | const std::string & | key,
|  | const T & | def ) const
| inline

Lexically cast a parameter to the specified type, or use the default value if the key is not found.

Parameters

  key | the key as one of the address parameters
  def | the value to use when key is not present

Returns
  the casted value as type T or the default

Exceptions

  error | when the parameter cannot be casted

## ◆ to_pp_string()

std::string uhd::device_addr_t::to_pp_string | ( | void |  | ) | const

Convert a device address into a pretty print string.

Returns
  a printable string representing the device address

## ◆ to_string()

std::string uhd::device_addr_t::to_string | ( | void |  | ) | const

Convert the device address into an args string. The args string contains delimiter symbols.

Returns
  a string with delimiter markup

The documentation for this class was generated from the following file:

- device_addr.hpp