Hi Jeon, in principle, your flow graph does make a lot of sense. However, there's one problem: GNU Radio is a series of tubes, so to speak; as you switch the "upstream" selector, there's still items in the in- and output buffers of the previously selected encoder. Thus, you'd need to switch the downstream selector just the right amount of items later; the problem here is that you get absolutely no relation between "wall clock time" and the amount of items that have been processed.
Exactly for problems like that GNU Radio has stream tags, which really are just pieces of information logically "stuck" to a single item, as it passes through the block chain[1][2]. Now, if the selector was able to deal with such stream tags, you could just tell each selector to switch its ports right after a specific item has passed. Sadly, the selector can't do that. You could implement that in C++ or python; however, that might be a bit challenging, because this requires usage of the general block type, which makes it harder to implement (you'll need to build some kind of state machine to be able to tell GNU Radio how many input items you need on which input to produce the wanted amount of output). For a quick implementation, I'd go a different route: source -+--> custom_block0 ---> encoder0 ---> add --> +--> custom_block1 ---> encoder1 ------^ you'd need to implement custom_block in python or C++, that would either pass through items, just like the block does that comes out of gr_modtool add -l python -t sync or set the output items to 0. You'd toggle that behavior exactly at the sample that you get a tag. Of course, this has the downside of a unnecessary copy, encoding and adding per sample, compared to a proper stream en/disabler, but it'd be easier to implement, I'd say. Greetings, Marcus [1] You'll find a bit of instructional information in https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorial_Programming_Topics#52-Stream-Tags [2] Reference http://gnuradio.org/doc/doxygen/page_stream_tags.html On 03/25/2015 07:54 AM, Jeon wrote: > I will be using either Manchester code or 4B6B (something like 8B10B) > coding. Only one of them should be used at a time. > > What I ama thinking can be drawn like the following: > > > By using a certain variable that indicates it is Manchster or 4B6B, I > think the flow works. > > Do you think this flow makes sense? > Or is it recommended to write a cpp code that selects one of Manchester > and 4B6B? > > Regards, > Jeon. > > > > _______________________________________________ > 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