Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1584 Traffic Channel Shutdown - Residual Buffer Samples Processing Related Errors #1585

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions src/main/java/io/github/dsheirer/dsp/psk/PSKDemodulator.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -42,6 +43,31 @@ public PSKDemodulator(InterpolatingSampleBuffer interpolatingSampleBuffer, IPhas
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
*/
Expand Down Expand Up @@ -90,7 +116,10 @@ public void receive(ComplexSamples samples)

for(int x = 0; x < i.length; x++)
{
receive(i[x], q[x]);
if(isRunning())
{
receive(i[x], q[x]);
}
}
}

Expand Down
26 changes: 22 additions & 4 deletions src/main/java/io/github/dsheirer/module/decode/Decoder.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,11 +23,14 @@
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.
Expand All @@ -36,14 +39,29 @@ public Decoder()
{
}

/**
* 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()
Expand Down
34 changes: 15 additions & 19 deletions src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoder.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -84,6 +84,20 @@ public DMRDecoder(DecodeConfigDMR config)
setSampleRate(25000.0);
}

@Override
public void start()
{
super.start();
mQPSKDemodulator.start();
}

@Override
public void stop()
{
super.stop();
mQPSKDemodulator.stop();
}

/**
* DMR decoder type.
*/
Expand Down Expand Up @@ -318,22 +332,4 @@ public Listener<ComplexSamples> getComplexSamplesListener()
{
return DMRDecoder.this;
}

/**
* Starts the decoder
*/
@Override
public void start()
{
//No-op
}

/**
* Stops the decoder
*/
@Override
public void stop()
{
//No-op
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,7 +31,6 @@
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,
Expand Down Expand Up @@ -166,24 +165,6 @@ public Listener<ComplexSamples> getComplexSamplesListener()
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()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -62,6 +62,20 @@ public P25P1DecoderC4FM()
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -62,6 +62,20 @@ public P25P1DecoderLSM()
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
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,7 +31,6 @@
import io.github.dsheirer.source.ISourceEventListener;
import io.github.dsheirer.source.ISourceEventProvider;
import io.github.dsheirer.source.SourceEvent;

import java.nio.ByteBuffer;

/**
Expand Down Expand Up @@ -169,24 +168,6 @@ public Listener<ComplexSamples> getComplexSamplesListener()
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()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -67,6 +67,27 @@ public P25P2DecoderHDQPSK(DecodeConfigP25Phase2 decodeConfigP25Phase2)
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);
Expand Down Expand Up @@ -188,19 +209,6 @@ public void reset()
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()
{
Expand Down