Skip to content

Commit

Permalink
#1455 work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Sheirer committed Feb 19, 2023
1 parent 75347f9 commit 279004d
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/main/java/io/github/dsheirer/source/tuner/TunerClass.java
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 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
Expand All @@ -26,6 +26,7 @@
public enum TunerClass
{
AIRSPY("Airspy"),
AIRSPY_HF("Airspy HF+"),
FUNCUBE_DONGLE_PRO("Funcube Dongle Pro" ),
FUNCUBE_DONGLE_PRO_PLUS("Funcube Dongle Pro+" ),
HACKRF("HackRF" ),
Expand All @@ -52,7 +53,7 @@ public String toString()
return mDescription;
}

public static final EnumSet<TunerClass> SUPPORTED_USB_TUNERS = EnumSet.of(AIRSPY, HACKRF, RTL2832,
public static final EnumSet<TunerClass> SUPPORTED_USB_TUNERS = EnumSet.of(AIRSPY, AIRSPY_HF, HACKRF, RTL2832,
FUNCUBE_DONGLE_PRO, FUNCUBE_DONGLE_PRO_PLUS);

public static final EnumSet<TunerClass> FUNCUBE_TUNERS = EnumSet.of(FUNCUBE_DONGLE_PRO, FUNCUBE_DONGLE_PRO_PLUS);
Expand Down Expand Up @@ -122,6 +123,8 @@ public static TunerClass lookup(short vendor, short product)
return HACKRF;
case 0x1D5060A1:
return AIRSPY;
case 0x03EB800C:
return AIRSPY_HF;
}

return TunerClass.UNKNOWN;
Expand Down
Expand Up @@ -28,6 +28,9 @@
import io.github.dsheirer.source.tuner.airspy.AirspyTunerConfiguration;
import io.github.dsheirer.source.tuner.airspy.AirspyTunerController;
import io.github.dsheirer.source.tuner.airspy.AirspyTunerEditor;
import io.github.dsheirer.source.tuner.airspy.hf.AirspyHfTuner;
import io.github.dsheirer.source.tuner.airspy.hf.AirspyHfTunerConfiguration;
import io.github.dsheirer.source.tuner.airspy.hf.AirspyHfTunerController;
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
import io.github.dsheirer.source.tuner.fcd.FCDTuner;
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerConfiguration;
Expand Down Expand Up @@ -313,6 +316,8 @@ public static Tuner getUsbTuner(TunerClass tunerClass, String portAddress, int b
{
case AIRSPY:
return new AirspyTuner(new AirspyTunerController(bus, portAddress, tunerErrorListener), tunerErrorListener, channelizerType);
case AIRSPY_HF:
return new AirspyHfTuner(new AirspyHfTunerController(bus, portAddress, tunerErrorListener), tunerErrorListener, channelizerType);
case FUNCUBE_DONGLE_PRO:
TargetDataLine tdl1 = MixerManager.getTunerTargetDataLine(MixerTunerType.FUNCUBE_DONGLE_PRO);
if(tdl1 != null)
Expand Down Expand Up @@ -362,6 +367,8 @@ public static TunerConfiguration getTunerConfiguration(TunerType type, String un
{
switch(type)
{
case AIRSPY_HF_PLUS:
return new AirspyHfTunerConfiguration(uniqueID);
case AIRSPY_R820T:
return new AirspyTunerConfiguration(uniqueID);
case ELONICS_E4000:
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/github/dsheirer/source/tuner/TunerType.java
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 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
Expand All @@ -26,6 +26,7 @@
public enum TunerType
{
AIRSPY_R820T("R820T"),
AIRSPY_HF_PLUS("HF+"),
ELONICS_E4000("E4000"),
FCI_FC2580("FC2580"),
FITIPOWER_FC0012("FC0012"),
Expand Down
@@ -0,0 +1,96 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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.hf;

import io.github.dsheirer.preference.source.ChannelizerType;
import io.github.dsheirer.source.tuner.ITunerErrorListener;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Airspy HF+Tuner
*/
public class AirspyHfTuner extends Tuner
{
private final static Logger mLog = LoggerFactory.getLogger(AirspyHfTuner.class);

/**
* Constructs an instance
* @param controller for the Airspy HF
* @param tunerErrorListener to listen for errors from this tuner
* @param channelizerType for the channelizer
*/
public AirspyHfTuner(AirspyHfTunerController controller, ITunerErrorListener tunerErrorListener,
ChannelizerType channelizerType)
{
super(controller, tunerErrorListener, channelizerType);
}

@Override
public String getPreferredName()
{
// return "Airspy HF+ " + getController().getDeviceInfo().getSerialNumber();
return "Airspy HF+";
}

/**
* Airspy tuner controller
*/
public AirspyHfTunerController getController()
{
return (AirspyHfTunerController)getTunerController();
}

@Override
public String getUniqueID()
{
return "Unique ID";
// try
// {
// return getController().getDeviceInfo().getSerialNumber();
// }
// catch(Exception e)
// {
// mLog.error("error getting serial number", e);
// }
//
// return BoardID.AIRSPY.getLabel();
}

@Override
public TunerClass getTunerClass()
{
return TunerClass.AIRSPY_HF;
}

@Override
public double getSampleSize()
{
return 13.0;
}

@Override
public int getMaximumUSBBitsPerSecond()
{
//4-bytes per sample = 32 bits times 10 MSps = 320,000,000 bits per second
return 320000000;
}
}
@@ -0,0 +1,49 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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.hf;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.github.dsheirer.source.tuner.TunerType;
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;

public class AirspyHfTunerConfiguration extends TunerConfiguration
{
/**
* Default constructor for JAXB
*/
public AirspyHfTunerConfiguration()
{
}

/**
* Constructs an instance for the unique ID.
* @param uniqueID of the tuner (ie serial number)
*/
public AirspyHfTunerConfiguration(String uniqueID)
{
super(uniqueID);
}

@Override
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
public TunerType getTunerType()
{
return TunerType.AIRSPY_HF_PLUS;
}
}
@@ -0,0 +1,104 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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.hf;

import io.github.dsheirer.buffer.INativeBufferFactory;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.ITunerErrorListener;
import io.github.dsheirer.source.tuner.TunerType;
import io.github.dsheirer.source.tuner.usb.USBTunerController;

/**
* Airspy HF+ and Discovery tuner controller.
*/
public class AirspyHfTunerController extends USBTunerController
{
private static final long MINIMUM_FREQUENCY_HZ = 500_000;
private static final long MAXIMUM_FREQUENCY_HZ = 260_000_000;

public AirspyHfTunerController(int bus, String portAddress, ITunerErrorListener tunerErrorListener)
{
super(bus, portAddress, tunerErrorListener);
setMinimumFrequency(MINIMUM_FREQUENCY_HZ);
setMaximumFrequency(MAXIMUM_FREQUENCY_HZ);
setUsableBandwidthPercentage(1.00);
setMiddleUnusableHalfBandwidth(0);
}

@Override
public int getBufferSampleCount()
{
//TODO:
return 0;
}

@Override
public long getTunedFrequency() throws SourceException
{
//TODO:
return 0;
}

@Override
public void setTunedFrequency(long frequency) throws SourceException
{
//TODO:

}

@Override
public double getCurrentSampleRate() throws SourceException
{
//TODO:
return 0;
}

@Override
public TunerType getTunerType()
{
return TunerType.AIRSPY_HF_PLUS;
}

@Override
protected INativeBufferFactory getNativeBufferFactory()
{
//TODO:
return null;
}

@Override
protected int getTransferBufferSize()
{
//TODO:
return 0;
}

@Override
protected void deviceStart() throws SourceException
{
//TODO:
}

@Override
protected void deviceStop()
{
//TODO:
}
}

0 comments on commit 279004d

Please sign in to comment.