示例#1
0
 public void CopyTo(csKMPLogRegisters array, int index)
 {
     foreach (csKMPLogRegister csKmpLogRegister in array)
     {
         this.m_List.Insert(index, csKmpLogRegister);
     }
 }
示例#2
0
 public void CopyRecordsTo(csKMPLogRegisters array, int index)
 {
     foreach (csKMPLogRegister csKmpLogRegister in array.m_List)
     {
         this.GetKMPLogRegister(csKmpLogRegister.RegisterId).CopyRecordsTo(csKmpLogRegister.Records);
     }
 }
示例#3
0
        public bool GetLogFromRecordIdTowardsPresent(byte DestinationAddress, byte LogId, ushort[] registers, byte noOfRecords, ushort fromRecordId, ref ushort lastRecordId, ref ushort newestRecordId, ref byte info, ref csKMPLogRegisters KMPLogRegisters, out string ErrorMessage)
        {
            bool PortOpened = false;
            byte bytCID     = (byte)162;

            if (!this.HandlePortOpen(out PortOpened, out ErrorMessage))
            {
                return(false);
            }
            byte      num1    = Convert.ToByte(registers.Length);
            ArrayList arrData = new ArrayList();

            arrData.Add((object)LogId);
            arrData.Add((object)num1);
            foreach (ushort shoValue in registers)
            {
                arrData.AddRange((ICollection)csTools.ShortToBigEndianBytes(shoValue));
            }
            arrData.Add((object)noOfRecords);
            arrData.Add((object)Convert.ToByte(128));
            arrData.AddRange((ICollection)csTools.ShortToBigEndianBytes(fromRecordId));
            ArrayList data = this.get_data(new csDataFrame(ControlCharacters.TXStart, DestinationAddress, bytCID, arrData, ControlCharacters.StopByte).GetCommBuffer(), out ErrorMessage);

            if (data == null)
            {
                this.HandlePortClose(PortOpened);
                return(false);
            }
            csDataFrame objGetLogDataAns = new csDataFrame(data);

            if (!objGetLogDataAns.CRC || objGetLogDataAns.Data.Count < 4)
            {
                this.HandlePortClose(PortOpened);
                return(false);
            }
            byte num2 = (byte)objGetLogDataAns.Data[1];

            KMPLogRegisters.Clear();
            int num3 = objGetLogDataAns.Data.Count - 3;

            lastRecordId   = Functions.GetUshortFromLogData(objGetLogDataAns, objGetLogDataAns.Data.Count - 5);
            newestRecordId = Functions.GetUshortFromLogData(objGetLogDataAns, objGetLogDataAns.Data.Count - 3);
            info           = (byte)objGetLogDataAns.Data[objGetLogDataAns.Data.Count - 1];
            ushort num4     = (ushort)0;
            ushort num5     = (ushort)0;
            int    pointer1 = 2;

            while (num3 - pointer1 > 5)
            {
                num5      = Functions.GetUshortFromLogData(objGetLogDataAns, pointer1);
                pointer1 += 2;
                ++num4;
                if ((int)num4 == 1)
                {
                    for (int index1 = 1; index1 <= (int)num2; ++index1)
                    {
                        csKMPLogRegister csKmpLogRegister = new csKMPLogRegister(noOfRecords);
                        csKmpLogRegister.RegisterId = Functions.GetUshortFromLogData(objGetLogDataAns, pointer1);
                        int index2 = pointer1 + 2;
                        csKmpLogRegister.Unit = (byte)objGetLogDataAns.Data[index2];
                        int index3 = index2 + 1;
                        csKmpLogRegister.Size = (byte)objGetLogDataAns.Data[index3];
                        int index4 = index3 + 1;
                        csKmpLogRegister.SignEx = (byte)objGetLogDataAns.Data[index4];
                        int pointer2 = index4 + 1;
                        csKmpLogRegister.Records[(int)num4 - 1] = Functions.GetDoubleFromLogData(objGetLogDataAns, csKmpLogRegister.SignEx, pointer2);
                        pointer1 = pointer2 + 4;
                        KMPLogRegisters.Add(csKmpLogRegister);
                    }
                }
                else
                {
                    for (int index = 1; index <= (int)num2; ++index)
                    {
                        csKMPLogRegister csKmpLogRegister = KMPLogRegisters[index - 1];
                        csKmpLogRegister.Records[(int)num4 - 1] = Functions.GetDoubleFromLogData(objGetLogDataAns, csKmpLogRegister.SignEx, pointer1);
                        pointer1 += 4;
                    }
                }
            }
            this.HandlePortClose(PortOpened);
            return(true);
        }