/// <summary> /// 数据库实体转换 /// </summary> /// <param name="baseEntity"></param> /// <returns></returns> public override BaseEntity ConvertEntity(BYDQBaseEntity baseEntity) { var entity = baseEntity as RemoteDebugDownEntity; var protocol = new RemoteDebugDown(); protocol.Encryption = Convert.ToByte(entity.Encryption); protocol.Type = Convert.ToByte(entity.Type); protocol.CMD = Convert.ToByte(entity.CMD); protocol.FunctionCode = (ushort)entity.FunctionNumber; protocol.ResponseSign = Convert.ToByte(entity.ResponseSign); protocol.FunctionStatus = Convert.ToByte(entity.FunctionStatus); protocol.UniqueIdentity = entity.UniqueIdentity; protocol.ProductType = Convert.ToByte(entity.ProductType); protocol.CloudProductCode = Convert.ToByte(entity.CloudProductCode); protocol.TimeStamp = (ulong)BytesExtend.ConvertDataTimeToLong(entity.Time); protocol.UUID = entity.UUID; protocol.CNT = Convert.ToByte(entity.CNT); protocol.SEQ = Convert.ToByte(entity.SEQ); protocol.CNT = Convert.ToByte(entity.CNT); protocol.SEQ = Convert.ToByte(entity.SEQ); protocol.DiagnosticDataType = Convert.ToByte(entity.DiagnosticDataType); protocol.SecurityAuthentication = Convert.ToByte(entity.SecurityAuthentication); protocol.DiagnosticMode = Convert.ToByte(entity.DiagnosticMode); protocol.SendCANID = (uint)entity.SendCANID; protocol.RecCANID = (uint)entity.RecCANID; protocol.FrameType = Convert.ToByte(entity.FrameType); protocol.KeyK = (uint)entity.KeyK; protocol.SIDCNT = Convert.ToByte(entity.SIDCNT); protocol.DataUnitList = ProtoBufSerialize.Deserialize <List <DiagnosticDataDown> >(entity.DiagnosticDataList, 0, entity.DiagnosticDataList.Length); return(protocol); }
/// <summary> /// 解析数据库实体为解析实体 /// </summary> /// <param name="protocol"></param> /// <returns></returns> public BaseEntity GetBaseEntity(BYDQBaseEntity protocol) { var functionId = protocol.FunctionNumber; if (functionId == 7002) { var responseSign = protocol.ResponseSign; functionId = Convert.ToUInt16(responseSign == 0xFE ? 0xFE : 0xFF); } var parser = ProtocolParseDictionay[Convert.ToUInt32(functionId)]; return(parser.ConvertEntity(protocol)); }
/// <summary> /// 数据库实体转换 /// </summary> /// <param name="baseEntity"></param> /// <returns></returns> public override BaseEntity ConvertEntity(BYDQBaseEntity baseEntity) { var entity = baseEntity as EventTriggerEntity; var protocol = new EventTrigger(); protocol.Encryption = Convert.ToByte(entity.Encryption); protocol.Type = Convert.ToByte(entity.Type); protocol.CMD = Convert.ToByte(entity.CMD); protocol.FunctionCode = (ushort)entity.FunctionNumber; protocol.ResponseSign = Convert.ToByte(entity.ResponseSign); protocol.FunctionStatus = Convert.ToByte(entity.FunctionStatus); protocol.UniqueIdentity = entity.UniqueIdentity; protocol.ProductType = Convert.ToByte(entity.ProductType); protocol.CloudProductCode = Convert.ToByte(entity.CloudProductCode); protocol.TimeStamp = (ulong)BytesExtend.ConvertDataTimeToLong(entity.Time); protocol.UUID = entity.UUID; protocol.DT = Convert.ToUInt64(entity.DbDT); protocol.EventCode = Convert.ToByte(entity.EventCode); return(protocol); }
public override BaseEntity ConvertEntity(BYDQBaseEntity baseEntity) { var entity = baseEntity as DispatchInstructionDownEntity; var protocol = new DispatchInstructionDown(); protocol.Encryption = Convert.ToByte(entity.Encryption); protocol.Type = Convert.ToByte(entity.Type); protocol.CMD = Convert.ToByte(entity.CMD); protocol.FunctionCode = (ushort)entity.FunctionNumber; protocol.ResponseSign = Convert.ToByte(entity.ResponseSign); protocol.FunctionStatus = Convert.ToByte(entity.FunctionStatus); protocol.UniqueIdentity = entity.UniqueIdentity; protocol.ProductType = Convert.ToByte(entity.ProductType); protocol.CloudProductCode = Convert.ToByte(entity.CloudProductCode); protocol.TimeStamp = ulong.Parse(entity.TimeStamp);//(ulong)BytesExtend.ConvertDataTimeToLong(entity.Time); protocol.UUID = entity.UUID; protocol.Time1 = entity.Time1.ToBytes6(); protocol.Time2 = entity.Time2.ToBytes6(); return(protocol); }
/// <summary> /// 数据库实体转换 /// </summary> /// <param name="baseEntity"></param> /// <returns></returns> public override BaseEntity ConvertEntity(BYDQBaseEntity baseEntity) { var entity = baseEntity as DataMonitorEntity; var protocol = new DataMonitor(); protocol.Encryption = Convert.ToByte(entity.Encryption); protocol.Type = Convert.ToByte(entity.Type); protocol.CMD = Convert.ToByte(entity.CMD); protocol.FunctionCode = (ushort)entity.FunctionNumber; protocol.ResponseSign = Convert.ToByte(entity.ResponseSign); protocol.FunctionStatus = Convert.ToByte(entity.FunctionStatus); protocol.UniqueIdentity = entity.UniqueIdentity; protocol.ProductType = Convert.ToByte(entity.ProductType); protocol.CloudProductCode = Convert.ToByte(entity.CloudProductCode); protocol.TimeStamp = (ulong)BytesExtend.ConvertDataTimeToLong(entity.Time); protocol.UUID = entity.UUID; protocol.SignType = Convert.ToByte(entity.SignType); protocol.CNT = (ushort)entity.DbCNT; protocol.SEQ = (ushort)entity.DbSEQ; protocol.DataUnitList = ProtoBufSerialize.Deserialize <List <CanMessageData> >(entity.CanMessageData, 0, entity.CanMessageData.Length); return(protocol); }
public override BaseEntity ConvertEntity(BYDQBaseEntity baseEntity) { var entity = baseEntity as RemoteDebugUPEntity; var protocol = new RemoteDebugUP(); protocol.Encryption = Convert.ToByte(entity.Encryption); protocol.Type = Convert.ToByte(entity.Type); protocol.CMD = Convert.ToByte(entity.CMD); protocol.FunctionCode = (ushort)entity.FunctionNumber; protocol.ResponseSign = Convert.ToByte(entity.ResponseSign); protocol.FunctionStatus = Convert.ToByte(entity.FunctionStatus); protocol.UniqueIdentity = entity.UniqueIdentity; protocol.ProductType = Convert.ToByte(entity.ProductType); protocol.CloudProductCode = Convert.ToByte(entity.CloudProductCode); protocol.TimeStamp = (ulong)BytesExtend.ConvertDataTimeToLong(entity.Time); protocol.UUID = entity.UUID; protocol.CNT = Convert.ToByte(entity.CNT); protocol.SEQ = Convert.ToByte(entity.SEQ); protocol.CNT = Convert.ToByte(entity.CNT); protocol.SEQ = Convert.ToByte(entity.SEQ); protocol.DiagnosticResult = Convert.ToByte(entity.DiagnosticResult); protocol.DataUnitList = ProtoBufSerialize.Deserialize <List <DiagnosticDataUP> >(entity.DiagnosticData, 0, entity.DiagnosticData.Length); return(protocol); }
public abstract BaseEntity ConvertEntity(BYDQBaseEntity entity);