| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
uhd::device Class Referenceabstract

`#include <uhd/device.hpp>`

Inheritance diagram for uhd::device:

## Public Types
enum | device_filter_t { ANY , USRP , CLOCK }
| Device type, used as a filter in make. More...
typedef std::shared_ptr< device > | sptr
typedef std::function< device_addrs_t(const device_addr_t &)> | find_t
typedef std::function< sptr(const device_addr_t &)> | make_t

## Public Member Functions
virtual | ~device (void)=0
virtual rx_streamer::sptr | get_rx_stream (const stream_args_t &args)=0
| Make a new receive streamer from the streamer arguments.
virtual tx_streamer::sptr | get_tx_stream (const stream_args_t &args)=0
| Make a new transmit streamer from the streamer arguments.
virtual bool | recv_async_msg (async_metadata_t &async_metadata, double timeout=0.1)=0
uhd::property_tree::sptr | get_tree (void) const
| Get access to the underlying property structure.
device_filter_t | get_device_type () const
| Get device type.

## Static Public Member Functions
static void | register_device (const find_t &find, const make_t &make, const device_filter_t filter)
static device_addrs_t | find (const device_addr_t &hint, device_filter_t filter=ANY)
| Find devices attached to the host.
static sptr | make (const device_addr_t &hint, device_filter_t filter=ANY, size_t which=0)
| Create a new device from the device address hint.

## Protected Attributes
uhd::property_tree::sptr | _tree
device_filter_t | _type

## Detailed Description

The device interface represents the hardware. The API allows for discovery, configuration, and streaming.

## Member Typedef Documentation

## ◆ find_t

typedef std::function<device_addrs_t(const device_addr_t&)> uhd::device::find_t

## ◆ make_t

typedef std::function<sptr(const device_addr_t&)> uhd::device::make_t

## ◆ sptr

typedef std::shared_ptr<device> uhd::device::sptr

## Member Enumeration Documentation

## ◆ device_filter_t

enum uhd::device::device_filter_t

Device type, used as a filter in make.

Enumerator
ANY |
USRP |
CLOCK |

## Constructor & Destructor Documentation

## ◆ ~device()

virtual uhd::device::~device | ( | void |  | ) |
| pure virtual

## Member Function Documentation

## ◆ find()

static device_addrs_t uhd::device::find | ( | const device_addr_t & | hint,
|  | device_filter_t | filter = ANY )
| static

Find devices attached to the host.

The hint device address should be used to narrow down the search to particular transport types and/or transport arguments.

Parameters

  hint | a partially (or fully) filled in device address
  filter | an optional filter to exclude USRP or clock devices

Returns
  a vector of device addresses for all devices on the system

## ◆ get_device_type()

device_filter_t uhd::device::get_device_type | ( |  | ) | const

Get device type.

## ◆ get_rx_stream()

virtual rx_streamer::sptr uhd::device::get_rx_stream | ( | const stream_args_t & | args | ) |
| pure virtual

Make a new receive streamer from the streamer arguments.

Note: For RFNoC devices, there can always be only one streamer per channel. When calling get_rx_stream() a second time, the first streamer connected to this channel must be destroyed beforehand. Multiple streamers for different channels are allowed. For non-RFNoC devices, you can only have one RX streamer at a time. Be careful to destroy the old one if you want to create a new one.

## ◆ get_tree()

uhd::property_tree::sptr uhd::device::get_tree | ( | void |  | ) | const

Get access to the underlying property structure.

## ◆ get_tx_stream()

virtual tx_streamer::sptr uhd::device::get_tx_stream | ( | const stream_args_t & | args | ) |
| pure virtual

Make a new transmit streamer from the streamer arguments.

Note: For RFNoC devices, there can always be only one streamer per channel. When calling get_tx_stream() a second time, the first streamer connected to this channel must be destroyed beforehand. Multiple streamers for different channels are allowed. For non-RFNoC devices, you can only have one TX streamer at a time. Be careful to destroy the old one if you want to create a new one.

## ◆ make()

static sptr uhd::device::make | ( | const device_addr_t & | hint,
|  | device_filter_t | filter = ANY,
|  | size_t | which = 0 )
| static

Create a new device from the device address hint.

The method will go through the registered device types and pick one of the discovered devices.

By default, the first result will be used to create a new device. Use the which parameter as an index into the list of results.

Parameters

  hint | a partially (or fully) filled in device address
  filter | an optional filter to exclude USRP or clock devices
  which | which address to use when multiple are found

Returns
  a shared pointer to a new device instance

## ◆ recv_async_msg()

virtual bool uhd::device::recv_async_msg | ( | async_metadata_t & | async_metadata,
|  | double | timeout = 0.1 )
| pure virtual

DEPRECATED: Receive asynchronous message from the device

Prefer calling recv_async_msg on the associated TX streamer. This method has the problem that it doesn't necessarily know which Tx streamer is being addressed, and thus might not be delivering the expected outcome.

Parameters

  async_metadata | the metadata to be filled in
  timeout | the timeout in seconds to wait for a message

Returns
  true when the async_metadata is valid, false for timeout

## ◆ register_device()

static void uhd::device::register_device | ( | const find_t & | find,
|  | const make_t & | make,
|  | const device_filter_t | filter )
| static

Register a device into the discovery and factory system.

Parameters

  find | a function that discovers devices
  make | a factory function that makes a device
  filter | include only USRP devices, clock devices, or both

## Member Data Documentation

## ◆ _tree

uhd::property_tree::sptr uhd::device::_tree
| protected

## ◆ _type

device_filter_t uhd::device::_type
| protected

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

- device.hpp