diff --git a/release/hackrf_spectrum_analyzer.zip b/release/hackrf_spectrum_analyzer.zip index 00f770d..9b4b71e 100644 Binary files a/release/hackrf_spectrum_analyzer.zip and b/release/hackrf_spectrum_analyzer.zip differ diff --git a/src/hackrf-sweep/Makefile b/src/hackrf-sweep/Makefile index 1aec142..2078f2e 100644 --- a/src/hackrf-sweep/Makefile +++ b/src/hackrf-sweep/Makefile @@ -1,5 +1,5 @@ #Settings: -JAVA_EXECUTABLE = "c:\Program Files (x86)\Java\jre\bin\java.exe" #required to generate jna wrapper +JAVA_EXECUTABLE = "c:\Program Files\Java\jre\bin\java.exe" #required to generate jna wrapper IS_RELEASE = y IS_64BIT = n #temporary build dir @@ -81,7 +81,7 @@ endif OUTPUT_DIR = build/lib/$(LIB_DIR) JNA_LIB = lib/hackrf-sweep-jna.jar -JNA_HEADER = $(CURDIR)/lib/hackrf/host/hackrf-tools/src/hackrf_sweep.h +JNA_SWEEP_HEADER = $(CURDIR)/lib/hackrf/host/hackrf-tools/src/hackrf_sweep.h DLL_LIB_PTHREAD = lib/$(LIB_DIR)/libwinpthread-1.dll @@ -138,8 +138,9 @@ $(DLL_LIB): $(OBJECTS) $(JNA_LIB) $(CXX) $(LDFLAGS) -shared -Wl,--kill-at -static-libgcc -static-libstdc++ $(LDPATHS) $(OBJECTS) -o $(DLL_LIB) $(LDLIBS) strip --strip-unneeded $(DLL_LIB) -$(JNA_LIB): $(JNA_HEADER) $(OBJECTS) - $(JAVA_EXECUTABLE) -Xmx1024M -jar $(JNAERATOR) -limitComments -emptyStructsAsForwardDecls -f -skipLibraryInstance -runtime JNA -direct -mode Jar -o lib -jar $(JNA_LIB) -v -library "hackrf-sweep" $(JNA_HEADER) +$(JNA_LIB): $(JNA_SWEEP_HEADER) $(OBJECTS) + $(JAVA_EXECUTABLE) -Xmx1024M -jar $(JNAERATOR) -limitComments -emptyStructsAsForwardDecls -f -skipLibraryInstance -runtime JNA -direct -mode Jar -o lib -jar $(JNA_LIB) -v -library "hackrf-sweep" $(JNA_SWEEP_HEADER) + $(JAVA_EXECUTABLE) -Xmx1024M -jar $(JNAERATOR) -limitComments -emptyStructsAsForwardDecls -f -skipLibraryInstance -runtime JNA -direct -mode Jar -o lib -jar libhackrf-jna.jar -v -library "hackrf-sweep" $(CURDIR)/lib/hackrf/host/libhackrf/src/hackrf.h rm -rf $(CURDIR)/_jnaerator.* diff --git a/src/hackrf-sweep/lib/hackrf b/src/hackrf-sweep/lib/hackrf index ee2499c..cade0a8 160000 --- a/src/hackrf-sweep/lib/hackrf +++ b/src/hackrf-sweep/lib/hackrf @@ -1 +1 @@ -Subproject commit ee2499c772aaa0524f16c9254dde4cc8aa8f6bcc +Subproject commit cade0a8fe31a57ac726290d6359a6997a0fb366c diff --git a/src/hackrf-sweep/lib/hackrf-sweep-jna.jar b/src/hackrf-sweep/lib/hackrf-sweep-jna.jar index faa3882..9b14d66 100644 Binary files a/src/hackrf-sweep/lib/hackrf-sweep-jna.jar and b/src/hackrf-sweep/lib/hackrf-sweep-jna.jar differ diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/HackRFSweepSpectrumAnalyzer.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/HackRFSweepSpectrumAnalyzer.java index 1a98085..c288b90 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/HackRFSweepSpectrumAnalyzer.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/HackRFSweepSpectrumAnalyzer.java @@ -6,6 +6,9 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics2D; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; import java.awt.geom.Rectangle2D; import java.io.IOException; import java.text.DecimalFormat; @@ -39,13 +42,16 @@ import org.jfree.data.Range; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; +import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleInsets; +import org.jfree.ui.TextAnchor; import jspectrumanalyzer.core.DatasetSpectrum; import jspectrumanalyzer.core.DatasetSpectrumPeak; import jspectrumanalyzer.core.FFTBins; import jspectrumanalyzer.core.HackRFSettings; import jspectrumanalyzer.core.HackRFSweepSettingsUI; +import jspectrumanalyzer.core.PowerCalibration; import jspectrumanalyzer.core.SpurFilter; import jspectrumanalyzer.core.WaterfallPlot; import jspectrumanalyzer.nativebridge.HackRFSweepDataCallback; @@ -76,11 +82,11 @@ public static void main(String[] args) throws IOException private int parameterMaxFreqMHz = 2500; private int parameterMinFreqMHz = 2400; private int parameterSamples = 8192; + private boolean parameterAntPower = false; private ArrayBlockingQueue processingQueue = new ArrayBlockingQueue<>(1000); private boolean showPeaks = false; - private float spectrumInitValue = -100; + private float spectrumInitValue = -150; private boolean spurRemoval = false; - private Thread threadHackrfSweep; private ArrayBlockingQueue threadLaunchCommands = new ArrayBlockingQueue<>(1); @@ -127,7 +133,7 @@ public HackRFSweepSpectrumAnalyzer() XYLineAndShapeRenderer rend = new XYLineAndShapeRenderer(); rend.setBaseShapesVisible(false); - ChartPanel chartPanel = new ChartPanel(chart); + chartPanel = new ChartPanel(chart); chartPanel.setMaximumDrawWidth(4096); chartPanel.setMaximumDrawHeight(2160); chartPanel.setMouseWheelEnabled(false); @@ -182,6 +188,8 @@ public HackRFSweepSpectrumAnalyzer() } }); + addChartMouseMarkers(); + waterfallPlot = new WaterfallPlot(chartPanel, 300); waterfallPaletteStartMarker = new ValueMarker(waterfallPlot.getSpectrumPaletteStart(), palette2, new BasicStroke(1f)); @@ -215,7 +223,7 @@ public HackRFSweepSpectrumAnalyzer() f.setVisible(true); rangeAxis.setAutoRange(false); - rangeAxis.setRange(-100, 10); + rangeAxis.setRange(-110, 0); rangeAxis.setTickUnit(new NumberTickUnit(10, new DecimalFormat("###"))); domainAxis.setNumberFormatOverride(new DecimalFormat(" #.### ")); @@ -288,6 +296,50 @@ public HackRFSweepSpectrumAnalyzer() })); } + private void addChartMouseMarkers() { + ValueMarker freqMarker = new ValueMarker(0, Color.WHITE, new BasicStroke(1f)); + freqMarker.setLabelPaint(Color.white); + freqMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + freqMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT); + freqMarker.setLabelFont(new Font(Font.MONOSPACED, Font.BOLD, 16)); + ValueMarker signalMarker = new ValueMarker(0, Color.WHITE, new BasicStroke(1f)); + signalMarker.setLabelPaint(Color.white); + signalMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + signalMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); + signalMarker.setLabelFont(new Font(Font.MONOSPACED, Font.BOLD, 16)); + + chartPanel.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + + XYPlot plot = chart.getXYPlot(); + Rectangle2D subplotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea(); + double crosshairRange = plot.getRangeAxis().java2DToValue(y, subplotArea, plot.getRangeAxisEdge()); + signalMarker.setValue(crosshairRange); + signalMarker.setLabel(String.format("%.1fdB", crosshairRange)); + double crosshairDomain = plot.getDomainAxis().java2DToValue(x, subplotArea, plot.getDomainAxisEdge()); + freqMarker.setValue(crosshairDomain); + freqMarker.setLabel(String.format("%.1fMHz", crosshairDomain)); + } + }); + chartPanel.addMouseListener(new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + chart.getXYPlot().clearDomainMarkers(); + chart.getXYPlot().clearRangeMarkers(); + } + @Override + public void mouseEntered(MouseEvent e) { + chart.getXYPlot().clearDomainMarkers(); + chart.getXYPlot().clearRangeMarkers(); + chart.getXYPlot().addRangeMarker(signalMarker); + chart.getXYPlot().addDomainMarker(freqMarker); + } + }); + } + public boolean isHWSendingData = false; private void fireHardwareStateChanged(boolean sendingData) { @@ -343,6 +395,17 @@ private void fireCapturingStateChanged(boolean isCapturing) } } + @Override + public boolean getAntennaPowerEnable() { + return parameterAntPower; + } + + @Override + public void setAntennaPowerEnable(boolean enable) { + this.parameterAntPower = enable; + restartHackrfSweep(); + } + @Override public int getFFTBinHz() { return parameterFFTBinHz; @@ -532,9 +595,10 @@ private void processingThread() } float binHz = bin1.fftBinWidthHz; +// PowerCalibration calibration = new PowerCalibration(-45, -12.5, 40); + datasetSpectrum = new DatasetSpectrumPeak(binHz, parameterMinFreqMHz, parameterMaxFreqMHz, spectrumInitValue, 15, 30000); chart.getXYPlot().getDomainAxis().setRange(parameterMinFreqMHz, parameterMaxFreqMHz); - float maxPeakJitterdB = 6; float peakThresholdAboveNoise = 4; @@ -560,6 +624,7 @@ private void processingThread() if (bins.freqStart != null && bins.sigPowdBm != null) { +// PowerCalibration.correctPower(calibration, parameterGaindB, bins); datasetSpectrum.addNewData(bins); } @@ -578,6 +643,7 @@ private void processingThread() */ if (showPeaks){ datasetSpectrum.refreshPeakSpectrum(); + waterfallPlot.setStatusMessage(String.format("Total Spectrum Peak Power %.1fdBm", datasetSpectrum.calculateSpectrumPeakPower())); } XYSeries spectrumSeries = new XYSeries("spectrum"); @@ -651,6 +717,7 @@ private synchronized void restartHackrfSweep() private volatile boolean forceStopSweep = false; private SpurFilter spurFilter; + private ChartPanel chartPanel; /** * no need to synchronize, executes only in launcher thread */ @@ -771,7 +838,7 @@ private void sweep() throws IOException System.out.println("hackrf_sweep params: freq " + parameterMinFreqMHz + "-" + parameterMaxFreqMHz + "MHz samples " + parameterSamples + " lna: " + lnaGain + " vga: " + vgaGain); fireHardwareStateChanged(false); - HackRFSweepNativeBridge.start(this, parameterMinFreqMHz, parameterMaxFreqMHz, parameterFFTBinHz, parameterSamples, lnaGain, vgaGain); + HackRFSweepNativeBridge.start(this, parameterMinFreqMHz, parameterMaxFreqMHz, parameterFFTBinHz, parameterSamples, lnaGain, vgaGain, parameterAntPower); fireHardwareStateChanged(false); if (forceStopSweep==false){ Thread.sleep(1000); diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/Version.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/Version.java index 1560c3f..261da9c 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/Version.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/Version.java @@ -2,6 +2,6 @@ public class Version { - public static final String version = "1.2"; + public static final String version = "1.3"; public static final String url = "https://github.com/pavsa/hackrf-spectrum-analyzer"; } diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/DatasetSpectrumPeak.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/DatasetSpectrumPeak.java index 0048cae..0768df2 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/DatasetSpectrumPeak.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/DatasetSpectrumPeak.java @@ -55,6 +55,15 @@ public void fillPeaksToXYSeries(XYSeries series) fillToXYSeriesPriv(series, spectrumPeakHold); } + public double calculateSpectrumPeakPower(){ + double powerSum = 0; + for (int i = 0; i < spectrumPeakHold.length; i++) { + powerSum += Math.pow(10, spectrumPeakHold[i]/10); /*convert dB to mW to sum power in linear form*/ + } + powerSum = 10*Math.log10(powerSum); /*convert back to dB*/ + return powerSum; + } + public void refreshPeakSpectrum() { long timeDiffFromPrevValueMillis = System.currentTimeMillis() - lastAdded; diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSettings.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSettings.java index 3647c6d..4e8c81a 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSettings.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSettings.java @@ -72,4 +72,7 @@ public static interface HackRFEventListener{ public void setSpectrumPaletteStart(int dB); public void setSpurRemoval(boolean enable); + + public void setAntennaPowerEnable(boolean enable); + public boolean getAntennaPowerEnable(); } diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSweepSettingsUI.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSweepSettingsUI.java index dbc8256..537c2fc 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSweepSettingsUI.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/HackRFSweepSettingsUI.java @@ -45,7 +45,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) int maxFreq = 7250; int freqStep = 1; - setLayout(new MigLayout("", "[123.00px,grow,leading]", "[][20px][][][20px][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]")); + setLayout(new MigLayout("", "[123.00px,grow,leading]", "[][20px][][][20px][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]")); JLabel lblNewLabel = new JLabel("Frequency start [MHz]"); lblNewLabel.setForeground(Color.WHITE); @@ -73,9 +73,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) spinnerFFTBinHz.setModel(new SpinnerListModel( new String[] { "1000", "2000", "5000", "10 000", "20 000", "50 000", "100 000", "200 000", "500 000", "1 000 000", "2 000 000", "5 000 000" })); add(spinnerFFTBinHz, "cell 0 7,growx"); - spinnerFFTBinHz.setValue("100 000"); ((ListEditor) spinnerFFTBinHz.getEditor()).getTextField().setHorizontalAlignment(JTextField.RIGHT); - spinnerFFTBinHz.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) @@ -83,6 +81,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) hackRFSettings.setFFTBin(Integer.parseInt(spinnerFFTBinHz.getValue().toString().replaceAll("\\s", ""))); } }); + spinnerFFTBinHz.setValue("100 000"); JLabel lblGain = new JLabel("Gain [dB]"); lblGain.setForeground(Color.WHITE); @@ -121,10 +120,23 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) ((ListEditor) spinner_numberOfSamples.getEditor()).getTextField().setEditable(false); ; add(spinner_numberOfSamples, "cell 0 13,growx"); + + JCheckBox chckbxAntennaPower = new JCheckBox("Antenna power"); + chckbxAntennaPower.setBackground(Color.BLACK); + chckbxAntennaPower.setForeground(Color.WHITE); + add(chckbxAntennaPower, "cell 0 15"); + chckbxAntennaPower.setSelected(hackRFSettings.getAntennaPowerEnable()); + chckbxAntennaPower.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + hackRFSettings.setAntennaPowerEnable(chckbxAntennaPower.isSelected()); + } + }); + JLabel lblWaterfallPaletteStart = new JLabel("Waterfall palette start [dB]"); lblWaterfallPaletteStart.setForeground(Color.WHITE); - add(lblWaterfallPaletteStart, "cell 0 15"); + add(lblWaterfallPaletteStart, "cell 0 18"); JSlider slider_waterfallPaletteStart = new JSlider(); slider_waterfallPaletteStart.setForeground(Color.WHITE); @@ -132,7 +144,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) slider_waterfallPaletteStart.setMinimum(-100); slider_waterfallPaletteStart.setMaximum(0); slider_waterfallPaletteStart.setValue(-30); - add(slider_waterfallPaletteStart, "cell 0 16,growx"); + add(slider_waterfallPaletteStart, "cell 0 19,growx"); slider_waterfallPaletteStart.setValue(hackRFSettings.getSpectrumPaletteStart()); slider_waterfallPaletteStart.addChangeListener(new ChangeListener() { @@ -153,12 +165,12 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) JLabel lblWaterfallPaletteLength = new JLabel("Waterfall palette length [dB]"); lblWaterfallPaletteLength.setForeground(Color.WHITE); - add(lblWaterfallPaletteLength, "cell 0 18"); + add(lblWaterfallPaletteLength, "cell 0 21"); JSlider slider_waterfallPaletteSize = new JSlider(HackRFSweepSpectrumAnalyzer.SPECTRUM_PALETTE_SIZE_MIN, 100); slider_waterfallPaletteSize.setBackground(Color.BLACK); slider_waterfallPaletteSize.setForeground(Color.WHITE); - add(slider_waterfallPaletteSize, "cell 0 19,growx"); + add(slider_waterfallPaletteSize, "cell 0 22,growx"); slider_waterfallPaletteSize.setValue(hackRFSettings.getSpectrumPaletteSize()); @@ -181,23 +193,23 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) JCheckBox chckbxShowPeaks = new JCheckBox("Show peaks"); chckbxShowPeaks.setForeground(Color.WHITE); chckbxShowPeaks.setBackground(Color.BLACK); - add(chckbxShowPeaks, "cell 0 21,growx"); + add(chckbxShowPeaks, "cell 0 24,growx"); JCheckBox chckbxRemoveSpurs = new JCheckBox("Spur filter (may distort real signals)"); chckbxRemoveSpurs.setForeground(Color.WHITE); chckbxRemoveSpurs.setBackground(Color.BLACK); - add(chckbxRemoveSpurs, "cell 0 23"); + add(chckbxRemoveSpurs, "cell 0 26"); txtHackrfConnected = new JTextField(); txtHackrfConnected.setText("HackRF connected"); txtHackrfConnected.setForeground(Color.WHITE); txtHackrfConnected.setBackground(Color.BLACK); - add(txtHackrfConnected, "cell 0 26,growx"); + add(txtHackrfConnected, "cell 0 29,growx"); txtHackrfConnected.setColumns(10); txtHackrfConnected.setBorder(null); JButton btnPause = new JButton("Pause"); - add(btnPause, "cell 0 28,growx"); + add(btnPause, "cell 0 31,growx"); btnPause.setBackground(Color.black); JButton btnAbout = new JButton("Visit homepage"); @@ -218,9 +230,9 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) }); Label labelVersion = new Label("Version: v"+Version.version); - add(labelVersion, "flowx,cell 0 39"); + add(labelVersion, "flowx,cell 0 42"); btnAbout.setBackground(Color.BLACK); - add(btnAbout, "cell 0 39,alignx right"); + add(btnAbout, "cell 0 42,alignx right"); btnPause.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -240,7 +252,6 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings) } });; - JCheckBox chckbxFilterSpectrum = new JCheckBox("Filter spectrum"); chckbxFilterSpectrum.setBackground(Color.BLACK); chckbxFilterSpectrum.setForeground(Color.WHITE); diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/PowerCalibration.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/PowerCalibration.java new file mode 100644 index 0000000..3260b77 --- /dev/null +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/PowerCalibration.java @@ -0,0 +1,23 @@ +package jspectrumanalyzer.core; + +public class PowerCalibration +{ + public final double offset_dB; + public final double gain; + public PowerCalibration(double expectedPower_dBm, double measuredPower_dBm, double measuredAtGain) + { + offset_dB = expectedPower_dBm - measuredPower_dBm; + this.gain = measuredAtGain; + } + public double getOffset_dB(double gain){ + return offset_dB + (this.gain - gain); + } + + public static void correctPower(PowerCalibration cal, double gain, FFTBins bins){ +// bins.fftBinWidthHz + double offset = cal.getOffset_dB(gain); + for (int i = 0; i < bins.sigPowdBm.length; i++) { + bins.sigPowdBm[i] += offset; + } + } +} diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/WaterfallPlot.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/WaterfallPlot.java index 119533a..c630e5a 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/core/WaterfallPlot.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/core/WaterfallPlot.java @@ -54,6 +54,8 @@ public class WaterfallPlot extends JPanel private int screenWidth; private double spectrumPaletteSize = 65; private double spectrumPaletteStart = -90; + private String statusMessage = ""; + public WaterfallPlot(ChartPanel chartPanel, int maxHeight) { setPreferredSize(new Dimension(100, 200)); @@ -166,7 +168,7 @@ public synchronized void addNewData(DatasetSpectrum spectrum) g.draw(rect); } - renderingInfo = String.format("No. of FFT bins: %d%s / %.1ffps", size >= 10000 ? size / 1000 : size, size >= 10000 ? "k" : "", fps.getEma()); + renderingInfo = String.format("RBW %.1fkHz / FFT bins: %d%s / %.1ffps", lastSpectrum == null ? 0 : lastSpectrum.getFFTBinSizeHz()/1000d, size >= 10000 ? size / 1000 : size, size >= 10000 ? "k" : "", fps.getEma()); fpsRenderedFrames++; if (System.currentTimeMillis() - lastFPSRecalculated > 1000) { @@ -249,9 +251,17 @@ public double getSpectrumPaletteStart() }//finish marker g.setColor(Color.white); - g.drawString(renderingInfo, chartXOffset + w - 150, h - 20); + int x = chartXOffset + w - 250; + int y = h - 20; + g.drawString(renderingInfo, x, y-20); + g.drawString(statusMessage, x, y); } + public void setStatusMessage(String message) + { + this.statusMessage = message; + } + public void setDrawingOffsets(int xOffsetLeft, int width) { this.chartXOffset = xOffsetLeft; diff --git a/src/hackrf-sweep/src-java/jspectrumanalyzer/nativebridge/HackRFSweepNativeBridge.java b/src/hackrf-sweep/src-java/jspectrumanalyzer/nativebridge/HackRFSweepNativeBridge.java index f1b0231..07fed36 100644 --- a/src/hackrf-sweep/src-java/jspectrumanalyzer/nativebridge/HackRFSweepNativeBridge.java +++ b/src/hackrf-sweep/src-java/jspectrumanalyzer/nativebridge/HackRFSweepNativeBridge.java @@ -32,7 +32,7 @@ public class HackRFSweepNativeBridge } public static synchronized void start(HackRFSweepDataCallback dataCallback, int freq_min_MHz, int freq_max_MHz, int fft_bin_width, int num_samples, - int lna_gain, int vga_gain) + int lna_gain, int vga_gain, boolean antennaPowerEnable) { hackrf_sweep_lib_start__fft_power_callback_callback callback = new hackrf_sweep_lib_start__fft_power_callback_callback() { @@ -45,7 +45,7 @@ public static synchronized void start(HackRFSweepDataCallback dataCallback, int }; Native.setCallbackThreadInitializer(callback, new CallbackThreadInitializer(true)); - HackrfSweepLibrary.hackrf_sweep_lib_start(callback, freq_min_MHz, freq_max_MHz, fft_bin_width, num_samples, lna_gain, vga_gain); + HackrfSweepLibrary.hackrf_sweep_lib_start(callback, freq_min_MHz, freq_max_MHz, fft_bin_width, num_samples, lna_gain, vga_gain, antennaPowerEnable ? 1 : 0); } public static void stop()