mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
330 WIP on redesigning the P25 C4FM decoder. Creates a new decoder
based on the P25 LSM decoder using a costas loop and a gardner detector. Updates the Demodulator Viewer FX application to add in a symbol chart and a phase error chart. The decoder won't lock on yet ... still a wip.
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
@@ -22,39 +22,39 @@ import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.module.Module;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
|
||||
public abstract class Decoder extends Module
|
||||
implements IMessageProvider, Listener<Message>
|
||||
public abstract class Decoder extends Module implements IMessageProvider
|
||||
{
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
protected Listener<Message> mMessageListener;
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
private Listener<Message> mMessageDistributor = new MessageDistributor();
|
||||
protected Listener<Message> mMessageListener;
|
||||
|
||||
/**
|
||||
* Decoder - parent class for all decoders, demodulators and components.
|
||||
*/
|
||||
public Decoder()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Decoder - parent class for all decoders, demodulators and components.
|
||||
*/
|
||||
public Decoder()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose()
|
||||
{
|
||||
mMessageListener = null;
|
||||
}
|
||||
@Override
|
||||
public void dispose()
|
||||
{
|
||||
mMessageListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies the decoder type (ie protocol)
|
||||
*/
|
||||
public abstract DecoderType getDecoderType();
|
||||
/**
|
||||
* Identifies the decoder type (ie protocol)
|
||||
*/
|
||||
public abstract DecoderType getDecoderType();
|
||||
|
||||
|
||||
/**
|
||||
* Adds a listener for receiving decoded messages from this decoder
|
||||
*/
|
||||
@Override
|
||||
public void setMessageListener( Listener<Message> listener )
|
||||
public void setMessageListener(Listener<Message> listener)
|
||||
{
|
||||
mMessageListener = listener;
|
||||
}
|
||||
mMessageListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving decoded messages from all attached
|
||||
@@ -63,23 +63,29 @@ public abstract class Decoder extends Module
|
||||
@Override
|
||||
public void removeMessageListener()
|
||||
{
|
||||
mMessageListener = null;
|
||||
mMessageListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts the message to the registered message listener
|
||||
* Message listener for receiving the output from this decoder
|
||||
*/
|
||||
public void broadcast( Message message )
|
||||
protected Listener<Message> getMessageListener()
|
||||
{
|
||||
if( mMessageListener != null )
|
||||
{
|
||||
mMessageListener.receive( message );
|
||||
}
|
||||
return mMessageDistributor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
{
|
||||
broadcast( message );
|
||||
}
|
||||
/**
|
||||
* Distributes/forwards messages from sub-class decoder implementations to the registered message listener.
|
||||
*/
|
||||
public class MessageDistributor implements Listener<Message>
|
||||
{
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(mMessageListener != null)
|
||||
{
|
||||
mMessageListener.receive(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user