Esempio n. 1
0
 //读取队列数据写入时标文件,
 void m_queue_TEvent(DataAndTime t)
 {
     if (m_FlagTimeSign == true)
     {
         Pro_CheckTime(t);
     }
     m_time_count1++;
     fs.Write(t.Data, 0, (int)(t.Data.Length));
     if (m_time_count1 == 1250)
     {
         m_time_count1 = 0;
         fs.Close();
     }
 }
Esempio n. 2
0
        public void PushChannelData(byte[] t, double StartFreq, int channel, DataTime datatime, TimeInfo timeInfo)
        {
            m_channel   = channel;
            m_StartFreq = StartFreq;
            m_StopFreq  = m_StartFreq + 0.5;//每个子带的带宽LX

            /*记录文件初始化*/
            if (m_FlagSaveLast == false && m_FlagSave == true)
            {
                string time = timeInfo.year.ToString("d") + "_" + timeInfo.month.ToString("d") + "_" + timeInfo.day_offset.ToString("d") + "_" + timeInfo.hour.ToString("d") + "_" + timeInfo.minute.ToString("d") + "_" + timeInfo.second.ToString("d") + "_" + timeInfo.millisecond.ToString("d") + "_" + timeInfo.microsecond.ToString("d");
                path = @"\...\...\RecvData\";
                DirectoryInfo fi = new DirectoryInfo(path);
                if (!fi.Exists)
                {
                    fi.Create();
                }
                fs             = new FileStream(path + @"\" + time + ".dat", FileMode.OpenOrCreate | FileMode.Append);
                m_FlagSaveLast = true;
            }
            else if (m_FlagSaveLast == true && m_FlagSave == false)
            {
                fs.Close();
                m_FlagSaveLast = false;
            }
            if (m_FlagSave == true)
            {
                fs.Write(t, 0, (int)t.Length);
            }

            if (m_FlagTime == true)
            {
                m_time_count++;
                DataAndTime nDataAndTime = new DataAndTime();
                nDataAndTime.Time = datatime;
                nDataAndTime.Data = new byte[(int)t.Length];
                Buffer.BlockCopy(t, 0, nDataAndTime.Data, 0, (int)t.Length);
                m_queue.Enqueue(nDataAndTime);
                if (m_time_count >= 1250)
                {
                    m_time_count = 0;
                    m_FlagTime   = false;
                }
            }
            /////////////////////////////////////////////////////////////////
        }
Esempio n. 3
0
        //
        private void Pro_CheckTime(DataAndTime t)
        {
            short[] IData          = new short[512];
            int[]   DataDifference = new int[512];

            IData[0] = BitConverter.ToInt16(t.Data, 0);

            for (int i = 2; i < 512; i++)
            {
                IData[i]          = BitConverter.ToInt16(t.Data, 4 * i);
                DataDifference[i] = Math.Abs(IData[i] - IData[i - 1]);
                if (DataDifference[i] > 10000 && DataDifference[i - 1] > 6000 && DataDifference[i - 2] > 6000)
                {
                    if (passDeleTimeSign != null)
                    {
                        passDeleTimeSign(t.Time);
                    }
                    m_FlagTimeSign = false;
                    break;
                }
            }
        }