Esempio n. 1
0
        //获取:飞机运行状况
        public static ADS_MessageInfo GetAirCondition(byte[] ADSData)
        {
            ADS_MessageInfo info = new ADS_MessageInfo();

            try
            {
                info.SubType = (int)(ADSData[4]);

                if (info.SubType == 0)
                {
                    info.ICAO    = (uint)((ADSData[0] & 0xFF) << 16 | (ADSData[1] & 0xFF) << 8 | (ADSData[2] & 0xFF));
                    info.Type    = (int)(ADSData[3]);
                    info.MOPS    = ADS_DicMessage.GetMOPS((int)(ADSData[9]));
                    info.CC_CDTI = ADS_DicMessage.GetCC_CDTI((int)((ADSData[6] & 0x10) >> 4));
                    if (ADSData[9] == 0x01)
                    {
                        info.CC_ARV = ADS_DicMessage.GetCC_ARV((int)((ADSData[6] & 0x02) >> 1));
                        info.CC_TS  = ADS_DicMessage.GetCC_TS((int)(ADSData[6] & 0x01));
                        info.CC_TC  = ADS_DicMessage.GetCC_TC((int)((ADSData[5] & 0xC0) >> 6));
                    }
                    info.OM_Type = (int)((ADSData[8] & 0xC0) >> 6);
                    if (info.OM_Type == 0)
                    {
                        info.OM_RA    = ADS_DicMessage.GetOM_RA((int)((ADSData[8] & 0x20) >> 5));
                        info.OM_IDENT = ADS_DicMessage.GetOM_IDENT(((int)(ADSData[8] & 0x10) >> 4));
                        info.OM_ATC   = ADS_DicMessage.GetOM_ATC(((int)(ADSData[8] & 0x08) >> 3));
                    }
                    info.NACp     = ADS_DicMessage.GetNACp((int)ADSData[11]);
                    info.SIL      = ADS_DicMessage.GetSIL((int)ADSData[13]);
                    info.NIC_BARO = ADS_DicMessage.GetNIC_BARO((int)ADSData[14]);
                    info.HRD      = ADS_DicMessage.GetHRD((int)ADSData[15]);
                }
                else if (info.SubType == 1)
                {
                    info.ICAO    = (uint)((ADSData[0] & 0xFF) << 16 | (ADSData[1] & 0xFF) << 8 | (ADSData[2] & 0xFF));
                    info.Type    = (int)(ADSData[3]);
                    info.MOPS    = ADS_DicMessage.GetMOPS((int)(ADSData[9]));
                    info.L_WType = ADS_DicMessage.GetL_WType((int)(ADSData[5] & 0x0F));
                    info.CC_CDTI = ADS_DicMessage.GetCC_CDTI((int)((ADSData[6] & 0x10) >> 4));
                    if (ADSData[9] == 0x01)
                    {
                        info.CC_POA   = ADS_DicMessage.GetCC_POA((int)((ADSData[6] & 0x20) >> 5));
                        info.CC_B2Low = ADS_DicMessage.GetCC_B2Low((int)((ADSData[6] & 0x02) >> 1));
                    }
                    info.OM_Type = (int)((ADSData[8] & 0xC0) >> 6);
                    if (info.OM_Type == 0)
                    {
                        info.OM_RA    = ADS_DicMessage.GetOM_RA((int)((ADSData[8] & 0x20) >> 5));
                        info.OM_IDENT = ADS_DicMessage.GetOM_IDENT(((int)(ADSData[8] & 0x10) >> 4));
                        info.OM_ATC   = ADS_DicMessage.GetOM_ATC(((int)(ADSData[8] & 0x08) >> 3));
                    }
                    info.NACp    = ADS_DicMessage.GetNACp((int)ADSData[11]);
                    info.SIL     = ADS_DicMessage.GetSIL((int)ADSData[13]);
                    info.TRK_HDG = ADS_DicMessage.GetTRK_HDG((int)ADSData[14]);
                    info.HRD     = ADS_DicMessage.GetHRD((int)ADSData[15]);
                }
            }
            catch (System.Exception ex)
            {
                // ErrorRecord.ProcessError(ex.ToString());
            }
            return(info);
        }