Skip to content

Commit

Permalink
ctrlport: blocks: added controlport support to multiply_const_XXX blo…
Browse files Browse the repository at this point in the history
…cks.
  • Loading branch information
trondeau committed Oct 16, 2015
1 parent 616fee5 commit 9bf9b47
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 8 deletions.
10 changes: 5 additions & 5 deletions gr-blocks/lib/multiply_const_cc_impl.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2009,2010,2012 Free Software Foundation, Inc.
* Copyright 2004,2009,2010,2012,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand Down Expand Up @@ -69,8 +69,8 @@ namespace gr {
rpcbasic_sptr(new rpcbasic_register_get<multiply_const_cc, gr_complex>(
alias(), "Constant",
&multiply_const_cc::k,
pmt::from_complex(-1000.0f, 0.0f),
pmt::from_complex(1000.0f, 0.0f),
pmt::from_complex(-1024.0f, 0.0f),
pmt::from_complex(1024.0f, 0.0f),
pmt::from_complex(0.0f, 0.0f),
"", "Constant to multiply", RPC_PRIVLVL_MIN,
DISPTIME | DISPOPTCPLX | DISPOPTSTRIP)));
Expand All @@ -79,8 +79,8 @@ namespace gr {
rpcbasic_sptr(new rpcbasic_register_set<multiply_const_cc, gr_complex>(
alias(), "Constant",
&multiply_const_cc::set_k,
pmt::from_complex(-1000.0f, 0.0f),
pmt::from_complex(1000.0f, 0.0f),
pmt::from_complex(-1024.0f, 0.0f),
pmt::from_complex(1024.0f, 0.0f),
pmt::from_complex(0.0f, 0.0f),
"", "Constant to multiply",
RPC_PRIVLVL_MIN, DISPNULL)));
Expand Down
24 changes: 23 additions & 1 deletion gr-blocks/lib/multiply_const_ff_impl.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2004,2009,2010,2012 Free Software Foundation, Inc.
* Copyright 2004,2009,2010,2012,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand Down Expand Up @@ -63,5 +63,27 @@ namespace gr {
return noutput_items;
}

void
multiply_const_ff_impl::setup_rpc()
{
#ifdef GR_CTRLPORT
add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_get<multiply_const_ff, float>(
alias(), "coefficient",
&multiply_const_ff::k,
pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
"", "Coefficient", RPC_PRIVLVL_MIN,
DISPTIME | DISPOPTSTRIP)));

add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_set<multiply_const_ff, float>(
alias(), "coefficient",
&multiply_const_ff::set_k,
pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
"", "Coefficient",
RPC_PRIVLVL_MIN, DISPNULL)));
#endif /* GR_CTRLPORT */
}

} /* namespace blocks */
} /* namespace gr */
2 changes: 2 additions & 0 deletions gr-blocks/lib/multiply_const_ff_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace gr {
public:
multiply_const_ff_impl(float k, size_t vlen);

void setup_rpc();

float k() const { return d_k; }
void set_k(float k) { d_k = k; }

Expand Down
30 changes: 29 additions & 1 deletion gr-blocks/lib/multiply_const_vcc_impl.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2014 Free Software Foundation, Inc.
* Copyright 2014-2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand Down Expand Up @@ -68,5 +68,33 @@ namespace gr {
return noutput_items;
}

void
multiply_const_vcc_impl::setup_rpc()
{
#ifdef GR_CTRLPORT
add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vcc,
std::vector<gr_complex> >(
alias(), "coefficient",
&multiply_const_vcc::k,
pmt::from_complex(-1024.0f),
pmt::from_complex(1024.0f),
pmt::from_complex(0.0f),
"", "Coefficient", RPC_PRIVLVL_MIN,
DISPTIME | DISPOPTSTRIP)));

add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vcc,
std::vector<gr_complex> >(
alias(), "coefficient",
&multiply_const_vcc::set_k,
pmt::from_complex(-1024.0f),
pmt::from_complex(1024.0f),
pmt::from_complex(0.0f),
"", "Coefficient",
RPC_PRIVLVL_MIN, DISPNULL)));
#endif /* GR_CTRLPORT */
}

} /* namespace blocks */
} /* namespace gr */
2 changes: 2 additions & 0 deletions gr-blocks/lib/multiply_const_vcc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace gr {
public:
multiply_const_vcc_impl(std::vector<gr_complex> k);

void setup_rpc();

std::vector<gr_complex> k() const { return d_k; }
void set_k(std::vector<gr_complex> k) { d_k = k; }

Expand Down
26 changes: 25 additions & 1 deletion gr-blocks/lib/multiply_const_vff_impl.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
* Copyright 2014 Free Software Foundation, Inc.
* Copyright 2014-2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand Down Expand Up @@ -68,5 +68,29 @@ namespace gr {
return noutput_items;
}

void
multiply_const_vff_impl::setup_rpc()
{
#ifdef GR_CTRLPORT
add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vff,
std::vector<float> >(
alias(), "coefficient",
&multiply_const_vff::k,
pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
"", "Coefficient", RPC_PRIVLVL_MIN,
DISPTIME | DISPOPTSTRIP)));

add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vff,
std::vector<float> >(
alias(), "coefficient",
&multiply_const_vff::set_k,
pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f),
"", "Coefficient",
RPC_PRIVLVL_MIN, DISPNULL)));
#endif /* GR_CTRLPORT */
}

} /* namespace blocks */
} /* namespace gr */
2 changes: 2 additions & 0 deletions gr-blocks/lib/multiply_const_vff_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace gr {
public:
multiply_const_vff_impl(std::vector<float> k);

void setup_rpc();

std::vector<float> k() const { return d_k; }
void set_k(std::vector<float> k) { d_k = k; }

Expand Down

0 comments on commit 9bf9b47

Please sign in to comment.