From 25494489bf8b7c60875ea355d29323bcfffd604b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 9 Sep 2011 13:39:52 -0700 Subject: usrp2: uart/udp work in host and fw, working --- host/include/uhd/transport/udp_simple.hpp | 8 ++++++++ host/include/uhd/types/serial.hpp | 8 ++++---- host/include/uhd/usrp/gps_ctrl.hpp | 13 ++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/transport/udp_simple.hpp b/host/include/uhd/transport/udp_simple.hpp index 83f895ba9..83d1072ee 100644 --- a/host/include/uhd/transport/udp_simple.hpp +++ b/host/include/uhd/transport/udp_simple.hpp @@ -19,6 +19,7 @@ #define INCLUDED_UHD_TRANSPORT_UDP_SIMPLE_HPP #include +#include #include #include #include @@ -61,6 +62,13 @@ public: */ static sptr make_broadcast(const std::string &addr, const std::string &port); + /*! + * Make a UART interface from a UDP transport. + * \param udp the UDP transport object + * \return a new UART interface + */ + static uart_iface::sptr make_uart(sptr udp); + /*! * Send a single buffer. * Blocks until the data is sent. diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index 8a5ed1c32..f66822775 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -184,17 +184,17 @@ namespace uhd{ /*! * Write to a serial port. - * \param dev which UART to write to * \param buf the data to write */ - virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0; + virtual void write_uart(const std::string &buf) = 0; /*! * Read from a serial port. - * \param dev which UART to read from + * Reads until complete line or timeout. + * \param timeout the timeout in seconds * \return the data read from the serial port */ - virtual std::string read_uart(boost::uint8_t dev) = 0; + virtual std::string read_uart(double timeout) = 0; }; } //namespace uhd diff --git a/host/include/uhd/usrp/gps_ctrl.hpp b/host/include/uhd/usrp/gps_ctrl.hpp index 6ff00e03c..3b643a30c 100644 --- a/host/include/uhd/usrp/gps_ctrl.hpp +++ b/host/include/uhd/usrp/gps_ctrl.hpp @@ -18,17 +18,14 @@ #ifndef INCLUDED_GPS_CTRL_HPP #define INCLUDED_GPS_CTRL_HPP +#include +#include #include #include #include -#include #include -#include -using namespace boost::posix_time; - -typedef boost::function gps_send_fn_t; -typedef boost::function gps_recv_fn_t; +namespace uhd{ class gps_ctrl : boost::noncopyable{ public: @@ -37,7 +34,7 @@ public: /*! * Make a GPS config for Jackson Labs or generic NMEA GPS devices */ - static sptr make(gps_send_fn_t, gps_recv_fn_t); + static sptr make(uart_iface::sptr uart); /*! * Retrieve the list of sensors this GPS object provides @@ -59,4 +56,6 @@ public: }; +} //namespace uhd + #endif /* INCLUDED_GPS_CTRL_HPP */ -- cgit v1.2.3