Changed endianness of LJ1200 message parser and rearranged the message string.

This commit is contained in:
dennis.sheirer
2014-11-18 02:01:26 +00:00
parent def5f9ed6f
commit 960de375bc
4 changed files with 55 additions and 16 deletions

View File

@@ -88,7 +88,7 @@ public class CRCFleetsync
0x08E9, // 000100011101001 Bit 44
0x707E, // 111000001111110 Bit 45
0x383F, // 011100000111111 Bit 46
0x6815, // 110100000010101 Bit 47
0x6815, // 110100000010101 Bit 47
//Single bit errors in the CRC Checksum
0x4000, //Bit 48

View File

@@ -32,14 +32,14 @@ public class LJ1200Message extends Message
{
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
public static int[] VRC = { 16,17,18,19,20,21,22,23 };
public static int[] VRC = { 23,22,21,20,19,18,17,16 };
public static int[] LRC = { 24,25,26,27,28,29,30,31 };
public static int[] LRC = { 31,30,29,28,27,26,25,24 };
public static int[] FUNCTION = { 32,33,34,35 };
public static int[] FUNCTION = { 35,34,33,32 };
public static int[] ADDRESS = { 36,37,38,39,40,41,42,43,44,45,46,47,
48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 };
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[] CRC = { 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 };
@@ -100,9 +100,14 @@ public class LJ1200Message extends Message
return mMessage.getHex( LRC, 2 );
}
public int getFunction()
public String getCRC()
{
return mMessage.getInt( FUNCTION );
return mMessage.getHex( CRC, 4 );
}
public String getFunction()
{
return mMessage.getHex( FUNCTION, 1 );
}
public String getAddress()
@@ -115,10 +120,12 @@ public class LJ1200Message extends Message
{
StringBuilder sb = new StringBuilder();
sb.append( "VRC: " + getVRC() );
sb.append( " LRC: " + getLRC() );
sb.append( " FUNCTION: " + getFunction() );
sb.append( " ADDRESS:" + getAddress() );
sb.append( "FUNCTION [" + getFunction() );
sb.append( "] ADDRESS [" + getAddress() );
sb.append( "] VRC [" + getVRC() );
sb.append( "] LRC [" + getLRC() );
sb.append( "] CRC [" + getCRC() );
sb.append( "]" );
return sb.toString();
}

View File

@@ -4,6 +4,7 @@ import alias.AliasList;
import bits.BitSetBuffer;
import decode.p25.message.tsbk.TSBKMessage;
import decode.p25.reference.DataUnitID;
import decode.p25.reference.Encryption;
import decode.p25.reference.Opcode;
public class ProtectionParameterUpdate extends TSBKMessage
@@ -35,16 +36,16 @@ public class ProtectionParameterUpdate extends TSBKMessage
sb.append( " TGT ADDR: " + getTargetAddress() );
sb.append( " ALGORITHM:" + getAlgorithmID() );
sb.append( " ENCRYPTION ALGORITHM:" + getAlgorithm().name() );
sb.append( " KEY:" + getKeyID() );
return sb.toString();
}
public String getAlgorithmID()
public Encryption getAlgorithm()
{
return mMessage.getHex( ALGORITHM_ID, 2 );
return Encryption.fromValue( mMessage.getInt( ALGORITHM_ID ) );
}
public String getKeyID()

View File

@@ -12,7 +12,8 @@ public enum Encryption
DES_OFB( 0x81 ),
TRIPLE_DES_2_KEY( 0x82 ),
TRIPLE_DES_3_KEY( 0x83 ),
AES( 0x84 );
AES( 0x84 ),
UNKNOWN( -1 );
private int mValue;
@@ -20,4 +21,34 @@ public enum Encryption
{
mValue = value;
}
public static Encryption fromValue( int value )
{
switch( value )
{
case 0x00:
return ACCORDION_1_3;
case 0x01:
return BATON_AUTO_EVEN;
case 0x02:
return FIREFLY_TYPE1;
case 0x03:
return MAYFLY_TYPE1;
case 0x04:
return SAVILLE;
case 0x41:
return BATON_AUTO_ODD;
case 0x80:
return UNENCRYPTED;
case 0x82:
return TRIPLE_DES_2_KEY;
case 0x83:
return TRIPLE_DES_3_KEY;
case 0x84:
return AES;
default:
return UNKNOWN;
}
}
}