summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-09 17:35:15 -0700
committerJosh Blum <josh@joshknows.com>2010-07-09 17:35:15 -0700
commitbf77d1f6e38e1cb561520408ecff8f633f5cefc7 (patch)
treebdf9efe00dd25f542d5ca301136fe64c2108149b /host/include
parentecd7308793ad639880faf2a44f3b8b603d87c7fd (diff)
downloaduhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.tar.gz
uhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.tar.bz2
uhd-bf77d1f6e38e1cb561520408ecff8f633f5cefc7.zip
uhd: added error codes to rx metadata, switched examples to use
vrt packet handler fills in error codes and inspects non-data packet
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/device.hpp2
-rw-r--r--host/include/uhd/types/metadata.hpp29
2 files changed, 27 insertions, 4 deletions
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index a0c29f2e6..a19d22880 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -174,7 +174,7 @@ public:
* \param metadata data to fill describing the buffer
* \param io_type the type of data to fill into the buffer
* \param recv_mode tells recv how to load the buffer
- * \return the number of samples received
+ * \return the number of samples received or 0 on error
*/
virtual size_t recv(
const std::vector<void *> &buffs,
diff --git a/host/include/uhd/types/metadata.hpp b/host/include/uhd/types/metadata.hpp
index 6712e2594..039196250 100644
--- a/host/include/uhd/types/metadata.hpp
+++ b/host/include/uhd/types/metadata.hpp
@@ -57,10 +57,33 @@ namespace uhd{
bool end_of_burst;
/*!
- * Error conditions (TODO):
- * Previous packets dropped?
- * Timed-out on receive?
+ * Error conditions:
+ * - none: no error associated with this metadata
+ * - timeout: no packet received, underlying code timed-out
+ * - late command: a stream command was issued in the past
+ * - broken chain: expected another stream command
+ * - overrun: an internal receive buffer has overrun
+ * - bad packet: the buffer was unrecognizable as a vrt packet
+ *
+ * Note: When an overrun occurs in continuous streaming mode,
+ * the device will continue to send samples to the host.
+ * For other streaming modes, streaming will discontinue
+ * until the user issues a new stream command.
+ *
+ * Note: The metadata fields have meaning for the following error codes:
+ * - none
+ * - late command
+ * - broken chain
+ * - overrun
*/
+ enum error_code_t {
+ ERROR_CODE_NONE = 0x0,
+ ERROR_CODE_TIMEOUT = 0x1,
+ ERROR_CODE_LATE_COMMAND = 0x2,
+ ERROR_CODE_BROKEN_CHAIN = 0x4,
+ ERROR_CODE_OVERRUN = 0x8,
+ ERROR_CODE_BAD_PACKET = 0xf
+ } error_code;
/*!
* The default constructor: