USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
UHD and USRP Manual
actions.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2019 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
9 #include <uhd/config.hpp>
11 #include <uhd/types/metadata.hpp>
12 #include <uhd/types/ranges.hpp>
13 #include <uhd/types/stream_cmd.hpp>
14 #include <uhd/types/time_spec.hpp>
17 #include <boost/optional.hpp>
18 #include <cstddef>
19 #include <cstdint>
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 namespace uhd { namespace rfnoc {
26 
35 {
36 public:
37  virtual ~action_info() {}
38 
39  using sptr = std::shared_ptr<action_info>;
41  const size_t id;
43  std::string key;
47  std::vector<uint8_t> payload;
50 
52  static sptr make(const std::string& key = "",
53  const uhd::device_addr_t& args = uhd::device_addr_t(""));
54 
55 protected:
57  const std::string& key, const uhd::device_addr_t& args = uhd::device_addr_t(""));
58 };
59 
61 {
62 public:
63  using sptr = std::shared_ptr<stream_cmd_action_info>;
64 
66 
68  static sptr make(const uhd::stream_cmd_t::stream_mode_t stream_mode);
69 
70 private:
72 };
73 
75 {
76 public:
77  using sptr = std::shared_ptr<rx_event_action_info>;
78 
81 
84 
85 protected:
87 };
88 
90 {
91 public:
92  using sptr = std::shared_ptr<tx_event_action_info>;
93 
96 
98  bool has_tsf;
99 
101  uint64_t tsf;
102 
105  const std::optional<uint64_t>& tsf);
106 
112  static sptr make(uhd::async_metadata_t::event_code_t event_code, uint64_t tsf)
113  {
114  return make(event_code, std::make_optional<uint64_t>(tsf));
115  }
116 
118  [[deprecated("Prefer std::optional over boost::optional.")]] static sptr make(
120  const boost::optional<uint64_t>& tsf)
121  {
122  return make(
123  event_code, bool(tsf) ? std::make_optional<uint64_t>(*tsf) : std::nullopt);
124  }
125 
126 protected:
128  const std::optional<uint64_t>& tsf);
129 };
130 
133 {
134 public:
135  using sptr = std::shared_ptr<tune_request_action_info>;
136 
144  static sptr make(const uhd::tune_request_t tune_request);
145 
146 private:
147  tune_request_action_info(const uhd::tune_request_t tune_request);
148 };
149 
150 }} /* namespace uhd::rfnoc */
Definition: device_addr.hpp:39
Definition: time_spec.hpp:31
#define UHD_API
Definition: config.h:87
Definition: build_info.hpp:12
event_code_t
Definition: metadata.hpp:216
Definition: ranges.hpp:67
Definition: actions.hpp:35
std::vector< uint8_t > payload
Definition: actions.hpp:47
std::string key
A string identifier for this action.
Definition: actions.hpp:43
virtual ~action_info()
Definition: actions.hpp:37
const size_t id
A unique counter for this action.
Definition: actions.hpp:41
action_info(const std::string &key, const uhd::device_addr_t &args=uhd::device_addr_t(""))
std::shared_ptr< action_info > sptr
Definition: actions.hpp:39
static sptr make(const std::string &key="", const uhd::device_addr_t &args=uhd::device_addr_t(""))
Factory function.
uhd::device_addr_t args
A dictionary of key-value pairs. May be used as desired.
Definition: actions.hpp:49
Definition: actions.hpp:75
static sptr make(uhd::rx_metadata_t::error_code_t error_code)
Factory function.
rx_event_action_info(uhd::rx_metadata_t::error_code_t error_code)
uhd::rx_metadata_t::error_code_t error_code
The error code that describes the event.
Definition: actions.hpp:80
Definition: actions.hpp:61
static sptr make(const uhd::stream_cmd_t::stream_mode_t stream_mode)
Factory function.
uhd::stream_cmd_t stream_cmd
Definition: actions.hpp:65
Action object for graph-based tuning.
Definition: actions.hpp:133
static sptr make(const uhd::tune_request_t tune_request)
Factory function.
uhd::freq_range_t overall_freq_range
Definition: actions.hpp:142
uhd::tune_request_t tune_request
Definition: actions.hpp:137
uhd::time_spec_t time_spec
Definition: actions.hpp:138
uhd::freq_range_t rf_range
Definition: actions.hpp:141
uhd::tune_result_t tune_result
Definition: actions.hpp:139
uhd::freq_range_t dsp_range
Definition: actions.hpp:140
Definition: actions.hpp:90
tx_event_action_info(uhd::async_metadata_t::event_code_t event_code, const std::optional< uint64_t > &tsf)
uint64_t tsf
When the async event occurred.
Definition: actions.hpp:101
static sptr make(uhd::async_metadata_t::event_code_t event_code, const boost::optional< uint64_t > &tsf)
Factory function (legacy, to support boost::optional)
Definition: actions.hpp:118
static sptr make(uhd::async_metadata_t::event_code_t event_code, const std::optional< uint64_t > &tsf)
Factory function.
bool has_tsf
Has time specification?
Definition: actions.hpp:98
uhd::async_metadata_t::event_code_t event_code
The event code that describes the event.
Definition: actions.hpp:95
static sptr make(uhd::async_metadata_t::event_code_t event_code, uint64_t tsf)
Definition: actions.hpp:112
error_code_t
Definition: metadata.hpp:113
Definition: stream_cmd.hpp:42
stream_mode_t
Definition: stream_cmd.hpp:43
Definition: tune_request.hpp:25
Definition: tune_result.hpp:19