diff options
Diffstat (limited to 'host/lib/usrp/mpmd/mpmd_impl.cpp')
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index 38a089788..93e777af2 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -106,6 +106,36 @@ namespace { ); }) ; + + /*** Sensors ********************************************************/ + auto sensor_list = + mb->rpc->request_with_token<std::vector<std::string>>( + "get_mb_sensors" + ); + UHD_LOG_DEBUG("MPMD", + "Found " << sensor_list.size() << " motherboard sensors." + ); + for (const auto& sensor_name : sensor_list) { + UHD_LOG_TRACE("MPMD", + "Adding motherboard sensor `" << sensor_name << "'" + ); + tree->create<sensor_value_t>( + mb_path / "sensors" / sensor_name) + .set_publisher([mb, sensor_name](){ + return sensor_value_t( + mb->rpc->request_with_token<sensor_value_t::sensor_map_t>( + "get_mb_sensor", sensor_name + ) + ); + }) + .set_coercer([](const sensor_value_t &){ + throw uhd::runtime_error( + "Trying to write read-only sensor value!" + ); + return sensor_value_t("", "", ""); + }) + ; + } } void reset_time_synchronized(uhd::property_tree::sptr tree) |