Esempio n. 1
0
 public int udpRecvInit(string LocalIP, int LocalPort)                                            //窄带宽带数据接收与处理
 {
     udpRecv = new udpRecv(LocalIP, LocalPort);                                                   //建立udp连接
     udpRecv.passParameter += new XD_DBDW_Server.udpRecv.PassInformationr(udpRecv_passParameter); //委托
     udpRecv.Start();                                                                             //开始接收数据
     return(0);
 }
Esempio n. 2
0
 void udpRecv_passParameter_FFT(udpRecv sender, byte[] t)//委托事件,udpRecv类传递的数据
 {
     if (t[0] == 0x66 && t[1] == 0x66 && t[2] == 0x66 && t[3] == 0x66)
     {
         m_queue.Enqueue(t);
     }
 }
Esempio n. 3
0
        public int udpRecvInit(string LocalIP, int LocalPort)//窄带宽带数据接收与处理
        {
            udpRecvNB = new udpRecv(LocalIP, 6543);
            udpRecvNB.passParameter += new XD_DBDW_Server.udpRecv.PassInformationr(udpRecv_passParameter_NB);
            udpRecvNB.Start();

            udpRecvFFT = new udpRecv(LocalIP, 8765);
            udpRecvFFT.passParameter += new XD_DBDW_Server.udpRecv.PassInformationr(udpRecv_passParameter_FFT);
            udpRecvFFT.Start();

            udpRecvOrder = new udpRecv(LocalIP, 9876);
            udpRecvOrder.passParameter += new XD_DBDW_Server.udpRecv.PassInformationr(udpRecv_passParameter_Order);
            udpRecvOrder.Start();

            return(0);
        }
Esempio n. 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;
                }
            }
        }
Esempio n. 5
0
        void udpRecv_passParameter_Order(udpRecv sender, byte[] t)//委托事件,udpRecv类传递的数据
        {
            if (t[0] == 0x44 && t[1] == 0x44 && t[2] == 0x44 && t[3] == 0x44 && BitConverter.ToInt32(t, 12) == 0x1000FFFF)
            {
                switch (BitConverter.ToInt32(t, 20))
                {
                case 0x10000002:
                {
                    string        result = "自检成功!";
                    StringBuilder str    = new StringBuilder();
                    ushort        status = BitConverter.ToUInt16(t, 26);
                    for (int i = 0; i < 5; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            str.Append(" 射频AGC_MGC设置");
                            break;

                        case 1:
                            str.Append(" 射频增益设置");
                            break;

                        case 2:
                            str.Append(" 射频状态查询");
                            break;

                        case 3:
                            str.Append(" PCIE工作");
                            break;

                        case 4:
                            str.Append(" 时钟工作");
                            break;
                        }
                        if ((status & (1 << i)) != 0)
                        {
                            str.Append("成功");
                        }
                        else
                        {
                            str.Append("失败");
                            result = "自检失败";
                        }
                    }
                    float temp = BitConverter.ToUInt16(t, 24);
                    str.Append("设备温度: " + (temp * 503.975f / 4096 - 273.15f) + " ℃");
                    form.SetReturnStatus(result + str.ToString());
                    break;
                }

                case 0x10000101:
                {
                    form.SetReturnStatus("窄带频点配置成功");
                    break;
                }

                case 0x10000102:
                {
                    form.SetReturnStatus("窄带带宽配置成功");
                    break;
                }

                case 0x10000103:
                {
                    form.SetReturnStatus("射频衰减控制成功");
                    break;
                }

                case 0x10000302:
                {
                    form.SetReturnStatus("窄带解调模式配置成功");
                    break;
                }

                case 0x10000303:
                {
                    form.SetReturnStatus("CW拍频值设置成功");
                    break;
                }

                case 0x10000ccc:
                {
                    form.SetReturnStatus("24db开关控制成功");
                    break;
                }

                case 0x10000eee:
                {
                    short temp = (short)((t[26] << 8) | t[27]);
                    form.SetReturnStatus("射频衰减值: " + t[24] + "dBm | 是否馈电: " + ((t[25] == 1) ? "是" : "否") + " | 射频温度: " + ((double)temp * 0.03125) + " ℃");
                    break;
                }

                case 0x10000fff:
                {
                    form.SetReturnStatus("射频增益模式: " + ((t[24] == 1) ? "AGC" : "MGC"));
                    break;
                }

                case 0x10000202:
                {
                    form.SetReturnStatus("FFT点数配置成功");
                    break;
                }

                case 0x10000ddd:
                {
                    form.SetReturnStatus("平滑次数配置成功");
                    break;
                }

                default: break;
                }
            }
        }