mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 17:17:29 -05:00
Compare commits
4 Commits
v0.4.0-bet
...
v0.4.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57f56d31a2 | ||
|
|
df25675d3f | ||
|
|
277a84702a | ||
|
|
c651296378 |
@@ -33,7 +33,7 @@ repositories {
|
|||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
|
|
||||||
version = '0.4.0-beta.7'
|
version = '0.4.0-beta.8'
|
||||||
sourceCompatibility = '13'
|
sourceCompatibility = '13'
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import io.github.dsheirer.gui.editor.EditorValidationException;
|
|||||||
import io.github.dsheirer.gui.editor.ValidatingEditor;
|
import io.github.dsheirer.gui.editor.ValidatingEditor;
|
||||||
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@@ -41,10 +43,13 @@ import javax.swing.event.ChangeListener;
|
|||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
|
public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(MPT1327DecoderEditor.class);
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JComboBox<ChannelMap> mComboChannelMaps;
|
private JComboBox<ChannelMap> mComboChannelMaps;
|
||||||
@@ -65,12 +70,17 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
|
|||||||
{
|
{
|
||||||
setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
|
setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
|
||||||
|
|
||||||
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
|
|
||||||
ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]);
|
|
||||||
|
|
||||||
mComboChannelMaps = new JComboBox<ChannelMap>();
|
mComboChannelMaps = new JComboBox<ChannelMap>();
|
||||||
mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
|
refreshChannelMaps();
|
||||||
mComboChannelMaps.setEnabled(false);
|
mComboChannelMaps.setEnabled(false);
|
||||||
|
mComboChannelMaps.addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
setModified(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
add(new JLabel("Channel Map:"));
|
add(new JLabel("Channel Map:"));
|
||||||
add(mComboChannelMaps);
|
add(mComboChannelMaps);
|
||||||
|
|
||||||
@@ -80,8 +90,17 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
final ChannelMapManagerFrame manager =
|
final ChannelMapManagerFrame manager = new ChannelMapManagerFrame(mChannelMapModel);
|
||||||
new ChannelMapManagerFrame(mChannelMapModel);
|
manager.addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosed(WindowEvent e)
|
||||||
|
{
|
||||||
|
super.windowClosed(e);
|
||||||
|
mLog.debug("Refreshing channel maps combo box");
|
||||||
|
refreshChannelMaps();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
@@ -139,6 +158,22 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
|
|||||||
add(mCallTimeout);
|
add(mCallTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshChannelMaps()
|
||||||
|
{
|
||||||
|
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
|
||||||
|
|
||||||
|
ChannelMap[] mapArray = new ChannelMap[maps.size() + 1];
|
||||||
|
|
||||||
|
int index = 1;
|
||||||
|
|
||||||
|
for(ChannelMap channelMap: maps)
|
||||||
|
{
|
||||||
|
mapArray[index++] = channelMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -280,7 +280,13 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void start()
|
public void start()
|
||||||
{
|
{
|
||||||
|
//Send call start event for traffic channels to unsquelch the audio. Decoded return to channel message
|
||||||
|
//or fade timeout expire will end the call event.
|
||||||
|
if(mChannelType == ChannelType.TRAFFIC)
|
||||||
|
{
|
||||||
|
//Broadcast a start call event so the squelch kicks on and the audio path opens
|
||||||
|
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -190,8 +190,9 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
*/
|
*/
|
||||||
private void processMetadata(IAudioWithMetadata audioWithMetadata)
|
private void processMetadata(IAudioWithMetadata audioWithMetadata)
|
||||||
{
|
{
|
||||||
if(audioWithMetadata.hasMetadata() && mIdentifierUpdateNotificationListener != null)
|
if(audioWithMetadata.hasMetadata())
|
||||||
{
|
{
|
||||||
|
//JMBE only places 1 entry in the map, but for consistency we'll process the map entry set
|
||||||
for(Map.Entry<String,String> entry: audioWithMetadata.getMetadata().entrySet())
|
for(Map.Entry<String,String> entry: audioWithMetadata.getMetadata().entrySet())
|
||||||
{
|
{
|
||||||
//Each metadata map entry contains a tone-type (key) and tone (value)
|
//Each metadata map entry contains a tone-type (key) and tone (value)
|
||||||
@@ -203,6 +204,10 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToneMetadataProcessor.closeMetadata();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -243,6 +248,7 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
public class ToneMetadataProcessor
|
public class ToneMetadataProcessor
|
||||||
{
|
{
|
||||||
private List<ToneMetadata> mToneMetadata = new ArrayList<>();
|
private List<ToneMetadata> mToneMetadata = new ArrayList<>();
|
||||||
|
private ToneMetadata mCurrentToneMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets or clears any accumulated call tone metadata to prepare for the next call.
|
* Resets or clears any accumulated call tone metadata to prepare for the next call.
|
||||||
@@ -265,18 +271,27 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToneMetadata toneMetadata = (mToneMetadata.size() > 0 ? mToneMetadata.get(mToneMetadata.size() - 1) : null);
|
if(mCurrentToneMetadata != null && mCurrentToneMetadata.matches(type, value))
|
||||||
|
|
||||||
if(toneMetadata == null || !toneMetadata.matches(type, value))
|
|
||||||
{
|
{
|
||||||
toneMetadata = new ToneMetadata(type, value);
|
mCurrentToneMetadata.incrementCount();
|
||||||
mToneMetadata.add(toneMetadata);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurrentToneMetadata = new ToneMetadata(type, value);
|
||||||
|
mToneMetadata.add(mCurrentToneMetadata);
|
||||||
|
mCurrentToneMetadata.incrementCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
toneMetadata.incrementCount();
|
|
||||||
|
|
||||||
return P25ToneIdentifier.create(Joiner.on(",").join(mToneMetadata));
|
return P25ToneIdentifier.create(Joiner.on(",").join(mToneMetadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes current tone metadata when there is no metadata for the current audio frame.
|
||||||
|
*/
|
||||||
|
public void closeMetadata()
|
||||||
|
{
|
||||||
|
mCurrentToneMetadata = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user