Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-25 Thread David Halls
​Thanks Patrick,


There may be many ways to skin a cat, but this method was very quick and easy 
to implement and does exactly as I need :)


From: Patrick Sathyanathan <wp...@hotmail.com>
Sent: 24 September 2015 21:27
To: Kevin McQuiggin; David Halls
Cc: discuss-gnuradio@gnu.org
Subject: RE: [Discuss-gnuradio] Function Probe and OOT Blocks

Hi David, Making the parameter vary at runtime is simple and just needs some 
extra XML and python code. The parameter should be an argument to the __init__ 
method (constructor) of your block and should have a "" declaration in the 
matching XML file. Let's say the parameter name is "variable_param" with a 
declaration like: Variable parameter variable_param 42 int Then you need to add 
the following in the XML file: set_variable_param($variable_param) And you need 
to implement the "set_variable_param" method in your python class to take 
whatever action is needed when the parameter value changes. This method will be 
called every time the value of the expression in the underlined "Variable 
parameter" box in the GUI changes. The method will look like: def 
set_variable_param(self, new_value): whatever code This should make GRC 
underline the variable_param in the GUI and it will be variable at runtime. 
Thanks, --Patrick  > From: mcqui...@sfu.ca > 
Date: Thu, 24 Sep 2015 10:35:34 -0700 > To: david.ha...@toshiba-trel.com > CC: 
discuss-gnuradio@gnu.org > Subject: Re: [Discuss-gnuradio] Function Probe and 
OOT Blocks > > Hi David: > > I'm a relative newbie myself, but I can say that I 
had this same issue. > I had a block with a static parameter that I wanted to 
be able to > change dynamically at runtime. > > I looked at the block's source 
code, and also at a block that had a > dynamically adjustable parameter. > > 
Basically, and with a little help from the list (Marcus Muller in > particular) 
as I had to learn c++, I was able to use the code from the > dynamic block as 
an example, and modify the static block to change the > parameter to be 
dynamically changeable. It all came down to at most a > couple dozen lines of 
code. The bigger challenge was learning about > Gnuradio's architecture, to 
know what to do. > > I would suggest a similar approach. You will find the list 
members > very helpful. I'd also look at the guided tutorials, there are good > 
examples there under "how to write a c++ block". > > I will help if I can but 
alas, I am still quite a newbie, so others > will be able to help much more 
efficiently! > > Kevin > > Sent from my iPad > > On Sep 23, 2015, at 4:12 AM, 
David Halls > > > wrote: > > > ​Hi guys, > > > I am familiar with using 
function probes to update values to blocks. > This is straightforward with 
built in blocks like Multiply Const, where > the input is underline in the GRC 
dialogue box. > > > How do I create a block, specifically a Python block, that 
allows me to > update parameters in this fashion so that they are not fixed at 
> runtime? > > > Regards, > > > David > >  > > 
NOTE: The information in this email and any attachments may be > confidential 
and/or legally privileged. This message may be read, > copied and used only by 
the intended recipient. If you are not the > intended recipient, please destroy 
this message, delete any copies held > on your system and notify the sender 
immediately. > > Toshiba Research Europe Limited, registered in England and 
Wales > (2519556). Registered Office 208 Cambridge Science Park, Milton Road, > 
Cambridge CB4 0GZ, England. Web: > www.toshiba.eu/research/trl > > > > 
 > This email has been scanned for email 
related threats and delivered > safely by Mimecast. > For more information 
please visit http://www.mimecast.com >  > 
___ > Discuss-gnuradio mailing list 
> Discuss-gnuradio@gnu.org > 
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > 
___ Discuss-gnuradio > mailing list 
Discuss-gnuradio@gnu.org > 
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



NOTE: The information in this email and any attachments may be confidential 
and/or legally privileged. This message may be read, copied and used only by 
the intended recipient. If you are not the intended recipient, please destroy 
this message, delete any copies held on your system and notify the sender 
immediately.

Toshiba Research Europe Limited, registered in England and Wales (2519556). 
Registered Office 208 Cambr

Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-24 Thread Kevin McQuiggin
Hi David:

I'm a relative newbie myself, but I can say that I had this same issue.  I had 
a block with a static parameter that I wanted to be able to change dynamically 
at runtime.

I looked at the block's source code, and also at a block that had a dynamically 
adjustable parameter.

Basically, and with a little help from the list (Marcus Muller in particular) 
as I had to learn c++, I was able to use the code from the dynamic block as an 
example, and modify the static block to change the parameter to be dynamically 
changeable.  It all came down to at most a couple dozen lines of code.  The 
bigger challenge was learning about Gnuradio's architecture, to know what to do.

I would suggest a similar approach.  You will find the list members very 
helpful.  I'd also look at the guided tutorials, there are good examples there 
under "how to write a c++ block".

I will help if I can but alas, I am still quite a newbie, so others will be 
able to help much more efficiently!

Kevin

Sent from my iPad

On Sep 23, 2015, at 4:12 AM, David Halls > wrote:

> ​Hi guys,
> 
> I am familiar with using function probes to update values to blocks. This is 
> straightforward with built in blocks like Multiply Const, where the input is 
> underline in the GRC dialogue box.
> 
> How do I create a block, specifically a Python block, that allows me to 
> update parameters in this fashion so that they are not fixed at runtime?
> 
> Regards,
> 
> David
> 
> 
> NOTE: The information in this email and any attachments may be confidential 
> and/or legally privileged. This message may be read, copied and used only by 
> the intended recipient. If you are not the intended recipient, please destroy 
> this message, delete any copies held on your system and notify the sender 
> immediately.
> 
> Toshiba Research Europe Limited, registered in England and Wales (2519556). 
> Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, 
> England. Web: www.toshiba.eu/research/trl 
> 
> 
> 
> This email has been scanned for email related threats and delivered safely by 
> Mimecast.
> For more information please visit http://www.mimecast.com 
> 
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio 
> 


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-24 Thread Patrick Sathyanathan
Hi David,




Making the parameter vary at runtime is simple and just needs some extra XML 
and python code. The parameter should be an argument to the __init__ method 
(constructor) of your block and should have a "" declaration in the matching 
XML file. Let's say the parameter name is "variable_param" with a declaration 
like:






   Variable parameter

   variable_param

   42

   int






Then you need to add the following in the XML file:




set_variable_param($variable_param)




And you need to implement the "set_variable_param" method in your python class 
to take whatever action is needed when the parameter value changes. This method 
will be called every time the value of the expression in the underlined 
"Variable parameter" box in the GUI changes. The method will look like:





 def set_variable_param(self, new_value):

   whatever code




This should make GRC underline the variable_param in the GUI and it will be 
variable at runtime.




Thanks,




--Patrick


> From: mcqui...@sfu.ca 
> Date: Thu, 24 Sep 2015 10:35:34 -0700 
> To: david.ha...@toshiba-trel.com 
> CC: discuss-gnuradio@gnu.org 
> Subject: Re: [Discuss-gnuradio] Function Probe and OOT Blocks 
> 
> Hi David: 
> 
> I'm a relative newbie myself, but I can say that I had this same issue. 
> I had a block with a static parameter that I wanted to be able to 
> change dynamically at runtime. 
> 
> I looked at the block's source code, and also at a block that had a 
> dynamically adjustable parameter. 
> 
> Basically, and with a little help from the list (Marcus Muller in 
> particular) as I had to learn c++, I was able to use the code from the 
> dynamic block as an example, and modify the static block to change the 
> parameter to be dynamically changeable. It all came down to at most a 
> couple dozen lines of code. The bigger challenge was learning about 
> Gnuradio's architecture, to know what to do. 
> 
> I would suggest a similar approach. You will find the list members 
> very helpful. I'd also look at the guided tutorials, there are good 
> examples there under "how to write a c++ block". 
> 
> I will help if I can but alas, I am still quite a newbie, so others 
> will be able to help much more efficiently! 
> 
> Kevin 
> 
> Sent from my iPad 
> 
> On Sep 23, 2015, at 4:12 AM, David Halls 
> <david.ha...@toshiba-trel.com> 
> wrote: 
> 
> 
> ​Hi guys, 
> 
> 
> I am familiar with using function probes to update values to blocks. 
> This is straightforward with built in blocks like Multiply Const, where 
> the input is underline in the GRC dialogue box. 
> 
> 
> How do I create a block, specifically a Python block, that allows me to 
> update parameters in this fashion so that they are not fixed at 
> runtime? 
> 
> 
> Regards, 
> 
> 
> David 
> 
>  
> 
> NOTE: The information in this email and any attachments may be 
> confidential and/or legally privileged. This message may be read, 
> copied and used only by the intended recipient. If you are not the 
> intended recipient, please destroy this message, delete any copies held 
> on your system and notify the sender immediately. 
> 
> Toshiba Research Europe Limited, registered in England and Wales 
> (2519556). Registered Office 208 Cambridge Science Park, Milton Road, 
> Cambridge CB4 0GZ, England. Web: 
> www.toshiba.eu/research/trl 
> 
> 
> 
>  
> This email has been scanned for email related threats and delivered 
> safely by Mimecast. 
> For more information please visit http://www.mimecast.com 
>  
> ___ 
> Discuss-gnuradio mailing list 
> Discuss-gnuradio@gnu.org 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio 
> 
> ___ Discuss-gnuradio 
> mailing list Discuss-gnuradio@gnu.org 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio   
>   ___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-24 Thread Patrick Sathyanathan
Attaching reply as text since outlook.com insists on eating XML and formatting.


--Patrick


> From: mcqui...@sfu.ca 
> Date: Thu, 24 Sep 2015 10:35:34 -0700 
> To: david.ha...@toshiba-trel.com 
> CC: discuss-gnuradio@gnu.org 
> Subject: Re: [Discuss-gnuradio] Function Probe and OOT Blocks 
> 
> Hi David: 
> 
> I'm a relative newbie myself, but I can say that I had this same issue. 
> I had a block with a static parameter that I wanted to be able to 
> change dynamically at runtime. 
> 
> I looked at the block's source code, and also at a block that had a 
> dynamically adjustable parameter. 
> 
> Basically, and with a little help from the list (Marcus Muller in 
> particular) as I had to learn c++, I was able to use the code from the 
> dynamic block as an example, and modify the static block to change the 
> parameter to be dynamically changeable. It all came down to at most a 
> couple dozen lines of code. The bigger challenge was learning about 
> Gnuradio's architecture, to know what to do. 
> 
> I would suggest a similar approach. You will find the list members 
> very helpful. I'd also look at the guided tutorials, there are good 
> examples there under "how to write a c++ block". 
> 
> I will help if I can but alas, I am still quite a newbie, so others 
> will be able to help much more efficiently! 
> 
> Kevin 
> 
> Sent from my iPad 
> 
> On Sep 23, 2015, at 4:12 AM, David Halls 
> <david.ha...@toshiba-trel.com<mailto:david.ha...@toshiba-trel.com>> 
> wrote: 
> 
> 
> ​Hi guys, 
> 
> 
> I am familiar with using function probes to update values to blocks. 
> This is straightforward with built in blocks like Multiply Const, where 
> the input is underline in the GRC dialogue box. 
> 
> 
> How do I create a block, specifically a Python block, that allows me to 
> update parameters in this fashion so that they are not fixed at 
> runtime? 
> 
> 
> Regards, 
> 
> 
> David 
> 
>  
> 
> NOTE: The information in this email and any attachments may be 
> confidential and/or legally privileged. This message may be read, 
> copied and used only by the intended recipient. If you are not the 
> intended recipient, please destroy this message, delete any copies held 
> on your system and notify the sender immediately. 
> 
> Toshiba Research Europe Limited, registered in England and Wales 
> (2519556). Registered Office 208 Cambridge Science Park, Milton Road, 
> Cambridge CB4 0GZ, England. Web: 
> www.toshiba.eu/research/trl<http://www.toshiba.eu/research/trl> 
> 
> 
> 
>  
> This email has been scanned for email related threats and delivered 
> safely by Mimecast. 
> For more information please visit http://www.mimecast.com 
>  
> ___ 
> Discuss-gnuradio mailing list 
> Discuss-gnuradio@gnu.org<mailto:Discuss-gnuradio@gnu.org> 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio 
> 
> ___ Discuss-gnuradio 
> mailing list Discuss-gnuradio@gnu.org 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio   
>   Hi David, 

Making the parameter vary at runtime is simple and just needs 
some extra XML and python code. The parameter should be an argument to 
the __init__ method (constructor) of your block and should have a "" 
declaration in the matching XML file. Let's say the parameter name is 
"variable_param" with a declaration like:


   Variable parameter
   variable_param
   42
   int


Then you need to add the following in the XML file: 

set_variable_param($variable_param)

And you need to implement the "set_variable_param" method in your python class 
to take whatever action is needed when the parameter value changes. This method 
will be called every time the value of the expression in the underlined 
"Variable parameter" box in the GUI changes. The method will look like: 

   def set_variable_param(self, new_value): 
  whatever code 
  
This should make GRC underline the variable_param in the GUI and it will be 
variable 
at runtime. 

Thanks, 

--Patrick ___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-24 Thread Patrick Sathyanathan
Retrying in plain text, since browser/outlook ate the XML I had typed:


Hi David, 


Making the parameter vary at runtime is simple and just needs some extra XML 
and python code. 

The parameter should be an argument to the __init__ method (constructor) of 
your block and should 

have a "" declaration in the matching XML file. Let's say the parameter name is 

"variable_param" with a declaration like:



   Variable parameter
   variable_param
   42
   int



Then you need to add the following in the XML file: 


set_variable_param($variable_param)


And you need to implement the "set_variable_param" method in your python class 
to take whatever 

action is needed when the parameter value changes. This method will be called 
every time the value 

of the expression in the underlined "Variable parameter" box in the GUI 
changes. The method will look 

like: 


   def set_variable_param(self, new_value): 
  whatever code 
  
This should make GRC underline the variable_param in the GUI and it will be 
variable at runtime. 


Thanks, 


--Patrick 

From: mcqui...@sfu.ca
Date: Thu, 24 Sep 2015 10:35:34 -0700
To: david.ha...@toshiba-trel.com
CC: discuss-gnuradio@gnu.org
Subject: Re: [Discuss-gnuradio] Function Probe and OOT Blocks


Hi David:




I'm a relative newbie myself, but I can say that I had this same issue.  I had 
a block with a static parameter that I wanted to be able to change dynamically 
at runtime.




I looked at the block's source code, and also at a block that had a dynamically 
adjustable parameter.




Basically, and with a little help from the list (Marcus Muller in particular) 
as I had to learn c++, I was able to use the code from the dynamic block as an 
example, and modify the static block to change the parameter to be dynamically 
changeable. It all came down to at most a couple dozen lines of code. The 
bigger challenge was learning about Gnuradio's architecture, to know what to do.




I would suggest a similar approach. You will find the list members very 
helpful. I'd also look at the guided tutorials, there are good examples there 
under "how to write a c++ block".




I will help if I can but alas, I am still quite a newbie, so others will be 
able to help much more efficiently!




Kevin

Sent from my iPad


On Sep 23, 2015, at 4:12 AM, David Halls  wrote:




​Hi guys,





I am familiar with using function probes to update values to blocks. This is 
straightforward with built in blocks like Multiply Const, where the input is 
underline in the GRC dialogue box.





How do I create a block, specifically a Python block, that allows me to update 
parameters in this fashion so that they are not fixed at runtime?





Regards,





David





 NOTE: The information in this email and any attachments may be confidential 
and/or legally privileged. This message may be read, copied and used only by 
the intended recipient. If you are not the intended recipient, please destroy 
this message, delete any copies held on your system and notify the sender 
immediately.

 Toshiba Research Europe Limited, registered in England and Wales (2519556). 
Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, 
England. Web: www.toshiba.eu/research/trl





This email has been scanned for email related threats and delivered safely by 
Mimecast.
 For more information please visit http://www.mimecast.com 


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


___ Discuss-gnuradio mailing list 
Discuss-gnuradio@gnu.org 
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio 
   ___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-23 Thread David Halls
?Hi guys,


I am familiar with using function probes to update values to blocks. This is 
straightforward with built in blocks like Multiply Const, where the input is 
underline in the GRC dialogue box.


How do I create a block, specifically a Python block, that allows me to update 
parameters in this fashion so that they are not fixed at runtime?


Regards,


David



NOTE: The information in this email and any attachments may be confidential 
and/or legally privileged. This message may be read, copied and used only by 
the intended recipient. If you are not the intended recipient, please destroy 
this message, delete any copies held on your system and notify the sender 
immediately.

Toshiba Research Europe Limited, registered in England and Wales (2519556). 
Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, 
England. Web: www.toshiba.eu/research/trl
---
 This email has been scanned for email related threats and delivered safely by 
Mimecast.
 For more information please visit http://www.mimecast.com
---
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Function Probe and OOT Blocks

2015-09-23 Thread Marcus Müller
Hi David,

For these cases, I typically recommend building an adjustable block that has a 
message port input, and one or multiple blocks that have message port outputs. 
You can, for example, write a multiply block that has one stream in-and one 
steam output, and does register_message_port_in, and has a message handler that 
updates the factor used internally for multiplication in a thread-safe manner.

Then, you'd write something that is a stream sink, I.e. only has an input for 
samples, but based on some condition, sporadically sends a message to the 
aforementioned block. That way, you get asynchronous cooperation in GNU radio. 
I'm on my phone, currently, but if you look for the "GNU radio guided 
tutorials", you'll find a section on message passing. In the GNU radio doxygen, 
you'll find a reference for the typical command syntax that GNU radio devs 
usually agree on using.

Best regards,
Marcus

Am 23. September 2015 13:12:20 MESZ, schrieb David Halls 
:
>?Hi guys,
>
>
>I am familiar with using function probes to update values to blocks.
>This is straightforward with built in blocks like Multiply Const, where
>the input is underline in the GRC dialogue box.
>
>
>How do I create a block, specifically a Python block, that allows me to
>update parameters in this fashion so that they are not fixed at
>runtime?
>
>
>Regards,
>
>
>David
>
>
>
>NOTE: The information in this email and any attachments may be
>confidential and/or legally privileged. This message may be read,
>copied and used only by the intended recipient. If you are not the
>intended recipient, please destroy this message, delete any copies held
>on your system and notify the sender immediately.
>
>Toshiba Research Europe Limited, registered in England and Wales
>(2519556). Registered Office 208 Cambridge Science Park, Milton Road,
>Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl
>---
>This email has been scanned for email related threats and delivered
>safely by Mimecast.
> For more information please visit http://www.mimecast.com
>---
>
>
>
>
>___
>Discuss-gnuradio mailing list
>Discuss-gnuradio@gnu.org
>https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio