예제 #1
0
 public int udpRecvInit(string LocalIP, string[] GroupIP, int GroupPort)           //窄带宽带数据接收与处理
 {
     udpRecv = new udpRecv(LocalIP, GroupIP, GroupPort);                           //建立udp连接
     udpRecv.passParameter += new udpRecv.PassInformationr(udpRecv_passParameter); //委托
     udpRecv.Start();                                                              //开始接收数据
     return(0);
 }
예제 #2
0
        void udpRecv_passParameter(udpRecv sender, byte[] t) //委托事件,udpRecv类传递的数据LX
        {
            double StartFreq       = 0d;                     //初始化起始频率LX
            double StopFreq        = 0d;                     //初始化终止频率LX
            int    Header_DataType = Convert.ToInt32(t[1]);  //数据包帧头中的数据类型LX

            switch (Header_DataType)
            {
            case 1:
                m_DataPacket   = 2048;                             //每路IQ数据长度LX
                m_ChannelCount = 1;                                //每包中的通道数(路数)LX
                byte[][] ChannelData = new byte[m_ChannelCount][]; //存放IQ数据的二维数组LX
                byte[]   Data        = new byte[m_DataPacket];
                m_PacketBandNum = t[2];
                for (int i = 0; i < m_ChannelCount; i++)
                {
                    ChannelData[i] = new byte[m_DataPacket];
                    Buffer.BlockCopy(t, 96 + m_DataPacket * i, ChannelData[i], 0, m_DataPacket);    //接收到的数据分通道放入二维数组
                }
                if (m_PacketBandNum >= 0 && m_PacketBandNum <= 195)
                {
                    Buffer.BlockCopy(ChannelData[m_ChannelCount - 1], 0, Data, 0, m_DataPacket);    //从二位数组中取出选择的一路数据
                }

                StartFreq = nbddcfreq - nbddcbandwidth / 2000;                                      //窄带起始频率
                StopFreq  = nbddcfreq + nbddcbandwidth / 2000;                                      //窄带终止频率
                DataFunction.PushChannelData_NB(Data, StartFreq, m_PacketBandNum, new TimeInfo(t)); //时标检测
                break;

            case 2:
                m_DataPacket    = 2048;                       //每路IQ数据长度LX
                m_ChannelCount  = 20;                         //每包中的通道数(路数)LX//20200224test
                ChannelData     = new byte[m_ChannelCount][]; //存放IQ数据的二维数组LX
                m_PacketBandNum = t[2];
                byte[]   Data_temp = new byte[m_DataPacket];
                TimeInfo time      = new TimeInfo(t);
                for (int i = 0; i < m_ChannelCount; i++)
                {
                    ChannelData[i] = new byte[m_DataPacket];
                    Buffer.BlockCopy(t, 96 + m_DataPacket * i, ChannelData[i], 0, m_DataPacket);                //接收到的数据分通道放入二维数组
                    DataFunction.PushChannelData_BB(ChannelData[i], StartFreq, i + m_PacketBandNum * 20, time); //时标检测
                }
                break;

            default:
                break;
            }
        }