mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
#1584 Updates DMR & P25 decoders to stop processing residual samples from the current buffer after a traffic channel shutdown has been signalled. (#1585)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,6 +30,7 @@ public abstract class PSKDemodulator<T> implements ComplexSampleListener
|
||||
private IPhaseLockedLoop mPLL;
|
||||
private Complex mReceivedSample = new Complex(0, 0);
|
||||
private Listener<T> mSymbolListener;
|
||||
private boolean mRunning;
|
||||
|
||||
/**
|
||||
* Abstract Phase Shift Keyed (PSK) demodulator
|
||||
@@ -42,6 +43,31 @@ public abstract class PSKDemodulator<T> implements ComplexSampleListener
|
||||
mPLL = phaseLockedLoop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts this decoder and sets the running flag to true
|
||||
*/
|
||||
public void start()
|
||||
{
|
||||
mRunning = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops this decoder and sets the running flag to false.
|
||||
*/
|
||||
public void stop()
|
||||
{
|
||||
mRunning = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this demodulator is running and capable of processing samples
|
||||
* @return true if running
|
||||
*/
|
||||
public boolean isRunning()
|
||||
{
|
||||
return mRunning;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the listener to receive symbol decisions from this demodulator
|
||||
*/
|
||||
@@ -90,7 +116,10 @@ public abstract class PSKDemodulator<T> implements ComplexSampleListener
|
||||
|
||||
for(int x = 0; x < i.length; x++)
|
||||
{
|
||||
receive(i[x], q[x]);
|
||||
if(isRunning())
|
||||
{
|
||||
receive(i[x], q[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,11 +23,14 @@ import io.github.dsheirer.message.IMessageProvider;
|
||||
import io.github.dsheirer.module.Module;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
|
||||
/**
|
||||
* Base decoder class.
|
||||
*/
|
||||
public abstract class Decoder extends Module implements IMessageProvider
|
||||
{
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
private Listener<IMessage> mMessageDistributor = new MessageDistributor();
|
||||
protected Listener<IMessage> mMessageListener;
|
||||
private boolean mRunning;
|
||||
|
||||
/**
|
||||
* Decoder - parent class for all decoders, demodulators and components.
|
||||
@@ -36,14 +39,29 @@ public abstract class Decoder extends Module implements IMessageProvider
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts this decoder and sets the running flag to true.
|
||||
*/
|
||||
public void start()
|
||||
{
|
||||
//no-op
|
||||
mRunning = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops this decoder and sets the running flag to false.
|
||||
*/
|
||||
public void stop()
|
||||
{
|
||||
//no-op
|
||||
mRunning = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this decoder is currently started and in a running state.
|
||||
* @return true if running or false if not.
|
||||
*/
|
||||
public boolean isRunning()
|
||||
{
|
||||
return mRunning;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -84,6 +84,20 @@ public class DMRDecoder extends FeedbackDecoder implements ISourceEventListener,
|
||||
setSampleRate(25000.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
super.start();
|
||||
mQPSKDemodulator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
super.stop();
|
||||
mQPSKDemodulator.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* DMR decoder type.
|
||||
*/
|
||||
@@ -318,22 +332,4 @@ public class DMRDecoder extends FeedbackDecoder implements ISourceEventListener,
|
||||
{
|
||||
return DMRDecoder.this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the decoder
|
||||
*/
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the decoder
|
||||
*/
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,7 +31,6 @@ import io.github.dsheirer.sample.complex.IComplexSamplesListener;
|
||||
import io.github.dsheirer.source.ISourceEventListener;
|
||||
import io.github.dsheirer.source.ISourceEventProvider;
|
||||
import io.github.dsheirer.source.SourceEvent;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public abstract class P25P1Decoder extends FeedbackDecoder implements ISourceEventListener, ISourceEventProvider,
|
||||
@@ -166,24 +165,6 @@ public abstract class P25P1Decoder extends FeedbackDecoder implements ISourceEve
|
||||
return P25P1Decoder.this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the decoder
|
||||
*/
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the decoder
|
||||
*/
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -62,6 +62,20 @@ public class P25P1DecoderC4FM extends P25P1Decoder
|
||||
setSampleRate(25000.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
super.start();
|
||||
mQPSKDemodulator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
super.stop();
|
||||
mQPSKDemodulator.stop();
|
||||
}
|
||||
|
||||
public void setSampleRate(double sampleRate)
|
||||
{
|
||||
super.setSampleRate(sampleRate);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -62,6 +62,20 @@ public class P25P1DecoderLSM extends P25P1Decoder
|
||||
setSampleRate(25000.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
super.start();
|
||||
mQPSKDemodulator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
super.stop();
|
||||
mQPSKDemodulator.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or changes the channel sample rate
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,7 +31,6 @@ import io.github.dsheirer.sample.complex.IComplexSamplesListener;
|
||||
import io.github.dsheirer.source.ISourceEventListener;
|
||||
import io.github.dsheirer.source.ISourceEventProvider;
|
||||
import io.github.dsheirer.source.SourceEvent;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
@@ -169,24 +168,6 @@ public abstract class P25P2Decoder extends FeedbackDecoder implements ISourceEve
|
||||
return P25P2Decoder.this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the decoder
|
||||
*/
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the decoder
|
||||
*/
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
//No-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -67,6 +67,27 @@ public class P25P2DecoderHDQPSK extends P25P2Decoder implements IdentifierUpdate
|
||||
mDecodeConfigP25Phase2 = decodeConfigP25Phase2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
super.start();
|
||||
mQPSKDemodulator.start();
|
||||
|
||||
//Refresh the scramble parameters each time we start in case they change
|
||||
if(mDecodeConfigP25Phase2 != null && mDecodeConfigP25Phase2.getScrambleParameters() != null &&
|
||||
!mDecodeConfigP25Phase2.isAutoDetectScrambleParameters())
|
||||
{
|
||||
mMessageFramer.setScrambleParameters(mDecodeConfigP25Phase2.getScrambleParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
super.stop();
|
||||
mQPSKDemodulator.stop();
|
||||
}
|
||||
|
||||
public void setSampleRate(double sampleRate)
|
||||
{
|
||||
super.setSampleRate(sampleRate);
|
||||
@@ -188,19 +209,6 @@ public class P25P2DecoderHDQPSK extends P25P2Decoder implements IdentifierUpdate
|
||||
mCostasLoop.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
super.start();
|
||||
|
||||
//Refresh the scramble parameters each time we start in case they change
|
||||
if(mDecodeConfigP25Phase2 != null && mDecodeConfigP25Phase2.getScrambleParameters() != null &&
|
||||
!mDecodeConfigP25Phase2.isAutoDetectScrambleParameters())
|
||||
{
|
||||
mMessageFramer.setScrambleParameters(mDecodeConfigP25Phase2.getScrambleParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<IdentifierUpdateNotification> getIdentifierUpdateListener()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user