discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] filename using time-stamp in GRC


From: Alexandru Csete
Subject: Re: [Discuss-gnuradio] filename using time-stamp in GRC
Date: Thu, 20 Jan 2011 18:41:00 +0100

On Thu, Jan 20, 2011 at 5:41 PM,  <address@hidden> wrote:
>
...
> Following up on this, I found this site that had some useful 
> suggestions:http://www.oz9aec.net/index.php/gnu-radio/grc-examples
>
> A grc example is provided that implements a dynamic time stamp, but NOT a 
> button to control it.  So I am trying to use a Variable Chooser to select 
> between "/dev/null" and the filename that is based on the time-stamp.  
> However, nothing is generated.  In particular, I have:
>
> A file sink with File: recfile
> A Variable with ID prefix with Value "./"
> A Variable Chooser with ID: recfile, Default Value: "/dev/null" and
> Choices of "/dev/null" or "prefix + 
> datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".bin"
>
> I was hoping this would dynamically create a file with the current time stamp 
> for the name, but no files are actually being generated.  Could this be and 
> issue related to a bug that is described in the link below?
>
> http://lists.gnu.org/archive/html/discuss-gnuradio/2011-01/msg00080.html
>
> If so, will this approach work if I upgrade via git?
>

Hi Eric,

The problem with this simple example is that the variable containing

"prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".bin"

is evaluated when you start the script, so it will only work for a
single file per execution. I believe it is for the same reason that
you see no file with your modification: The file sink is initialized
with /dev/null as filename and it can not change the file name during
runtime because the required code for "close file, set new file name,
open new file" is not generated by GRC - I am not exactly sure about
this but it should be obvious if you look in the generated code. I
would try to do as Josh said in the other mail, implement the required
code yourself and embed it as a custom block.

Alex



reply via email to

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