mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-15 10:07:26 -05:00
wip #34 - testing and validating changes and testing decoding.
This commit is contained in:
@@ -173,6 +173,8 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
|||||||
{
|
{
|
||||||
if( hasItem() )
|
if( hasItem() )
|
||||||
{
|
{
|
||||||
|
save();
|
||||||
|
|
||||||
mChannelEnableRequested = true;
|
mChannelEnableRequested = true;
|
||||||
mChannelModel.broadcast( new ChannelEvent( getItem(), Event.REQUEST_ENABLE ) );
|
mChannelModel.broadcast( new ChannelEvent( getItem(), Event.REQUEST_ENABLE ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
if( !mProcessingChains.containsKey( channel.getChannelID() ) ||
|
if( !mProcessingChains.containsKey( channel.getChannelID() ) ||
|
||||||
!mProcessingChains.get( channel.getChannelID() ).isProcessing() )
|
!mProcessingChains.get( channel.getChannelID() ).isProcessing() )
|
||||||
{
|
{
|
||||||
startProcessing( channel );
|
startProcessing( event );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REQUEST_DISABLE:
|
case REQUEST_DISABLE:
|
||||||
@@ -141,7 +141,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
if( isProcessing( channel ) )
|
if( isProcessing( channel ) )
|
||||||
{
|
{
|
||||||
stopProcessing( channel, false );
|
stopProcessing( channel, false );
|
||||||
startProcessing( channel );
|
startProcessing( event );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -149,8 +149,10 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startProcessing( Channel channel )
|
private void startProcessing( ChannelEvent event )
|
||||||
{
|
{
|
||||||
|
Channel channel = event.getChannel();
|
||||||
|
|
||||||
ProcessingChain processingChain = mProcessingChains.get( channel.getChannelID() );
|
ProcessingChain processingChain = mProcessingChains.get( channel.getChannelID() );
|
||||||
|
|
||||||
//If we're already processing, ignore the request
|
//If we're already processing, ignore the request
|
||||||
@@ -256,8 +258,17 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
processingChain.setSource( source );
|
processingChain.setSource( source );
|
||||||
|
|
||||||
processingChain.start();
|
if( event instanceof TrafficChannelEvent )
|
||||||
|
{
|
||||||
|
TrafficChannelEvent trafficChannelEvent = (TrafficChannelEvent)event;
|
||||||
|
|
||||||
|
processingChain.getChannelState().configureAsTrafficChannel(
|
||||||
|
trafficChannelEvent.getTrafficChannelManager(),
|
||||||
|
trafficChannelEvent.getCallEvent() );
|
||||||
|
}
|
||||||
|
|
||||||
|
processingChain.start();
|
||||||
|
|
||||||
channel.setEnabled( true );
|
channel.setEnabled( true );
|
||||||
|
|
||||||
mProcessingChains.put( channel.getChannelID(), processingChain );
|
mProcessingChains.put( channel.getChannelID(), processingChain );
|
||||||
@@ -276,8 +287,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
chain.stop();
|
chain.stop();
|
||||||
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel,
|
mChannelModel.broadcast( new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_STOP ) );
|
||||||
Event.NOTIFICATION_PROCESSING_STOP ) );
|
|
||||||
|
|
||||||
if( remove )
|
if( remove )
|
||||||
{
|
{
|
||||||
|
|||||||
34
src/controller/channel/TrafficChannelEvent.java
Normal file
34
src/controller/channel/TrafficChannelEvent.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package controller.channel;
|
||||||
|
|
||||||
|
import module.decode.event.CallEvent;
|
||||||
|
import module.decode.state.TrafficChannelManager;
|
||||||
|
|
||||||
|
public class TrafficChannelEvent extends ChannelEvent
|
||||||
|
{
|
||||||
|
private TrafficChannelManager mTrafficChannelManager;
|
||||||
|
private CallEvent mCallEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call event with traffic channel manager for call back, and original creation event.
|
||||||
|
*/
|
||||||
|
public TrafficChannelEvent( TrafficChannelManager trafficChannelManager,
|
||||||
|
Channel channel,
|
||||||
|
Event event,
|
||||||
|
CallEvent callEvent )
|
||||||
|
{
|
||||||
|
super( channel, event );
|
||||||
|
|
||||||
|
mTrafficChannelManager = trafficChannelManager;
|
||||||
|
mCallEvent = callEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrafficChannelManager getTrafficChannelManager()
|
||||||
|
{
|
||||||
|
return mTrafficChannelManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CallEvent getCallEvent()
|
||||||
|
{
|
||||||
|
return mCallEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,7 +69,6 @@ import audio.squelch.ISquelchStateListener;
|
|||||||
import audio.squelch.ISquelchStateProvider;
|
import audio.squelch.ISquelchStateProvider;
|
||||||
import audio.squelch.SquelchState;
|
import audio.squelch.SquelchState;
|
||||||
import controller.NamingThreadFactory;
|
import controller.NamingThreadFactory;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
import controller.channel.IChannelEventListener;
|
import controller.channel.IChannelEventListener;
|
||||||
@@ -95,8 +94,7 @@ import controller.channel.IChannelEventProvider;
|
|||||||
*/
|
*/
|
||||||
public class ProcessingChain implements IChannelEventListener
|
public class ProcessingChain implements IChannelEventListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger( ProcessingChain.class );
|
||||||
LoggerFactory.getLogger( ProcessingChain.class );
|
|
||||||
|
|
||||||
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
|
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
|
||||||
private Broadcaster<Metadata> mMetadataBroadcaster = new Broadcaster<>();
|
private Broadcaster<Metadata> mMetadataBroadcaster = new Broadcaster<>();
|
||||||
@@ -177,6 +175,11 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
mMessageBroadcaster.dispose();
|
mMessageBroadcaster.dispose();
|
||||||
mFilteredRealBufferBroadcaster.dispose();
|
mFilteredRealBufferBroadcaster.dispose();
|
||||||
mSquelchStateBroadcaster.dispose();
|
mSquelchStateBroadcaster.dispose();
|
||||||
|
|
||||||
|
if( mScheduledExecutorService != null )
|
||||||
|
{
|
||||||
|
mScheduledExecutorService.shutdownNow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -356,7 +359,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
|
|
||||||
if( module instanceof IUnFilteredRealBufferListener )
|
if( module instanceof IUnFilteredRealBufferListener )
|
||||||
{
|
{
|
||||||
mFilteredRealBufferBroadcaster.addListener(
|
mUnFilteredRealBufferBroadcaster.addListener(
|
||||||
((IUnFilteredRealBufferListener)module).getUnFilteredRealBufferListener() );
|
((IUnFilteredRealBufferListener)module).getUnFilteredRealBufferListener() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,8 +481,11 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mScheduledExecutorService = Executors.newScheduledThreadPool(
|
if( mScheduledExecutorService == null )
|
||||||
1, new NamingThreadFactory( "channel " + mName ) );
|
{
|
||||||
|
mScheduledExecutorService = Executors.newScheduledThreadPool(
|
||||||
|
1, new NamingThreadFactory( "channel " + mName ) );
|
||||||
|
}
|
||||||
|
|
||||||
/* Start each of the modules */
|
/* Start each of the modules */
|
||||||
for( Module module: mModules )
|
for( Module module: mModules )
|
||||||
@@ -493,6 +499,8 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
mLog.error( "Error starting module", e );
|
mLog.error( "Error starting module", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSource.start( mScheduledExecutorService );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -511,6 +519,8 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
if( mSource != null )
|
if( mSource != null )
|
||||||
{
|
{
|
||||||
|
mSource.stop();
|
||||||
|
|
||||||
switch( mSource.getSampleType() )
|
switch( mSource.getSampleType() )
|
||||||
{
|
{
|
||||||
case COMPLEX:
|
case COMPLEX:
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ import module.decode.p25.reference.LinkControlOpcode;
|
|||||||
import module.decode.p25.reference.Response;
|
import module.decode.p25.reference.Response;
|
||||||
import module.decode.p25.reference.Service;
|
import module.decode.p25.reference.Service;
|
||||||
import module.decode.p25.reference.Vendor;
|
import module.decode.p25.reference.Vendor;
|
||||||
|
import module.decode.state.ChangeChannelTimeoutEvent;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderState;
|
import module.decode.state.DecoderState;
|
||||||
import module.decode.state.DecoderStateEvent;
|
import module.decode.state.DecoderStateEvent;
|
||||||
@@ -207,6 +208,10 @@ public class P25DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start( ScheduledExecutorService executor )
|
||||||
{
|
{
|
||||||
|
if( mChannelType == ChannelType.TRAFFIC )
|
||||||
|
{
|
||||||
|
broadcast( new ChangeChannelTimeoutEvent( this, ChannelType.TRAFFIC, 1000 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2819,8 +2824,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
broadcast( event );
|
broadcast( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast( new TrafficChannelAllocationEvent( this,
|
broadcast( new TrafficChannelAllocationEvent( this, mChannelCallMap.get( channel ) ) );
|
||||||
mChannelCallMap.get( channel ) ) );
|
|
||||||
|
|
||||||
if( gvcgu.hasChannelNumber2() )
|
if( gvcgu.hasChannelNumber2() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,30 +21,27 @@ import java.util.concurrent.RejectedExecutionException;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
import module.Module;
|
||||||
|
import module.decode.config.DecodeConfiguration;
|
||||||
|
import module.decode.event.CallEvent;
|
||||||
|
import module.decode.event.ICallEventProvider;
|
||||||
|
import module.decode.state.DecoderStateEvent.Event;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sample.Listener;
|
||||||
import audio.metadata.IMetadataProvider;
|
import audio.metadata.IMetadataProvider;
|
||||||
import audio.metadata.Metadata;
|
import audio.metadata.Metadata;
|
||||||
import audio.metadata.MetadataReset;
|
import audio.metadata.MetadataReset;
|
||||||
import audio.metadata.MetadataType;
|
import audio.metadata.MetadataType;
|
||||||
import audio.squelch.ISquelchStateProvider;
|
import audio.squelch.ISquelchStateProvider;
|
||||||
import audio.squelch.SquelchState;
|
import audio.squelch.SquelchState;
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.ThreadPoolManager.ThreadType;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import module.Module;
|
|
||||||
import module.decode.config.DecodeConfiguration;
|
|
||||||
import module.decode.event.CallEvent;
|
|
||||||
import module.decode.event.ICallEventProvider;
|
|
||||||
import module.decode.state.DecoderStateEvent.Event;
|
|
||||||
import sample.Listener;
|
|
||||||
|
|
||||||
public class ChannelState extends Module implements ICallEventProvider,
|
public class ChannelState extends Module implements ICallEventProvider, IChangedAttributeProvider,
|
||||||
IChangedAttributeProvider, IDecoderStateEventListener,
|
IDecoderStateEventListener, IDecoderStateEventProvider, IMetadataProvider, ISquelchStateProvider
|
||||||
IDecoderStateEventProvider, IMetadataProvider, ISquelchStateProvider
|
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( ChannelState.class );
|
LoggerFactory.getLogger( ChannelState.class );
|
||||||
@@ -66,18 +63,16 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
private boolean mSelected = false;
|
private boolean mSelected = false;
|
||||||
|
|
||||||
private long mStandardChannelFadeTimeout = FADE_TIMEOUT_DELAY;
|
private long mStandardChannelFadeTimeout = FADE_TIMEOUT_DELAY;
|
||||||
private long mTrafficChannelFadeTimeout =
|
private long mTrafficChannelFadeTimeout = DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000;
|
||||||
DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000;
|
|
||||||
private long mFadeTimeout;
|
private long mFadeTimeout;
|
||||||
private long mEndTimeout;
|
private long mEndTimeout;
|
||||||
|
|
||||||
private StateMonitor mStateMonitor = new StateMonitor();
|
private StateMonitor mStateMonitor = new StateMonitor();
|
||||||
private AtomicBoolean mMonitoring = new AtomicBoolean();
|
|
||||||
private ScheduledFuture<?> mStateMonitorFuture;
|
private ScheduledFuture<?> mStateMonitorFuture;
|
||||||
|
|
||||||
private ChannelType mChannelType;
|
private ChannelType mChannelType;
|
||||||
|
|
||||||
private TrafficChannelStatusListener mTrafficChannelStatusListener;
|
private TrafficChannelManager mTrafficChannelEndListener;
|
||||||
private CallEvent mTrafficChannelCallEvent;
|
private CallEvent mTrafficChannelCallEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,21 +122,20 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start( ScheduledExecutorService executor )
|
||||||
{
|
{
|
||||||
//Start a monitoring task to check for FADE and END event timeouts
|
if( mStateMonitorFuture == null && mStateMonitor != null )
|
||||||
if( mMonitoring.compareAndSet( false, true ) )
|
|
||||||
{
|
{
|
||||||
if( mStateMonitorFuture == null && mStateMonitor != null )
|
if( mTrafficChannelEndListener != null )
|
||||||
{
|
{
|
||||||
try
|
setState( State.CALL );
|
||||||
{
|
}
|
||||||
mStateMonitorFuture = executor.scheduleAtFixedRate(
|
|
||||||
mStateMonitor, 0, 20, TimeUnit.MILLISECONDS );
|
try
|
||||||
}
|
{
|
||||||
catch( RejectedExecutionException ree )
|
mStateMonitorFuture = executor.scheduleAtFixedRate( mStateMonitor, 0, 20, TimeUnit.MILLISECONDS );
|
||||||
{
|
}
|
||||||
mLog.error( "state monitor scheduled task rejected", ree );
|
catch( RejectedExecutionException ree )
|
||||||
mMonitoring.set( false );
|
{
|
||||||
}
|
mLog.error( "state monitor scheduled task rejected", ree );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,23 +143,29 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
mSquelchLocked = false;
|
if( mStateMonitorFuture != null )
|
||||||
|
|
||||||
//Shutdown the state montoring task
|
|
||||||
if( mMonitoring.compareAndSet( true, false ) )
|
|
||||||
{
|
{
|
||||||
if( mStateMonitorFuture != null )
|
boolean success = mStateMonitorFuture.cancel( true );
|
||||||
{
|
|
||||||
boolean success = mStateMonitorFuture.cancel( true );
|
|
||||||
|
|
||||||
if( !success )
|
|
||||||
{
|
|
||||||
mLog.error("Couldn't stop monitoring scheduled future" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mStateMonitorFuture = null;
|
if( !success )
|
||||||
|
{
|
||||||
|
mLog.error("Couldn't stop monitoring scheduled future" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mTrafficChannelEndListener = null;
|
||||||
|
|
||||||
|
if( mTrafficChannelCallEvent != null )
|
||||||
|
{
|
||||||
|
mTrafficChannelCallEvent.end();
|
||||||
|
broadcast( mTrafficChannelCallEvent );
|
||||||
|
}
|
||||||
|
|
||||||
|
mTrafficChannelCallEvent = null;
|
||||||
|
|
||||||
|
mStateMonitorFuture = null;
|
||||||
|
|
||||||
|
mSquelchLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
@@ -203,7 +203,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
|
|
||||||
if( mChannelType == ChannelType.TRAFFIC )
|
if( mChannelType == ChannelType.TRAFFIC )
|
||||||
{
|
{
|
||||||
mFadeTimeout = mTrafficChannelFadeTimeout;
|
mFadeTimeout = System.currentTimeMillis() + mTrafficChannelFadeTimeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,6 +235,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
{
|
{
|
||||||
mFadeTimeout = System.currentTimeMillis() + mStandardChannelFadeTimeout;
|
mFadeTimeout = System.currentTimeMillis() + mStandardChannelFadeTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,23 +388,9 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
|
|
||||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||||
|
|
||||||
if( mTrafficChannelCallEvent != null )
|
if( mTrafficChannelEndListener != null )
|
||||||
{
|
{
|
||||||
mTrafficChannelCallEvent.end();
|
mTrafficChannelEndListener.callEnd( mTrafficChannelCallEvent.getChannel() );
|
||||||
|
|
||||||
broadcast( mTrafficChannelCallEvent );
|
|
||||||
mTrafficChannelCallEvent = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mTrafficChannelStatusListener != null )
|
|
||||||
{
|
|
||||||
mTrafficChannelStatusListener.callEnd();
|
|
||||||
mTrafficChannelStatusListener = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mLog.error( "Traffic channel status listener was null - couldn't "
|
|
||||||
+ "teardown the channel");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,11 +515,11 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
* Registers a listener to be notified when a traffic channel call event is
|
* Registers a listener to be notified when a traffic channel call event is
|
||||||
* completed, so that the listener can perform call tear-down
|
* completed, so that the listener can perform call tear-down
|
||||||
*/
|
*/
|
||||||
public void configureAsTrafficChannel( TrafficChannelStatusListener listener,
|
public void configureAsTrafficChannel( TrafficChannelManager manager, CallEvent callEvent )
|
||||||
TrafficChannelAllocationEvent allocationEvent )
|
|
||||||
{
|
{
|
||||||
mTrafficChannelStatusListener = listener;
|
mTrafficChannelEndListener = manager;
|
||||||
mTrafficChannelCallEvent = allocationEvent.getCallEvent();
|
|
||||||
|
mTrafficChannelCallEvent = callEvent;
|
||||||
|
|
||||||
/* Broadcast the call event details as metadata for the audio manager */
|
/* Broadcast the call event details as metadata for the audio manager */
|
||||||
String channel = mTrafficChannelCallEvent.getChannel();
|
String channel = mTrafficChannelCallEvent.getChannel();
|
||||||
@@ -541,9 +528,9 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
{
|
{
|
||||||
broadcast( new Metadata( MetadataType.CHANNEL_NUMBER, channel, true ) );
|
broadcast( new Metadata( MetadataType.CHANNEL_NUMBER, channel, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.PROTOCOL,
|
broadcast( new Metadata( MetadataType.PROTOCOL,
|
||||||
mTrafficChannelCallEvent.getDecoderType().getDisplayString(), true ) );
|
mTrafficChannelCallEvent.getDecoderType().getDisplayString(), true ) );
|
||||||
|
|
||||||
String details = mTrafficChannelCallEvent.getDetails();
|
String details = mTrafficChannelCallEvent.getDetails();
|
||||||
|
|
||||||
@@ -572,13 +559,12 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
|
|
||||||
if( frequency > 0 )
|
if( frequency > 0 )
|
||||||
{
|
{
|
||||||
broadcast( new Metadata( MetadataType.FREQUENCY,
|
broadcast( new Metadata( MetadataType.FREQUENCY, String.valueOf( frequency ), true ) );
|
||||||
String.valueOf( frequency ), true ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rebroadcast the allocation event so that the internal decoder states
|
/* Rebroadcast the allocation event so that the internal decoder states
|
||||||
* can self-configure with the call event details */
|
* can self-configure with the call event details */
|
||||||
broadcast( allocationEvent );
|
broadcast( mTrafficChannelCallEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -660,7 +646,6 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
if( State.CALL_STATES.contains( mState ) &&
|
if( State.CALL_STATES.contains( mState ) &&
|
||||||
mFadeTimeout <= System.currentTimeMillis() )
|
mFadeTimeout <= System.currentTimeMillis() )
|
||||||
{
|
{
|
||||||
mState = State.FADE;
|
|
||||||
processFadeState();
|
processFadeState();
|
||||||
}
|
}
|
||||||
else if( mState == State.FADE &&
|
else if( mState == State.FADE &&
|
||||||
|
|||||||
@@ -103,11 +103,8 @@ public enum State
|
|||||||
|
|
||||||
private String mDisplayValue;
|
private String mDisplayValue;
|
||||||
|
|
||||||
public static final EnumSet<State> CALL_STATES =
|
public static final EnumSet<State> CALL_STATES = EnumSet.of( CALL, CONTROL, DATA, ENCRYPTED );
|
||||||
EnumSet.of( CALL, CONTROL, DATA, ENCRYPTED );
|
public static final EnumSet<State> IDLE_STATES = EnumSet.of( IDLE, FADE );
|
||||||
|
|
||||||
public static final EnumSet<State> IDLE_STATES =
|
|
||||||
EnumSet.of( IDLE, FADE );
|
|
||||||
|
|
||||||
private State( String displayValue )
|
private State( String displayValue )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import module.ProcessingChain;
|
|
||||||
import module.decode.config.DecodeConfiguration;
|
import module.decode.config.DecodeConfiguration;
|
||||||
import module.decode.event.CallEvent;
|
import module.decode.event.CallEvent;
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
import module.decode.event.CallEvent.CallEventType;
|
||||||
@@ -29,6 +28,7 @@ import controller.channel.ChannelEvent;
|
|||||||
import controller.channel.ChannelEvent.Event;
|
import controller.channel.ChannelEvent.Event;
|
||||||
import controller.channel.ChannelModel;
|
import controller.channel.ChannelModel;
|
||||||
import controller.channel.ChannelProcessingManager;
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import controller.channel.TrafficChannelEvent;
|
||||||
|
|
||||||
public class TrafficChannelManager extends Module
|
public class TrafficChannelManager extends Module
|
||||||
implements ICallEventProvider, IDecoderStateEventListener
|
implements ICallEventProvider, IDecoderStateEventListener
|
||||||
@@ -148,7 +148,7 @@ public class TrafficChannelManager extends Module
|
|||||||
mTrafficChannelPool.add( channel );
|
mTrafficChannelPool.add( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a configured channel, start it and track it */
|
/* If we have a configured channel, update metadata */
|
||||||
if( channel != null )
|
if( channel != null )
|
||||||
{
|
{
|
||||||
channel.setSourceConfiguration( new SourceConfigTuner( tunerChannel ) );
|
channel.setSourceConfiguration( new SourceConfigTuner( tunerChannel ) );
|
||||||
@@ -156,11 +156,7 @@ public class TrafficChannelManager extends Module
|
|||||||
channel.setSite( mSite );
|
channel.setSite( mSite );
|
||||||
channel.setName( channelNumber );
|
channel.setName( channelNumber );
|
||||||
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel,
|
mChannelModel.broadcast( new ChannelEvent( channel, Event.NOTIFICATION_CONFIGURATION_CHANGE ) );
|
||||||
Event.NOTIFICATION_CONFIGURATION_CHANGE ) );
|
|
||||||
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel,
|
|
||||||
Event.REQUEST_ENABLE ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,35 +197,25 @@ public class TrafficChannelManager extends Module
|
|||||||
}
|
}
|
||||||
else if( frequency > 0 )
|
else if( frequency > 0 )
|
||||||
{
|
{
|
||||||
Channel channel = getChannel( callEvent.getChannel(),
|
Channel channel = getChannel( callEvent.getChannel(), new TunerChannel( Type.TRAFFIC,
|
||||||
new TunerChannel( Type.TRAFFIC, frequency,
|
frequency, mDecodeConfiguration.getDecoderType().getChannelBandwidth() ) );
|
||||||
mDecodeConfiguration.getDecoderType()
|
|
||||||
.getChannelBandwidth() ) );
|
|
||||||
|
|
||||||
if( channel != null )
|
if( channel != null )
|
||||||
{
|
{
|
||||||
|
TrafficChannelEvent trafficChannelEvent =
|
||||||
|
new TrafficChannelEvent( this, channel, Event.REQUEST_ENABLE, callEvent );
|
||||||
|
|
||||||
|
//Request to enable the channel
|
||||||
|
mChannelModel.broadcast( trafficChannelEvent );
|
||||||
|
|
||||||
if( channel.getEnabled() )
|
if( channel.getEnabled() )
|
||||||
{
|
{
|
||||||
ProcessingChain chain = mChannelProcessingManager
|
mTrafficChannelsInUse.put( callEvent.getChannel(), channel );
|
||||||
.getProcessingChain( channel );
|
|
||||||
|
|
||||||
if( chain != null )
|
|
||||||
{
|
|
||||||
ChannelState state = chain.getChannelState();
|
|
||||||
|
|
||||||
/* Register as a listener to be notified when the call
|
|
||||||
* is completed */
|
|
||||||
state.configureAsTrafficChannel(
|
|
||||||
new TrafficChannelStatusListener( this,
|
|
||||||
callEvent.getChannel() ), event );
|
|
||||||
|
|
||||||
/* Set state to call so that audio squelch state is correct */
|
|
||||||
state.setState( State.CALL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
callEvent.setCallEventType( CallEventType.CALL_DETECT );
|
||||||
|
callEvent.setDetails( "CHANNEL START REJECTED" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -394,7 +380,7 @@ public class TrafficChannelManager extends Module
|
|||||||
if( channelNumber != null && mTrafficChannelsInUse.containsKey( channelNumber ) )
|
if( channelNumber != null && mTrafficChannelsInUse.containsKey( channelNumber ) )
|
||||||
{
|
{
|
||||||
Channel channel = mTrafficChannelsInUse.get( channelNumber );
|
Channel channel = mTrafficChannelsInUse.get( channelNumber );
|
||||||
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_DISABLE ) );
|
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_DISABLE ) );
|
||||||
|
|
||||||
mTrafficChannelsInUse.remove( channelNumber );
|
mTrafficChannelsInUse.remove( channelNumber );
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package module.decode.state;
|
|
||||||
|
|
||||||
public class TrafficChannelStatusListener
|
|
||||||
{
|
|
||||||
private TrafficChannelManager mTrafficChannelManager;
|
|
||||||
private String mChannelNumber;
|
|
||||||
|
|
||||||
public TrafficChannelStatusListener( TrafficChannelManager manager, String channelNumber )
|
|
||||||
{
|
|
||||||
mTrafficChannelManager = manager;
|
|
||||||
mChannelNumber = channelNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void callEnd()
|
|
||||||
{
|
|
||||||
if( mTrafficChannelManager != null )
|
|
||||||
{
|
|
||||||
mTrafficChannelManager.callEnd( mChannelNumber );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -51,9 +51,8 @@ public class DemodulatedAudioFilterModule extends Module
|
|||||||
assert( stop > pass );
|
assert( stop > pass );
|
||||||
|
|
||||||
//TODO: change this to a band pass filter
|
//TODO: change this to a band pass filter
|
||||||
mBandPassFilter = new RealFIRFilter_RB_RB(
|
mBandPassFilter = new RealFIRFilter_RB_RB( FilterFactory.getLowPass( 48000, pass, stop, 60,
|
||||||
FilterFactory.getLowPass( 48000, pass, stop, 60,
|
WindowType.HANNING, true ), 1.0f );
|
||||||
WindowType.HANNING, true ), 1.0f );
|
|
||||||
|
|
||||||
mDCFilter.setListener( mBandPassFilter );
|
mDCFilter.setListener( mBandPassFilter );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import dsp.fm.FMDemodulator_CB;
|
|||||||
public class FMDemodulatorModule extends Module
|
public class FMDemodulatorModule extends Module
|
||||||
implements IComplexBufferListener, IUnFilteredRealBufferProvider
|
implements IComplexBufferListener, IUnFilteredRealBufferProvider
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger( FMDemodulatorModule.class );
|
||||||
|
|
||||||
private static final int SAMPLE_RATE = 48000;
|
private static final int SAMPLE_RATE = 48000;
|
||||||
|
|
||||||
private ComplexFIRFilter_CB_CB mIQFilter;
|
private ComplexFIRFilter_CB_CB mIQFilter;
|
||||||
|
|||||||
@@ -614,7 +614,6 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
|
|||||||
|
|
||||||
private void save()
|
private void save()
|
||||||
{
|
{
|
||||||
mLog.debug( "Saving settings" );
|
|
||||||
saveTunerConfigurationModel();
|
saveTunerConfigurationModel();
|
||||||
|
|
||||||
JAXBContext context = null;
|
JAXBContext context = null;
|
||||||
@@ -699,8 +698,7 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
|
|||||||
|
|
||||||
if( Files.exists( settingsPath ) )
|
if( Files.exists( settingsPath ) )
|
||||||
{
|
{
|
||||||
mLog.info( "SettingsManager - loading settings file [" +
|
mLog.info( "SettingsManager - loading settings file [" + settingsPath.toString() + "]" );
|
||||||
settingsPath.toString() + "]" );
|
|
||||||
|
|
||||||
JAXBContext context = null;
|
JAXBContext context = null;
|
||||||
|
|
||||||
|
|||||||
@@ -132,8 +132,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.warn( "Attempt to start() and already running tuner channel "
|
mLog.warn( "Attempt to start() and already running tuner channel source was ignored" );
|
||||||
+ "source was ignored" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +161,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.warn( "Attempt to stop() and already stopped tuner channel "
|
mLog.warn( "Attempt to stop() and already stopped tuner channel source was ignored" );
|
||||||
+ "source was ignored" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +372,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mLog.debug( "Processed [" + mSampleBuffers.size() + "] in " + ( System.currentTimeMillis() - start ) );
|
// mLog.debug( "Processed [" + mSampleBuffers.size() + "] in " + ( System.currentTimeMillis() - start ) );
|
||||||
|
|
||||||
mSampleBuffers.clear();
|
mSampleBuffers.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user