DDCBankChannel
Note
This feature is available only with a License - Contact us for more details
This object maps to an existing channel in one DDC Bank, allocated with the DDCBank.createChannel() method.
It is possible to allocate a DDCBankChannel from any task given the channel unique id.
Object DDCBankChannel {
constructor DDCBankChannel( uuid ) ;
string getUUID();
bool setOffset( number Hz );
bool setCenterFrequency( number MHz );
number getCenterFrequency();
number getCenterOffset();
number getSampleRate();
bool start();
stop();
bool isRunning();
bool release() ; // destroy all
IQData getIQ([optional bool wait if nothing]);
}
.getUUID
Returns the globally unique identifier for this DDC Channel. This string can be used in any task to access the DDC channel.
var bank = new DDCBank(rx,8);
bank.setInputChannel(1);
var channel = bank.createChannel( 100e3 );
var uuid = channel.getUUID();
print('Channel UUID:' + uuid);
.setOffset
Retunes the DDC internal oscillator; parameter number is in Hertz and relative to the center frequency of the incoming stream.
This has no effect on the hardware receiver parameters.
.setCenterFrequency
Retunes the DDC internal oscillator, parameter number is in MHz and is the absolute frequency.
This has no effect on the hardware receiver parameters: the current center frequency of the receiver is used to estimate the offset, internally this function calls setOffset()
.getCenterFrequency
Returns the absolute frequency (in Hz) of the current DDC channel.
.getCenterOffset
Returns the current value of the internal oscillator. Value in Hz.
.getSampleRate
Returns the current sampling rate (equals the bandwidth) of the current DDC channel.
.start
Starts streaming on this DDC channel.
- If the attached receiver was off, it turns on the attached receiver.
- If the receiver was already running, this command has no effect.
.stop
Stops streaming on this DDC channel.
- if this is the only running channel in the DDC Bank, the attached receiver is turned off,
- if other DDCs are currently running, this command has no effect.
The allocated resources are not released. The DDC channel might be turned on again.
.isRunning
Returns true if the DDC channel is currently streaming.
.release
Stops and destroys the curent DDC channel. It cannot be restarted.
.getIQ
Extracts one IQ data block from the DDC channel output. Unless a boolean true value is passed as parameters, this call is non-blocking :
- If no data is available, and empty IQData block is returned (length=0).
Example
// open and tune RF input
var rx = BladeRF.makeDevice({"device_name" : "bladerf"});
rx.setRxCenterFreq(466);
rx.setRxSampleRate(5e6);
rx.setGain( 50 ) ;
// Create a DDC Bank connected to the second input of the BladeRF (rx2)
var bank = new DDCBank(rx,2);
bank.setRFInputChannel(1);
// allocate one single DDC channel, 1MHz wide
var channel = bank.createChannel( 1e6 );
print('Channel UUID:' + channel.getUUID());
// tune it to +990kHz
channel.setOffset( 990e3 );
// start
if( channel.start() == false ) {
print(' error starting channel id : ' + channel_name );
exit();
}
print('Running ' + channel.getCenterFrequency());
var blk = 0 ;
for( ; ; ) {
var iq = channel.getIQ(true);
// do something with IQ
//iq.dump();
print( 'received : ' + blk );
blk++ ;
}
Last update: May 1, 2022