Merge pull request #1177

* Fixes message filtering that was not being initialized.  Fixes minor spotted code issues
This commit is contained in:
Andrzej Pańkowski
2022-04-30 10:25:33 +02:00
committed by GitHub
parent 166383e1ed
commit 1152b13220
8 changed files with 27 additions and 47 deletions

View File

@@ -35,7 +35,7 @@ public class BinaryMessage extends BitSet
* Logical (ie constructed) size of this bitset, despite the actual size of * Logical (ie constructed) size of this bitset, despite the actual size of
* the super bitset that this class is based on * the super bitset that this class is based on
*/ */
private int mSize = 0; private int mSize;
/** /**
* Pointer to the next fill index location, when adding bits to this bitset * Pointer to the next fill index location, when adding bits to this bitset
@@ -43,21 +43,21 @@ public class BinaryMessage extends BitSet
*/ */
private int mPointer = 0; private int mPointer = 0;
/**
* Bitset that buffers bits added one at a time, up to the size of the this
* bitset.
*
* Note: the super class bitset behind this class may have a size larger
* that the size parameter specified.
* @param size
*/
/** /**
* Used for temporary storage of CRC check results when we're passing this * Used for temporary storage of CRC check results when we're passing this
* message to an EDAC function. * message to an EDAC function.
*/ */
private CRC mCRC; private CRC mCRC;
/**
* Constructs a bitset that buffers bits added one at a time, up to the size
* of the this bitset.
* <p>
* Note: the super class bitset behind this class may have a size larger
* that the size parameter specified.
*
* @param size of constructed bitset
*/
public BinaryMessage(int size) public BinaryMessage(int size)
{ {
super(size); super(size);
@@ -214,9 +214,7 @@ public class BinaryMessage extends BitSet
} }
/** /**
* Returns a (new) copy of this bitsetbuffer * @return a (new) copy of this binary message
*
* @return
*/ */
public BinaryMessage copy() public BinaryMessage copy()
{ {

View File

@@ -75,7 +75,7 @@ public class FilterEditorPanel<T> extends JPanel
List<IFilter<T>> filters = filterSet.getFilters(); List<IFilter<T>> filters = filterSet.getFilters();
/* sort the filters in alphabetical order by name */ /* sort the filters in alphabetical order by name */
filters.sort((Comparator<IFilter<?>>) (first, second) -> first.getName().compareTo(second.getName())); filters.sort(Comparator.comparing(IFilter::getName));
for(IFilter<T> filter : filters) for(IFilter<T> filter : filters)
{ {
@@ -98,7 +98,7 @@ public class FilterEditorPanel<T> extends JPanel
{ {
List<FilterElement<?>> elements = filter.getFilterElements(); List<FilterElement<?>> elements = filter.getFilterElements();
elements.sort(Comparator.comparing(FilterElement::toString)); elements.sort(Comparator.comparing(FilterElement::getName));
for(FilterElement<?> element : elements) for(FilterElement<?> element : elements)
{ {

View File

@@ -62,6 +62,11 @@ public class MessageActivityModel extends AbstractTableModel implements Listener
mMessageFilterSet = filterSet; mMessageFilterSet = filterSet;
} }
public void clearFilters()
{
mMessageFilterSet = new FilterSet<>(new AllPassFilter<>());
}
/** /**
* Clears all messages from history * Clears all messages from history
*/ */
@@ -203,4 +208,4 @@ public class MessageActivityModel extends AbstractTableModel implements Listener
return null; return null;
} }
} }

View File

@@ -26,6 +26,7 @@ import io.github.dsheirer.filter.FilterSet;
import io.github.dsheirer.message.IMessage; import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.message.MessageHistory; import io.github.dsheirer.message.MessageHistory;
import io.github.dsheirer.module.ProcessingChain; import io.github.dsheirer.module.ProcessingChain;
import io.github.dsheirer.module.decode.DecoderFactory;
import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.preference.swing.JTableColumnWidthMonitor; import io.github.dsheirer.preference.swing.JTableColumnWidthMonitor;
import io.github.dsheirer.sample.Listener; import io.github.dsheirer.sample.Listener;
@@ -91,6 +92,7 @@ public class MessageActivityPanel extends JPanel implements Listener<ProcessingC
if(processingChain != null) if(processingChain != null)
{ {
mCurrentMessageHistory = processingChain.getMessageHistory(); mCurrentMessageHistory = processingChain.getMessageHistory();
mMessageModel.setFilters(DecoderFactory.getMessageFilters(processingChain.getModules()));
mMessageModel.clearAndSet(mCurrentMessageHistory.getItems()); mMessageModel.clearAndSet(mCurrentMessageHistory.getItems());
mCurrentMessageHistory.addListener(mMessageModel); mCurrentMessageHistory.addListener(mMessageModel);
mManagementPanel.enableButtons(); mManagementPanel.enableButtons();
@@ -98,6 +100,7 @@ public class MessageActivityPanel extends JPanel implements Listener<ProcessingC
else else
{ {
mCurrentMessageHistory = null; mCurrentMessageHistory = null;
mMessageModel.clearFilters();
mMessageModel.clear(); mMessageModel.clear();
mManagementPanel.disableButtons(); mManagementPanel.disableButtons();
} }

View File

@@ -1,25 +0,0 @@
/*******************************************************************************
* sdr-trunk
* 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.module.decode.mpt1327;
/**
* MPT-1327 Ident Value Types
*/
public enum MPT1327IdentType
{
}

View File

@@ -105,7 +105,7 @@ public class WaveWriter implements AutoCloseable
*/ */
public WaveWriter(AudioFormat format, Path file) throws IOException public WaveWriter(AudioFormat format, Path file) throws IOException
{ {
this(format, file, Integer.MAX_VALUE * 2); this(format, file, 0);
} }
/** /**

View File

@@ -25,17 +25,17 @@ import java.nio.ByteBuffer;
public interface IByteBufferProvider public interface IByteBufferProvider
{ {
/** /**
* Adds the listener to receive complex buffer samples * Adds the listener to receive byte buffer samples
*/ */
void setBufferListener(Listener<ByteBuffer> listener); void setBufferListener(Listener<ByteBuffer> listener);
/** /**
* Removes the listener from receiving complex buffer samples * Removes the listener from receiving byte buffer samples
*/ */
void removeBufferListener(Listener<ByteBuffer> listener); void removeBufferListener(Listener<ByteBuffer> listener);
/** /**
* Indicates if there are any complex buffer listeners registered * Indicates if there are any byte buffer listeners registered
*/ */
boolean hasBufferListeners(); boolean hasBufferListeners();
} }

View File

@@ -8,7 +8,6 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import static io.github.dsheirer.service.radioreference.RadioReference.CheckExpDate; import static io.github.dsheirer.service.radioreference.RadioReference.CheckExpDate;
import static org.junit.Assert.*;
public class RadioReferenceTest public class RadioReferenceTest
{ {
@@ -51,4 +50,4 @@ public class RadioReferenceTest
Assertions.assertEquals(RadioReference.LoginStatus.VALID_PREMIUM, CheckExpDate("Not a date")); Assertions.assertEquals(RadioReference.LoginStatus.VALID_PREMIUM, CheckExpDate("Not a date"));
} }
} }