aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-11-20 21:36:55 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:07 -0800
commit59ecec43d4120e0b8e5d5d6ede1c673b5575a14f (patch)
tree999ef41f50139634e4a94f4a43c8c897d97d3d17 /host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
parentb14cafd90c84e69cdb77aec2d8553c4d45213b8f (diff)
downloaduhd-59ecec43d4120e0b8e5d5d6ede1c673b5575a14f.tar.gz
uhd-59ecec43d4120e0b8e5d5d6ede1c673b5575a14f.tar.bz2
uhd-59ecec43d4120e0b8e5d5d6ede1c673b5575a14f.zip
mg: Init dboard sensors via MPM
Reviewed-By: Steven Bingler <steven.bingler@ni.com> Reviewed-By: Trung Tran <trung.tran@ettus.com>
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
index 7cfa45bc7..27cf926a2 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
@@ -401,3 +401,35 @@ void magnesium_radio_ctrl_impl::_init_prop_tree()
}
}
+void magnesium_radio_ctrl_impl::_init_mpm_sensors(
+ const direction_t dir,
+ const size_t chan_idx
+) {
+ const std::string trx = (dir == RX_DIRECTION) ? "RX" : "TX";
+ const fs_path fe_path =
+ fs_path("dboards") / _radio_slot /
+ (dir == RX_DIRECTION ? "rx_frontends" : "tx_frontends") / chan_idx;
+ auto sensor_list =
+ _rpcc->request_with_token<std::vector<std::string>>(
+ this->_rpc_prefix + "get_sensors", trx);
+ UHD_LOG_TRACE(unique_id(),
+ "Chan " << chan_idx << ": Found "
+ << sensor_list.size() << " " << trx << " sensors.");
+ for (const auto &sensor_name : sensor_list) {
+ UHD_LOG_TRACE(unique_id(),
+ "Adding " << trx << " sensor " << sensor_name);
+ _tree->create<sensor_value_t>(fe_path / "sensors" / sensor_name)
+ .add_coerced_subscriber([](const sensor_value_t &){
+ throw uhd::runtime_error(
+ "Attempting to write to sensor!");
+ })
+ .set_publisher([this, trx, sensor_name, chan_idx](){
+ return sensor_value_t(
+ this->_rpcc->request_with_token<sensor_value_t::sensor_map_t>(
+ this->_rpc_prefix + "get_sensor",
+ trx, sensor_name, chan_idx)
+ );
+ })
+ ;
+ }
+}