using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LK{publicclassComplementTOoriginal{publicstatic double complementTOoriginal(byte[] byteArray){
double _Speed =0;
byte[] data = byteArray;// 解析数据// 当上传的数据为负数时 if((UInt16)(data[1]&0x08)==0x08){//补码
byte[] d = data.Skip(2).Take(2).ToArray();//补码转反码
d[1]-=1;for(int i =0; i <2; i++){
d[i]=(byte)~d[i];}//原码转源数据
_Speed =-Convert.ToInt32(BitConverter.ToString(d).Replace("-",""),16);}// 当待解析的数据为正数时else{
_Speed = Convert.ToInt32(BitConverter.ToString(data).Replace("-",""),16);}return _Speed /1000;//单位转化,实际需根据解析手册}}}