summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan2012-01-26 14:06:37 -0800
committerJohnathan Corgan2012-01-26 14:06:37 -0800
commitb207aa2d76a8171681b0ff0a3b5342e8f0703ba9 (patch)
tree483cd40a119bdf26fd2ba5b27332d592966b49fc
parent2d80e59c2b26de65e5266b8c6fb4be118a7428a0 (diff)
downloadgnuradio-b207aa2d76a8171681b0ff0a3b5342e8f0703ba9.tar.gz
gnuradio-b207aa2d76a8171681b0ff0a3b5342e8f0703ba9.tar.bz2
gnuradio-b207aa2d76a8171681b0ff0a3b5342e8f0703ba9.zip
uhd: add utility function to convert raw gr_message to async_metadata_t
-rw-r--r--gr-uhd/include/gr_uhd_amsg_source.h7
-rw-r--r--gr-uhd/lib/gr_uhd_amsg_source.cc5
2 files changed, 12 insertions, 0 deletions
diff --git a/gr-uhd/include/gr_uhd_amsg_source.h b/gr-uhd/include/gr_uhd_amsg_source.h
index accf15ce2..3c1b59fa7 100644
--- a/gr-uhd/include/gr_uhd_amsg_source.h
+++ b/gr-uhd/include/gr_uhd_amsg_source.h
@@ -38,6 +38,13 @@ GR_UHD_API boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source(
);
class GR_UHD_API uhd_amsg_source{
+public:
+ /*!
+ * Convert a raw asynchronous message to an asynchronous metatdata object.
+ * \return The asynchronous metadata object.
+ */
+ static uhd::async_metadata_t msg_to_async_metadata_t(const gr_message_sptr msg);
+
};
#endif /* INCLUDED_GR_UHD_AMSG_SOURCE_H */
diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc
index f2958f115..08941584b 100644
--- a/gr-uhd/lib/gr_uhd_amsg_source.cc
+++ b/gr-uhd/lib/gr_uhd_amsg_source.cc
@@ -75,6 +75,11 @@ protected:
bool _running;
};
+uhd::async_metadata_t uhd_amsg_source::msg_to_async_metadata_t(const gr_message_sptr msg)
+{
+ return *(uhd::async_metadata_t *)msg->msg();
+}
+
/***********************************************************************
* Make UHD Asynchronous Message Source
**********************************************************************/