// Configure a 27MHz real-time stream at a 2.44GHz center
bbConfigureAcquisition(handle, BB_MIN_AND_MAX, BB_LOG_SCALE);
bbConfigureCenterSpan(handle, 2.44e9, 20.0e6);
bbConfigureLevel(handle, -20.0, BB_AUTO_ATTEN);
bbConfigureGain(handle, BB_AUTO_GAIN);
// 9.8kHz RBW, for real-time must specify a native BW value
bbConfigureSweepCoupling(handle, 9863.28125, 9863.28125, 0.001,
BB_NATIVE_RBW, BB_NO_SPUR_REJECT);
bbConfigureRealTime(handle, 100.0, 30);
// Initialize the device for real-time
if(bbInitiate(handle, BB_REAL_TIME, 0)) {
myErrorRoutine("Device couldn't initialize");
}
// Get sweep characteristics and allocate memory for sweep
unsigned int sweepSize;
double binSize, startFreq;
bbQueryTraceInfo(handle, &sweepSize, &binSize, &startFreq);
int frameWidth, frameHeight;
bbQueryRealTimeInfo(handle, &frameWidth, &frameHeight);
float *sweep = new float[sweepSize];
float *frame = new float[frameWidth * frameHeight];
// Retrieve 1 real-time sweep/frame
bbFetchRealTimeFrame(handle, sweep, frame);
// Finished/close device
bbCloseDevice(handle);
I/Q Streaming Example
Below is the smallest example of using the BB60 and API for streaming I/Q data. The code snippet opens
the device, fully configures the device for I/Q data streaming, initializes the device for streaming,
retrieves one packet of data and then closes the device.
int handle;
bbOpenDevice(&handle);
// Configure an I/Q data stream
bbConfigureCenterSpan(handle, 2400.0e6, 20.0e6);
bbConfigureLevel(handle, -20.0 BB_AUTO_ATTEN);
bbConfigureGain(handle, BB_AUTO_GAIN);
// Set a sample rate of 20.0e6 MS/s and bandwidth of 15 MHz
bbConfigureIQ(handle, 2, 15.0e6);
// Initialize the device
bbInitiate(handle, BB_STREAMING, BB_STREAM_IQ);
// Allocate an array large enough for the I/Q stream configured
int buffer_len;
bbQueryStreamInfo(handle, &buffer_len, 0, 0);
float *iq_buffer;
// Allocate an array for ‘buffer_len’ alternating I/Q complex values
iq_buffer = new float[buffer_len * 2];
// Retrieve I/Q data packet