Merge pull request #94 from DSheirer/#66_remove_loggers_and_recorders_between_channel_restarts

#66 remove loggers and recorders between channel restarts
This commit is contained in:
Denny Sheirer
2017-01-08 05:28:16 -05:00
committed by GitHub
3 changed files with 777 additions and 594 deletions

View File

@@ -207,9 +207,18 @@ public class ChannelProcessingManager implements ChannelEventListener
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
processingChain.setMessageActivityModel(messageModel);
/* Inject channel metadata that will be inserted into audio packets
* for the recorder manager and streaming */
processingChain.broadcast(
new Metadata(MetadataType.SYSTEM, channel.getSystem()));
processingChain.broadcast(
new Metadata(MetadataType.SITE_ID, channel.getSite()));
processingChain.broadcast(
new Metadata(MetadataType.CHANNEL_NAME, channel.getName()));
}
/* Setup event logging */
List<Module> loggers = mEventLogManager.getLoggers(
channel.getEventLogConfiguration(), channel.getName());
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), channel.getName());
if (!loggers.isEmpty())
{
@@ -222,32 +231,18 @@ public class ChannelProcessingManager implements ChannelEventListener
if (!recorders.isEmpty())
{
/* Add baseband recorder */
if ((recorders.contains(RecorderType.BASEBAND) &&
channel.getChannelType() == ChannelType.STANDARD))
if ((recorders.contains(RecorderType.BASEBAND) && channel.getChannelType() == ChannelType.STANDARD))
{
processingChain.addModule(mRecorderManager.getBasebandRecorder(
channel.toString()));
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
}
/* Add traffic channel baseband recorder */
if (recorders.contains(RecorderType.TRAFFIC_BASEBAND) &&
channel.getChannelType() == ChannelType.TRAFFIC)
if (recorders.contains(RecorderType.TRAFFIC_BASEBAND) && channel.getChannelType() == ChannelType.TRAFFIC)
{
processingChain.addModule(mRecorderManager
.getBasebandRecorder(channel.toString()));
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
}
}
/* Inject channel metadata that will be inserted into audio packets
* for the recorder manager and streaming */
processingChain.broadcast(
new Metadata(MetadataType.SYSTEM, channel.getSystem()));
processingChain.broadcast(
new Metadata(MetadataType.SITE_ID, channel.getSite()));
processingChain.broadcast(
new Metadata(MetadataType.CHANNEL_NAME, channel.getName()));
}
processingChain.setSource(source);
if (event instanceof TrafficChannelEvent)
@@ -275,9 +270,14 @@ public class ChannelProcessingManager implements ChannelEventListener
if (mProcessingChains.containsKey(channel.getChannelID()))
{
ProcessingChain chain = mProcessingChains.get(channel.getChannelID());
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
processingChain.stop();
processingChain.removeEventLoggingModules();
processingChain.removeRecordingModules();
chain.stop();
mChannelModel.broadcast(new ChannelEvent(channel, Event.NOTIFICATION_PROCESSING_STOP));
@@ -285,7 +285,7 @@ public class ChannelProcessingManager implements ChannelEventListener
{
mProcessingChains.remove(channel.getChannelID());
chain.dispose();
processingChain.dispose();
}
}
}

View File

@@ -17,12 +17,20 @@
******************************************************************************/
package module;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import audio.AudioPacket;
import audio.IAudioPacketListener;
import audio.IAudioPacketProvider;
import audio.metadata.IMetadataListener;
import audio.metadata.IMetadataProvider;
import audio.metadata.Metadata;
import audio.squelch.ISquelchStateListener;
import audio.squelch.ISquelchStateProvider;
import audio.squelch.SquelchState;
import controller.NamingThreadFactory;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelEvent;
import controller.channel.IChannelEventListener;
import controller.channel.IChannelEventProvider;
import message.IMessageListener;
import message.IMessageProvider;
import message.Message;
@@ -38,10 +46,11 @@ import module.decode.state.DecoderStateEvent.Event;
import module.decode.state.IDecoderStateEventListener;
import module.decode.state.IDecoderStateEventProvider;
import module.decode.state.State;
import module.log.EventLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import record.wave.ComplexBufferWaveRecorder;
import record.wave.RealBufferWaveRecorder;
import sample.Broadcaster;
import sample.Listener;
import sample.complex.ComplexBuffer;
@@ -59,20 +68,12 @@ import source.tuner.TunerChannelSource;
import source.tuner.frequency.FrequencyChangeEvent;
import source.tuner.frequency.IFrequencyChangeListener;
import source.tuner.frequency.IFrequencyChangeProvider;
import audio.AudioPacket;
import audio.IAudioPacketListener;
import audio.IAudioPacketProvider;
import audio.metadata.IMetadataListener;
import audio.metadata.IMetadataProvider;
import audio.metadata.Metadata;
import audio.squelch.ISquelchStateListener;
import audio.squelch.ISquelchStateProvider;
import audio.squelch.SquelchState;
import controller.NamingThreadFactory;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelEvent;
import controller.channel.IChannelEventListener;
import controller.channel.IChannelEventProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Processing chain provides a framework for connecting a complex or real sample
@@ -94,7 +95,7 @@ import controller.channel.IChannelEventProvider;
*/
public class ProcessingChain implements IChannelEventListener
{
private final static Logger mLog = LoggerFactory.getLogger( ProcessingChain.class );
private final static Logger mLog = LoggerFactory.getLogger(ProcessingChain.class);
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
private Broadcaster<Metadata> mMetadataBroadcaster = new Broadcaster<>();
@@ -124,15 +125,15 @@ public class ProcessingChain implements IChannelEventListener
* @param name for thread pool naming each thread
* @param channelType
*/
public ProcessingChain( String name, ChannelType channelType )
public ProcessingChain(String name, ChannelType channelType)
{
mName = name;
mChannelState = new ChannelState( channelType );
addModule( mChannelState );
mChannelState = new ChannelState(channelType);
addModule(mChannelState);
mCallEventModel = new CallEventModel();
addCallEventListener( mCallEventModel );
addCallEventListener(mCallEventModel);
}
public CallEventModel getCallEventModel()
@@ -150,18 +151,18 @@ public class ProcessingChain implements IChannelEventListener
return mMessageActivityModel;
}
public void setMessageActivityModel( MessageActivityModel model )
public void setMessageActivityModel(MessageActivityModel model)
{
mMessageActivityModel = model;
addMessageListener( mMessageActivityModel );
addMessageListener(mMessageActivityModel);
}
public void dispose()
{
stop();
for( Module module: mModules )
for(Module module : mModules)
{
module.dispose();
}
@@ -179,7 +180,7 @@ public class ProcessingChain implements IChannelEventListener
mFilteredRealBufferBroadcaster.dispose();
mSquelchStateBroadcaster.dispose();
if( mScheduledExecutorService != null )
if(mScheduledExecutorService != null)
{
mScheduledExecutorService.shutdownNow();
}
@@ -188,11 +189,11 @@ public class ProcessingChain implements IChannelEventListener
/**
* Broadcasts the metadata to any registered listeners
*/
public void broadcast( Metadata metadata )
public void broadcast(Metadata metadata)
{
if( mMetadataBroadcaster != null )
if(mMetadataBroadcaster != null)
{
mMetadataBroadcaster.broadcast( metadata );
mMetadataBroadcaster.broadcast(metadata);
}
}
@@ -218,18 +219,17 @@ public class ProcessingChain implements IChannelEventListener
* start until the start() method is invoked.
*
* @param source - real or complex sample source
*
* @throws IllegalStateException if the processing chain is currently
* processing with another source. Invoke stop() before applying a new
* source.
*/
public void setSource( Source source ) throws IllegalStateException
public void setSource(Source source) throws IllegalStateException
{
if( isProcessing() )
if(isProcessing())
{
throw new IllegalStateException( "Processing chain is currently "
throw new IllegalStateException("Processing chain is currently "
+ "processing. Invoke stop() on the processing chain before "
+ "applying a new sample source" );
+ "applying a new sample source");
}
mSource = source;
@@ -250,11 +250,11 @@ public class ProcessingChain implements IChannelEventListener
{
List<DecoderState> decoderStates = new ArrayList<>();
for( Module module: mModules )
for(Module module : mModules)
{
if( module instanceof DecoderState )
if(module instanceof DecoderState)
{
decoderStates.add( (DecoderState)module );
decoderStates.add((DecoderState) module);
}
}
@@ -264,11 +264,11 @@ public class ProcessingChain implements IChannelEventListener
/**
* Adds the list of modules to this processing chain
*/
public void addModules( List<Module> modules )
public void addModules(List<Module> modules)
{
for( Module module: modules )
for(Module module : modules)
{
addModule( module );
addModule(module);
}
}
@@ -286,84 +286,167 @@ public class ProcessingChain implements IChannelEventListener
* @param module - processing module, demodulator, decoder, source, state
* machine, etc.
*/
public void addModule( Module module )
public void addModule(Module module)
{
mModules.add( module );
mModules.add(module);
registerListeners( module );
registerProviders( module );
registerListeners(module);
registerProviders(module);
}
/**
* Removes the module from the processing chain and deregisters the module as a listener and
* as a provider
*/
public void removeModule(Module module)
{
unregisterListeners(module);
unregisterProviders(module);
mModules.remove(module);
}
/**
* Registers the module as a listener to each of the broadcasters that
* provide the data interface(s) supported by the module.
*/
private void registerListeners( Module module )
private void registerListeners(Module module)
{
if( module instanceof IAudioPacketListener )
if(module instanceof IAudioPacketListener)
{
mAudioPacketBroadcaster.addListener(
((IAudioPacketListener)module).getAudioPacketListener() );
((IAudioPacketListener) module).getAudioPacketListener());
}
if( module instanceof ICallEventListener )
if(module instanceof ICallEventListener)
{
mCallEventBroadcaster.addListener(
((ICallEventListener)module).getCallEventListener() );
((ICallEventListener) module).getCallEventListener());
}
if( module instanceof IChannelEventListener )
if(module instanceof IChannelEventListener)
{
mChannelEventBroadcaster.addListener(
((IChannelEventListener)module).getChannelEventListener() );
((IChannelEventListener) module).getChannelEventListener());
}
if( module instanceof IComplexBufferListener )
if(module instanceof IComplexBufferListener)
{
mComplexBufferBroadcaster.addListener(
((IComplexBufferListener)module).getComplexBufferListener() );
((IComplexBufferListener) module).getComplexBufferListener());
}
if( module instanceof IDecoderStateEventListener )
if(module instanceof IDecoderStateEventListener)
{
mDecoderStateEventBroadcaster.addListener(
((IDecoderStateEventListener)module).getDecoderStateListener() );
((IDecoderStateEventListener) module).getDecoderStateListener());
}
if( module instanceof IFrequencyChangeListener )
if(module instanceof IFrequencyChangeListener)
{
mFrequencyChangeEventBroadcaster.addListener(
((IFrequencyChangeListener)module).getFrequencyChangeListener());
((IFrequencyChangeListener) module).getFrequencyChangeListener());
}
if( module instanceof IMessageListener )
if(module instanceof IMessageListener)
{
mMessageBroadcaster.addListener(
((IMessageListener)module).getMessageListener() );
((IMessageListener) module).getMessageListener());
}
if( module instanceof IMetadataListener )
if(module instanceof IMetadataListener)
{
mMetadataBroadcaster.addListener(
((IMetadataListener)module).getMetadataListener() );
((IMetadataListener) module).getMetadataListener());
}
if( module instanceof IFilteredRealBufferListener )
if(module instanceof IFilteredRealBufferListener)
{
mFilteredRealBufferBroadcaster.addListener(
((IFilteredRealBufferListener)module).getFilteredRealBufferListener() );
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
}
if( module instanceof ISquelchStateListener )
if(module instanceof ISquelchStateListener)
{
mSquelchStateBroadcaster.addListener(
((ISquelchStateListener)module).getSquelchStateListener() );
((ISquelchStateListener) module).getSquelchStateListener());
}
if( module instanceof IUnFilteredRealBufferListener )
if(module instanceof IUnFilteredRealBufferListener)
{
mUnFilteredRealBufferBroadcaster.addListener(
((IUnFilteredRealBufferListener)module).getUnFilteredRealBufferListener() );
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
}
}
/**
* Registers the module as a listener to each of the broadcasters that
* provide the data interface(s) supported by the module.
*/
private void unregisterListeners(Module module)
{
if(module instanceof IAudioPacketListener)
{
mAudioPacketBroadcaster.removeListener(
((IAudioPacketListener) module).getAudioPacketListener());
}
if(module instanceof ICallEventListener)
{
mCallEventBroadcaster.removeListener(
((ICallEventListener) module).getCallEventListener());
}
if(module instanceof IChannelEventListener)
{
mChannelEventBroadcaster.removeListener(
((IChannelEventListener) module).getChannelEventListener());
}
if(module instanceof IComplexBufferListener)
{
mComplexBufferBroadcaster.removeListener(
((IComplexBufferListener) module).getComplexBufferListener());
}
if(module instanceof IDecoderStateEventListener)
{
mDecoderStateEventBroadcaster.removeListener(
((IDecoderStateEventListener) module).getDecoderStateListener());
}
if(module instanceof IFrequencyChangeListener)
{
mFrequencyChangeEventBroadcaster.removeListener(
((IFrequencyChangeListener) module).getFrequencyChangeListener());
}
if(module instanceof IMessageListener)
{
mMessageBroadcaster.removeListener(((IMessageListener) module).getMessageListener());
}
if(module instanceof IMetadataListener)
{
mMetadataBroadcaster.removeListener(((IMetadataListener) module).getMetadataListener());
}
if(module instanceof IFilteredRealBufferListener)
{
mFilteredRealBufferBroadcaster.removeListener(
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
}
if(module instanceof ISquelchStateListener)
{
mSquelchStateBroadcaster.removeListener(
((ISquelchStateListener) module).getSquelchStateListener());
}
if(module instanceof IUnFilteredRealBufferListener)
{
mUnFilteredRealBufferBroadcaster.removeListener(
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
}
}
@@ -371,64 +454,121 @@ public class ProcessingChain implements IChannelEventListener
* Registers the broadcaster(s) as listeners to the module for each
* provider interface that is supported by the module.
*/
private void registerProviders( Module module )
private void registerProviders(Module module)
{
if( module instanceof IAudioPacketProvider )
if(module instanceof IAudioPacketProvider)
{
((IAudioPacketProvider)module).setAudioPacketListener(
mAudioPacketBroadcaster );
((IAudioPacketProvider) module).setAudioPacketListener(
mAudioPacketBroadcaster);
}
if( module instanceof ICallEventProvider )
if(module instanceof ICallEventProvider)
{
((ICallEventProvider)module).addCallEventListener( mCallEventBroadcaster );
((ICallEventProvider) module).addCallEventListener(mCallEventBroadcaster);
}
if( module instanceof IChannelEventProvider )
if(module instanceof IChannelEventProvider)
{
((IChannelEventProvider)module).setChannelEventListener(
mChannelEventBroadcaster );
((IChannelEventProvider) module).setChannelEventListener(
mChannelEventBroadcaster);
}
if( module instanceof IDecoderStateEventProvider )
if(module instanceof IDecoderStateEventProvider)
{
((IDecoderStateEventProvider)module).setDecoderStateListener(
mDecoderStateEventBroadcaster );
((IDecoderStateEventProvider) module).setDecoderStateListener(
mDecoderStateEventBroadcaster);
}
if( module instanceof IFrequencyChangeProvider )
if(module instanceof IFrequencyChangeProvider)
{
((IFrequencyChangeProvider)module).setFrequencyChangeListener(
mFrequencyChangeEventBroadcaster );
((IFrequencyChangeProvider) module).setFrequencyChangeListener(
mFrequencyChangeEventBroadcaster);
}
if( module instanceof IMessageProvider )
if(module instanceof IMessageProvider)
{
((IMessageProvider)module).setMessageListener( mMessageBroadcaster );
((IMessageProvider) module).setMessageListener(mMessageBroadcaster);
}
if( module instanceof IMetadataProvider )
if(module instanceof IMetadataProvider)
{
((IMetadataProvider)module).setMetadataListener(
mMetadataBroadcaster );
((IMetadataProvider) module).setMetadataListener(
mMetadataBroadcaster);
}
if( module instanceof IFilteredRealBufferProvider )
if(module instanceof IFilteredRealBufferProvider)
{
((IFilteredRealBufferProvider)module)
.setFilteredRealBufferListener( mFilteredRealBufferBroadcaster );
((IFilteredRealBufferProvider) module)
.setFilteredRealBufferListener(mFilteredRealBufferBroadcaster);
}
if( module instanceof ISquelchStateProvider )
if(module instanceof ISquelchStateProvider)
{
((ISquelchStateProvider)module).setSquelchStateListener(
mSquelchStateBroadcaster );
((ISquelchStateProvider) module).setSquelchStateListener(
mSquelchStateBroadcaster);
}
if( module instanceof IUnFilteredRealBufferProvider )
if(module instanceof IUnFilteredRealBufferProvider)
{
((IUnFilteredRealBufferProvider)module)
.setUnFilteredRealBufferListener( mUnFilteredRealBufferBroadcaster );
((IUnFilteredRealBufferProvider) module)
.setUnFilteredRealBufferListener(mUnFilteredRealBufferBroadcaster);
}
}
/**
* Unregisters the broadcaster(s) as listeners to the module for each
* provider interface that is supported by the module.
*/
private void unregisterProviders(Module module)
{
if(module instanceof IAudioPacketProvider)
{
((IAudioPacketProvider) module).setAudioPacketListener(null);
}
if(module instanceof ICallEventProvider)
{
((ICallEventProvider) module).removeCallEventListener(mCallEventBroadcaster);
}
if(module instanceof IChannelEventProvider)
{
((IChannelEventProvider) module).setChannelEventListener(null);
}
if(module instanceof IDecoderStateEventProvider)
{
((IDecoderStateEventProvider) module).setDecoderStateListener(null);
}
if(module instanceof IFrequencyChangeProvider)
{
((IFrequencyChangeProvider) module).setFrequencyChangeListener(null);
}
if(module instanceof IMessageProvider)
{
((IMessageProvider) module).setMessageListener(null);
}
if(module instanceof IMetadataProvider)
{
((IMetadataProvider) module).setMetadataListener(null);
}
if(module instanceof IFilteredRealBufferProvider)
{
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(null);
}
if(module instanceof ISquelchStateProvider)
{
((ISquelchStateProvider) module).setSquelchStateListener(null);
}
if(module instanceof IUnFilteredRealBufferProvider)
{
((IUnFilteredRealBufferProvider) module).setUnFilteredRealBufferListener(null);
}
}
@@ -438,12 +578,12 @@ public class ProcessingChain implements IChannelEventListener
*/
public void start()
{
if( mRunning.compareAndSet( false, true ) )
if(mRunning.compareAndSet(false, true))
{
if( mSource != null )
if(mSource != null)
{
/* Reset each of the modules */
for( Module module: mModules )
for(Module module : mModules)
{
module.reset();
}
@@ -451,63 +591,63 @@ public class ProcessingChain implements IChannelEventListener
/* Register with the source to receive sample data. Setup a
* timer task to process the buffer queues 50 times a second
* (every 20 ms) */
switch( mSource.getSampleType() )
switch(mSource.getSampleType())
{
case COMPLEX:
((ComplexSource)mSource).setListener( mComplexBufferBroadcaster );
((ComplexSource) mSource).setListener(mComplexBufferBroadcaster);
break;
case REAL:
((RealSource)mSource).setListener( mFilteredRealBufferBroadcaster );
((RealSource) mSource).setListener(mFilteredRealBufferBroadcaster);
break;
default:
throw new IllegalArgumentException( "Unrecognized source "
+ "sample type - cannot start processing chain" );
throw new IllegalArgumentException("Unrecognized source "
+ "sample type - cannot start processing chain");
}
/* If this is a tuner source, broadcast the frequency to all
* of the decoder state's and start the samples flowing */
if( mSource instanceof TunerChannelSource )
if(mSource instanceof TunerChannelSource)
{
TunerChannelSource tcs = (TunerChannelSource)mSource;
TunerChannelSource tcs = (TunerChannelSource) mSource;
try
{
long frequency = tcs.getFrequency();
mDecoderStateEventBroadcaster.broadcast(
new DecoderStateEvent( this, Event.SOURCE_FREQUENCY,
State.IDLE, frequency ) );
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY,
State.IDLE, frequency));
}
catch( SourceException e )
catch(SourceException e)
{
mLog.error( "Error getting frequency from tuner channel source", e );
mLog.error("Error getting frequency from tuner channel source", e);
}
}
if( mScheduledExecutorService == null )
if(mScheduledExecutorService == null)
{
mScheduledExecutorService = Executors.newScheduledThreadPool(
1, new NamingThreadFactory( "channel " + mName ) );
1, new NamingThreadFactory("channel " + mName));
}
/* Start each of the modules */
for( Module module: mModules )
for(Module module : mModules)
{
try
{
module.start( mScheduledExecutorService );
module.start(mScheduledExecutorService);
}
catch( Exception e )
catch(Exception e)
{
mLog.error( "Error starting module", e );
mLog.error("Error starting module", e);
}
}
mSource.start( mScheduledExecutorService );
mSource.start(mScheduledExecutorService);
}
else
{
mLog.error( "Source is null on start()" );
mLog.error("Source is null on start()");
}
}
}
@@ -518,23 +658,23 @@ public class ProcessingChain implements IChannelEventListener
*/
public void stop()
{
if( mRunning.compareAndSet( true, false ) )
if(mRunning.compareAndSet(true, false))
{
if( mSource != null )
if(mSource != null)
{
mSource.stop();
switch( mSource.getSampleType() )
switch(mSource.getSampleType())
{
case COMPLEX:
((ComplexSource)mSource).removeListener( mComplexBufferBroadcaster );
((ComplexSource) mSource).removeListener(mComplexBufferBroadcaster);
break;
case REAL:
((RealSource)mSource).removeListener( mFilteredRealBufferBroadcaster );
((RealSource) mSource).removeListener(mFilteredRealBufferBroadcaster);
break;
default:
throw new IllegalArgumentException( "Unrecognized source "
+ "sample type - cannot start processing chain" );
throw new IllegalArgumentException("Unrecognized source "
+ "sample type - cannot start processing chain");
}
/* Release the source */
@@ -543,63 +683,105 @@ public class ProcessingChain implements IChannelEventListener
}
/* Stop each of the modules */
for( Module module: mModules )
for(Module module : mModules)
{
module.stop();
}
}
}
/**
* Removes any logging modules that are currently registered with this processing chain
*/
public void removeEventLoggingModules()
{
List<Module> eventLoggingModules = new ArrayList<>();
for(Module module: mModules)
{
if(module instanceof EventLogger)
{
eventLoggingModules.add(module);
}
}
for(Module eventLoggingModule: eventLoggingModules)
{
removeModule(eventLoggingModule);
}
}
/**
* Removes any recording modules that are currently registered with this processing chain
*/
public void removeRecordingModules()
{
List<Module> recordingModules = new ArrayList<>();
for(Module module: mModules)
{
if(module instanceof RealBufferWaveRecorder || module instanceof ComplexBufferWaveRecorder)
{
recordingModules.add(module);
}
}
for(Module recordingModule: recordingModules)
{
removeModule(recordingModule);
}
}
/**
* Adds the listener to receive audio packets from all modules.
*/
public void addAudioPacketListener( Listener<AudioPacket> listener )
public void addAudioPacketListener(Listener<AudioPacket> listener)
{
mAudioPacketBroadcaster.addListener( listener );
mAudioPacketBroadcaster.addListener(listener);
}
public void removeAudioPacketListener( Listener<AudioPacket> listener )
public void removeAudioPacketListener(Listener<AudioPacket> listener)
{
mAudioPacketBroadcaster.removeListener( listener );
mAudioPacketBroadcaster.removeListener(listener);
}
/**
* Adds the listener to receive call events from all modules.
*/
public void addCallEventListener( Listener<CallEvent> listener )
public void addCallEventListener(Listener<CallEvent> listener)
{
mCallEventBroadcaster.addListener( listener );
mCallEventBroadcaster.addListener(listener);
}
public void removeCallEventListener( Listener<CallEvent> listener )
public void removeCallEventListener(Listener<CallEvent> listener)
{
mCallEventBroadcaster.removeListener( listener );
mCallEventBroadcaster.removeListener(listener);
}
/**
* Adds the listener to receive call events from all modules.
*/
public void addChannelEventListener( Listener<ChannelEvent> listener )
public void addChannelEventListener(Listener<ChannelEvent> listener)
{
mChannelEventBroadcaster.addListener( listener );
mChannelEventBroadcaster.addListener(listener);
}
public void removeChannelEventListener( Listener<ChannelEvent> listener )
public void removeChannelEventListener(Listener<ChannelEvent> listener)
{
mChannelEventBroadcaster.removeListener( listener );
mChannelEventBroadcaster.removeListener(listener);
}
/**
* Adds the listener to receive decoder state events from decoder modules
*/
public void addDecoderStateEventListener( Listener<DecoderStateEvent> listener )
public void addDecoderStateEventListener(Listener<DecoderStateEvent> listener)
{
mDecoderStateEventBroadcaster.addListener( listener );
mDecoderStateEventBroadcaster.addListener(listener);
}
public void removeDecoderStateEventListener( Listener<DecoderStateEvent> listener)
public void removeDecoderStateEventListener(Listener<DecoderStateEvent> listener)
{
mDecoderStateEventBroadcaster.removeListener( listener );
mDecoderStateEventBroadcaster.removeListener(listener);
}
public Listener<DecoderStateEvent> getDecoderStateEventListener()
@@ -610,48 +792,48 @@ public class ProcessingChain implements IChannelEventListener
/**
* Adds the listener to receive decoded messages from all decoders.
*/
public void addMessageListener( Listener<Message> listener )
public void addMessageListener(Listener<Message> listener)
{
mMessageBroadcaster.addListener( listener );
mMessageBroadcaster.addListener(listener);
}
/**
* Adds the list of listeners to receive decoded messages from all decoders.
*/
public void addMessageListeners( List<Listener<Message>> listeners )
public void addMessageListeners(List<Listener<Message>> listeners)
{
for( Listener<Message> listener: listeners )
for(Listener<Message> listener : listeners)
{
mMessageBroadcaster.addListener( listener );
mMessageBroadcaster.addListener(listener);
}
}
public void removeMessageListener( Listener<Message> listener )
public void removeMessageListener(Listener<Message> listener)
{
mMessageBroadcaster.removeListener( listener );
mMessageBroadcaster.removeListener(listener);
}
/**
* Adds the listener to receive call events from all modules.
*/
public void addSquelchStateListener( Listener<SquelchState> listener )
public void addSquelchStateListener(Listener<SquelchState> listener)
{
mSquelchStateBroadcaster.addListener( listener );
mSquelchStateBroadcaster.addListener(listener);
}
public void removeSquelchStateListener( Listener<SquelchState> listener )
public void removeSquelchStateListener(Listener<SquelchState> listener)
{
mSquelchStateBroadcaster.removeListener( listener );
mSquelchStateBroadcaster.removeListener(listener);
}
public void addRealBufferListener( Listener<RealBuffer> listener )
public void addRealBufferListener(Listener<RealBuffer> listener)
{
mFilteredRealBufferBroadcaster.addListener( listener );
mFilteredRealBufferBroadcaster.addListener(listener);
}
public void removeRealBufferListener( Listener<RealBuffer> listener )
public void removeRealBufferListener(Listener<RealBuffer> listener)
{
mFilteredRealBufferBroadcaster.removeListener( listener );
mFilteredRealBufferBroadcaster.removeListener(listener);
}
@Override

View File

@@ -45,7 +45,8 @@ public class RecorderManager implements Listener<AudioPacket>
private boolean mCanStartNewRecorders = true;
/**
* Manages starting and stopping all system recorders and distributes channel audio to each of the recorders.
* Manages all audio recording for all processing channels. Reconstructs audio streams and distributes channel
* audio to each of the recorders, starting and stopping the recorders as needed.
*/
public RecorderManager(ThreadPoolManager threadPoolManager)
{