summaryrefslogtreecommitdiff
path: root/gr-uhd/lib
diff options
context:
space:
mode:
authorJohannes Schmitz <schmitz@ti.rwth-aachen.de>2015-12-16 11:31:16 +0100
committerJohannes Schmitz <schmitz@ti.rwth-aachen.de>2015-12-16 19:30:38 +0100
commit338cfae6ded4cfae8faa2a089f2c4cce63d47c47 (patch)
treedb5d2bfa0872528496069076f2a84e53be65e697 /gr-uhd/lib
parent4ae7a6015ba719a4720f61cc6f3857de2ebda89f (diff)
gr-uhd: add parameter to enable/disable streaming when flowgraph starts
Diffstat (limited to 'gr-uhd/lib')
-rw-r--r--gr-uhd/lib/usrp_source_impl.cc35
-rw-r--r--gr-uhd/lib/usrp_source_impl.h4
2 files changed, 23 insertions, 16 deletions
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index eeb9521a5a..7ad2280955 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -53,20 +53,23 @@ namespace gr {
usrp_source::sptr
usrp_source::make(const ::uhd::device_addr_t &device_addr,
- const ::uhd::stream_args_t &stream_args)
+ const ::uhd::stream_args_t &stream_args,
+ const bool issue_stream_cmd_on_start)
{
check_abi();
return usrp_source::sptr
- (new usrp_source_impl(device_addr, stream_args_ensure(stream_args)));
+ (new usrp_source_impl(device_addr, stream_args_ensure(stream_args), issue_stream_cmd_on_start));
}
usrp_source_impl::usrp_source_impl(const ::uhd::device_addr_t &device_addr,
- const ::uhd::stream_args_t &stream_args):
+ const ::uhd::stream_args_t &stream_args,
+ const bool issue_stream_cmd_on_start):
usrp_block("gr uhd usrp source",
io_signature::make(0, 0, 0),
args_to_io_sig(stream_args)),
usrp_block_impl(device_addr, stream_args, ""),
- _tag_now(false)
+ _tag_now(false),
+ _issue_stream_cmd_on_start(issue_stream_cmd_on_start)
{
std::stringstream str;
str << name() << unique_id();
@@ -382,18 +385,20 @@ namespace gr {
_samps_per_packet = _rx_stream->get_max_num_samps();
}
#endif
- //setup a stream command that starts streaming slightly in the future
- static const double reasonable_delay = 0.1; //order of magnitude over RTT
- ::uhd::stream_cmd_t stream_cmd(::uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
- stream_cmd.stream_now = _stream_now;
- if(_start_time_set) {
- _start_time_set = false; //cleared for next run
- stream_cmd.time_spec = _start_time;
- }
- else {
- stream_cmd.time_spec = get_time_now() + ::uhd::time_spec_t(reasonable_delay);
+ if(_issue_stream_cmd_on_start){
+ //setup a stream command that starts streaming slightly in the future
+ static const double reasonable_delay = 0.1; //order of magnitude over RTT
+ ::uhd::stream_cmd_t stream_cmd(::uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+ stream_cmd.stream_now = _stream_now;
+ if(_start_time_set) {
+ _start_time_set = false; //cleared for next run
+ stream_cmd.time_spec = _start_time;
+ }
+ else {
+ stream_cmd.time_spec = get_time_now() + ::uhd::time_spec_t(reasonable_delay);
+ }
+ this->issue_stream_cmd(stream_cmd);
}
- this->issue_stream_cmd(stream_cmd);
_tag_now = true;
return true;
}
diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h
index 98af816c02..b43df4dab3 100644
--- a/gr-uhd/lib/usrp_source_impl.h
+++ b/gr-uhd/lib/usrp_source_impl.h
@@ -55,7 +55,8 @@ namespace gr {
{
public:
usrp_source_impl(const ::uhd::device_addr_t &device_addr,
- const ::uhd::stream_args_t &stream_args);
+ const ::uhd::stream_args_t &stream_args,
+ const bool issue_stream_cmd_on_start = true);
~usrp_source_impl();
// Get Commands
@@ -119,6 +120,7 @@ namespace gr {
bool _tag_now;
::uhd::rx_metadata_t _metadata;
pmt::pmt_t _id;
+ bool _issue_stream_cmd_on_start;
//tag shadows
double _samp_rate;