mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
WIP #34 - updates tuners and tuner model to provide details on
frequency, sample rate, sourced channels, and spectral display in the tuner view tab.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* SDR Trunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -71,9 +71,9 @@ public class ControllerPanel extends JPanel
|
|||||||
|
|
||||||
private JideTabbedPane mTabbedPane;
|
private JideTabbedPane mTabbedPane;
|
||||||
|
|
||||||
protected ConfigurationTreePanel mSystemControlViewPanel;
|
// protected ConfigurationTreePanel mSystemControlViewPanel;
|
||||||
protected OldConfigurationEditor mConfigurationEditor;
|
// protected OldConfigurationEditor mConfigurationEditor;
|
||||||
protected JideSplitPane mSystemControlSplitPane;
|
// protected JideSplitPane mSystemControlSplitPane;
|
||||||
|
|
||||||
protected JTable mChannelActivityTable = new JTable();
|
protected JTable mChannelActivityTable = new JTable();
|
||||||
private AudioPanel mAudioPanel;
|
private AudioPanel mAudioPanel;
|
||||||
@@ -128,25 +128,25 @@ public class ControllerPanel extends JPanel
|
|||||||
"[grow,fill]",
|
"[grow,fill]",
|
||||||
"[grow,fill]") );
|
"[grow,fill]") );
|
||||||
|
|
||||||
//System Configuration View and Editor
|
// //System Configuration View and Editor
|
||||||
mConfigurationEditor = new OldConfigurationEditor();
|
// mConfigurationEditor = new OldConfigurationEditor();
|
||||||
|
//
|
||||||
|
// mSystemControlViewPanel = new ConfigurationTreePanel( mController );
|
||||||
|
// mSystemControlViewPanel.addTreeSelectionListener( mConfigurationEditor );
|
||||||
|
|
||||||
mSystemControlViewPanel = new ConfigurationTreePanel( mController );
|
// mSystemControlSplitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
|
||||||
mSystemControlViewPanel.addTreeSelectionListener( mConfigurationEditor );
|
// mSystemControlSplitPane.setDividerSize( 5 );
|
||||||
|
// mSystemControlSplitPane.add( mSystemControlViewPanel );
|
||||||
mSystemControlSplitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
|
// mSystemControlSplitPane.add( mConfigurationEditor );
|
||||||
mSystemControlSplitPane.setDividerSize( 5 );
|
|
||||||
mSystemControlSplitPane.add( mSystemControlViewPanel );
|
|
||||||
mSystemControlSplitPane.add( mConfigurationEditor );
|
|
||||||
|
|
||||||
//Tabbed View - configuration, calls, messages, map
|
//Tabbed View - configuration, calls, messages, map
|
||||||
mTabbedPane = new JideTabbedPane();
|
mTabbedPane = new JideTabbedPane();
|
||||||
mTabbedPane.setFont( this.getFont() );
|
mTabbedPane.setFont( this.getFont() );
|
||||||
mTabbedPane.setForeground( Color.BLACK );
|
mTabbedPane.setForeground( Color.BLACK );
|
||||||
|
mTabbedPane.addTab( "Tuners", mTunerManagerPanel );
|
||||||
mTabbedPane.addTab( "Channels", mChannelController );
|
mTabbedPane.addTab( "Channels", mChannelController );
|
||||||
mTabbedPane.addTab( "Aliases", mAliasController );
|
mTabbedPane.addTab( "Aliases", mAliasController );
|
||||||
mTabbedPane.addTab( "Tuners", mTunerManagerPanel );
|
// mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
||||||
mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
|
||||||
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
||||||
mTabbedPane.addTab( "Events", mCallEventPanel );
|
mTabbedPane.addTab( "Events", mCallEventPanel );
|
||||||
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
||||||
|
|||||||
@@ -1,17 +1,34 @@
|
|||||||
package source;
|
package source;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.AbstractListModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
|
||||||
|
import sample.Listener;
|
||||||
import source.tuner.Tuner;
|
import source.tuner.Tuner;
|
||||||
|
import source.tuner.TunerChangeEvent;
|
||||||
|
|
||||||
public class TunerModel extends AbstractListModel<Tuner>
|
public class TunerModel extends AbstractTableModel
|
||||||
|
implements Listener<TunerChangeEvent>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private static final int TUNER_CLASS = 0;
|
||||||
|
private static final int TUNER_TYPE = 1;
|
||||||
|
private static final int SAMPLE_RATE = 2;
|
||||||
|
private static final int FREQUENCY = 3;
|
||||||
|
private static final int CHANNEL_COUNT = 4;
|
||||||
|
private static final int SPECTRAL_DISPLAY = 5;
|
||||||
|
|
||||||
|
private static final String MHZ = " MHz";
|
||||||
|
private static final String[] COLUMNS =
|
||||||
|
{ "Class", "Type", "Sample Rate", "Frequency", "Channels", "Spectrum" };
|
||||||
|
|
||||||
private List<Tuner> mTuners = new ArrayList<>();
|
private List<Tuner> mTuners = new ArrayList<>();
|
||||||
|
private DecimalFormat mFrequencyFormat = new DecimalFormat( "0.00000" );
|
||||||
|
private DecimalFormat mSampleRateFormat = new DecimalFormat( "0.000" );
|
||||||
|
|
||||||
public TunerModel()
|
public TunerModel()
|
||||||
{
|
{
|
||||||
@@ -25,6 +42,16 @@ public class TunerModel extends AbstractListModel<Tuner>
|
|||||||
return mTuners;
|
return mTuners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Tuner getTuner( int index )
|
||||||
|
{
|
||||||
|
if( index < mTuners.size() )
|
||||||
|
{
|
||||||
|
return mTuners.get( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void addTuners( List<Tuner> Tuners )
|
public void addTuners( List<Tuner> Tuners )
|
||||||
{
|
{
|
||||||
for( Tuner tuner: Tuners )
|
for( Tuner tuner: Tuners )
|
||||||
@@ -44,7 +71,9 @@ public class TunerModel extends AbstractListModel<Tuner>
|
|||||||
|
|
||||||
int index = mTuners.indexOf( tuner );
|
int index = mTuners.indexOf( tuner );
|
||||||
|
|
||||||
fireIntervalAdded( this, index, index );
|
fireTableRowsInserted( index, index );
|
||||||
|
|
||||||
|
tuner.addTunerChangeListener( this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,34 +84,101 @@ public class TunerModel extends AbstractListModel<Tuner>
|
|||||||
{
|
{
|
||||||
if( mTuners.contains( tuner ) )
|
if( mTuners.contains( tuner ) )
|
||||||
{
|
{
|
||||||
|
tuner.removeTunerChangeListener( this );
|
||||||
|
|
||||||
int index = mTuners.indexOf( tuner );
|
int index = mTuners.indexOf( tuner );
|
||||||
|
|
||||||
mTuners.remove( tuner );
|
mTuners.remove( tuner );
|
||||||
|
|
||||||
fireIntervalRemoved( this, index, index );
|
fireTableRowsDeleted( index, index );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of Tuners in this model
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize()
|
public void receive( TunerChangeEvent event )
|
||||||
|
{
|
||||||
|
if( event.getTuner() != null )
|
||||||
|
{
|
||||||
|
int index = mTuners.indexOf( event.getTuner() );
|
||||||
|
|
||||||
|
if( index >= 0 )
|
||||||
|
{
|
||||||
|
switch( event.getEvent() )
|
||||||
|
{
|
||||||
|
case CHANNEL_COUNT:
|
||||||
|
fireTableCellUpdated( index, CHANNEL_COUNT );
|
||||||
|
break;
|
||||||
|
case FREQUENCY:
|
||||||
|
fireTableCellUpdated( index, FREQUENCY );
|
||||||
|
break;
|
||||||
|
case SAMPLE_RATE:
|
||||||
|
fireTableCellUpdated( index, SAMPLE_RATE );
|
||||||
|
break;
|
||||||
|
case SPECTRAL_DISPLAY:
|
||||||
|
fireTableCellUpdated( index, SPECTRAL_DISPLAY );
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRowCount()
|
||||||
{
|
{
|
||||||
return mTuners.size();
|
return mTuners.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the Tuner at the specified index
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Tuner getElementAt( int index )
|
public int getColumnCount()
|
||||||
{
|
{
|
||||||
if( index <= mTuners.size() )
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValueAt( int rowIndex, int columnIndex )
|
||||||
|
{
|
||||||
|
if( rowIndex < mTuners.size() )
|
||||||
{
|
{
|
||||||
return mTuners.get( index );
|
Tuner tuner = mTuners.get( rowIndex );
|
||||||
|
|
||||||
|
switch( columnIndex )
|
||||||
|
{
|
||||||
|
case TUNER_CLASS:
|
||||||
|
return tuner.getTunerClass().getVendorDescription();
|
||||||
|
case TUNER_TYPE:
|
||||||
|
return tuner.getTunerType().getLabel();
|
||||||
|
case SAMPLE_RATE:
|
||||||
|
int sampleRate = tuner.getSampleRate();
|
||||||
|
|
||||||
|
return mSampleRateFormat.format( sampleRate / 1E6D ) + MHZ;
|
||||||
|
case FREQUENCY:
|
||||||
|
try
|
||||||
|
{
|
||||||
|
long frequency = tuner.getFrequency();
|
||||||
|
|
||||||
|
return mFrequencyFormat.format( frequency / 1E6D ) + MHZ;
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case CHANNEL_COUNT:
|
||||||
|
return tuner.getChannelCount();
|
||||||
|
case SPECTRAL_DISPLAY:
|
||||||
|
return "TBD";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getColumnName( int columnIndex )
|
||||||
|
{
|
||||||
|
return COLUMNS[ columnIndex ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package source;
|
|||||||
import gui.editor.EmptyEditor;
|
import gui.editor.EmptyEditor;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
|
||||||
import javax.swing.JList;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
@@ -30,7 +31,7 @@ public class TunerViewPanel extends JPanel
|
|||||||
private TunerModel mTunerModel;
|
private TunerModel mTunerModel;
|
||||||
private SettingsManager mSettingsManager;
|
private SettingsManager mSettingsManager;
|
||||||
private JideSplitPane mSplitPane;
|
private JideSplitPane mSplitPane;
|
||||||
private JList<Tuner> mTunerList;
|
private JTable mTunerTable;
|
||||||
|
|
||||||
public TunerViewPanel( TunerModel tunerModel, SettingsManager settingsManager )
|
public TunerViewPanel( TunerModel tunerModel, SettingsManager settingsManager )
|
||||||
{
|
{
|
||||||
@@ -44,17 +45,19 @@ public class TunerViewPanel extends JPanel
|
|||||||
{
|
{
|
||||||
setLayout( new MigLayout( "insets 1 1 1 1", "[fill,grow]", "[fill,grow]" ) );
|
setLayout( new MigLayout( "insets 1 1 1 1", "[fill,grow]", "[fill,grow]" ) );
|
||||||
|
|
||||||
mTunerList = new JList<>( mTunerModel );
|
mTunerTable = new JTable( mTunerModel );
|
||||||
mTunerList.setLayoutOrientation( JList.VERTICAL );
|
mTunerTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||||
mTunerList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
mTunerTable.getSelectionModel().addListSelectionListener( new ListSelectionListener()
|
||||||
mTunerList.addListSelectionListener( new ListSelectionListener()
|
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged( ListSelectionEvent event )
|
public void valueChanged( ListSelectionEvent event )
|
||||||
{
|
{
|
||||||
if( !event.getValueIsAdjusting() )
|
if( !event.getValueIsAdjusting() )
|
||||||
{
|
{
|
||||||
Tuner selected = mTunerList.getSelectedValue();
|
int row = mTunerTable.getSelectedRow();
|
||||||
|
int modelRow = mTunerTable.convertRowIndexToModel( row );
|
||||||
|
|
||||||
|
Tuner selected = mTunerModel.getTuner( modelRow );
|
||||||
|
|
||||||
Component component = null;
|
Component component = null;
|
||||||
|
|
||||||
@@ -80,12 +83,14 @@ public class TunerViewPanel extends JPanel
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
JScrollPane listScroller = new JScrollPane( mTunerList );
|
JScrollPane listScroller = new JScrollPane( mTunerTable );
|
||||||
|
listScroller.setPreferredSize( new Dimension( 400, 20 ) );
|
||||||
|
|
||||||
JScrollPane editorScroller = new JScrollPane( new EmptyEditor<Tuner>() );
|
JScrollPane editorScroller = new JScrollPane( new EmptyEditor<Tuner>() );
|
||||||
|
editorScroller.setPreferredSize( new Dimension( 400, 80 ) );
|
||||||
|
|
||||||
mSplitPane = new JideSplitPane();
|
mSplitPane = new JideSplitPane();
|
||||||
mSplitPane.setOrientation( JideSplitPane.HORIZONTAL_SPLIT );
|
mSplitPane.setOrientation( JideSplitPane.VERTICAL_SPLIT );
|
||||||
mSplitPane.add( listScroller );
|
mSplitPane.add( listScroller );
|
||||||
mSplitPane.add( editorScroller );
|
mSplitPane.add( editorScroller );
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package source.tuner;
|
package source.tuner;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
@@ -32,7 +34,6 @@ import source.SourceException;
|
|||||||
import source.tuner.frequency.FrequencyChangeEvent;
|
import source.tuner.frequency.FrequencyChangeEvent;
|
||||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tuner - provides tuner channel sources, representing a channel frequency
|
* Tuner - provides tuner channel sources, representing a channel frequency
|
||||||
@@ -48,11 +49,14 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
|||||||
* Sample Listeners - these will typically be the DFT processor for spectral
|
* Sample Listeners - these will typically be the DFT processor for spectral
|
||||||
* display, or it will be one or more tuner channel sources
|
* display, or it will be one or more tuner channel sources
|
||||||
*/
|
*/
|
||||||
protected CopyOnWriteArrayList<Listener<ComplexBuffer>>
|
protected List<Listener<ComplexBuffer>> mSampleListeners =
|
||||||
mSampleListeners = new CopyOnWriteArrayList<Listener<ComplexBuffer>>();
|
new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
protected CopyOnWriteArrayList<IFrequencyChangeProcessor>
|
protected List<IFrequencyChangeProcessor> mFrequencyChangeProcessors =
|
||||||
mFrequencyChangeProcessors = new CopyOnWriteArrayList<IFrequencyChangeProcessor>();
|
new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
protected List<Listener<TunerChangeEvent>> mTunerChangeListeners =
|
||||||
|
new ArrayList<>();
|
||||||
|
|
||||||
public Tuner( String name )
|
public Tuner( String name )
|
||||||
{
|
{
|
||||||
@@ -148,6 +152,11 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
|||||||
public abstract TunerChannelSource getChannel( TunerChannel channel )
|
public abstract TunerChannelSource getChannel( TunerChannel channel )
|
||||||
throws RejectedExecutionException, SourceException;
|
throws RejectedExecutionException, SourceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count of currently sourced channels (TunerChannel).
|
||||||
|
*/
|
||||||
|
public abstract int getChannelCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the tuned channel resources
|
* Releases the tuned channel resources
|
||||||
*
|
*
|
||||||
@@ -211,6 +220,33 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
|||||||
new FrequencyChangeEvent( Event.NOTIFICATION_FREQUENCY_CHANGE, frequency ) );
|
new FrequencyChangeEvent( Event.NOTIFICATION_FREQUENCY_CHANGE, frequency ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the listener
|
||||||
|
*/
|
||||||
|
public void addTunerChangeListener( Listener<TunerChangeEvent> listener )
|
||||||
|
{
|
||||||
|
mTunerChangeListeners.add( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the registered listener
|
||||||
|
*/
|
||||||
|
public void removeTunerChangeListener( Listener<TunerChangeEvent> listener )
|
||||||
|
{
|
||||||
|
mTunerChangeListeners.remove( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcasts the tuner change event
|
||||||
|
*/
|
||||||
|
public void broadcast( TunerChangeEvent event )
|
||||||
|
{
|
||||||
|
for( Listener<TunerChangeEvent> listener: mTunerChangeListeners )
|
||||||
|
{
|
||||||
|
listener.receive( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts a sample rate change event to all registered listeners
|
* Broadcasts a sample rate change event to all registered listeners
|
||||||
*/
|
*/
|
||||||
@@ -238,6 +274,15 @@ public abstract class Tuner implements IFrequencyChangeProcessor,
|
|||||||
{
|
{
|
||||||
processor.frequencyChanged( event );
|
processor.frequencyChanged( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( event.getEvent() == Event.NOTIFICATION_FREQUENCY_CHANGE )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.FREQUENCY ) );
|
||||||
|
}
|
||||||
|
else if( event.getEvent() == Event.NOTIFICATION_SAMPLE_RATE_CHANGE )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.SAMPLE_RATE ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
33
src/source/tuner/TunerChangeEvent.java
Normal file
33
src/source/tuner/TunerChangeEvent.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package source.tuner;
|
||||||
|
|
||||||
|
public class TunerChangeEvent
|
||||||
|
{
|
||||||
|
private Tuner mTuner;
|
||||||
|
private Event mEvent;
|
||||||
|
|
||||||
|
public TunerChangeEvent( Tuner tuner, Event event )
|
||||||
|
{
|
||||||
|
mTuner = tuner;
|
||||||
|
mEvent = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tuner getTuner()
|
||||||
|
{
|
||||||
|
return mTuner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event getEvent()
|
||||||
|
{
|
||||||
|
return mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Event
|
||||||
|
{
|
||||||
|
ADD,
|
||||||
|
REMOVE,
|
||||||
|
CHANNEL_COUNT,
|
||||||
|
FREQUENCY,
|
||||||
|
SAMPLE_RATE,
|
||||||
|
SPECTRAL_DISPLAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -222,6 +222,11 @@ public abstract class TunerController implements Tunable
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
return mTunedChannels.size();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the tuner's LO frequency must be updated in order to
|
* Indicates if the tuner's LO frequency must be updated in order to
|
||||||
* accomodate the tuner channel
|
* accomodate the tuner channel
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package source.tuner;
|
|||||||
|
|
||||||
public enum TunerType
|
public enum TunerType
|
||||||
{
|
{
|
||||||
AIRSPY_R820T( "R820T" ),
|
AIRSPY_R820T( "R820T/R820T2" ),
|
||||||
ELONICS_E4000( "E4000" ),
|
ELONICS_E4000( "E4000" ),
|
||||||
ETTUS_WBX( "WBX" ),
|
ETTUS_WBX( "WBX" ),
|
||||||
ETTUS_VARIOUS( "Ettus Tuner" ),
|
ETTUS_VARIOUS( "Ettus Tuner" ),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import sample.complex.ComplexBuffer;
|
|||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.Tuner;
|
import source.tuner.Tuner;
|
||||||
|
import source.tuner.TunerChangeEvent;
|
||||||
import source.tuner.TunerChannel;
|
import source.tuner.TunerChannel;
|
||||||
import source.tuner.TunerChannelSource;
|
import source.tuner.TunerChannelSource;
|
||||||
import source.tuner.TunerClass;
|
import source.tuner.TunerClass;
|
||||||
@@ -137,9 +138,24 @@ public class AirspyTuner extends Tuner
|
|||||||
//Consider implementing a fractional resampler to get a correct 48 kHz
|
//Consider implementing a fractional resampler to get a correct 48 kHz
|
||||||
//output sample rate
|
//output sample rate
|
||||||
|
|
||||||
return mController.getChannel( this, channel );
|
TunerChannelSource source = mController.getChannel( this, channel );
|
||||||
|
|
||||||
|
if( source != null )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.CHANNEL_COUNT ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
return mController.getChannelCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseChannel( TunerChannelSource source )
|
public void releaseChannel( TunerChannelSource source )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,6 +106,13 @@ public class B100Tuner extends Tuner
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseChannel( TunerChannelSource source )
|
public void releaseChannel( TunerChannelSource source )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import settings.SettingsManager;
|
|||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.MixerTuner;
|
import source.tuner.MixerTuner;
|
||||||
import source.tuner.MixerTunerDataLine;
|
import source.tuner.MixerTunerDataLine;
|
||||||
|
import source.tuner.TunerChangeEvent;
|
||||||
import source.tuner.TunerChannel;
|
import source.tuner.TunerChannel;
|
||||||
import source.tuner.TunerChannelSource;
|
import source.tuner.TunerChannelSource;
|
||||||
import source.tuner.TunerClass;
|
import source.tuner.TunerClass;
|
||||||
@@ -113,9 +114,22 @@ public class FCDTuner extends MixerTuner
|
|||||||
public TunerChannelSource getChannel( TunerChannel tunerChannel )
|
public TunerChannelSource getChannel( TunerChannel tunerChannel )
|
||||||
throws RejectedExecutionException, SourceException
|
throws RejectedExecutionException, SourceException
|
||||||
{
|
{
|
||||||
return mController.getChannel( this, tunerChannel );
|
TunerChannelSource source = mController.getChannel( this, tunerChannel );
|
||||||
|
|
||||||
|
if( source != null )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.CHANNEL_COUNT ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
return mController.getChannelCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the tuned channel so that the tuner controller can tune to
|
* Releases the tuned channel so that the tuner controller can tune to
|
||||||
* other frequencies as needed.
|
* other frequencies as needed.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import sample.complex.ComplexBuffer;
|
|||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.Tuner;
|
import source.tuner.Tuner;
|
||||||
|
import source.tuner.TunerChangeEvent;
|
||||||
import source.tuner.TunerChannel;
|
import source.tuner.TunerChannel;
|
||||||
import source.tuner.TunerChannelSource;
|
import source.tuner.TunerChannelSource;
|
||||||
import source.tuner.TunerClass;
|
import source.tuner.TunerClass;
|
||||||
@@ -108,9 +109,22 @@ public class HackRFTuner extends Tuner
|
|||||||
public TunerChannelSource getChannel( TunerChannel channel )
|
public TunerChannelSource getChannel( TunerChannel channel )
|
||||||
throws RejectedExecutionException, SourceException
|
throws RejectedExecutionException, SourceException
|
||||||
{
|
{
|
||||||
return mController.getChannel( this, channel );
|
TunerChannelSource source = mController.getChannel( this, channel );
|
||||||
|
|
||||||
|
if( source != null )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.CHANNEL_COUNT ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
return mController.getChannelCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseChannel( TunerChannelSource source )
|
public void releaseChannel( TunerChannelSource source )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import sample.complex.ComplexBuffer;
|
|||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.Tuner;
|
import source.tuner.Tuner;
|
||||||
|
import source.tuner.TunerChangeEvent;
|
||||||
import source.tuner.TunerChannel;
|
import source.tuner.TunerChannel;
|
||||||
import source.tuner.TunerChannelSource;
|
import source.tuner.TunerChannelSource;
|
||||||
import source.tuner.TunerClass;
|
import source.tuner.TunerClass;
|
||||||
@@ -157,6 +158,11 @@ public class RTL2832Tuner extends Tuner
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
source = mController.getChannel( this, channel );
|
source = mController.getChannel( this, channel );
|
||||||
|
|
||||||
|
if( source != null )
|
||||||
|
{
|
||||||
|
broadcast( new TunerChangeEvent( this, TunerChangeEvent.Event.CHANNEL_COUNT ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
@@ -165,6 +171,13 @@ public class RTL2832Tuner extends Tuner
|
|||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChannelCount()
|
||||||
|
{
|
||||||
|
return mController.getChannelCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the tuned channel so that the tuner controller can tune to
|
* Releases the tuned channel so that the tuner controller can tune to
|
||||||
* other frequencies as needed.
|
* other frequencies as needed.
|
||||||
|
|||||||
Reference in New Issue
Block a user