diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-03-13 09:30:17 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-03-13 09:30:17 -0400 |
commit | 5fd8738eae397739ebf9fa9518dc587b40b3464e (patch) | |
tree | 2ef081c749fb252206eaa25275502adc72e08825 /gr-blocks | |
parent | 60b85d7a8f7ca142287090b3c53fc01c7c612358 (diff) | |
parent | 13cf0ce205bfc986e462591764cb7ca16e21346c (diff) |
Merge branch 'maint'
Diffstat (limited to 'gr-blocks')
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t | 3 | ||||
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/udp_source.h | 4 | ||||
-rw-r--r-- | gr-blocks/lib/multiply_matrix_cc_impl.cc | 3 | ||||
-rw-r--r-- | gr-blocks/lib/multiply_matrix_ff_impl.cc | 3 | ||||
-rw-r--r-- | gr-blocks/lib/udp_source_impl.cc | 25 | ||||
-rw-r--r-- | gr-blocks/lib/udp_source_impl.h | 2 |
6 files changed, 25 insertions, 15 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t b/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t index 56a8b1b70..20931f1cc 100644 --- a/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/multiply_matrix_XX.h.t @@ -91,10 +91,9 @@ namespace gr { */ virtual void set_tag_propagation_policy(gr::block::tag_propagation_policy_t p) = 0; - static const int TPP_SELECT_BY_MATRIX = 999; + static const int TPP_SELECT_BY_MATRIX; static const std::string MSG_PORT_NAME_SET_A; }; - const std::string @NAME@::MSG_PORT_NAME_SET_A = "set_A"; } // namespace blocks } // namespace gr diff --git a/gr-blocks/include/gnuradio/blocks/udp_source.h b/gr-blocks/include/gnuradio/blocks/udp_source.h index 67c31a7c6..d1b4062b7 100644 --- a/gr-blocks/include/gnuradio/blocks/udp_source.h +++ b/gr-blocks/include/gnuradio/blocks/udp_source.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007-2010,2013 Free Software Foundation, Inc. + * Copyright 2007-2010,2013,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -43,7 +43,7 @@ namespace gr { * \brief UDP Source Constructor * * \param itemsize The size (in bytes) of the item datatype - * \param host The name or IP address of the receiving host; can be + * \param host The name or IP address of the transmitting host; can be * NULL, None, or "0.0.0.0" to allow reading from any * interface on the host * \param port The port number on which to receive data; use 0 to diff --git a/gr-blocks/lib/multiply_matrix_cc_impl.cc b/gr-blocks/lib/multiply_matrix_cc_impl.cc index eaa902ec4..603347d67 100644 --- a/gr-blocks/lib/multiply_matrix_cc_impl.cc +++ b/gr-blocks/lib/multiply_matrix_cc_impl.cc @@ -31,6 +31,9 @@ namespace gr { namespace blocks { + const int multiply_matrix_cc::TPP_SELECT_BY_MATRIX = 999; + const std::string multiply_matrix_cc::MSG_PORT_NAME_SET_A = "set_A"; + multiply_matrix_cc::sptr multiply_matrix_cc::make(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy) { diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.cc b/gr-blocks/lib/multiply_matrix_ff_impl.cc index fb0a6d587..43f8e2464 100644 --- a/gr-blocks/lib/multiply_matrix_ff_impl.cc +++ b/gr-blocks/lib/multiply_matrix_ff_impl.cc @@ -31,6 +31,9 @@ namespace gr { namespace blocks { + const int multiply_matrix_ff::TPP_SELECT_BY_MATRIX = 999; + const std::string multiply_matrix_ff::MSG_PORT_NAME_SET_A = "set_A"; + multiply_matrix_ff::sptr multiply_matrix_ff::make(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy) { diff --git a/gr-blocks/lib/udp_source_impl.cc b/gr-blocks/lib/udp_source_impl.cc index ca4018464..b1977a8fc 100644 --- a/gr-blocks/lib/udp_source_impl.cc +++ b/gr-blocks/lib/udp_source_impl.cc @@ -35,6 +35,8 @@ namespace gr { namespace blocks { + const int udp_source_impl::BUF_SIZE_PAYLOADS = 50; + udp_source::sptr udp_source::make(size_t itemsize, const std::string &ipaddr, int port, @@ -56,7 +58,7 @@ namespace gr { { // Give us some more room to play. d_rxbuf = new char[4*d_payload_size]; - d_residbuf = new char[50*d_payload_size]; + d_residbuf = new char[BUF_SIZE_PAYLOADS*d_payload_size]; connect(host, port); } @@ -150,7 +152,7 @@ namespace gr { if(d_eof && (bytes_transferred == 1) && (d_rxbuf[0] == 0x00)) { // If we are using EOF notification, test for it and don't // add anything to the output. - d_residual = -1; + d_residual = WORK_DONE; d_cond_wait.notify_one(); return; } @@ -158,7 +160,7 @@ namespace gr { // Make sure we never go beyond the boundary of the // residual buffer. This will just drop the last bit of // data in the buffer if we've run out of room. - if((int)(d_residual + bytes_transferred) >= (50*d_payload_size)) { + if((int)(d_residual + bytes_transferred) >= (BUF_SIZE_PAYLOADS*d_payload_size)) { GR_LOG_WARN(d_logger, "Too much data; dropping packet."); } else { @@ -192,24 +194,25 @@ namespace gr { //use timed_wait to avoid permanent blocking in the work function d_cond_wait.timed_wait(lock, boost::posix_time::milliseconds(10)); - if(d_residual < 0) - return -1; + if (d_residual < 0) { + return d_residual; + } - int to_be_sent = (int)(d_residual - d_sent); - int to_send = std::min(noutput_items, to_be_sent); + int bytes_left_in_buffer = (int)(d_residual - d_sent); + int bytes_to_send = std::min<int>(d_itemsize * noutput_items, bytes_left_in_buffer); // Copy the received data in the residual buffer to the output stream - memcpy(out, d_residbuf+d_sent, to_send); - int nitems = to_send/d_itemsize; + memcpy(out, d_residbuf+d_sent, bytes_to_send); + int nitems = bytes_to_send/d_itemsize; // Keep track of where we are if we don't have enough output // space to send all the data in the residbuf. - if(to_send == to_be_sent) { + if (bytes_to_send == bytes_left_in_buffer) { d_residual = 0; d_sent = 0; } else { - d_sent += to_send; + d_sent += bytes_to_send; } return nitems; diff --git a/gr-blocks/lib/udp_source_impl.h b/gr-blocks/lib/udp_source_impl.h index 949364cf2..42cb64dab 100644 --- a/gr-blocks/lib/udp_source_impl.h +++ b/gr-blocks/lib/udp_source_impl.h @@ -44,6 +44,8 @@ namespace gr { ssize_t d_sent; // track how much of d_residbuf we've outputted size_t d_offset; // point to residbuf location offset + static const int BUF_SIZE_PAYLOADS; //!< The d_residbuf size in multiples of d_payload_size + std::string d_host; unsigned short d_port; |