/// <summary> /// byte数组是一个 8Byte的数组 /// </summary> /// <param name="sign"></param> /// <param name="arr"></param> /// <returns></returns> public static String AnalysisDisplayData(SubDisplaySign sign, byte[] arr) { List <int> lreturn = new List <int>(); lreturn.Add(arr[5]); if (sign.floatLocation == 5) { lreturn.Add(9999); } lreturn.Add((arr[6] & 0xf0) >> 4); if (sign.floatLocation == 4) { lreturn.Add(9999); } lreturn.Add(arr[6] & 0xf); if (sign.floatLocation == 3) { lreturn.Add(9999); } lreturn.Add((arr[7] & 0xf0) >> 4); if (sign.floatLocation == 2) { lreturn.Add(9999); } lreturn.Add(arr[7] & 0xf); if (sign.floatLocation == 1) { lreturn.Add(9999); } if (sign.isLetter) { for (int i = 0; i < lreturn.Count; i++) { lreturn[i] += 100; } } List <String> lresp = new List <string>(); if (lreturn.TrueForAll(k => k == 13 || k == 113)) { return("login"); } if (lreturn.TrueForAll(k => k == 12 || k == 112)) { return("no"); } if (lreturn.TrueForAll(k => k == 11 || k == 111)) { return("yes"); } lreturn.ForEach(k => lresp.Add(dicreverse[k])); StringBuilder sb = new StringBuilder(); lresp.ForEach(k => sb.Append(k)); return(sb.ToString()); }
public static SubDisplaySign AnalysisSubDisplaySign(Byte sign) { SubDisplaySign ana = new SubDisplaySign(); if ((sign & 0x80) != 0) { ana.isLetter = true; } ana.floatLocation = (sign & 0x70) >> 4; ana.batteryLevel = (sign & 0xF); return(ana); }