diff options
Diffstat (limited to 'host/lib/usrp_clock')
-rw-r--r-- | host/lib/usrp_clock/multi_usrp_clock.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp_clock/octoclock/octoclock_impl.cpp | 48 | ||||
-rw-r--r-- | host/lib/usrp_clock/usrp_clock_c.cpp | 3 |
5 files changed, 27 insertions, 36 deletions
diff --git a/host/lib/usrp_clock/multi_usrp_clock.cpp b/host/lib/usrp_clock/multi_usrp_clock.cpp index 71521190e..bcc0b57d6 100644 --- a/host/lib/usrp_clock/multi_usrp_clock.cpp +++ b/host/lib/usrp_clock/multi_usrp_clock.cpp @@ -19,11 +19,10 @@ #include <uhd/usrp_clock/multi_usrp_clock.hpp> #include <uhd/usrp_clock/octoclock_eeprom.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> using namespace uhd; @@ -92,6 +91,6 @@ multi_usrp_clock::~multi_usrp_clock(void){ * Multi USRP Clock factory function **********************************************************************/ multi_usrp_clock::sptr multi_usrp_clock::make(const device_addr_t &dev_addr){ - UHD_LOG << "multi_usrp_clock::make with args " << dev_addr.to_pp_string() << std::endl; + UHD_LOGGER_TRACE("OCTOCLOCK") << "multi_usrp_clock::make with args " << dev_addr.to_pp_string() ; return sptr(new multi_usrp_clock_impl(dev_addr)); } diff --git a/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp b/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp index b0d24deec..82b3463a8 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_eeprom.cpp @@ -24,8 +24,6 @@ #include <uhd/utils/byteswap.hpp> #include <boost/assign/list_of.hpp> #include <boost/asio.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/foreach.hpp> #include <iostream> @@ -85,7 +83,7 @@ void octoclock_eeprom_t::_load(){ (*this)["name"] = bytes_to_string(name_bytes); //Revision - (*this)["revision"] = boost::lexical_cast<std::string>(int(eeprom_in->revision)); + (*this)["revision"] = std::to_string(int(eeprom_in->revision)); } else throw uhd::runtime_error("Error loading OctoClock EEPROM."); } diff --git a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp index d3502113e..0e7845be7 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp @@ -31,7 +31,6 @@ #include <stdint.h> #include <boost/filesystem.hpp> #include <boost/format.hpp> -#include <boost/lexical_cast.hpp> #include <boost/thread.hpp> #include <algorithm> @@ -140,7 +139,7 @@ static void octoclock_setup_session(octoclock_session_t &session, std::string err_msg = "Could not resolve given args to a single OctoClock device.\n" "Applicable devices:\n"; - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ std::string name = (dev["type"] == "octoclock") ? str(boost::format("OctoClock r%d") % dev.get("revision","4")) : "OctoClock Bootloader"; diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp index 4da9db19f..cea493fb4 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp @@ -21,7 +21,6 @@ #include <boost/assign.hpp> #include <stdint.h> #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> @@ -34,7 +33,7 @@ #include <uhd/usrp_clock/octoclock_eeprom.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/paths.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/utils/paths.hpp> #include <uhd/utils/static.hpp> @@ -57,7 +56,7 @@ device_addrs_t octoclock_find(const device_addr_t &hint){ if (hints.size() > 1){ device_addrs_t found_devices; std::string error_msg; - BOOST_FOREACH(const device_addr_t &hint_i, hints){ + for(const device_addr_t &hint_i: hints){ device_addrs_t found_devices_i = octoclock_find(hint_i); if (found_devices_i.size() != 1) error_msg += str(boost::format( "Could not resolve device hint \"%s\" to a single device." @@ -84,7 +83,7 @@ device_addrs_t octoclock_find(const device_addr_t &hint){ //If no address was specified, send a broadcast on each interface if (not _hint.has_key("addr")){ - BOOST_FOREACH(const if_addrs_t &if_addrs, get_if_addrs()){ + for(const if_addrs_t &if_addrs: get_if_addrs()){ //avoid the loopback device if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; @@ -118,10 +117,10 @@ device_addrs_t octoclock_find(const device_addr_t &hint){ udp_transport->send(boost::asio::buffer(&pkt_out, sizeof(pkt_out))); } catch(const std::exception &ex){ - UHD_MSG(error) << "OctoClock network discovery error - " << ex.what() << std::endl; + UHD_LOGGER_ERROR("OCTOCLOCK") << "OctoClock network discovery error - " << ex.what() ; } catch(...){ - UHD_MSG(error) << "OctoClock network discovery unknown error" << std::endl; + UHD_LOGGER_ERROR("OCTOCLOCK") << "OctoClock network discovery unknown error" ; } uint8_t octoclock_data[udp_simple::mtu]; @@ -187,7 +186,7 @@ UHD_STATIC_BLOCK(register_octoclock_device){ * Structors **********************************************************************/ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ - UHD_MSG(status) << "Opening an OctoClock device..." << std::endl; + UHD_LOGGER_INFO("OCTOCLOCK") << "Opening an OctoClock device..."; _type = device::CLOCK; device_addrs_t device_args = separate_device_addr(_device_addr); // To avoid replicating sequence numbers between sessions @@ -212,7 +211,7 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ ) % _get_images_help_message(addr))); } - const std::string oc = boost::lexical_cast<std::string>(oci); + const std::string oc = std::to_string(oci); //////////////////////////////////////////////////////////////////// // Set up UDP transports @@ -235,7 +234,7 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ "%s\n" ) % int(OCTOCLOCK_FW_COMPAT_NUM) % int(_proto_ver) % _get_images_help_message(addr))); } - _tree->create<std::string>(oc_path / "fw_version").set(boost::lexical_cast<std::string>(int(_proto_ver))); + _tree->create<std::string>(oc_path / "fw_version").set(std::to_string(int(_proto_ver))); //////////////////////////////////////////////////////////////////// // Set up EEPROM @@ -265,9 +264,9 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ std::string asterisk = (device_args.size() > 1) ? " * " : ""; if(device_args.size() > 1){ - UHD_MSG(status) << std::endl << "Checking status of " << addr << ":" << std::endl; + UHD_LOGGER_INFO("OCTOCLOCK") << "Checking status of " << addr; } - UHD_MSG(status) << boost::format("%sDetecting internal GPSDO...") % asterisk << std::flush; + UHD_LOGGER_INFO("OCTOCLOCK") << boost::format("%sDetecting internal GPSDO...") % asterisk; _get_state(oc); if(_oc_dict[oc].state.gps_detected){ @@ -275,7 +274,7 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ _oc_dict[oc].gps = gps_ctrl::make(octoclock_make_uart_iface(_oc_dict[oc].gpsdo_xport, _proto_ver)); if(_oc_dict[oc].gps and _oc_dict[oc].gps->gps_detected()){ - BOOST_FOREACH(const std::string &name, _oc_dict[oc].gps->get_sensors()){ + for(const std::string &name: _oc_dict[oc].gps->get_sensors()){ _tree->create<sensor_value_t>(oc_path / "sensors" / name) .set_publisher(boost::bind(&gps_ctrl::get_sensor, _oc_dict[oc].gps, name)); } @@ -283,26 +282,23 @@ octoclock_impl::octoclock_impl(const device_addr_t &_device_addr){ else{ //If GPSDO communication failed, set gps_detected to false _oc_dict[oc].state.gps_detected = 0; - UHD_MSG(warning) << "Device reports that it has a GPSDO, but we cannot communicate with it." << std::endl; - std::cout << std::endl; + UHD_LOGGER_WARNING("OCTOCLOCK") << "Device reports that it has a GPSDO, but we cannot communicate with it."; } } catch(std::exception &e){ - UHD_MSG(error) << "An error occurred making GPSDO control: " << e.what() << std::endl; + UHD_LOGGER_ERROR("OCTOCLOCK") << "An error occurred making GPSDO control: " << e.what(); } } - else UHD_MSG(status) << "No GPSDO found" << std::endl; - UHD_MSG(status) << boost::format("%sDetecting external reference...%s") % asterisk - % _ext_ref_detected(oc).value - << std::endl; - UHD_MSG(status) << boost::format("%sDetecting switch position...%s") % asterisk - % _switch_pos(oc).value - << std::endl; + else UHD_LOGGER_INFO("OCTOCLOCK") << "No GPSDO found"; + UHD_LOGGER_INFO("OCTOCLOCK") << boost::format("%sDetecting external reference...%s") % asterisk + % _ext_ref_detected(oc).value; + UHD_LOGGER_INFO("OCTOCLOCK") << boost::format("%sDetecting switch position...%s") % asterisk + % _switch_pos(oc).value; std::string ref = _which_ref(oc).value; - if(ref == "none") UHD_MSG(status) << boost::format("%sDevice is not using any reference") % asterisk << std::endl; - else UHD_MSG(status) << boost::format("%sDevice is using %s reference") % asterisk + if(ref == "none") UHD_LOGGER_INFO("OCTOCLOCK") << boost::format("%sDevice is not using any reference") % asterisk; + else UHD_LOGGER_INFO("OCTOCLOCK") << boost::format("%sDevice is using %s reference") % asterisk % _which_ref(oc).value - << std::endl; + ; } } @@ -324,7 +320,7 @@ void octoclock_impl::_set_eeprom(const std::string &oc, const octoclock_eeprom_t * what it currently has in the EEPROM, so store the relevant values * from the user's input and send that instead. */ - BOOST_FOREACH(const std::string &key, oc_eeprom.keys()){ + for(const std::string &key: oc_eeprom.keys()){ if(_oc_dict[oc].eeprom.has_key(key)) _oc_dict[oc].eeprom[key] = oc_eeprom[key]; } _oc_dict[oc].eeprom.commit(); diff --git a/host/lib/usrp_clock/usrp_clock_c.cpp b/host/lib/usrp_clock/usrp_clock_c.cpp index 220112f37..274eba5d1 100644 --- a/host/lib/usrp_clock/usrp_clock_c.cpp +++ b/host/lib/usrp_clock/usrp_clock_c.cpp @@ -22,7 +22,6 @@ #include <uhd/usrp_clock/usrp_clock.h> -#include <boost/foreach.hpp> #include <boost/thread/mutex.hpp> #include <string.h> @@ -64,7 +63,7 @@ uhd_error uhd_usrp_clock_find( uhd::device_addrs_t devs = uhd::device::find(std::string(args), uhd::device::CLOCK); devices_out->string_vector_cpp.clear(); - BOOST_FOREACH(const uhd::device_addr_t &dev, devs){ + for(const uhd::device_addr_t &dev: devs){ devices_out->string_vector_cpp.push_back(dev.to_string()); } ) |