From 279004d969d60fcbbbf9d4a6726a221f4da59150 Mon Sep 17 00:00:00 2001 From: Dennis Sheirer Date: Sun, 19 Feb 2023 10:08:50 -0500 Subject: [PATCH] #1455 work in progress --- .../dsheirer/source/tuner/TunerClass.java | 7 +- .../dsheirer/source/tuner/TunerFactory.java | 7 ++ .../dsheirer/source/tuner/TunerType.java | 3 +- .../source/tuner/airspy/hf/AirspyHfTuner.java | 96 ++++++++++++++++ .../airspy/hf/AirspyHfTunerConfiguration.java | 49 +++++++++ .../airspy/hf/AirspyHfTunerController.java | 104 ++++++++++++++++++ 6 files changed, 263 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTuner.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerConfiguration.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerController.java diff --git a/src/main/java/io/github/dsheirer/source/tuner/TunerClass.java b/src/main/java/io/github/dsheirer/source/tuner/TunerClass.java index 51906891e..90f2e638d 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/TunerClass.java +++ b/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 @@ -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" ), @@ -52,7 +53,7 @@ public String toString() return mDescription; } - public static final EnumSet SUPPORTED_USB_TUNERS = EnumSet.of(AIRSPY, HACKRF, RTL2832, + public static final EnumSet SUPPORTED_USB_TUNERS = EnumSet.of(AIRSPY, AIRSPY_HF, HACKRF, RTL2832, FUNCUBE_DONGLE_PRO, FUNCUBE_DONGLE_PRO_PLUS); public static final EnumSet FUNCUBE_TUNERS = EnumSet.of(FUNCUBE_DONGLE_PRO, FUNCUBE_DONGLE_PRO_PLUS); @@ -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; diff --git a/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java b/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java index ba5251989..d543b174d 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java +++ b/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java @@ -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; @@ -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) @@ -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: diff --git a/src/main/java/io/github/dsheirer/source/tuner/TunerType.java b/src/main/java/io/github/dsheirer/source/tuner/TunerType.java index de36198eb..7a0ab54b2 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/TunerType.java +++ b/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 @@ -26,6 +26,7 @@ public enum TunerType { AIRSPY_R820T("R820T"), + AIRSPY_HF_PLUS("HF+"), ELONICS_E4000("E4000"), FCI_FC2580("FC2580"), FITIPOWER_FC0012("FC0012"), diff --git a/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTuner.java b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTuner.java new file mode 100644 index 000000000..afe1d0780 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTuner.java @@ -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 + * **************************************************************************** + */ +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; + } +} diff --git a/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerConfiguration.java b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerConfiguration.java new file mode 100644 index 000000000..306fd9e5d --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerConfiguration.java @@ -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 + * **************************************************************************** + */ +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; + } +} diff --git a/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerController.java new file mode 100644 index 000000000..195749711 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/airspy/hf/AirspyHfTunerController.java @@ -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 + * **************************************************************************** + */ + +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: + } +}