Resolves #57 - default tuner configuration per tuner type was being

shared across multiple tuners of the same type, unless the user created
a new tuner configuration for each tuner. 

Updated code to create a default tuner configuration based on the tuner
type, but name the configuration as 'Default-UNIQUETUNERID', so that any
changes to that uniquely identified tuner will persist across sessions.

Note: this does not avoid the situation where multiple tuners of the
same type are all using the same default serial number (e.g. 0000001).
In this case, they will all still share the same configuraiton.  User
must change the serial number of the dongle in order for it to be
uniquely identifiable, so that we can correctly lookup the configuration
for the specific tuner.
This commit is contained in:
denny
2016-02-26 06:07:21 -05:00
parent 6f2a7e89a9
commit 399d164bd0
4 changed files with 21 additions and 19 deletions

View File

@@ -557,11 +557,6 @@ public class SettingsManager
ArrayList<TunerConfiguration> configs = getSettings()
.getTunerConfigurations( type );
if( configs.isEmpty() )
{
configs.add( addNewTunerConfiguration( type, "Default" ) );
}
return configs;
}

View File

@@ -544,16 +544,14 @@ public class TunerManager
}
}
}
else
{
config = configs.get( 0 );
}
//If we're still null at this point, create a default config
if( config == null )
{
String name = "Default-" + tuner.getUniqueID();
config = mResourceManager.getSettingsManager()
.addNewTunerConfiguration( tuner.getTunerType(), "Default" );
.addNewTunerConfiguration( tuner.getTunerType(), name );
}
//Persist the config as the selected tuner configuration. The method

View File

@@ -55,8 +55,6 @@ import sample.complex.ComplexBuffer;
import source.SourceException;
import source.tuner.TunerController;
import source.tuner.TunerType;
import source.tuner.frequency.FrequencyChangeEvent;
import source.tuner.frequency.FrequencyChangeEvent.Event;
import buffer.FloatAveragingBuffer;
import controller.ResourceManager;
import controller.ThreadPoolManager;
@@ -1486,8 +1484,11 @@ public abstract class RTL2832TunerController extends TunerController
buffer.get( data );
buffer.rewind();
mFilledBuffers.add( data );
if( mRunning.get() )
{
mFilledBuffers.add( data );
}
mSampleCounter.addAndGet( transfer.actualLength() );
@@ -1501,11 +1502,19 @@ public abstract class RTL2832TunerController extends TunerController
{
case LibUsb.TRANSFER_COMPLETED:
/* resubmit the transfer */
int result = LibUsb.submitTransfer( transfer );
if( result != LibUsb.SUCCESS )
if( isRunning() )
{
int result = LibUsb.submitTransfer( transfer );
if( result != LibUsb.SUCCESS )
{
mLog.error( "couldn't resubmit buffer transfer to tuner" );
LibUsb.freeTransfer( transfer );
mTransfers.remove( transfer );
}
}
else
{
mLog.error( "couldn't resubmit buffer transfer to tuner" );
LibUsb.freeTransfer( transfer );
mTransfers.remove( transfer );
}

View File

@@ -34,7 +34,7 @@ public class R820TTunerConfiguration extends TunerConfiguration
private R820TLNAGain mLNAGain = R820TLNAGain.GAIN_222;
private R820TVGAGain mVGAGain = R820TVGAGain.GAIN_210;
private double mFrequencyCorrection = 0.0d;
private SampleRate mSampleRate = SampleRate.RATE_1_920MHZ;
private SampleRate mSampleRate = SampleRate.RATE_2_400MHZ;
/**
* Default constructor for JAXB