aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/rf_control/gain_profile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/rf_control/gain_profile.cpp')
-rw-r--r--host/lib/rfnoc/rf_control/gain_profile.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/host/lib/rfnoc/rf_control/gain_profile.cpp b/host/lib/rfnoc/rf_control/gain_profile.cpp
index 54ccb9006..9d415cb45 100644
--- a/host/lib/rfnoc/rf_control/gain_profile.cpp
+++ b/host/lib/rfnoc/rf_control/gain_profile.cpp
@@ -21,13 +21,16 @@ std::vector<std::string> default_gain_profile::get_gain_profile_names(const size
return {DEFAULT_GAIN_PROFILE};
}
-void default_gain_profile::set_gain_profile(const std::string& profile, const size_t)
+void default_gain_profile::set_gain_profile(const std::string& profile, const size_t chan)
{
if (profile != DEFAULT_GAIN_PROFILE) {
throw uhd::value_error(
std::string("set_tx_gain_profile(): Unknown gain profile: `") + profile
+ "'");
}
+ if (_sub) {
+ _sub(profile, chan);
+ }
}
std::string default_gain_profile::get_gain_profile(const size_t) const
@@ -35,6 +38,12 @@ std::string default_gain_profile::get_gain_profile(const size_t) const
return DEFAULT_GAIN_PROFILE;
}
+
+void default_gain_profile::add_subscriber(subscriber_type&& sub)
+{
+ _sub = std::move(sub);
+}
+
enumerated_gain_profile::enumerated_gain_profile(
const std::vector<std::string>& possible_profiles,
const std::string& default_profile,
@@ -52,6 +61,9 @@ void enumerated_gain_profile::set_gain_profile(
throw uhd::key_error(err_msg);
}
_gain_profile.at(chan) = profile;
+ if (_sub) {
+ _sub(profile, chan);
+ }
}
std::string enumerated_gain_profile::get_gain_profile(const size_t chan) const
@@ -65,4 +77,9 @@ std::vector<std::string> enumerated_gain_profile::get_gain_profile_names(
return _possible_profiles;
}
+void enumerated_gain_profile::add_subscriber(subscriber_type&& sub)
+{
+ _sub = std::move(sub);
+}
+
}}} // namespace uhd::rfnoc::rf_control