summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Gilbert <mrjacobagilbert@gmail.com>2017-08-14 19:35:36 -0700
committerJacob Gilbert <mrjacobagilbert@gmail.com>2017-08-14 19:35:36 -0700
commit0672cd5de4b2f97115a78683be731f4c0d9acc44 (patch)
tree326033753540cae08b32fde68377bc81d200a243
parent811bee8c54bdca5c53c2ccbc6ef6d1bbca55eaae (diff)
gr-digital: added callbacks and setters for correlate_access_code_tag_xx block parameters including mutex for the access code setters
-rw-r--r--gr-digital/grc/digital_correlate_access_code_tag_xx.xml4
-rw-r--r--gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h2
-rw-r--r--gr-digital/include/gnuradio/digital/correlate_access_code_tag_ff.h2
-rw-r--r--gr-digital/lib/correlate_access_code_tag_bb_impl.cc4
-rw-r--r--gr-digital/lib/correlate_access_code_tag_bb_impl.h4
-rw-r--r--gr-digital/lib/correlate_access_code_tag_ff_impl.cc4
-rw-r--r--gr-digital/lib/correlate_access_code_tag_ff_impl.h4
7 files changed, 24 insertions, 0 deletions
diff --git a/gr-digital/grc/digital_correlate_access_code_tag_xx.xml b/gr-digital/grc/digital_correlate_access_code_tag_xx.xml
index 83ccb422ea..c7c137187f 100644
--- a/gr-digital/grc/digital_correlate_access_code_tag_xx.xml
+++ b/gr-digital/grc/digital_correlate_access_code_tag_xx.xml
@@ -9,6 +9,10 @@
<key>digital_correlate_access_code_tag_xx</key>
<import>from gnuradio import digital</import>
<make>digital.correlate_access_code_tag_$(type.fcn)($access_code, $threshold, $tagname)</make>
+ <callback>set_access_code($access_code)</callback>
+ <callback>set_threshold($threshold)</callback>
+ <callback>set_tagname($tagname)</callback>
+
<param>
<name>IO Type</name>
<key>type</key>
diff --git a/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h
index 475c038dc7..d064c45709 100644
--- a/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h
+++ b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_bb.h
@@ -63,6 +63,8 @@ namespace gr {
* e.g., "010101010111000100"
*/
virtual bool set_access_code(const std::string &access_code) = 0;
+ virtual void set_threshold(int threshold) = 0;
+ virtual void set_tagname(const std::string &tagname) = 0;
};
} /* namespace digital */
diff --git a/gr-digital/include/gnuradio/digital/correlate_access_code_tag_ff.h b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_ff.h
index 93e89d6a6e..9eaad08c69 100644
--- a/gr-digital/include/gnuradio/digital/correlate_access_code_tag_ff.h
+++ b/gr-digital/include/gnuradio/digital/correlate_access_code_tag_ff.h
@@ -64,6 +64,8 @@ namespace gr {
* e.g., "010101010111000100"
*/
virtual bool set_access_code(const std::string &access_code) = 0;
+ virtual void set_threshold(int threshold) = 0;
+ virtual void set_tagname(const std::string &tagname) = 0;
};
} /* namespace digital */
diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
index 753efa7a51..b7e93719fc 100644
--- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
@@ -73,6 +73,8 @@ namespace gr {
correlate_access_code_tag_bb_impl::set_access_code(
const std::string &access_code)
{
+ gr::thread::scoped_lock l(d_mutex_access_code);
+
d_len = access_code.length(); // # of bytes in string
if(d_len > 64)
return false;
@@ -96,6 +98,8 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gr::thread::scoped_lock l(d_mutex_access_code);
+
const unsigned char *in = (const unsigned char*)input_items[0];
unsigned char *out = (unsigned char*)output_items[0];
diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.h b/gr-digital/lib/correlate_access_code_tag_bb_impl.h
index df558dd17e..7f6d58b5fc 100644
--- a/gr-digital/lib/correlate_access_code_tag_bb_impl.h
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.h
@@ -42,6 +42,8 @@ namespace gr {
pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
+ gr::thread::mutex d_mutex_access_code;
+
public:
correlate_access_code_tag_bb_impl(const std::string &access_code,
int threshold,
@@ -53,6 +55,8 @@ namespace gr {
gr_vector_void_star &output_items);
bool set_access_code(const std::string &access_code);
+ void set_threshold(int threshold) { d_threshold = threshold; };
+ void set_tagname(const std::string &tag_name) { d_key = pmt::string_to_symbol(tag_name); };
};
} /* namespace digital */
diff --git a/gr-digital/lib/correlate_access_code_tag_ff_impl.cc b/gr-digital/lib/correlate_access_code_tag_ff_impl.cc
index 6efacbb08b..1aa3d5aca9 100644
--- a/gr-digital/lib/correlate_access_code_tag_ff_impl.cc
+++ b/gr-digital/lib/correlate_access_code_tag_ff_impl.cc
@@ -74,6 +74,8 @@ namespace gr {
correlate_access_code_tag_ff_impl::set_access_code(
const std::string &access_code)
{
+ gr::thread::scoped_lock l(d_mutex_access_code);
+
d_len = access_code.length(); // # of bytes in string
if(d_len > 64)
return false;
@@ -97,6 +99,8 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gr::thread::scoped_lock l(d_mutex_access_code);
+
const float *in = (const float*)input_items[0];
float *out = (float*)output_items[0];
diff --git a/gr-digital/lib/correlate_access_code_tag_ff_impl.h b/gr-digital/lib/correlate_access_code_tag_ff_impl.h
index 67d3ba2d6d..3b5946228a 100644
--- a/gr-digital/lib/correlate_access_code_tag_ff_impl.h
+++ b/gr-digital/lib/correlate_access_code_tag_ff_impl.h
@@ -42,6 +42,8 @@ namespace gr {
pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID
+ gr::thread::mutex d_mutex_access_code;
+
public:
correlate_access_code_tag_ff_impl(const std::string &access_code,
int threshold,
@@ -53,6 +55,8 @@ namespace gr {
gr_vector_void_star &output_items);
bool set_access_code(const std::string &access_code);
+ void set_threshold(int threshold) { d_threshold = threshold; };
+ void set_tagname(const std::string &tag_name) { d_key = pmt::string_to_symbol(tag_name); };
};
} /* namespace digital */