Reads a binary file and produces a stream output with 'packet_len' tags for GNU Radio. Functionally it replaces a File Source block, a Stream to Tagged Stream block, and parts of a Burst_Shaper block. The advantage of this block is that when the input file size is not an exact multiple of the selected packet length, the remainder at the end of the file is not lost in the 'Stream to Tagged Stream' buffer. This block performs the following functions:
- Send a preamble to allow the receiver to synchronize.
- Send the selected file with "packet_len" tags.
- Send a post-file filler to assure that any buffers have been flushed.
During the development of the Packet Communications tutorial I decided to make an Out of Tree block to take the place of the File Source and the Stream to Tagged Stream blocks. That was the first version of this module.
After that I worked on the File transfer using Packet and AFSK tutorial and made several improvements to the Embedded Python Block.
Next came follow-on work to the Packet Communications tutorial which resulted in the File transfer using Packet and BPSK tutorial. It added several features such as Base64 encoding of the data, sending the originating filename in the postamble, and specifying the input file on the Python command line.
- Open a terminal window.
- Change to the home directory.
cd ~/
- If you don't have 'git', enter
sudo apt install git
- Execute the following commands:
cd
git clone https://github.com/duggabe/gr-File_Source_to_Tagged_Stream.git
cd ~/gr-File_Source_to_Tagged_Stream
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
After starting "gnuradio-companion", the "File Source to Tagged Stream" block will be listed in the Block Tree Panel under the "customEPB" group.
An example flowgraph for sending packets is shown in the examples
folder.