From bf77d1f6e38e1cb561520408ecff8f633f5cefc7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 9 Jul 2010 17:35:15 -0700 Subject: uhd: added error codes to rx metadata, switched examples to use vrt packet handler fills in error codes and inspects non-data packet --- host/include/uhd/device.hpp | 2 +- host/include/uhd/types/metadata.hpp | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'host/include') 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 &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: -- cgit v1.2.3