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

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