summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2010-03-26 14:01:27 -0700
committerJosh Blum2010-03-26 14:01:27 -0700
commit0abfa7d596265a2b7d54da1206979171a0891fb4 (patch)
tree109358858086fdac2e63af6fc428ab1d87b98279
parentb5c1edfd488ccdd8a2c6ff5a2efb3de35a048d67 (diff)
downloadgnuradio-0abfa7d596265a2b7d54da1206979171a0891fb4.tar.gz
gnuradio-0abfa7d596265a2b7d54da1206979171a0891fb4.tar.bz2
gnuradio-0abfa7d596265a2b7d54da1206979171a0891fb4.zip
using new streaming api
-rw-r--r--gr-uhd/lib/uhd_simple_source.cc18
-rw-r--r--gr-uhd/lib/uhd_simple_source.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/gr-uhd/lib/uhd_simple_source.cc b/gr-uhd/lib/uhd_simple_source.cc
index 1a0bb2b61..87b727874 100644
--- a/gr-uhd/lib/uhd_simple_source.cc
+++ b/gr-uhd/lib/uhd_simple_source.cc
@@ -52,12 +52,19 @@ uhd_simple_source::uhd_simple_source(
_dev = uhd::simple_device::make(args);
_sizeof_samp = get_size(type);
- _dev->set_streaming(false);
- _is_streaming = false;
+ set_streaming(false);
}
uhd_simple_source::~uhd_simple_source(void){
- _dev->set_streaming(false);
+ set_streaming(false);
+}
+
+void uhd_simple_source::set_streaming(bool enb){
+ uhd::stream_cmd_t stream_cmd;
+ stream_cmd.stream_now = true;
+ stream_cmd.continuous = enb;
+ _dev->issue_stream_cmd(stream_cmd);
+ _is_streaming = enb;
}
void uhd_simple_source::set_samp_rate(double rate){
@@ -82,10 +89,7 @@ int uhd_simple_source::work(
){
//conditionally start streaming in the work call
//this prevents streaming before the runtime is ready
- if (not _is_streaming){
- _dev->set_streaming(true);
- _is_streaming = true;
- }
+ if (not _is_streaming) set_streaming(true);
size_t total_items_read = 0;
uhd::rx_metadata_t metadata;
diff --git a/gr-uhd/lib/uhd_simple_source.h b/gr-uhd/lib/uhd_simple_source.h
index cfab8b7a4..98378d518 100644
--- a/gr-uhd/lib/uhd_simple_source.h
+++ b/gr-uhd/lib/uhd_simple_source.h
@@ -52,6 +52,7 @@ protected:
std::string _type;
size_t _sizeof_samp;
bool _is_streaming;
+ void set_streaming(bool enb);
};
#endif /* INCLUDED_UHD_SIMPLE_SOURCE_H */