aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-09-09 13:39:52 -0700
committerJosh Blum <josh@joshknows.com>2011-09-28 10:32:05 -0700
commit25494489bf8b7c60875ea355d29323bcfffd604b (patch)
treebbb533238db6fc24d807670c2adf23d59de9160a /host/include
parent18a3f03c06c65d79e5c4b7ac1076077c4b9fd8ff (diff)
downloaduhd-25494489bf8b7c60875ea355d29323bcfffd604b.tar.gz
uhd-25494489bf8b7c60875ea355d29323bcfffd604b.tar.bz2
uhd-25494489bf8b7c60875ea355d29323bcfffd604b.zip
usrp2: uart/udp work in host and fw, working
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/transport/udp_simple.hpp8
-rw-r--r--host/include/uhd/types/serial.hpp8
-rw-r--r--host/include/uhd/usrp/gps_ctrl.hpp13
3 files changed, 18 insertions, 11 deletions
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 <uhd/config.hpp>
+#include <uhd/types/serial.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
@@ -62,6 +63,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.
* \param buff single asio buffer
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 <uhd/types/serial.hpp>
+#include <uhd/types/sensors.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/function.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <vector>
-#include <uhd/types/sensors.hpp>
-using namespace boost::posix_time;
-
-typedef boost::function<void(std::string)> gps_send_fn_t;
-typedef boost::function<std::string(void)> 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 */