Automatic Frequency Control enhancement. Provides default AFC and ability to disable in the Decoder tab of each channel. Spectral display includes visual indicators of frequency center (grey) and current AFC offset (yellow).

This commit is contained in:
dennis.sheirer
2014-09-11 22:46:05 +00:00
parent 4e0fd9b7b0
commit 0f43c7ed22
23 changed files with 546 additions and 119 deletions

View File

@@ -43,6 +43,7 @@ public class MPT1327ChannelState extends ChannelState
private ChannelMap mChannelMap;
private MPT1327ActivitySummary mActivitySummary;
public MPT1327ChannelState( ProcessingChain processingChain,
AliasList aliasList,
ChannelMap channelMap )
@@ -156,72 +157,72 @@ public class MPT1327ChannelState extends ChannelState
setState( State.CONTROL );
break;
case GTC:
int channelNumber = mpt.getChannel();
if( !getProcessingChain().getChannel()
.hasTrafficChannel( channelNumber ) )
if( mpt.isValidCall() )
{
String aliasListName = mProcessingChain
.getChannel().getAliasListName();
int channelNumber = mpt.getChannel();
Channel traffic = getTrafficChannel( channelNumber,
aliasListName );
/* Set the system and site to same as control channel */
traffic.setSystem( getProcessingChain().getChannel()
.getSystem(), false );
traffic.setSite( getProcessingChain().getChannel()
.getSite(), false );
if( !getProcessingChain().getChannel()
.hasTrafficChannel( channelNumber ) )
{
String aliasListName = mProcessingChain
.getChannel().getAliasListName();
Channel traffic = getTrafficChannel( channelNumber,
aliasListName );
/* Set the system and site to same as control channel */
traffic.setSystem( getProcessingChain().getChannel()
.getSystem(), false );
traffic.setSite( getProcessingChain().getChannel()
.getSite(), false );
/* Add the traffic channel to the parent control channel */
getProcessingChain().getChannel()
.addTrafficChannel( channelNumber, traffic );
/* Add the traffic channel to the parent control channel */
getProcessingChain().getChannel()
.addTrafficChannel( channelNumber, traffic );
/* Start the traffic channel */
traffic.setEnabled( true );
/* Set traffic channel state info */
MPT1327ChannelState trafficState =
(MPT1327ChannelState)traffic
.getProcessingChain().getChannelState();
MPT1327ChannelState controlState =
(MPT1327ChannelState)getProcessingChain()
.getChannelState();
trafficState.setChannelMap( controlState.getChannelMap() );
trafficState.setChannelNumber( channelNumber );
trafficState.setFromTalkgroup( mpt.getFromID() );
trafficState.setToTalkgroup( mpt.getToID() );
/* Start the traffic channel */
traffic.setEnabled( true );
/* Set traffic channel state info */
MPT1327ChannelState trafficState =
(MPT1327ChannelState)traffic
.getProcessingChain().getChannelState();
MPT1327ChannelState controlState =
(MPT1327ChannelState)getProcessingChain()
.getChannelState();
trafficState.setChannelMap( controlState.getChannelMap() );
trafficState.setChannelNumber( channelNumber );
trafficState.setFromTalkgroup( mpt.getFromID() );
trafficState.setToTalkgroup( mpt.getToID() );
/* Add this control channel as message listener on the
* traffic channel so we can receive call tear-down
* messages */
traffic.addListener( (Listener<Message>)this );
CallEventType type = traffic.isProcessing() ?
CallEventType.CALL_START :
CallEventType.CALL_START_NO_TUNER;
/*
* Set the traffic channel's call event model to
* share the control channel's call event model
*/
traffic.getProcessingChain().getChannelState()
.setCallEventModel( mCallEventModel );
mCallEventModel.add(
new MPT1327CallEvent.Builder( type )
.aliasList( traffic.getProcessingChain().getAliasList() )
.channel( channelNumber )
.frequency( mChannelMap.getFrequency( channelNumber ) )
.from( mpt.getFromID() )
.to( mpt.getToID() )
.build() );
/* Add this control channel as message listener on the
* traffic channel so we can receive call tear-down
* messages */
traffic.addListener( (Listener<Message>)this );
CallEventType type = traffic.isProcessing() ?
CallEventType.CALL_START :
CallEventType.CALL_START_NO_TUNER;
/*
* Set the traffic channel's call event model to
* share the control channel's call event model
*/
traffic.getProcessingChain().getChannelState()
.setCallEventModel( mCallEventModel );
mCallEventModel.add(
new MPT1327CallEvent.Builder( type )
.aliasList( traffic.getProcessingChain().getAliasList() )
.channel( channelNumber )
.frequency( mChannelMap.getFrequency( channelNumber ) )
.from( mpt.getFromID() )
.to( mpt.getToID() )
.build() );
}
}
long frequency = mChannelMap.getFrequency( channelNumber );
break;
case CLEAR:
case MAINT:
@@ -237,7 +238,7 @@ public class MPT1327ChannelState extends ChannelState
mCallEventModel.add(
new MPT1327CallEvent.Builder( CallEventType.SDM )
.aliasList( mAliasList )
.details( mpt.getMessageType().getDescription() )
.details( mpt.getMessage() )
.from( mpt.getFromID() )
.to( mpt.getToID() )
.build() );
@@ -378,6 +379,7 @@ public class MPT1327ChannelState extends ChannelState
traffic.setSourceConfiguration( source );
DecodeConfigMPT1327 decode = new DecodeConfigMPT1327();
traffic.setDecodeConfiguration( decode );
traffic.setAliasListName( aliasListName );

View File

@@ -25,13 +25,16 @@ import instrument.tap.stream.FloatTap;
import java.util.ArrayList;
import java.util.List;
import log.Log;
import sample.Broadcaster;
import sample.Listener;
import source.Source.SampleType;
import alias.AliasList;
import bits.MessageFramer;
import bits.SyncPattern;
import decode.Decoder;
import decode.DecoderType;
import dsp.afc.AutomaticFrequencyControl;
import dsp.filter.DCRemovalFilter;
import dsp.filter.FilterFactory;
import dsp.filter.Filters;
@@ -95,7 +98,7 @@ public class MPT1327Decoder extends Decoder implements Instrumentable
/* I/Q low pass filtering narrow band FM demodulator */
mNBFMDemodulator = new NBFMDemodulator(
FilterFactory.getLowPass( 48000, 4000, 73, WindowType.HAMMING ),
1.0002 );
1.0002, true );
this.addComplexListener( mNBFMDemodulator );
@@ -166,6 +169,15 @@ public class MPT1327Decoder extends Decoder implements Instrumentable
mControlMessageFramer.addMessageListener( mMessageProcessor );
mTrafficMessageFramer.addMessageListener( mMessageProcessor );
}
@Override
public void addUnfilteredFloatListener( Listener<Float> listener )
{
if( mNBFMDemodulator != null )
{
mNBFMDemodulator.addListener( listener );
}
}
@Override
public DecoderType getType()

View File

@@ -281,6 +281,13 @@ public class MPT1327Message extends Message
return mCRC[ 0 ] == CRC.PASSED ||
mCRC[ 0 ] == CRC.CORRECTED;
}
public boolean isValidCall()
{
return getPrefix() != 0 &&
getIdent1() != 0 &&
getIdent2() != 0;
}
/**
* Constructs a decoded message string
@@ -312,9 +319,9 @@ public class MPT1327Message extends Message
*/
public MPTMessageType getMessageType()
{
int type = mMessage.getInt( B1_MESSAGE_TYPE );
int value = mMessage.getInt( B1_MESSAGE_TYPE );
return MPTMessageType.fromNumber( type );
return MPTMessageType.fromNumber( value );
}
/**
@@ -766,6 +773,7 @@ public class MPT1327Message extends Message
case HEAD_PLUS2:
case HEAD_PLUS3:
case HEAD_PLUS4:
sb.append( " " );
sb.append( getSDM() );
break;
}
@@ -947,9 +955,12 @@ public class MPT1327Message extends Message
break;
case USER:
default:
sb.append( format( prefix, 3 ) );
sb.append( "-" );
sb.append( format( ident, 4) );
if( prefix != 0 || ident != 0 )
{
sb.append( format( prefix, 3 ) );
sb.append( "-" );
sb.append( format( ident, 4) );
}
break;
}
@@ -1701,7 +1712,7 @@ public class MPT1327Message extends Message
public enum Descriptor
{
DESC0( "EXTENDED ADDRESSING INFORMATION",
"SERIAL NUMBER",
"ESN",
"SINGLE SEGMENT TRANSACTIONS (SST) ONLY" ),
DESC1( "PSTN DIALED DIGITS", "RESERVED", "N/A" ),
DESC2( "PABX EXTENSION", "RESERVED", "N/A" ),