Пример #1
0
 void udpRecv_passParameter_NB(udpRecv sender, byte[] t)//委托事件,udpRecv类传递的数据
 {
     if (t[0] == 0x66 && t[1] == 0x66 && t[2] == 0x66 && t[3] == 0x66)
     {
         m_queue.Enqueue(t);
     }
 }
        public void IQ_Process(short[] ar, short[] ai)
        {
            DataAndFreq data = new DataAndFreq();

            data.Ar_Data = ar;
            data.Ai_Data = ai;
            m_queue.Enqueue(data);
        }
Пример #3
0
 public void IQ_Process(byte[] t)
 {
     if (dataType == 0 && BitConverter.ToInt32(t, 4) == (uint)DATA_TYPE.DT_NB_DDC) //前4字节是ID 屏蔽网络上的非命令包
     {
         int channel  = BitConverter.ToInt32(t, 16);
         int DATA_LEN = 512 * 2 * 2;
         if (NB_Filter != channel)
         {
             return;
         }
         int    NB_DataMode = BitConverter.ToInt32(t, 92);
         byte[] fData       = new byte[DATA_LEN];
         Array.Copy(t, 104, fData, 0, DATA_LEN);
         //switch ((DataAndFreq.NB_DATA_MODE)NB_DataMode)
         //{
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_IQ:
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_ISB:
         //    {
         //        Array.Copy(t, 104, fData, 0, DATA_LEN);
         //        break;
         //    }
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_AM:
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_USB:
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_CW:
         //    case DataAndFreq.NB_DATA_MODE.NB_MODE_LSB:
         //    {
         //        Array.Copy(t, 104, fData, 0, DATA_LEN / 2);
         //        break;
         //    }
         //}
         DataAndFreq nDataAndFreq = new DataAndFreq(t, fData, 1, null, null, NB_DataMode);
         m_queue.Enqueue(nDataAndFreq);
     }
     else if (dataType == 1 && BitConverter.ToInt32(t, 4) == (uint)DATA_TYPE.DT_WB_FFT)
     {
         FFT_Data fft_Data = FFT_Data.DataProcessFFT(t);
         byte[]   fData    = fft_Data?.data;
         if (fData != null && fft_extract++ == 1)
         {
             fft_extract = 0;
             DataAndFreq nDataAndFreq = new DataAndFreq(t, fData, 3, null, null);
             m_queue.Enqueue(nDataAndFreq);
         }
     }
 }
Пример #4
0
        void udpRecv_passParameter(udpRecv sender, byte[] CltRBuf)                                    //委托事件,udpRecv类传递的数据
        {
            if (CltRBuf[0] == 0x0A && CltRBuf[1] == 0x0B && CltRBuf[2] == 0x0C && CltRBuf[3] == 0x0D) //前4字节是ID 屏蔽网络上的非命令包
            {
                byte   comno    = CltRBuf[4];                                                         // 第5字节是指令ID,可以是处理指令,回放指令等
                string fileName = null;
                switch (comno)
                {
                case 0x10:                                                  // 指令为0x10时表示下达日期,任务号等
                    //cmdIP.Text = iep_Svr.ToString() + "     " + BitConverter.ToInt32(CltRBuf, 13) + "   " + datat;
                    if ((fileName = FindOriDataFromHD(CltRBuf, 0)) != null) // 判断如果找到这个文件,则
                    {
                        m_queue.Enqueue(new FileInfo(fileName, false));
                    }
                    break;

                case 0x11:      // 接收 滤波带宽
                    try
                    {
                        if ((fileName = FindOriDataFromHD(CltRBuf, 0)) != null)      // 判断如果找到这个文件,则
                        {
                            m_queue.Enqueue(new FileInfo(fileName, true, BitConverter.ToInt32(CltRBuf, 5), BitConverter.ToInt32(CltRBuf, 9) / 100));
                        }
                        //bool LoadStartFlag = false;
                        //int LoadPacNum = 0;
                        //LoadStartFlag = true;
                        //bool timerswitch = true;
                        //bool LoadTmDif = true;
                        //int SendCnt = 0;
                    }
                    catch
                    {
                    }
                    break;
                }
            }
        }
Пример #5
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;
                }
            }
            /////////////////////////////////////////////////////////////////
        }
Пример #6
0
 public void SendOrder(byte[] data)
 {
     m_queueSend.Enqueue(data);
 }
Пример #7
0
 /// <summary>
 /// 接收数据处理
 /// </summary>
 /// <param name="revBytesBuf"></param>
 /// <param name="nRecvDatCnt"></param>
 private void RecvDataProc(byte[] revBytesBuf, int nRecvDatCnt)
 {
     byte[] t = new byte[nRecvDatCnt];
     Buffer.BlockCopy(revBytesBuf, 0, t, 0, nRecvDatCnt);
     m_queue.Enqueue(t);//数据进队列LX
 }
 public void PushData(DataAndFreq t)
 {
     m_queue.Enqueue(t);
 }
Пример #9
0
 public void PushData(double[] Data)
 {
     m_queue.Enqueue(Data);
 }