aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Müller <marcus.mueller@ettus.com>2015-04-16 21:37:49 +0200
committerMartin Braun <martin.braun@ettus.com>2015-04-20 15:20:20 -0700
commit14d2555d832f68243d5c810ba76f8f0823a3198c (patch)
tree51247673e880b07d0d4586031a95140215e98ed6
parent6eacba0a0e30090963f832ecfeacecfb829757a1 (diff)
downloaduhd-14d2555d832f68243d5c810ba76f8f0823a3198c.tar.gz
uhd-14d2555d832f68243d5c810ba76f8f0823a3198c.tar.bz2
uhd-14d2555d832f68243d5c810ba76f8f0823a3198c.zip
utils: added integer, range and double property tree accessors
This amends uhd_usrp_probe's ability to query the property tree.
-rw-r--r--host/utils/uhd_usrp_probe.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index a03646cc0..f8a8b5665 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -192,7 +192,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("version", "print the version string and exit")
("args", po::value<std::string>()->default_value(""), "device address args")
("tree", "specify to print a complete property tree")
- ("string", po::value<std::string>(), "query a string value from the properties tree")
+ ("string", po::value<std::string>(), "query a string value from the property tree")
+ ("double", po::value<std::string>(), "query a double precision floating point value from the property tree")
+ ("int", po::value<std::string>(), "query a integer value from the property tree")
+ ("range", po::value<std::string>(), "query a range (gain, bandwidth, frequency, ...) from the property tree")
("init-only", "skip all queries, only initialize device")
;
@@ -219,6 +222,22 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
return EXIT_SUCCESS;
}
+ if (vm.count("double")){
+ std::cout << tree->access<double>(vm["double"].as<std::string>()).get() << std::endl;
+ return EXIT_SUCCESS;
+ }
+
+ if (vm.count("int")){
+ std::cout << tree->access<int>(vm["int"].as<std::string>()).get() << std::endl;
+ return EXIT_SUCCESS;
+ }
+
+ if (vm.count("range")){
+ meta_range_t range = tree->access<meta_range_t>(vm["range"].as<std::string>()).get();
+ std::cout << boost::format("%.1f:%.1f:%.1f") % range.start() % range.step() % range.stop() << std::endl;
+ return EXIT_SUCCESS;
+ }
+
if (vm.count("tree") != 0) print_tree("/", tree);
else if (not vm.count("init-only")) std::cout << make_border(get_device_pp_string(tree)) << std::endl;