wip #34 - final edits to R820T tuner configuration editor and introduced

frequency correction to the airspy tuner configuration.
This commit is contained in:
denny
2016-03-18 10:59:36 -04:00
parent 45f0e09d5a
commit a4d69ce0aa
17 changed files with 333 additions and 286 deletions

View File

@@ -1,66 +0,0 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
******************************************************************************/
package source.tuner.configuration;
import javax.xml.bind.annotation.XmlAttribute;
import source.tuner.TunerType;
public class TunerConfigurationAssignment
{
private TunerType mTunerType;
private String mUniqueID;
private String mTunerConfigurationName;
public TunerConfigurationAssignment()
{
}
@XmlAttribute( name = "type" )
public TunerType getTunerType()
{
return mTunerType;
}
public void setTunerType( TunerType tunerType )
{
mTunerType = tunerType;
}
@XmlAttribute( name = "id" )
public String getUniqueID()
{
return mUniqueID;
}
public void setUniqueID( String uniqueID )
{
mUniqueID = uniqueID;
}
@XmlAttribute( name = "configuration_name" )
public String getTunerConfigurationName()
{
return mTunerConfigurationName;
}
public void setTunerConfigurationName( String tunerConfigurationName )
{
mTunerConfigurationName = tunerConfigurationName;
}
}

View File

@@ -61,7 +61,6 @@ public class TunerConfigurationFactory
break;
}
return new EmptyEditor<TunerConfiguration>();
return new EmptyEditor<TunerConfiguration>( "a tuner" );
}
}

View File

@@ -23,12 +23,13 @@ public class TunerConfigurationModel extends AbstractTableModel
private static final int ASSIGNED = 2;
private static final String[] COLUMN_HEADERS = { "Tuner Type", "Name", "Assigned" };
private List<Listener<TunerConfigurationEvent>> mConfigurationListeners = new ArrayList<>();
private List<Listener<TunerConfigurationEvent>> mConfigurationChangeListeners =
new ArrayList<>();
private List<TunerConfiguration> mTunerConfigurations = new ArrayList<>();
/**
* Table model for managing tuner configurations and tuner configuration
* assignments. Provides tuner configuration events to registered listeners
* Table model for managing tuner configurations. Provides tuner configuration events to
* registered listeners
*/
public TunerConfigurationModel()
{
@@ -115,7 +116,7 @@ public class TunerConfigurationModel extends AbstractTableModel
*/
public void addListener( Listener<TunerConfigurationEvent> listener )
{
mConfigurationListeners.add( listener );
mConfigurationChangeListeners.add( listener );
}
/**
@@ -123,7 +124,7 @@ public class TunerConfigurationModel extends AbstractTableModel
*/
public void removeListener( Listener<TunerConfigurationEvent> listener )
{
mConfigurationListeners.remove( listener );
mConfigurationChangeListeners.remove( listener );
}
/**
@@ -131,12 +132,44 @@ public class TunerConfigurationModel extends AbstractTableModel
*/
public void broadcast( TunerConfigurationEvent event )
{
for( Listener<TunerConfigurationEvent> listener: mConfigurationListeners )
for( Listener<TunerConfigurationEvent> listener: mConfigurationChangeListeners )
{
listener.receive( event );
}
}
/**
* Designates the configuration argument as the currently assigned configuration and unassigns
* any other configurations with the same tuner type and unique ID.
*/
public void assignTunerConfiguration( TunerConfiguration configToAssign )
{
if( configToAssign != null )
{
List<TunerConfiguration> configs =
getTunerConfigurations( configToAssign.getTunerType(), configToAssign.getUniqueID() );
for( TunerConfiguration config: configs )
{
if( config.isAssigned() )
{
mLog.debug( "Unassigning: " + config.getName() );
config.setAssigned( false );
int index = mTunerConfigurations.indexOf( config );
fireTableCellUpdated( index, ASSIGNED );
broadcast( new TunerConfigurationEvent( config, Event.CHANGE ) );
}
}
mLog.debug( "Assigning: " + configToAssign.getName() );
configToAssign.setAssigned( true );
int index = mTunerConfigurations.indexOf( configToAssign );
fireTableCellUpdated( index, ASSIGNED );
broadcast( new TunerConfigurationEvent( configToAssign, Event.CHANGE ) );
}
}
/**
* Returns the tuner configuration that is assigned to the tuner with the
* tuner type and uniqueID, or selects the first existing configuration that