discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] How to update the value of a variable by reading mess


From: Zhe Feng
Subject: [Discuss-gnuradio] How to update the value of a variable by reading message in grc?
Date: Fri, 2 May 2014 23:31:22 -0700 (PDT)

Hi all, 

I'm working on a system with packet headers. I want to use the message
decoded by the Packet Header Parser to update a variable. 

I knew the message can be stored in a message debug block, and be retrieved
by using the "get_message" function. So I can define a get function to read
the message in the flowgraph class, and call this get function in "main" and
set this value to the variable I want to update. For example, I wrote a get
function like this:

    def get_type(self):
        self.num_msg = self.msg_debug.num_messages()
        self.msg = pmt.to_python(self.msg_debug.get_message(self.num_msg-1))
        self.type = self.msg.get('type_tag')
        return self.type

and call this get function in "main"
    type = tb.get_type()
    tb.set_variable(type)

But as far as I know, the get function can only be called once in "main", so
the variable can only be updated once. Since we want to update the variable
every time we decoded a message, I'm wondering is there a way in the grc to
change a variable 
by the message?

I actually have a idea in mind. Like the Header/Payload Demux block used in
rx_ofdm, I can write a block that taking message as input, reading the PMT
dictionary to get the value we want, and output the value. Then the desired
variable can be updated by connecting the output of my designed block to a
function probe. 

But this function probe only probes the port in a certain frequency, i.e. it
can not catch all the updates. So I'm wondering if there is a way to update
a predefined variable through a block every time. 

Any suggestions will be valued. 

Thanks!
Best,
Zhe



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/How-to-update-the-value-of-a-variable-by-reading-message-in-grc-tp47932.html
Sent from the GnuRadio mailing list archive at Nabble.com.



reply via email to

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