discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gr.prefs


From: Martin DvH
Subject: Re: [Discuss-gnuradio] gr.prefs
Date: Thu, 29 Apr 2010 15:01:51 +0200

On Wed, 2010-04-28 at 15:28 -0400, Marcus D. Leech wrote:
> Is there any kind of guide as to how gr.prefs is supposed to be used? 
> Is this functionality going
>   to be deprecated at any point, is there any kind of plan as to how it
> will be used?
> 
There is not much documentation but I found out the hard way a few
thinks you should know.

The format of the prefs configartion files:

-Never ever put a comment on the same line as a setting.

For example:
GOOD:
# default fft_rate=15
fft_rate=8

BAD
fft_rate=8 # default fft_rate=15

This results in a parse error for the line, and consequently the default
being used (in this case 15) in stead of your value (in this case 8).

Comments should be on their own line, starting with a # with no
whitespace in front of the #.

-Don't have backups of conf files (or other files) laying around in 
(/usr/local)/etc/gnuradio/conf.d

All files in (/usr/local)/etc/gnuradio/conf.d will be parsed.

If you have gr-wxgui.conf and gr-wxgui.conf~ and gr-wxgui.conf.bak and
README.txt then all will be parsed in unknown order.
The last value parsed will be used.


The best way I found to find out which values are used from the prefs is
doing a grep on the whole gnuradio tree.
First find the files which use prefs

For C++ files:
grep -R "gr_prefs::singleton" *

For python files:
grep -R "gr\.prefs" *

Then look in those files for get_string, get_long, get_....
 
Maybe it is also possible to tweak doxygen to show all uses of gr_prefs,
I haven't tried.

To find out how to use it, just look at the current uses.
In short:
instantiate a gr_prefs singleton
 in C++           gr_prefs::singleton()
 in python        gr.prefs() 

And use one of the following methods to get your value: 
get_xxxx('section_name', 'option_name', default_value_if_not_found)

Where get_xxxx is get_bool, get_double, get_long,get_string or
get_long 

Martin

> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]