Updates to Tait decoder - adds GPS message parsing and SELCAL ident parsing

This commit is contained in:
dennis.sheirer
2015-01-10 20:27:01 +00:00
parent c579f1617d
commit 71c247a7c3
12 changed files with 453 additions and 259 deletions

View File

@@ -150,7 +150,7 @@ public enum SyncPattern
false, true, false, true,false, false, true, true, true
} ),
TAIT_MESSAGE_A( new boolean[]
TAIT_CCDI_GPS_MESSAGE( new boolean[]
{
true,false,true,false,
false,false,false,true,
@@ -158,13 +158,18 @@ public enum SyncPattern
true,true,false,true,
true,true,false,false
}),
TAIT_MESSAGE_B( new boolean[]
TAIT_SELCAL_MESSAGE( new boolean[]
{
// true,false,true,false,
false,false,false,false,
true,true,false,false,
false,true,true,true,
false,true,true,true
// false,false,false,false,
// true,true,false,false,
// false,true,true,true,
// false,true,true,true
false,true,false,false,
false,false,false,true,
true,false,false,false,
true,true,true,false,
true,true,true,false
});
boolean[] mBits;

View File

@@ -39,9 +39,9 @@ public class Tait1200ActivitySummary implements ActivitySummaryProvider,
@Override
public void receive( Message message )
{
if( message instanceof Tait1200MessageA )
if( message instanceof Tait1200GPSMessage )
{
Tait1200MessageA tait = ((Tait1200MessageA)message);
Tait1200GPSMessage tait = ((Tait1200GPSMessage)message);
//Do something here in the future
}

View File

@@ -126,7 +126,7 @@ public class Tait1200CallEvent extends CallEvent
builder.mDetails );
}
public static Tait1200CallEvent getLJ1200Event( Tait1200MessageA message )
public static Tait1200CallEvent getLJ1200Event( Tait1200GPSMessage message )
{
CallEventType type = CallEventType.COMMAND;

View File

@@ -46,7 +46,7 @@ public class Tait1200ChannelState extends AuxChannelState
@Override
public void receive( Message message )
{
if( message instanceof Tait1200MessageA )
if( message instanceof Tait1200GPSMessage )
{
mActivitySummary.receive( message );

View File

@@ -66,11 +66,11 @@ public class Tait1200Decoder extends Decoder implements Instrumentable
private FloatHalfBandFilter mDecimationFilter;
private FloatFIRFilter mBandPassFilter;
private MessageFramer mMessageFramerA;
private MessageFramer mMessageFramerB;
private MessageFramer mMessageFramerGPS;
private MessageFramer mMessageFramerSELCALL;
private Broadcaster<Boolean> mFSKBroadcaster = new Broadcaster<Boolean>();
private Tait1200MessageAProcessor mMessageAProcessor;
private Tait1200MessageBProcessor mMessageBProcessor;
private Tait1200GPSMessageProcessor mMessageAProcessor;
private Tait1200SELCALLMessageProcessor mMessageBProcessor;
public Tait1200Decoder( AliasList aliasList )
{
@@ -91,19 +91,19 @@ public class Tait1200Decoder extends Decoder implements Instrumentable
mFSKDecoder.setListener( mFSKBroadcaster );
mMessageFramerA = new MessageFramer(
SyncPattern.TAIT_MESSAGE_A.getPattern(), MESSAGE_LENGTH );
mMessageFramerB = new MessageFramer(
SyncPattern.TAIT_MESSAGE_B.getPattern(), MESSAGE_LENGTH );
mMessageFramerGPS = new MessageFramer(
SyncPattern.TAIT_CCDI_GPS_MESSAGE.getPattern(), MESSAGE_LENGTH );
mMessageFramerSELCALL = new MessageFramer(
SyncPattern.TAIT_SELCAL_MESSAGE.getPattern(), MESSAGE_LENGTH );
mFSKBroadcaster.addListener( mMessageFramerA );
mFSKBroadcaster.addListener( mMessageFramerB );
mFSKBroadcaster.addListener( mMessageFramerGPS );
mFSKBroadcaster.addListener( mMessageFramerSELCALL );
mMessageAProcessor = new Tait1200MessageAProcessor( aliasList );
mMessageBProcessor = new Tait1200MessageBProcessor( aliasList );
mMessageAProcessor = new Tait1200GPSMessageProcessor( aliasList );
mMessageBProcessor = new Tait1200SELCALLMessageProcessor( aliasList );
mMessageFramerA.addMessageListener( mMessageAProcessor );
mMessageFramerB.addMessageListener( mMessageBProcessor );
mMessageFramerGPS.addMessageListener( mMessageAProcessor );
mMessageFramerSELCALL.addMessageListener( mMessageBProcessor );
mMessageAProcessor.addMessageListener( this );
mMessageBProcessor.addMessageListener( this );
@@ -116,8 +116,8 @@ public class Tait1200Decoder extends Decoder implements Instrumentable
mDecimationFilter.dispose();
mBandPassFilter.dispose();
mFSKDecoder.dispose();
mMessageFramerA.dispose();
mMessageFramerB.dispose();
mMessageFramerGPS.dispose();
mMessageFramerSELCALL.dispose();
mMessageAProcessor.dispose();
mMessageBProcessor.dispose();
}

View File

@@ -0,0 +1,364 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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 decode.tait;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import map.Plottable;
import message.Message;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import alias.Alias;
import alias.AliasList;
import bits.BitSetBuffer;
import edac.CRC;
public class Tait1200GPSMessage extends Message
{
private final static Logger mLog = LoggerFactory.getLogger( Tait1200GPSMessage.class );
public static int[] REVS_1 = { 0,1,2,3 };
public static int[] SYNC = { 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 };
public static int[] SIZE = { 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 };
public static int[] FROM_DIGIT_1 = { 36,37,38,39,40,41,42,43 };
public static int[] FROM_DIGIT_2 = { 44,45,46,47,48,49,50,51 };
public static int[] FROM_DIGIT_3 = { 52,53,54,55,56,57,58,59 };
public static int[] FROM_DIGIT_4 = { 60,61,62,63,64,65,66,67 };
public static int[] FROM_DIGIT_5 = { 68,69,70,71,72,73,74,75 };
public static int[] FROM_DIGIT_6 = { 76,77,78,79,80,81,82,83 };
public static int[] FROM_DIGIT_7 = { 84,85,86,87,88,89,90,91 };
public static int[] FROM_DIGIT_8 = { 92,93,94,95,96,97,98,99 };
public static int[] CHECKSUM_1 = { 100,101,102,103,104,105,106,107,108,109,
110,111,112,113,114,115 };
public static int[] REVS_2 = { 116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131 };
public static int[] SIZE_2 = { 188,189,190,191,192,193,194,195,196,197,198,
199,200,201,202,203 };
public static int[] TO_DIGIT_1 = { 204,205,206,207,208,209,210,211 };
public static int[] TO_DIGIT_2 = { 212,213,214,215,216,217,218,219 };
public static int[] TO_DIGIT_3 = { 220,221,222,223,224,225,226,227 };
public static int[] TO_DIGIT_4 = { 228,229,230,231,232,233,234,235 };
public static int[] TO_DIGIT_5 = { 236,237,238,239,240,241,242,243 };
public static int[] TO_DIGIT_6 = { 244,245,246,247,248,249,250,251 };
public static int[] TO_DIGIT_7 = { 252,253,254,255,256,257,258,259 };
public static int[] TO_DIGIT_8 = { 260,261,262,263,264,265,266,267 };
public static int[] UNKNOWN_1 = { 268,269,270,271,272,273,274,275 };
public static int[] CHECKSUM_2 = { 276,277,278,279,280,281,282,283,284,285,
286,287,288,289,290,291 };
public static int DIVIDER_1 = 292;
public static int[] HOUR_TENS = { 293,294,295 };
public static int[] HOUR_ONES = { 296,297,298,299 };
public static int DIVIDER_2 = 300;
public static int[] MINUTES_TENS = { 301,302,303 };
public static int[] MINUTES_ONES = { 304,305,306,307 };
public static int DIVIDER_3 = 308;
public static int[] SECONDS_TENS = { 309,310,311 };
public static int[] SECONDS_ONES = { 312,313,314,315 };
public static int DIVIDER_4 = 316;
public static int[] LATITUDE_SIGN = { 317,318 };
public static int DIVIDER_5 = 319;
public static int[] LATITUDE_TENS = { 320,321,322,323 };
public static int[] LATITUDE_ONES = { 324,325,326,327 };
// public static int DIVIDER_6 = 328;
// public static int[] LATITUDE_FRACTIONAL = { 329,330,331,332,333,334,335,336,
// 337,338,339,340,341,342,343,344,345,346,347 };
public static int[] LATITUDE_FRACTIONAL = { 328,329,330,331,332,333,334,335,
336,337,338,339,340,341,342,343,344,345,346,347 };
public static int DIVIDER_7 = 348;
public static int[] LONGITUDE_SIGN = { 349,350 };
public static int LONGITUDE_HUNDREDS = 351;
public static int[] LONGITUDE_TENS = { 352,353,354,355 };
public static int[] LONGITUDE_ONES = { 356,357,358,359 };
// public static int DIVIDER_9 = 360;
// public static int[] LONGITUDE_FRACTIONAL = { 361,362,363,364,365,366,367,368,
// 369,370,371,372,373,374,375,376,377,378,379 };
public static int[] LONGITUDE_FRACTIONAL = { 360,361,362,363,364,365,366,
367,368,369,370,371,372,373,374,375,376,377,378,379 };
public static int DIVIDER_10 = 380;
public static int[] UNKNOWN_2 = { 381,382 };
public static int[] DATE_DAY = { 383,384,385,386,387 };
public static int[] DATE_MONTH = { 388,389,390,391 };
public static int[] HEADING = { 392,393,394,395,396,397,398,399,400 };
public static int[] SPEED = { 401,402,403,404,405,406,407,408,409 };
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
private BitSetBuffer mMessage;
private AliasList mAliasList;
private CRC mCRC;
public Tait1200GPSMessage( BitSetBuffer message, AliasList list )
{
mMessage = message;
mAliasList = list;
mLog.debug( toString() );
}
public boolean isValid()
{
//TODO: Override until we figure out the CRC
return true;
}
public int getMessage1Size()
{
return mMessage.getInt( SIZE );
}
public int getMessage2Size()
{
return mMessage.getInt( SIZE_2 );
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append( "GPS FROM:" );
sb.append( getFromID() );
sb.append( " TO:" );
sb.append( getToID() );
sb.append( " LOCATION:" );
GeoPosition location = getGPSLocation();
sb.append( location.getLatitude() );
sb.append( " " );
sb.append( location.getLongitude() );
sb.append( " GPS TIME:" );
sb.append( mSDF.format( new Date( getGPSTime() ) ) );
sb.append( " " );
sb.append( mMessage.toString() );
return sb.toString();
}
public GeoPosition getGPSLocation()
{
double latitude = mMessage.getInt( LATITUDE_TENS ) * 10.0d;
latitude += mMessage.getInt( LATITUDE_ONES );
double latitudeFractional = mMessage.getInt( LATITUDE_FRACTIONAL );
for( int x = 0; x < 20; x++ )
{
latitudeFractional /= 2.0d;
}
latitude += latitudeFractional;
if( mMessage.getInt( LATITUDE_SIGN ) == 0 )
{
latitude *= -1;
}
double longitude = mMessage.get( LONGITUDE_HUNDREDS ) ? 100.0d : 0.0d;
longitude += mMessage.getInt( LONGITUDE_TENS ) * 10.0d;
longitude += mMessage.getInt( LONGITUDE_ONES );
double longitudeFractional = mMessage.getInt( LONGITUDE_FRACTIONAL );
for( int x = 0; x < 20; x++ )
{
longitudeFractional /= 2.0d;
}
longitude += longitudeFractional;
if( mMessage.getInt( LONGITUDE_SIGN ) == 0 )
{
longitude = -1;
}
return new GeoPosition( latitude, longitude );
}
public long getGPSTime()
{
Calendar cal = new GregorianCalendar( TimeZone.getTimeZone( "UTC" ) );
cal.clear();
/* Use current time to get current year */
cal.setTimeInMillis( System.currentTimeMillis() );
cal.set( Calendar.MONTH, mMessage.getInt( DATE_MONTH ) );
cal.set( Calendar.DAY_OF_MONTH, mMessage.getInt( DATE_DAY ) );
cal.set( Calendar.HOUR_OF_DAY, ( mMessage.getInt( HOUR_TENS ) * 10 ) +
mMessage.getInt( HOUR_ONES ) );
cal.set( Calendar.MINUTE, ( mMessage.getInt( MINUTES_TENS ) * 10 ) +
mMessage.getInt( MINUTES_ONES ) );
cal.set( Calendar.SECOND, ( mMessage.getInt( SECONDS_TENS ) * 10 ) +
mMessage.getInt( SECONDS_ONES ) );
cal.set( Calendar.MILLISECOND, 0 );
return cal.getTimeInMillis();
}
@Override
public String getFromID()
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( FROM_DIGIT_1 ) );
sb.append( getCharacter( FROM_DIGIT_2 ) );
sb.append( getCharacter( FROM_DIGIT_3 ) );
sb.append( getCharacter( FROM_DIGIT_4 ) );
sb.append( getCharacter( FROM_DIGIT_5 ) );
sb.append( getCharacter( FROM_DIGIT_6 ) );
sb.append( getCharacter( FROM_DIGIT_7 ) );
sb.append( getCharacter( FROM_DIGIT_8 ) );
return sb.toString();
}
@Override
public Alias getFromIDAlias()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getFromID() );
}
return null;
}
@Override
public String getToID()
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( TO_DIGIT_1 ) );
sb.append( getCharacter( TO_DIGIT_2 ) );
sb.append( getCharacter( TO_DIGIT_3 ) );
sb.append( getCharacter( TO_DIGIT_4 ) );
sb.append( getCharacter( TO_DIGIT_5 ) );
sb.append( getCharacter( TO_DIGIT_6 ) );
sb.append( getCharacter( TO_DIGIT_7 ) );
sb.append( getCharacter( TO_DIGIT_8 ) );
return sb.toString();
}
@Override
public Alias getToIDAlias()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getToID() );
}
return null;
}
public char getCharacter( int[] bits )
{
int value = mMessage.getInt( bits );
return (char)value;
}
/**
* 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 "Tait-1200";
}
@Override
public String getEventType()
{
return "GPS";
}
@Override
public String getMessage()
{
return toString();
}
@Override
public String getErrorStatus()
{
return "UNKNOWN";
// return mCRC.getDisplayText();
}
@Override
public Plottable getPlottable()
{
return new Plottable( getGPSTime(), getGPSLocation(), getFromID(),
getFromIDAlias() );
}
}

View File

@@ -27,16 +27,16 @@ import sample.Listener;
import alias.AliasList;
import bits.BitSetBuffer;
public class Tait1200MessageAProcessor implements Listener<BitSetBuffer>
public class Tait1200GPSMessageProcessor implements Listener<BitSetBuffer>
{
private final static Logger mLog =
LoggerFactory.getLogger( Tait1200MessageAProcessor.class );
LoggerFactory.getLogger( Tait1200GPSMessageProcessor.class );
private Broadcaster<Message> mBroadcaster = new Broadcaster<Message>();
private AliasList mAliasList;
public Tait1200MessageAProcessor( AliasList list )
public Tait1200GPSMessageProcessor( AliasList list )
{
mAliasList = list;
}
@@ -49,7 +49,7 @@ public class Tait1200MessageAProcessor implements Listener<BitSetBuffer>
@Override
public void receive( BitSetBuffer buffer )
{
mBroadcaster.receive( new Tait1200MessageA( buffer, mAliasList ) );
mBroadcaster.receive( new Tait1200GPSMessage( buffer, mAliasList ) );
}
public void addMessageListener( Listener<Message> listener )

View File

@@ -1,184 +0,0 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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 decode.tait;
import java.text.SimpleDateFormat;
import map.Plottable;
import message.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import alias.Alias;
import alias.AliasList;
import bits.BitSetBuffer;
import edac.CRC;
public class Tait1200MessageB extends Message
{
private final static Logger mLog = LoggerFactory.getLogger( Tait1200MessageB.class );
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
private BitSetBuffer mMessage;
private AliasList mAliasList;
private CRC mCRC;
public Tait1200MessageB( BitSetBuffer 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;
// }
}
private void checkCRC()
{
// mCRC = CRCLJ.checkAndCorrect( mMessage );
}
public boolean isValid()
{
// return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
return true;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append( "TAIT MESSAGE B " );
sb.append( mMessage.toString() );
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 "Tait-1200";
}
@Override
public String getEventType()
{
return "Unknown";
}
@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 "UNKNOWN";
// return mCRC.getDisplayText();
}
@Override
public Plottable getPlottable()
{
return null;
}
}

View File

@@ -24,7 +24,7 @@ public class Tait1200MessageFilter extends Filter<Message>
@Override
public boolean canProcess( Message message )
{
return message instanceof Tait1200MessageA;
return message instanceof Tait1200GPSMessage;
}
@Override

View File

@@ -27,16 +27,16 @@ import sample.Listener;
import alias.AliasList;
import bits.BitSetBuffer;
public class Tait1200MessageBProcessor implements Listener<BitSetBuffer>
public class Tait1200SELCALLMessageProcessor implements Listener<BitSetBuffer>
{
private final static Logger mLog =
LoggerFactory.getLogger( Tait1200MessageBProcessor.class );
LoggerFactory.getLogger( Tait1200SELCALLMessageProcessor.class );
private Broadcaster<Message> mBroadcaster = new Broadcaster<Message>();
private AliasList mAliasList;
public Tait1200MessageBProcessor( AliasList list )
public Tait1200SELCALLMessageProcessor( AliasList list )
{
mAliasList = list;
}
@@ -49,7 +49,7 @@ public class Tait1200MessageBProcessor implements Listener<BitSetBuffer>
@Override
public void receive( BitSetBuffer buffer )
{
mBroadcaster.receive( new Tait1200MessageB( buffer, mAliasList ) );
mBroadcaster.receive( new Tait1200SELCALMessage( buffer, mAliasList ) );
}
public void addMessageListener( Listener<Message> listener )

View File

@@ -30,9 +30,9 @@ import alias.AliasList;
import bits.BitSetBuffer;
import edac.CRC;
public class Tait1200MessageA extends Message
public class Tait1200SELCALMessage extends Message
{
private final static Logger mLog = LoggerFactory.getLogger( Tait1200MessageA.class );
private final static Logger mLog = LoggerFactory.getLogger( Tait1200SELCALMessage.class );
public static int[] REVS_1 = { 0,1,2,3 };
public static int[] SYNC = { 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 };
@@ -47,9 +47,9 @@ public class Tait1200MessageA extends Message
public static int[] FROM_DIGIT_8 = { 92,93,94,95,96,97,98,99 };
public static int[] CHECKSUM_1 = { 100,101,102,103,104,105,106,107,108,109,
110,111,112,113,114,115 };
public static int[] REVS_2 = { 116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131 };
public static int[] SIZE_2 = { 188,189,190,191,192,193,194,195,196,197,198,
199,200,201,202,203 };
public static int[] TO_DIGIT_1 = { 204,205,206,207,208,209,210,211 };
@@ -60,6 +60,9 @@ public class Tait1200MessageA extends Message
public static int[] TO_DIGIT_6 = { 244,245,246,247,248,249,250,251 };
public static int[] TO_DIGIT_7 = { 252,253,254,255,256,257,258,259 };
public static int[] TO_DIGIT_8 = { 260,261,262,263,264,265,266,267 };
public static int[] UNKNOWN_1 = { 268,269,270,271,272,273,274,275 };
public static int[] CHECKSUM_2 = { 276,277,278,279,280,281,282,283,284,285,
286,287,288,289,290,291 };
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
@@ -67,45 +70,25 @@ public class Tait1200MessageA extends Message
private AliasList mAliasList;
private CRC mCRC;
public Tait1200MessageA( BitSetBuffer message, AliasList list )
public Tait1200SELCALMessage( BitSetBuffer message, AliasList list )
{
mMessage = message;
mAliasList = list;
}
public boolean isValid()
{
//TODO: Override until we figure out the CRC
return true;
}
public int getMessage1Size()
{
return mMessage.getInt( SIZE );
}
public int getMessage2Size()
{
return mMessage.getInt( SIZE_2 );
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append( "TAIT MESSAGE A FROM:" );
sb.append( getFromID() );
sb.append( " TO:" );
sb.append( getToID() );
sb.append( " SIZES:" );
sb.append( getMessage1Size() );
sb.append( "/" );
sb.append( getMessage2Size() );
sb.append( " " );
sb.append( mMessage.toString() );
return sb.toString();
// 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;
// }
}
@Override
@@ -171,6 +154,30 @@ public class Tait1200MessageA extends Message
return (char)value;
}
private void checkCRC()
{
// mCRC = CRCLJ.checkAndCorrect( mMessage );
}
public boolean isValid()
{
// return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
return true;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append( "SELCAL FROM:" );
sb.append( getFromID() );
sb.append( " TO:" );
sb.append( getToID() );
return sb.toString();
}
/**
* Pads spaces onto the end of the value to make it 'places' long
*/
@@ -222,7 +229,7 @@ public class Tait1200MessageA extends Message
@Override
public String getEventType()
{
return "Unknown";
return "SELCAL";
}
@Override

View File

@@ -57,7 +57,9 @@ public class SymbolEvent
public enum Shift
{
LEFT( "<" ),
AGGRESSIVE_LEFT( "<<" ),
RIGHT( ">" ),
AGGRESSIVE_RIGHT( ">>" ),
NONE( "=" );
private String mLabel;