Can now parse IBeacon Manufacturer data (need to flip the byte order of
a few fields)
This commit is contained in:
@@ -31,6 +31,17 @@ public class ByteUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static int getIntFrom2ByteArray(byte[] input){
|
||||
final byte[] result = new byte[4];
|
||||
|
||||
result[0] = 0;
|
||||
result[1] = 0;
|
||||
result[2] = input[0];
|
||||
result[3] = input[1];
|
||||
|
||||
return ByteUtils.getIntFromByteArray(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a byte to an int, preserving the sign.
|
||||
*
|
||||
@@ -53,6 +64,7 @@ public class ByteUtils {
|
||||
return ByteBuffer.wrap(bytes).getInt();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts a byte array to a long;
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user