Adds tuner preference editor with channelizer type options. Updates (#456)

tuners to use the preference to select either polyphase or heterodyne
channelizers.
This commit is contained in:
Denny Sheirer
2018-12-25 06:43:10 -05:00
committed by GitHub
parent b67d4d92dc
commit efd811407e
25 changed files with 717 additions and 249 deletions

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 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
@@ -14,10 +15,11 @@
*
* 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 io.github.dsheirer.source;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.settings.SettingsManager;
import io.github.dsheirer.source.config.SourceConfigTuner;
import io.github.dsheirer.source.config.SourceConfiguration;
@@ -34,12 +36,12 @@ public class SourceManager
private TunerManager mTunerManager;
private TunerModel mTunerModel;
public SourceManager(TunerModel tunerModel, SettingsManager settingsManager)
public SourceManager(TunerModel tunerModel, SettingsManager settingsManager, UserPreferences userPreferences)
{
mTunerModel = tunerModel;
mMixerManager = new MixerManager();
mRecordingSourceManager = new RecordingSourceManager(settingsManager);
mTunerManager = new TunerManager(mMixerManager, tunerModel);
mTunerManager = new TunerManager(mMixerManager, tunerModel, userPreferences);
//TODO: change mixer & recording managers to be models and hand them
//in via the constructor. Perform loading outside of this class.

View File

@@ -1,26 +1,33 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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 io.github.dsheirer.source.tuner;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.preference.tuner.ChannelizerType;
import io.github.dsheirer.sample.Broadcaster;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.source.ISourceEventProcessor;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.tuner.TunerEvent.Event;
import io.github.dsheirer.source.tuner.manager.ChannelSourceManager;
import io.github.dsheirer.source.tuner.manager.HeterodyneChannelSourceManager;
import io.github.dsheirer.source.tuner.manager.PolyphaseChannelSourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,15 +51,28 @@ public abstract class Tuner implements ISourceEventProcessor
* @param name of the tuner
* @param tunerController for the tuner
*/
public Tuner(String name, TunerController tunerController)
public Tuner(String name, TunerController tunerController, UserPreferences userPreferences)
{
mName = name;
mTunerController = tunerController;
//Register to receive frequency and sample rate change notifications
mTunerController.addListener(this::process);
mChannelSourceManager = new PolyphaseChannelSourceManager(mTunerController);
// mChannelSourceManager = new HeterodyneChannelSourceManager(mTunerController);
ChannelizerType channelizerType = userPreferences.getTunerPreference().getChannelizerType();
if(channelizerType == ChannelizerType.POLYPHASE)
{
mChannelSourceManager = new PolyphaseChannelSourceManager(mTunerController);
}
else if(channelizerType == ChannelizerType.HETERODYNE)
{
mChannelSourceManager = new HeterodyneChannelSourceManager(mTunerController);
}
else
{
throw new IllegalArgumentException("Unrecognized channelizer type: " + channelizerType);
}
//Register to receive channel count change notifications
mChannelSourceManager.addSourceEventListener(this::process);

View File

@@ -1,20 +1,25 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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 io.github.dsheirer.source.tuner;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.mixer.MixerManager;
import io.github.dsheirer.source.tuner.airspy.AirspyTuner;
@@ -44,7 +49,7 @@ public class TunerManager
private MixerManager mMixerManager;
private TunerModel mTunerModel;
private UserPreferences mUserPreferences;
/**
* Application-wide LibUSB timeout processor for transfer buffers. All classes that need to use USB transfer
@@ -58,10 +63,11 @@ public class TunerManager
LIBUSB_TRANSFER_PROCESSOR = new USBMasterProcessor();
}
public TunerManager(MixerManager mixerManager, TunerModel tunerModel)
public TunerManager(MixerManager mixerManager, TunerModel tunerModel, UserPreferences userPreferences)
{
mMixerManager = mixerManager;
mTunerModel = tunerModel;
mUserPreferences = userPreferences;
initTuners();
}
@@ -251,7 +257,7 @@ public class TunerManager
airspyController.init();
AirspyTuner tuner = new AirspyTuner(airspyController);
AirspyTuner tuner = new AirspyTuner(airspyController, mUserPreferences);
return new TunerInitStatus(tuner, "LOADED");
}
@@ -286,7 +292,7 @@ public class TunerManager
{
controller.init();
FCDTuner tuner = new FCDTuner(controller);
FCDTuner tuner = new FCDTuner(controller, mUserPreferences);
return new TunerInitStatus(tuner, "LOADED");
}
@@ -320,7 +326,7 @@ public class TunerManager
{
controller.init();
FCDTuner tuner = new FCDTuner(controller);
FCDTuner tuner = new FCDTuner(controller, mUserPreferences);
return new TunerInitStatus(tuner, "LOADED");
}
@@ -349,7 +355,7 @@ public class TunerManager
hackRFController.init();
HackRFTuner tuner = new HackRFTuner(hackRFController);
HackRFTuner tuner = new HackRFTuner(hackRFController, mUserPreferences);
return new TunerInitStatus(tuner, "LOADED");
}
@@ -392,7 +398,7 @@ public class TunerManager
controller.init();
RTL2832Tuner rtlTuner = new RTL2832Tuner(tunerClass, controller);
RTL2832Tuner rtlTuner = new RTL2832Tuner(tunerClass, controller, mUserPreferences);
return new TunerInitStatus(rtlTuner, "LOADED");
}
@@ -408,7 +414,7 @@ public class TunerManager
controller.init();
RTL2832Tuner rtlTuner = new RTL2832Tuner(tunerClass, controller);
RTL2832Tuner rtlTuner = new RTL2832Tuner(tunerClass, controller, mUserPreferences);
return new TunerInitStatus(rtlTuner, "LOADED");
}

View File

@@ -1,22 +1,25 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 io.github.dsheirer.source.tuner.airspy;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
import io.github.dsheirer.source.tuner.TunerType;
@@ -26,48 +29,48 @@ import org.slf4j.LoggerFactory;
public class AirspyTuner extends Tuner
{
private final static Logger mLog = LoggerFactory.getLogger( AirspyTuner.class );
private final static Logger mLog = LoggerFactory.getLogger(AirspyTuner.class);
public AirspyTuner( AirspyTunerController controller )
{
super( "Airspy " + controller.getDeviceInfo().getSerialNumber(), controller );
}
public AirspyTuner(AirspyTunerController controller, UserPreferences userPreferences)
{
super("Airspy " + controller.getDeviceInfo().getSerialNumber(), controller, userPreferences);
}
public AirspyTunerController getController()
{
return (AirspyTunerController)getTunerController();
}
public AirspyTunerController getController()
{
return (AirspyTunerController)getTunerController();
}
@Override
public String getUniqueID()
{
try
{
return getController().getDeviceInfo().getSerialNumber();
}
catch( Exception e )
{
mLog.error( "error getting serial number", e );
}
@Override
public String getUniqueID()
{
try
{
return getController().getDeviceInfo().getSerialNumber();
}
catch(Exception e)
{
mLog.error("error getting serial number", e);
}
return BoardID.AIRSPY.getLabel();
}
return BoardID.AIRSPY.getLabel();
}
@Override
public TunerClass getTunerClass()
{
return TunerClass.AIRSPY;
}
@Override
public TunerClass getTunerClass()
{
return TunerClass.AIRSPY;
}
@Override
public TunerType getTunerType()
{
return TunerType.AIRSPY_R820T;
}
@Override
public TunerType getTunerType()
{
return TunerType.AIRSPY_R820T;
}
@Override
public double getSampleSize()
{
return 13.0;
}
@Override
public double getSampleSize()
{
return 13.0;
}
}

View File

@@ -1,62 +1,67 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2017 Dennis Sheirer
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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 io.github.dsheirer.source.tuner.fcd;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
import io.github.dsheirer.source.tuner.TunerType;
public class FCDTuner extends Tuner
{
public FCDTuner(FCDTunerController controller)
{
super( controller.getConfiguration().toString(), controller);
}
public void dispose()
{
getController().dispose();
}
public FCDTunerController getController()
{
return (FCDTunerController)getTunerController();
}
@Override
public FCDTuner(FCDTunerController controller, UserPreferences userPreferences)
{
super(controller.getConfiguration().toString(), controller, userPreferences);
}
public void dispose()
{
getController().dispose();
}
public FCDTunerController getController()
{
return (FCDTunerController)getTunerController();
}
@Override
public TunerClass getTunerClass()
{
return getController().getTunerClass();
return getController().getTunerClass();
}
@Override
@Override
public TunerType getTunerType()
{
return getController().getTunerType();
return getController().getTunerType();
}
@Override
@Override
public String getUniqueID()
{
return getController().getUSBAddress();
return getController().getUSBAddress();
}
@Override
public double getSampleSize()
{
return 16.0;
}
@Override
public double getSampleSize()
{
return 16.0;
}
}

View File

@@ -1,20 +1,25 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2017 Dennis Sheirer
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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 io.github.dsheirer.source.tuner.hackrf;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
@@ -25,11 +30,11 @@ import org.slf4j.LoggerFactory;
public class HackRFTuner extends Tuner
{
private final static Logger mLog = LoggerFactory.getLogger( HackRFTuner.class );
private final static Logger mLog = LoggerFactory.getLogger(HackRFTuner.class);
public HackRFTuner( HackRFTunerController controller ) throws SourceException
public HackRFTuner(HackRFTunerController controller, UserPreferences userPreferences) throws SourceException
{
super( "HackRF", controller );
super("HackRF", controller, userPreferences);
}
public HackRFTunerController getController()
@@ -62,9 +67,9 @@ public class HackRFTuner extends Tuner
{
return getController().getSerial().getSerialNumber();
}
catch( Exception e )
catch(Exception e)
{
mLog.error( "error gettting serial number", e );
mLog.error("error gettting serial number", e);
}
return BoardID.HACKRF_ONE.getLabel();

View File

@@ -1,22 +1,25 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014-2016 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 io.github.dsheirer.source.tuner.rtl;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
@@ -30,10 +33,11 @@ public class RTL2832Tuner extends Tuner
private TunerClass mTunerClass;
public RTL2832Tuner(TunerClass tunerClass, RTL2832TunerController controller) throws SourceException
public RTL2832Tuner(TunerClass tunerClass, RTL2832TunerController controller, UserPreferences userPreferences)
throws SourceException
{
super(tunerClass.getVendorDeviceLabel() + "/" + controller.getTunerType().getLabel() + " " +
controller.getUniqueID(), controller);
controller.getUniqueID(), controller, userPreferences);
mTunerClass = tunerClass;
}

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 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
@@ -14,10 +15,11 @@
*
* 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 io.github.dsheirer.source.tuner.test;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
import io.github.dsheirer.source.tuner.TunerType;
@@ -34,9 +36,9 @@ public class TestTuner extends Tuner
private static int mInstanceCounter = 1;
private final int mInstanceID = mInstanceCounter++;
public TestTuner()
public TestTuner(UserPreferences userPreferences)
{
super("Test Tuner", new TestTunerController());
super("Test Tuner", new TestTunerController(), userPreferences);
}
/**