Jump to content
  • 0
Jacob R

WbtAPI for directly streaming

Question

Does this currently exist API for the WBT that will allow it to transmit directly from an IQ data stream?

There is a way to playback a file that would technically be transmission, but is there a way to directly transmit from a stream?

If not, the intended way of handling it would be to write a file (or series of files) to be played back by the WBT. The files would be short packets of IQ data and would be used to  transmit IQ data from a GRC flowchart. Would the Transmit function of the WBT be too slow for this method to be feasible

 There would be two files, one being read by the wbt and the other being written by (a GNURADIO-Companion flowchart>. At the end of reading the file being transmitted, the flowchart app would then clear the file, and write the next packet of data to be transmitted. The WBT would go to read the other file. It it essentially a buffer system, feed in the data on one end, read out on the other.

 

  • Upvote 1

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Can you be more specific on how to prefill the write iterator with data? 

You can prefill the write iterator's circular buffer by putting the desired data into each buffer chunk of the iterator and calling next, repeating the process for each buffer that was allocated by the creation of the iterator.

 

The API docs really help here:

A QVRT data stream is a packetized QVRT data stream that carries raw IQ data as well as other pertinent metadata establishing context (center frequency, sample rate, endpoints, etc). This stream uses a chunked circular buffer implementation to safely allow one writer and multiple readers. Each chunk of this buffer is divided into two areas: The IF Data Packet area- which contains 33 consecutive IF Data packets (each 4000 bytes) and the Context area- which contains a 4000 byte block containing context data (consisting of one Extension Data + one IF Context Packet). The WbtVRTWriteIterator operates by traversing the QVRT data stream buffer one buffered chunk at a time.

The created stream can have multiple readers connected to it. This can be accomplished by either specifying this stream's WbtCommon::Streams::StreamInformationBlock in the constructor for WbtApi::WbtVRTReadIterator or moving an exiting reader to it usingWbtApi::WbtSystem::MoveReaderToNewStream method.

Specification of all data and context packets used within a QVRT stream can be found within the WBT File Format document.

 

So in short:

1.  getCurrentLocationToWriteContext () and write your context information there, per the QVRT format documentation (you don't need to do this every time, just the first time, and any time your data would change)

2.  getCurrentLocationToWriteData () and write 33 data packets at a time, per the QVRT format documentation

3. setContextAvailable() - If you performed step 1

4. ++ operator - to advance the buffer. Do this for the number of buffer chunks that you had set up in the bufferSize parameter of the write iterator

5. move the streams to the iterator

6.  setStreamStarted ()

 

Do i only need to create a new WbtSystem obj and call startPlayback on it?

Beforehand, you also need to get the information about the file you want to play, to set up the sample rate and center frequency.

 

This can be accomplished using the following methods in WbtSystem.

getRecordingInfo

updateTunerSettings

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 1

There is a way, however, it is fairly roundabout so we are actively working to improve this functionality. Expect to see something a lot more convenient within the next quarter.

The current process is,

1. Create a WbtVRTWriteIterator, this will give you a handle to a new and empty shared buffer.

2. Prefill the write iterator with data, using the WBT File Format as a guide. (IF Data packets go into the main buffer area and context / extension data pairs go into the 4000 byte context section.)

3. Start a file that has the same radio configuration parameters (enabled tuners, span, bandwidth and center frequency) of what is intended to be streamed. This can be accomplished using WbtApi::WbtSystem::startPlayback.

4.Use WbtApi::WbtSystem::getActiveStreams to enumerate the active stream buffers on the system, that should include the file being played as well as the new stream created using the WbtVRTWriteIterator.

5. Use the function,  WbtApi::WbtSystem::MoveAllReadersToNewStream to redirect all of the listeners from the old stream (including the radio, as well as any other listening apps) to the new one. Now, all data that has been written, or is being written to your write iterator will be streamed to the radio.

 

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 1
On 2/4/2016 at 9:16 AM, Joey P said:

2. Prefill the write iterator with data, using the WBT File Format as a guide. (IF Data packets go into the main buffer area and context / extension data pairs go into the 4000 byte context section.)

   Can you be more specific on how to prefill the write iterator with data? 

On 2/4/2016 at 9:16 AM, Joey P said:

3. Start a file that has the same radio configuration parameters (enabled tuners, span, bandwidth and center frequency) of what is intended to be streamed. This can be accomplished using WbtApi::WbtSystem::startPlayback.

   Do i only need to create a new WbtSystem obj and call startPlayback on it?

Here is my code for a function this is meant to be used to Transmit IQ data from a stream that will come in as a gr::complex (GNURadio Companion) type. 


bool wbt_sink_c::start_transmission(WbtCommon::Data::RadioSelection_t tuner, float cent_freq, float span, float rx_Offset)
{
    Poco::Int32 m_int32 = 32;
    Poco::Int32 m_offset = 0;
    WbtApi::WbtSystem m_System();                           // create new system obj, to start playback with same settings as Tx
    WbtApi::WbtVRTWriteIterator m_Writer();                 // create a new iterator

    // fill it with data    < how can i do this??  >
    // do i need to set something more to have to same settings are the stream i want to Tx?         


   m_System().startPlayback("wbt_sink", m_offset,false);   // start playback
   m_System().getActiveStreams();                          // enumerate streams
    WbtCommon::Streams::StreamInformationBlock old_info;           // create info block old
    WbtCommon::Streams::StreamInformationBlock new_info;           // create info block new
    m_System().MoveAllReadersToNewStream(old_info,old_info);       // move all readers to Tx'ing stream

}

  • Upvote 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×