mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 09:07:27 -05:00
Updates pull request from Roman Tsypuk to convert the build system from
ant to gradle. Removes linux and windows application launch scripts and produces an executable jar with all resources included.
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.module.decode.DecoderType;
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
import io.github.dsheirer.module.decode.event.CallEvent;
|
||||
|
||||
public class LJ1200CallEvent extends CallEvent
|
||||
{
|
||||
public LJ1200CallEvent( CallEventType callEventType,
|
||||
AliasList aliasList,
|
||||
String fromID,
|
||||
String toID,
|
||||
String details )
|
||||
{
|
||||
super( DecoderType.LJ_1200, callEventType,
|
||||
aliasList, fromID, toID, details );
|
||||
}
|
||||
|
||||
private Alias getAlias( String ident )
|
||||
{
|
||||
if( hasAliasList() )
|
||||
{
|
||||
return getAliasList().getFleetsyncAlias( ident );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return getAlias( getFromID() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return getAlias( getToID() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFrequency()
|
||||
{
|
||||
return 173075000;
|
||||
}
|
||||
|
||||
public static class Builder
|
||||
{
|
||||
/* Required parameters */
|
||||
private CallEventType mCallEventType;
|
||||
|
||||
/* Optional parameters */
|
||||
private AliasList mAliasList;
|
||||
private String mFromID;
|
||||
private String mToID;
|
||||
private String mDetails;
|
||||
|
||||
public Builder( CallEventType callEventType )
|
||||
{
|
||||
mCallEventType = callEventType;
|
||||
}
|
||||
|
||||
public Builder aliasList( AliasList aliasList )
|
||||
{
|
||||
mAliasList = aliasList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder from( String val )
|
||||
{
|
||||
mFromID = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder details( String details )
|
||||
{
|
||||
mDetails = details;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder to( String toID )
|
||||
{
|
||||
mToID = toID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LJ1200CallEvent build()
|
||||
{
|
||||
return new LJ1200CallEvent( this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor for the builder
|
||||
*/
|
||||
private LJ1200CallEvent( Builder builder )
|
||||
{
|
||||
this( builder.mCallEventType,
|
||||
builder.mAliasList,
|
||||
builder.mFromID,
|
||||
builder.mToID,
|
||||
builder.mDetails );
|
||||
}
|
||||
|
||||
public static LJ1200CallEvent getLJ1200Event( LJ1200Message message )
|
||||
{
|
||||
CallEventType type = CallEventType.COMMAND;
|
||||
|
||||
return new LJ1200CallEvent.Builder( type )
|
||||
.to( message.getAddress() )
|
||||
.details( message.getMessage() )
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.bits.MessageFramer;
|
||||
import io.github.dsheirer.bits.SyncPattern;
|
||||
import io.github.dsheirer.instrument.Instrumentable;
|
||||
import io.github.dsheirer.instrument.tap.Tap;
|
||||
import io.github.dsheirer.instrument.tap.TapGroup;
|
||||
import io.github.dsheirer.instrument.tap.stream.BinaryTap;
|
||||
import io.github.dsheirer.instrument.tap.stream.FloatBufferTap;
|
||||
import io.github.dsheirer.instrument.tap.stream.FloatTap;
|
||||
import io.github.dsheirer.module.decode.DecoderType;
|
||||
import io.github.dsheirer.sample.Broadcaster;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import io.github.dsheirer.sample.real.IFilteredRealBufferListener;
|
||||
import io.github.dsheirer.sample.real.RealBuffer;
|
||||
import io.github.dsheirer.sample.real.RealSampleListener;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
import io.github.dsheirer.dsp.filter.Filters;
|
||||
import io.github.dsheirer.dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||
import io.github.dsheirer.dsp.filter.halfband.real.HalfBandFilter_RB_RB;
|
||||
import io.github.dsheirer.dsp.fsk.FSK2Decoder;
|
||||
import io.github.dsheirer.dsp.fsk.FSK2Decoder.Output;
|
||||
import io.github.dsheirer.module.decode.Decoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* LJ1200 - 1200 baud 2FSK decoder
|
||||
*/
|
||||
public class LJ1200Decoder extends Decoder implements IFilteredRealBufferListener,
|
||||
Instrumentable
|
||||
{
|
||||
/* Decimated sample rate ( 48,000 / 2 = 24,000 ) feeding the decoder */
|
||||
private static final int DECIMATED_SAMPLE_RATE = 24000;
|
||||
|
||||
/* Baud or Symbol Rate */
|
||||
private static final int SYMBOL_RATE = 1200;
|
||||
|
||||
/* Message length - 16-bit sync plus 64 bit message */
|
||||
private static final int MESSAGE_LENGTH = 80;
|
||||
|
||||
/* Instrumentation Taps */
|
||||
private ArrayList<TapGroup> mAvailableTaps;
|
||||
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
||||
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
||||
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
||||
"Tap Point: FSK2 Decoder > < Message Framer";
|
||||
|
||||
private FSK2Decoder mFSKDecoder;
|
||||
private Broadcaster<Boolean> mFSKDecoderBroadcaster =
|
||||
new Broadcaster<Boolean>();
|
||||
|
||||
private HalfBandFilter_RB_RB mDecimationFilter;
|
||||
private RealFIRFilter_RB_RB mBandPassFilter;
|
||||
private MessageFramer mTowerMessageFramer;
|
||||
private MessageFramer mTransponderMessageFramer;
|
||||
private LJ1200MessageProcessor mMessageProcessor;
|
||||
|
||||
public LJ1200Decoder( AliasList aliasList )
|
||||
{
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0f, true );
|
||||
|
||||
mBandPassFilter = new RealFIRFilter_RB_RB(
|
||||
Filters.FIRBP_1200FSK_24000FS.getCoefficients(), 1.02f );
|
||||
mDecimationFilter.setListener( mBandPassFilter );
|
||||
|
||||
mFSKDecoder = new FSK2Decoder( DECIMATED_SAMPLE_RATE,
|
||||
SYMBOL_RATE, Output.INVERTED );
|
||||
mBandPassFilter.setListener( mFSKDecoder );
|
||||
|
||||
mFSKDecoder.setListener( mFSKDecoderBroadcaster );
|
||||
|
||||
mTowerMessageFramer = new MessageFramer(
|
||||
SyncPattern.LJ1200.getPattern(), MESSAGE_LENGTH );
|
||||
mTransponderMessageFramer = new MessageFramer(
|
||||
SyncPattern.LJ1200_TRANSPONDER.getPattern(), MESSAGE_LENGTH );
|
||||
mFSKDecoderBroadcaster.addListener( mTowerMessageFramer );
|
||||
mFSKDecoderBroadcaster.addListener( mTransponderMessageFramer );
|
||||
|
||||
mMessageProcessor = new LJ1200MessageProcessor( aliasList );
|
||||
mTowerMessageFramer.addMessageListener( mMessageProcessor );
|
||||
mTransponderMessageFramer.addMessageListener( mMessageProcessor );
|
||||
mMessageProcessor.setMessageListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LJ_1200;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
|
||||
mDecimationFilter.dispose();
|
||||
mBandPassFilter.dispose();
|
||||
mFSKDecoder.dispose();
|
||||
mTowerMessageFramer.dispose();
|
||||
mMessageProcessor.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a float listener interface for connecting this decoder to a
|
||||
* float stream provider
|
||||
*/
|
||||
public RealSampleListener getRealReceiver()
|
||||
{
|
||||
return (RealSampleListener)mDecimationFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TapGroup> getTapGroups()
|
||||
{
|
||||
if( mAvailableTaps == null )
|
||||
{
|
||||
mAvailableTaps = new ArrayList<TapGroup>();
|
||||
|
||||
TapGroup group = new TapGroup( "LJ-1200 Decoder" );
|
||||
|
||||
group.add( new FloatTap(
|
||||
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
||||
group.add( new BinaryTap(
|
||||
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
||||
|
||||
mAvailableTaps.add( group );
|
||||
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||
}
|
||||
|
||||
return mAvailableTaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTap( Tap tap )
|
||||
{
|
||||
mFSKDecoder.registerTap( tap );
|
||||
|
||||
switch( tap.getName() )
|
||||
{
|
||||
case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD:
|
||||
FloatBufferTap bpTap = (FloatBufferTap)tap;
|
||||
mBandPassFilter.setListener( bpTap );
|
||||
bpTap.setListener( mFSKDecoder );
|
||||
break;
|
||||
case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER:
|
||||
BinaryTap decoderTap = (BinaryTap)tap;
|
||||
mFSKDecoder.setListener( decoderTap );
|
||||
decoderTap.setListener( mTowerMessageFramer );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterTap( Tap tap )
|
||||
{
|
||||
mFSKDecoder.unregisterTap( tap );
|
||||
|
||||
switch( tap.getName() )
|
||||
{
|
||||
case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD:
|
||||
mBandPassFilter.setListener( mFSKDecoder );
|
||||
break;
|
||||
case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER:
|
||||
mFSKDecoder.setListener( mTowerMessageFramer );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<RealBuffer> getFilteredRealBufferListener()
|
||||
{
|
||||
return mDecimationFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.channel.metadata.AliasedStringAttributeMonitor;
|
||||
import io.github.dsheirer.channel.metadata.Attribute;
|
||||
import io.github.dsheirer.channel.state.DecoderState;
|
||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||
import io.github.dsheirer.channel.state.State;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.module.decode.DecoderType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
import io.github.dsheirer.alias.id.AliasIDType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public class LJ1200DecoderState extends DecoderState
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LJ1200DecoderState.class);
|
||||
|
||||
private Set<String> mAddresses = new TreeSet<String>();
|
||||
|
||||
private AliasedStringAttributeMonitor mAddressAttribute;
|
||||
|
||||
public LJ1200DecoderState(AliasList aliasList)
|
||||
{
|
||||
super(aliasList);
|
||||
|
||||
mAddressAttribute = new AliasedStringAttributeMonitor(Attribute.SECONDARY_ADDRESS_TO,
|
||||
getAttributeChangeRequestListener(), getAliasList(), AliasIDType.SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LJ_1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ScheduledExecutorService executor)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(message instanceof LJ1200Message)
|
||||
{
|
||||
LJ1200Message lj = (LJ1200Message) message;
|
||||
|
||||
if(lj.isValid())
|
||||
{
|
||||
String address = lj.getAddress();
|
||||
|
||||
mAddressAttribute.process(address);
|
||||
mAddresses.add(address);
|
||||
|
||||
broadcast(LJ1200CallEvent.getLJ1200Event(lj));
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
}
|
||||
}
|
||||
else if(message instanceof LJ1200TransponderMessage)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivitySummary()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("=============================\n");
|
||||
sb.append("Decoder:\tLJ-1200I\n\n");
|
||||
|
||||
if(!mAddresses.isEmpty())
|
||||
{
|
||||
sb.append("Transponder Addresses:\n");
|
||||
|
||||
List<String> addresses = new ArrayList<String>(mAddresses);
|
||||
|
||||
Collections.sort(addresses);
|
||||
|
||||
for(String address : addresses)
|
||||
{
|
||||
sb.append("\t");
|
||||
sb.append(address);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization steps */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
if(event.getEvent() == Event.RESET)
|
||||
{
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
mAddressAttribute.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mAddresses.clear();
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.bits.BinaryMessage;
|
||||
import io.github.dsheirer.edac.CRC;
|
||||
import io.github.dsheirer.edac.CRCLJ;
|
||||
import io.github.dsheirer.map.Plottable;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LJ1200Message extends Message
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( LJ1200Message.class );
|
||||
|
||||
public static final String[] REPLY_CODE = { "0","1","2","3","4","5","6","7",
|
||||
"8","9","A","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S",
|
||||
"T","U","V","W","X","Y" };
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
|
||||
public static int[] VRC = { 23,22,21,20,19,18,17,16 };
|
||||
|
||||
public static int[] LRC = { 31,30,29,28,27,26,25,24 };
|
||||
|
||||
public static int[] FUNCTION = { 35,34,33,32 };
|
||||
|
||||
public static int[] ADDRESS = { 63,62,61,60,59,58,57,56,55,54,53,52,51,50,
|
||||
49,48,47,46,45,44,43,42,41,40,39,38,37,36 };
|
||||
|
||||
public static int[] REPLY_1 = { 39,38,37,36,43 };
|
||||
public static int[] REPLY_2 = { 42,41,40,47,46 };
|
||||
public static int[] REPLY_3 = { 45,44,51,50,49 };
|
||||
public static int[] REPLY_4 = { 48,55,54,53,52 };
|
||||
public static int[] REPLY_5 = { 59,58,57,56,63 };
|
||||
|
||||
public static int[] MESSAGE_CRC = { 79,78,77,76,75,74,73,72,71,70,69,68,67,
|
||||
66,65,64 };
|
||||
|
||||
private BinaryMessage mMessage;
|
||||
private AliasList mAliasList;
|
||||
private CRC mCRC;
|
||||
|
||||
public LJ1200Message( BinaryMessage message, AliasList list )
|
||||
{
|
||||
mMessage = message;
|
||||
mAliasList = list;
|
||||
|
||||
checkCRC();
|
||||
|
||||
switch( mCRC )
|
||||
{
|
||||
case CORRECTED:
|
||||
mLog.debug( "CORR:" + message.toString() );
|
||||
break;
|
||||
case FAILED_CRC:
|
||||
mLog.debug( "FAIL:" + message.toString() );
|
||||
break;
|
||||
case PASSED:
|
||||
mLog.debug( "PASS:" + message.toString() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCRC()
|
||||
{
|
||||
mCRC = CRCLJ.checkAndCorrect( mMessage );
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
|
||||
}
|
||||
|
||||
public String getVRC()
|
||||
{
|
||||
return mMessage.getHex( VRC, 2 );
|
||||
}
|
||||
|
||||
public String getLRC()
|
||||
{
|
||||
return mMessage.getHex( LRC, 2 );
|
||||
}
|
||||
|
||||
public String getCRC()
|
||||
{
|
||||
return mMessage.getHex( MESSAGE_CRC, 4 );
|
||||
}
|
||||
|
||||
public Function getFunction()
|
||||
{
|
||||
return Function.fromValue( mMessage.getInt( FUNCTION ),
|
||||
mMessage.getInt( REPLY_3 ) );
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return mMessage.getHex( ADDRESS, 7 );
|
||||
}
|
||||
|
||||
public Alias getTransponderAlias()
|
||||
{
|
||||
if( mAliasList != null )
|
||||
{
|
||||
return mAliasList.getESNAlias( getAddress() );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getFunctionAndIDAlias()
|
||||
{
|
||||
if( mAliasList != null )
|
||||
{
|
||||
return mAliasList.getLoJackAlias( getFunction(), getReplyCode() );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 5 character reply code for function E and F, transponder activation.
|
||||
* @return - reply code
|
||||
*/
|
||||
public String getReplyCode()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_1 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_2 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_3 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_4 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_5 ) ] );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Function function = getFunction();
|
||||
|
||||
sb.append( "FUNCTION: " );
|
||||
sb.append( function.toString() );
|
||||
|
||||
switch( function )
|
||||
{
|
||||
case F1_SITE_ID:
|
||||
sb.append( " SITE [" );
|
||||
break;
|
||||
case F1_SPEED_UP:
|
||||
case F2_TEST:
|
||||
case F3_DEACTIVATE:
|
||||
case F4_ACTIVATE:
|
||||
case FF_TRACK_PULSE:
|
||||
default:
|
||||
sb.append( " REPLY CODE [" );
|
||||
break;
|
||||
}
|
||||
|
||||
sb.append( getReplyCode() );
|
||||
|
||||
Alias site = getFunctionAndIDAlias();
|
||||
|
||||
if( site != null )
|
||||
{
|
||||
sb.append( "/" );
|
||||
sb.append( site.getName() );
|
||||
}
|
||||
|
||||
sb.append( "] ADDRESS [" );
|
||||
sb.append( getAddress() );
|
||||
sb.append( "] VRC [" + getVRC() );
|
||||
sb.append( "] LRC [" + getLRC() );
|
||||
sb.append( "] CRC [" + getCRC() );
|
||||
sb.append( "]" );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pads spaces onto the end of the value to make it 'places' long
|
||||
*/
|
||||
public String pad( String value, int places, String padCharacter )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( value );
|
||||
|
||||
while( sb.length() < places )
|
||||
{
|
||||
sb.append( padCharacter );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pads an integer value with additional zeroes to make it decimalPlaces long
|
||||
*/
|
||||
public String format( int number, int decimalPlaces )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
|
||||
|
||||
for( int x = 0; x < paddingRequired; x++)
|
||||
{
|
||||
sb.append( "0" );
|
||||
}
|
||||
|
||||
sb.append( number );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBinaryMessage()
|
||||
{
|
||||
return mMessage.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol()
|
||||
{
|
||||
return "LJ-1200";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType()
|
||||
{
|
||||
if( getFunction() == Function.F1_SPEED_UP )
|
||||
{
|
||||
return "TRANSPONDER";
|
||||
}
|
||||
|
||||
return "TOWER";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFromID()
|
||||
{
|
||||
return getReplyCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return getFunctionAndIDAlias();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToID()
|
||||
{
|
||||
return getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorStatus()
|
||||
{
|
||||
return mCRC.getDisplayText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plottable getPlottable()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum Function
|
||||
{
|
||||
/* Big Endian Format */
|
||||
F0_UNKNOWN( "0-UNKNOWN" ),
|
||||
F1_SITE_ID( "1Y-SITE ID" ),
|
||||
F1_SPEED_UP( "1-SPEED UP" ),
|
||||
F2_TEST( "2-TOWER TEST" ),
|
||||
F3_DEACTIVATE( "3-DEACTIVATE" ),
|
||||
F4_ACTIVATE( "4-ACTIVATE" ),
|
||||
F5_TRANSPONDER_TEST_REPLY( "5-TRANSPONDER TEST REPLY" ),
|
||||
F6_TRANSPONDER_TEST_COMMAND( "6-TRANSPONDER TEST COMMAND" ),
|
||||
F7_QUIET_COMMAND( "7-QUIET COMMAND" ),
|
||||
F8_UNKNOWN( "8-UNKNOWN" ),
|
||||
F9_UNKNOWN( "9-UNKNOWN" ),
|
||||
FA_UNKNOWN( "A-UNKNOWN" ),
|
||||
FB_UNKNOWN( "B-UNKNOWN" ),
|
||||
FC_ALT_DEACTIVATE( "C-ALT-DEACTIVATE" ),
|
||||
FD_UNKNOWN( "D-UNKNOWN" ),
|
||||
FE_UNKNOWN( "E-UNKNOWN" ),
|
||||
FF_TRACK_PULSE( "F-TRACK PULSE" ),
|
||||
|
||||
UNKNOWN( "UNKNOWN" );
|
||||
|
||||
private String mLabel;
|
||||
|
||||
private Function( String label )
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public static Function fromValue( int value, int replyCodeDigit3 )
|
||||
{
|
||||
switch( value )
|
||||
{
|
||||
case 0:
|
||||
return Function.F0_UNKNOWN;
|
||||
case 1:
|
||||
if( replyCodeDigit3 == 31 ) /* 'Y' middle character */
|
||||
{
|
||||
return Function.F1_SITE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Function.F1_SPEED_UP;
|
||||
}
|
||||
case 2:
|
||||
return Function.F2_TEST;
|
||||
case 3:
|
||||
return Function.F3_DEACTIVATE;
|
||||
case 4:
|
||||
return Function.F4_ACTIVATE;
|
||||
case 5:
|
||||
return Function.F5_TRANSPONDER_TEST_REPLY;
|
||||
case 6:
|
||||
return Function.F6_TRANSPONDER_TEST_COMMAND;
|
||||
case 7:
|
||||
return Function.F7_QUIET_COMMAND;
|
||||
case 8:
|
||||
return Function.F8_UNKNOWN;
|
||||
case 9:
|
||||
return Function.F9_UNKNOWN;
|
||||
case 10:
|
||||
return Function.FA_UNKNOWN;
|
||||
case 11:
|
||||
return Function.FB_UNKNOWN;
|
||||
case 12:
|
||||
return Function.FC_ALT_DEACTIVATE;
|
||||
case 13:
|
||||
return Function.FD_UNKNOWN;
|
||||
case 14:
|
||||
return Function.FE_UNKNOWN;
|
||||
case 15:
|
||||
return Function.FF_TRACK_PULSE;
|
||||
default:
|
||||
return Function.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a listing of aliases contained in the message.
|
||||
*/
|
||||
public List<Alias> getAliases()
|
||||
{
|
||||
List<Alias> aliases = new ArrayList<Alias>();
|
||||
|
||||
Alias functionAndID = getFunctionAndIDAlias();
|
||||
|
||||
if( functionAndID != null )
|
||||
{
|
||||
aliases.add( functionAndID );
|
||||
}
|
||||
|
||||
Alias transponder = getTransponderAlias();
|
||||
|
||||
if( transponder != null )
|
||||
{
|
||||
aliases.add( transponder );
|
||||
}
|
||||
|
||||
return aliases;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.filter.Filter;
|
||||
import io.github.dsheirer.filter.FilterElement;
|
||||
import io.github.dsheirer.message.Message;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LJ1200MessageFilter extends Filter<Message>
|
||||
{
|
||||
|
||||
public LJ1200MessageFilter()
|
||||
{
|
||||
super( "LJ-1200 Message Filter" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean passes( Message message )
|
||||
{
|
||||
return mEnabled && canProcess( message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProcess( Message message )
|
||||
{
|
||||
return message instanceof LJ1200Message ||
|
||||
message instanceof LJ1200TransponderMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilterElement<?>> getFilterElements()
|
||||
{
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.bits.BinaryMessage;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
|
||||
public class LJ1200MessageProcessor implements Listener<BinaryMessage>
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( LJ1200MessageProcessor.class );
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
|
||||
public static int SYNC_TOWER = 0x550F;
|
||||
public static int SYNC_TRANSPONDER = 0x2AD5;
|
||||
|
||||
private Listener<Message> mMessageListener;
|
||||
|
||||
private AliasList mAliasList;
|
||||
|
||||
public LJ1200MessageProcessor( AliasList list )
|
||||
{
|
||||
mAliasList = list;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
mAliasList = null;
|
||||
mMessageListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( BinaryMessage buffer )
|
||||
{
|
||||
int sync = buffer.getInt( SYNC );
|
||||
|
||||
if( sync == SYNC_TOWER )
|
||||
{
|
||||
if( mMessageListener != null )
|
||||
{
|
||||
mMessageListener.receive( new LJ1200Message( buffer, mAliasList ) );
|
||||
}
|
||||
}
|
||||
else if( sync == SYNC_TRANSPONDER )
|
||||
{
|
||||
if( mMessageListener != null )
|
||||
{
|
||||
mMessageListener.receive( new LJ1200TransponderMessage( buffer, mAliasList ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageListener( Listener<Message> listener )
|
||||
{
|
||||
mMessageListener = listener;
|
||||
}
|
||||
|
||||
public void removeMessageListener()
|
||||
{
|
||||
mMessageListener = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.bits.BinaryMessage;
|
||||
import io.github.dsheirer.edac.CRC;
|
||||
import io.github.dsheirer.map.Plottable;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class LJ1200TransponderMessage extends Message
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( LJ1200TransponderMessage.class );
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
|
||||
public static int[] MESSAGE_CRC = { 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 };
|
||||
|
||||
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
|
||||
|
||||
private BinaryMessage mMessage;
|
||||
private AliasList mAliasList;
|
||||
private CRC mCRC;
|
||||
|
||||
public LJ1200TransponderMessage( BinaryMessage message, AliasList list )
|
||||
{
|
||||
mMessage = message;
|
||||
mAliasList = list;
|
||||
|
||||
checkCRC();
|
||||
|
||||
switch( mCRC )
|
||||
{
|
||||
case CORRECTED:
|
||||
mLog.debug( "CORR:" + message.toString() );
|
||||
break;
|
||||
case FAILED_CRC:
|
||||
mLog.debug( "FAIL:" + message.toString() );
|
||||
break;
|
||||
case PASSED:
|
||||
mLog.debug( "PASS:" + message.toString() );
|
||||
break;
|
||||
case UNKNOWN:
|
||||
mLog.debug( "UNKNOWN:" + message.toString() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCRC()
|
||||
{
|
||||
mCRC = CRC.UNKNOWN;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
// return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
|
||||
|
||||
/* Override validity check until proper CRC is implemented */
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getCRC()
|
||||
{
|
||||
return mMessage.getHex( MESSAGE_CRC, 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "TRANSPONDER TEST" );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pads spaces onto the end of the value to make it 'places' long
|
||||
*/
|
||||
public String pad( String value, int places, String padCharacter )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( value );
|
||||
|
||||
while( sb.length() < places )
|
||||
{
|
||||
sb.append( padCharacter );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pads an integer value with additional zeroes to make it decimalPlaces long
|
||||
*/
|
||||
public String format( int number, int decimalPlaces )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
|
||||
|
||||
for( int x = 0; x < paddingRequired; x++)
|
||||
{
|
||||
sb.append( "0" );
|
||||
}
|
||||
|
||||
sb.append( number );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBinaryMessage()
|
||||
{
|
||||
return mMessage.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol()
|
||||
{
|
||||
return "LJ-1200";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType()
|
||||
{
|
||||
return "TRANSPONDER";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFromID()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToID()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorStatus()
|
||||
{
|
||||
return mCRC.getDisplayText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plottable getPlottable()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user