/// <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);
        }
Beispiel #2
0
        protected virtual BaseLogicEntity <TEntity> OnConvert(IFixBufferEntity entity)
        {
            var msg         = ProtoBufSerialize.Deserialize <CommandMsg>(entity.Buffer, entity.Offset, entity.Length);
            var logicEntity = OnConvert(msg);

            logicEntity.FindKey = FindKey;
            return(logicEntity);
        }
 protected override FromIncomBufferEntity OnConvert(IFixBufferEntity communicationEntity)
 {
     try
     {
         var proEntity = ProtoBufSerialize.Deserialize <BaseEntity>(communicationEntity.Buffer, communicationEntity.Offset, communicationEntity.Length);
         //获取解析字典
         return(BaseEntityToBuffer(proEntity));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        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);
        }