MPT1327 - adds sync pattern for French variant of MPT1327. Channel decode configuration editor now contains a combo box that allows selection of normal or French variant.

This commit is contained in:
dennis.sheirer
2014-08-04 00:06:00 +00:00
parent 44faeb9351
commit 63de9c6d7d
6 changed files with 108 additions and 9 deletions

View File

@@ -79,7 +79,11 @@ public class DecoderFactory
ltrNetConfig.getMessageDirection() );
break;
case MPT1327:
retVal = new MPT1327Decoder( sampleType, aliasList );
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327)config;
retVal = new MPT1327Decoder( sampleType, aliasList,
mptConfig.getSync() );
break;
case PASSPORT:
retVal = new PassportDecoder( sampleType, aliasList );

View File

@@ -17,13 +17,16 @@
******************************************************************************/
package decode.config;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import decode.DecoderType;
import decode.mpt1327.MPT1327Decoder.Sync;
public class DecodeConfigMPT1327 extends DecodeConfiguration
{
private String mChannelMapName;
private Sync mSync = Sync.NORMAL;
public DecodeConfigMPT1327()
{
@@ -40,4 +43,15 @@ public class DecodeConfigMPT1327 extends DecodeConfiguration
{
mChannelMapName = name;
}
@XmlAttribute( name="sync" )
public Sync getSync()
{
return mSync;
}
public void setSync( Sync sync )
{
mSync = sync;
}
}

View File

@@ -82,7 +82,9 @@ public class MPT1327Decoder extends Decoder implements Instrumentable
private MessageFramer mTrafficMessageFramer;
private MPT1327MessageProcessor mMessageProcessor;
public MPT1327Decoder( SampleType sampleType, AliasList aliasList )
public MPT1327Decoder( SampleType sampleType,
AliasList aliasList,
Sync sync )
{
super( sampleType );
@@ -134,13 +136,13 @@ public class MPT1327Decoder extends Decoder implements Instrumentable
/* Message framer for control channel messages */
mControlMessageFramer =
new MessageFramer( SyncPattern.MPT1327_CONTROL.getPattern(),
new MessageFramer( sync.getControlSyncPattern().getPattern(),
sMESSAGE_LENGTH );
mSymbolBroadcaster.addListener( mControlMessageFramer );
/* Message framer for traffic channel massages */
mTrafficMessageFramer =
new MessageFramer( SyncPattern.MPT1327_TRAFFIC.getPattern(),
new MessageFramer( sync.getTrafficSyncPattern().getPattern(),
sMESSAGE_LENGTH );
mSymbolBroadcaster.addListener( mTrafficMessageFramer );
@@ -280,4 +282,47 @@ public class MPT1327Decoder extends Decoder implements Instrumentable
break;
}
}
public enum Sync
{
NORMAL( "Normal",
SyncPattern.MPT1327_CONTROL,
SyncPattern.MPT1327_TRAFFIC ),
FRENCH( "French",
SyncPattern.MPT1327_CONTROL_FRENCH,
SyncPattern.MPT1327_TRAFFIC );
private String mLabel;
private SyncPattern mControlSyncPattern;
private SyncPattern mTrafficSyncPattern;
private Sync( String label,
SyncPattern controlPattern,
SyncPattern trafficPattern )
{
mLabel = label;
mControlSyncPattern = controlPattern;
mTrafficSyncPattern = trafficPattern;
}
public String getLabel()
{
return mLabel;
}
public SyncPattern getControlSyncPattern()
{
return mControlSyncPattern;
}
public SyncPattern getTrafficSyncPattern()
{
return mTrafficSyncPattern;
}
public String toString()
{
return getLabel();
}
}
}

View File

@@ -28,12 +28,14 @@ import controller.channel.ChannelNode;
import decode.DecodeEditor;
import decode.config.DecodeConfigMPT1327;
import decode.config.DecodeConfiguration;
import decode.mpt1327.MPT1327Decoder.Sync;
public class MPT1327Editor extends DecodeEditor
{
private static final long serialVersionUID = 1L;
private JComboBox<ChannelMap> mComboChannelMaps;
private JComboBox<Sync> mComboSync;
private ChannelNode mChannelNode;
public MPT1327Editor( DecodeConfiguration config, ChannelNode channelNode )
@@ -62,24 +64,41 @@ public class MPT1327Editor extends DecodeEditor
add( new JLabel( "Channel Map" ), "wrap" );
add( mComboChannelMaps, "wrap" );
mComboSync = new JComboBox<Sync>();
mComboSync.setModel( new DefaultComboBoxModel<Sync>( Sync.values() ) );
add( new JLabel( "Sync" ), "wrap" );
add( mComboSync, "wrap" );
reset();
}
@Override
public void save()
{
DecodeConfigMPT1327 config = (DecodeConfigMPT1327)mConfig;
ChannelMap selected = (ChannelMap)mComboChannelMaps.getSelectedItem();
if( selected != null )
{
((DecodeConfigMPT1327)mConfig).setChannelMapName( selected.getName() );
config.setChannelMapName( selected.getName() );
}
Sync selectedSync = (Sync)mComboSync.getSelectedItem();
if( selectedSync != null )
{
config.setSync( selectedSync );
}
}
@Override
public void reset()
{
String name = ((DecodeConfigMPT1327)mConfig).getChannelMapName();
DecodeConfigMPT1327 config = (DecodeConfigMPT1327)mConfig;
String name = config.getChannelMapName();
ChannelMap selected = null;
@@ -99,5 +118,7 @@ public class MPT1327Editor extends DecodeEditor
mComboChannelMaps.setSelectedItem( selected );
mComboChannelMaps.requestFocus();
mComboChannelMaps.requestFocusInWindow();
mComboSync.setSelectedItem( config.getSync() );
}
}