1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
public static double[] I021_131(byte[] byteData) { var len = byteData.Length; var startIndex = 0; var Len6Ruler = 180 / Math.Pow(2, 23); var Len8Ruler = 180 / Math.Pow(2, 30); var ruler = len == 6 ? Len6Ruler : Len8Ruler; var res = new double[] { 0, 0 };
int startValue = 0; byte lshBit = 0; for (int i = startIndex + len / 2 - 1; i >= startIndex; i--) { startValue += (int)byteData[i] << lshBit; lshBit += 8; } res[1] = startValue * ruler;
int endValue = 0; lshBit = 0; for (int i = startIndex + len - 1; i >= startIndex + len / 2; i--) { endValue += (int)byteData[i] << lshBit; lshBit += 8; }
res[0] = endValue * ruler; return res; }
|