Esempio n. 1
0
        //获取:目标状态与状况
        public static ADS_MessageInfo GetTargetState(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.AtmosphereDataSource = ADS_DicMessage.GetAtmosphereDataSource((int)(ADSData[5]));
                    info.HeightType           = ADS_DicMessage.GetHeightType((int)(ADSData[6]));
                    info.HeightProperty       = ADS_DicMessage.GetHeightProperty((int)ADSData[8]);
                    info.AtmosphereMode       = ADS_DicMessage.GetAtmosphereLevelMode((int)ADSData[9]);
                    info.TargetHeight         = ADS_DicMessage.GetTargetHeight((UInt16)((ADSData[10] & 0xFF) | (ADSData[11] & 0xFF) << 8));
                    info.LevelDataSource      = ADS_DicMessage.GetLevelDataSource((int)ADSData[12]);
                    info.TargetDirection      = (int)((ADSData[13] & 0xFF) | (ADSData[14] & 0xFF) << 8);
                    info.TargetDirectionFlag  = ADS_DicMessage.GetTargetDirectionFlag((int)ADSData[15]);
                    info.LevelMode            = ADS_DicMessage.GetAtmosphereLevelMode((int)ADSData[16]);
                    info.PropertyCode         = ADS_DicMessage.GetPropertyCode((int)ADSData[21]);
                    info.EmergencyCode        = ADS_DicMessage.GetEmergencyCode((int)ADSData[22]);
                }
            }
            catch (System.Exception ex)
            {
                // ErrorRecord.ProcessError(ex.ToString());
            }
            return(info);
        }
Esempio n. 2
0
        //获取:空中速度消息
        public static ADS_MessageInfo GetAirSpeed(byte[] ADSData)
        {
            ADS_MessageInfo info = new ADS_MessageInfo();

            try
            {
                info.SubType = (int)(ADSData[4]);
                if (info.SubType == 1 || info.SubType == 2)
                {
                    byte   west_east_flag    = ADSData[8];
                    byte   nouth_south_flag  = ADSData[11];
                    UInt16 west_east_speed   = (UInt16)((ADSData[9] & 0xFF) | (ADSData[10] & 0xFF) << 8);
                    UInt16 nouth_south_speed = (UInt16)((ADSData[12] & 0xFF) | (ADSData[13] & 0xFF) << 8);
                    info.AirDirection = ADS_DicMessage.GetDirectionofSpeed(info.SubType, west_east_flag, nouth_south_flag, west_east_speed, nouth_south_speed);
                    info.AirSpeed     = ADS_DicMessage.GetAirSpeed(info.SubType, info.AirDirection, west_east_speed, nouth_south_speed);
                }
                else if (info.SubType == 3 || info.SubType == 4)
                {
                    byte   direction_flag = ADSData[14];
                    int    speed_flag     = (int)ADSData[17];
                    UInt16 direction      = (UInt16)((ADSData[15] & 0xFF) | (ADSData[16] & 0xFF) << 8);
                    UInt16 speed          = (UInt16)((ADSData[18] & 0xFF) | (ADSData[19] & 0xFF) << 8);

                    info.AirDirection = ADS_DicMessage.GetDirectionFor34(direction_flag, direction);
                    info.AirSpeedType = ADS_DicMessage.GetAirSpeedType(speed_flag);
                    info.AirSpeed     = ADS_DicMessage.GetAirSpeedFor34(info.SubType, speed);
                }
                else
                {
                    return(info);
                }
                info.ICAO = (uint)((ADSData[0] & 0xFF) << 16 | (ADSData[1] & 0xFF) << 8 | (ADSData[2] & 0xFF));
                info.Type = (int)(ADSData[3]);

                info.AimChange = ADS_DicMessage.GetAimChange((int)(ADSData[5]));
                info.IFR       = ADS_DicMessage.GetIFR((int)(ADSData[6]));

                info.VerticalSpeedSource = ADS_DicMessage.GetVerticalSpeedSource((int)(ADSData[20]));
                info.VerticalSpeedFlag   = ADS_DicMessage.GetVerticalSpeedFlag((int)(ADSData[21]));
                info.VerticalSpeed       = ADS_DicMessage.GetVerticalSpeed((int)((ADSData[22] & 0xFF) | (ADSData[23] & 0xFF) << 8));

                info.AtmosphereFlag = ADS_DicMessage.GetAtmosphereFlag((int)(ADSData[25]));
                info.Atmosphere     = ADS_DicMessage.GetAtmosphere((int)(ADSData[26]));
            }
            catch (System.Exception ex)
            {
                // ErrorRecord.ProcessError(ex.ToString());
            }
            return(info);
        }
Esempio n. 3
0
        //获取:扩展间歇震荡飞机状况消息
        public static ADS_MessageInfo GetPauseAirCondition(byte[] ADSData)
        {
            ADS_MessageInfo info = new ADS_MessageInfo();

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

                if (info.SubType == 1)
                {
                    info.ICAO          = (uint)((ADSData[0] & 0xFF) << 16 | (ADSData[1] & 0xFF) << 8 | (ADSData[2] & 0xFF));
                    info.Type          = (int)(ADSData[3]);
                    info.EmergencyCode = ADS_DicMessage.GetEmergencyCode((int)(ADSData[5]));
                }
            }
            catch (System.Exception ex)
            {
                // ErrorRecord.ProcessError(ex.ToString());
            }
            return(info);
        }
Esempio n. 4
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);
        }