Compare commits

..

4 Commits

Author SHA1 Message Date
Denny Sheirer
57f56d31a2 #713 Update Version 0.4.0 Beta 8 (#714)
Co-authored-by: Denny <denny@denny-desktop>
2020-03-28 12:06:23 -04:00
Denny Sheirer
df25675d3f Resolves #707 separate DTMF tones of the same value get merged together (#712)
Co-authored-by: Denny <denny@denny-desktop>
2020-03-28 12:03:47 -04:00
Denny Sheirer
277a84702a Resolves #580 channel map selection and editing (#711)
Co-authored-by: Denny <denny@denny-desktop>
2020-03-28 11:52:39 -04:00
Denny Sheirer
c651296378 Resolves #709 MPT1327 no audio on traffic channels. (#710)
Co-authored-by: Denny <denny@denny-desktop>
2020-03-28 11:33:15 -04:00
4 changed files with 72 additions and 16 deletions

View File

@@ -33,7 +33,7 @@ repositories {
maven { url "https://jitpack.io" }
}
version = '0.4.0-beta.7'
version = '0.4.0-beta.8'
sourceCompatibility = '13'
sourceSets {

View File

@@ -30,6 +30,8 @@ import io.github.dsheirer.gui.editor.EditorValidationException;
import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
@@ -41,10 +43,13 @@ import javax.swing.event.ChangeListener;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
{
private final static Logger mLog = LoggerFactory.getLogger(MPT1327DecoderEditor.class);
private static final long serialVersionUID = 1L;
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]", ""));
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]);
mComboChannelMaps = new JComboBox<ChannelMap>();
mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
refreshChannelMaps();
mComboChannelMaps.setEnabled(false);
mComboChannelMaps.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
setModified(true);
}
});
add(new JLabel("Channel Map:"));
add(mComboChannelMaps);
@@ -80,8 +90,17 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
@Override
public void actionPerformed(ActionEvent e)
{
final ChannelMapManagerFrame manager =
new ChannelMapManagerFrame(mChannelMapModel);
final ChannelMapManagerFrame manager = 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()
{
@@ -139,6 +158,22 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
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
public void save()
{

View File

@@ -280,7 +280,13 @@ public class MPT1327DecoderState extends DecoderState
@Override
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

View File

@@ -190,8 +190,9 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
*/
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())
{
//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
{
private List<ToneMetadata> mToneMetadata = new ArrayList<>();
private ToneMetadata mCurrentToneMetadata;
/**
* 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;
}
ToneMetadata toneMetadata = (mToneMetadata.size() > 0 ? mToneMetadata.get(mToneMetadata.size() - 1) : null);
if(toneMetadata == null || !toneMetadata.matches(type, value))
if(mCurrentToneMetadata != null && mCurrentToneMetadata.matches(type, value))
{
toneMetadata = new ToneMetadata(type, value);
mToneMetadata.add(toneMetadata);
mCurrentToneMetadata.incrementCount();
}
else
{
mCurrentToneMetadata = new ToneMetadata(type, value);
mToneMetadata.add(mCurrentToneMetadata);
mCurrentToneMetadata.incrementCount();
}
toneMetadata.incrementCount();
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;
}
}
/**