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

@@ -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;
}
}
}