コード例 #1
0
        /*HelpDecode decode; CAT21Helper cat21Helper;
         * public CAT21v21(HelpDecode decode, CAT10Helper cat21Helper)
         * {
         *  cat21Helper.decode = decode;
         *  cat21Helper.cat21Helper = cat21Helper;
         * }*/
        // Constructor with message array and decoder class
        public CAT21(ref HelpDecode decode, ref CAT21Helper cat21Helper, string[] hexMessageArray, int id, string[] messageBinary)
        {
            try
            {
                //Decode FSPEC
                string FSPEC0      = decode.getFSPEC(hexMessageArray);
                int    octetsFSPEC = FSPEC0.Length / 7;
                int    index       = 3 + octetsFSPEC;
                this.FSPEC   = FSPEC0.ToCharArray(0, FSPEC0.Length);
                this.message = messageBinary;
                // Data Item Header
                this.Id        = id;
                this.numOctets = hexMessageArray.Length;

                /* From now on each function looks to see if the decoding parameter exists in the
                 * message (checking if the FSPEC in its indexition == 1) and if it exists calls the function to decode the parameter */

                if (FSPEC[0] == '1')
                {
                    index = cat21Helper.Compute_Data_Source_Identification(message, index);
                    SAC   = cat21Helper.SAC;
                    SIC   = cat21Helper.SIC;
                }
                if (FSPEC[1] == '1')
                {
                    index    = cat21Helper.Compute_Target_Report_Descripter(message, index);
                    ATP      = cat21Helper.ATP;
                    ARC      = cat21Helper.ARC;
                    RC       = cat21Helper.RC;
                    RAB      = cat21Helper.RAB;
                    DCR      = cat21Helper.DCR;
                    GBS      = cat21Helper.GBS;
                    SIM      = cat21Helper.SIM;
                    TST      = cat21Helper.TST;
                    this.SAA = cat21Helper.SAA;
                    CL       = cat21Helper.CL;
                    IPC      = cat21Helper.IPC;
                    NOGO     = cat21Helper.NOGO;
                    CPR      = cat21Helper.CPR;
                    LDPJ     = cat21Helper.LDPJ;
                    RCF      = cat21Helper.RCF;
                    FX       = cat21Helper.FX;
                }
                if (FSPEC[2] == '1')
                {
                    index        = cat21Helper.Compute_Track_Number(message, index);
                    Track_Number = cat21Helper.Track_Number;
                }
                if (FSPEC[3] == '1')
                {
                    index = cat21Helper.Compute_Service_Identification(message, index);
                    Service_Identification = cat21Helper.Service_Identification;
                }
                if (FSPEC[4] == '1')
                {
                    index = cat21Helper.Compute_Time_of_Aplicabillity_Position(message, index);
                    Time_of_Applicability_Position = cat21Helper.Time_of_Applicability_Position;
                }
                if (FSPEC[5] == '1')
                {
                    index               = cat21Helper.Compute_PositionWGS_84(message, index);
                    LatitudeWGS_84      = cat21Helper.LatitudeWGS_84;
                    LongitudeWGS_84     = cat21Helper.LongitudeWGS_84;
                    LatitudeWGS_84_map  = cat21Helper.LatitudeWGS_84_map;
                    LongitudeWGS_84_map = cat21Helper.LongitudeWGS_84_map;
                }
                if (FSPEC[6] == '1')
                {
                    index = cat21Helper.Compute_High_Resolution_PositionWGS_84(message, index);
                    High_Resolution_LatitudeWGS_84  = cat21Helper.High_Resolution_LatitudeWGS_84;
                    High_Resolution_LongitudeWGS_84 = cat21Helper.High_Resolution_LongitudeWGS_84;
                }
                if (FSPEC.Count() > 8)
                {
                    if (FSPEC[7] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Aplicabillity_Velocity(message, index);
                        Time_of_Applicability_Velocity = cat21Helper.Time_of_Applicability_Velocity;
                    }
                    if (FSPEC[8] == '1')
                    {
                        index     = cat21Helper.Compute_Air_Speed(message, index);
                        Air_Speed = cat21Helper.Air_Speed;
                    }
                    if (FSPEC[9] == '1')
                    {
                        index          = cat21Helper.Compute_True_Air_Speed(message, index);
                        True_Air_Speed = cat21Helper.True_Air_Speed;
                    }
                    if (FSPEC[10] == '1')
                    {
                        index          = cat21Helper.Compute_Target_Address(message, index);
                        Target_address = cat21Helper.Target_address;
                    }
                    if (FSPEC[11] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Message_Reception_Position(message, index);
                        Time_of_Message_Reception_Position = cat21Helper.Time_of_Message_Reception_Position;
                    }
                    if (FSPEC[12] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Message_Reception_Position_High_Precision(message, index);
                        Time_of_Message_Reception_Position_High_Precision = cat21Helper.Time_of_Message_Reception_Position_High_Precision;
                    }
                    if (FSPEC[13] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Message_Reception_Velocity(message, index);
                        Time_of_Message_Reception_Velocity = cat21Helper.Time_of_Message_Reception_Velocity;
                    }
                }
                if (FSPEC.Count() > 16)
                {
                    if (FSPEC[14] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Message_Reception_Velocity_High_Precision(message, index);
                        Time_of_Message_Reception_Velocity_High_Precision = cat21Helper.Time_of_Message_Reception_Velocity_High_Precision;
                    }
                    if (FSPEC[15] == '1')
                    {
                        index            = cat21Helper.Compute_Geometric_Height(message, index);
                        Geometric_Height = cat21Helper.Geometric_Height;
                    }
                    if (FSPEC[16] == '1')
                    {
                        index = cat21Helper.Compute_Quality_Indicators(message, index);
                        Quality_Indicators = cat21Helper.Quality_Indicators;
                        NUCr_NACv          = cat21Helper.NUCr_NACv;
                        NUCp_NIC           = cat21Helper.NUCp_NIC;
                        NICbaro            = cat21Helper.NICbaro;
                        SIL  = cat21Helper.SIL;
                        NACp = cat21Helper.NACp;
                        SILS = cat21Helper.SILS;
                        SDA  = cat21Helper.SDA;
                        GVA  = cat21Helper.GVA;
                        PIC  = cat21Helper.PIC;
                        ICB  = cat21Helper.ICB;
                        NUCp = cat21Helper.NUCp;
                        NIC  = cat21Helper.NIC;
                    }
                    if (FSPEC[17] == '1')
                    {
                        index = cat21Helper.Compute_MOPS_Version(message, index);
                        VNS   = cat21Helper.VNS;
                        LTT   = cat21Helper.LTT;
                        MOPS  = cat21Helper.MOPS;
                    }
                    if (FSPEC[18] == '1')
                    {
                        index  = cat21Helper.Compute_Mode_A3(message, index);
                        ModeA3 = cat21Helper.ModeA3;
                    }
                    if (FSPEC[19] == '1')
                    {
                        index      = cat21Helper.Compute_Roll_Angle(message, index);
                        Roll_Angle = cat21Helper.Roll_Angle;
                    }
                    if (FSPEC[20] == '1')
                    {
                        index        = cat21Helper.Compute_Flight_level(message, index);
                        Flight_Level = cat21Helper.Flight_Level;
                    }
                }
                if (FSPEC.Count() > 22)
                {
                    if (FSPEC[21] == '1')
                    {
                        index            = cat21Helper.Compute_Magnetic_Heading(message, index);
                        Magnetic_Heading = cat21Helper.Magnetic_Heading;
                    }
                    if (FSPEC[22] == '1')
                    {
                        index = cat21Helper.Compute_Target_Status(message, index);
                        ICF   = cat21Helper.ICF;
                        LNAV  = cat21Helper.LNAV;
                        PS    = cat21Helper.PS;
                        SS    = cat21Helper.SS;
                    }
                    if (FSPEC[23] == '1')
                    {
                        index = cat21Helper.Compute_Barometric_Vertical_Rate(message, index);
                        Barometric_Vertical_Rate = cat21Helper.Barometric_Vertical_Rate;
                    }
                    if (FSPEC[24] == '1')
                    {
                        index = cat21Helper.Compute_Geometric_Vertical_Rate(message, index);
                        Geometric_Vertical_Rate = cat21Helper.Geometric_Vertical_Rate;
                    }
                    if (FSPEC[25] == '1')
                    {
                        index         = cat21Helper.Compute_Airborne_Ground_Vector(message, index);
                        Ground_Speed  = cat21Helper.Ground_Speed;
                        Track_Angle   = cat21Helper.Track_Angle;
                        Ground_vector = cat21Helper.Ground_vector;
                    }
                    if (FSPEC[26] == '1')
                    {
                        index            = cat21Helper.Compute_Track_Angle_Rate(message, index);
                        Track_Angle_Rate = cat21Helper.Track_Angle_Rate;
                    }
                    if (FSPEC[27] == '1')
                    {
                        index = cat21Helper.Compute_Time_of_Asterix_Report_Transmission(message, index);
                        Time_of_Asterix_Report_Transmission = cat21Helper.Time_of_Asterix_Report_Transmission;
                        TimeOfDayInSeconds = cat21Helper.Time_of_day_sec;
                    }
                }
                if (FSPEC.Count() > 29)
                {
                    if (FSPEC[28] == '1')
                    {
                        index = cat21Helper.Compute_Target_Identification(message, index);
                        Target_Identification = cat21Helper.Target_Identification;
                    }
                    if (FSPEC[29] == '1')
                    {
                        index = cat21Helper.Compute_Emitter_Category(message, index);
                        ECAT  = cat21Helper.ECAT;
                    }
                    if (FSPEC[30] == '1')
                    {
                        index          = cat21Helper.Compute_Met_Information(message, index);
                        MET_present    = cat21Helper.MET_present;
                        Wind_Speed     = cat21Helper.Wind_Speed;
                        Wind_Direction = cat21Helper.Wind_Direction;
                        Temperature    = cat21Helper.Temperature;
                        Turbulence     = cat21Helper.Turbulence;
                    }
                    if (FSPEC[31] == '1')
                    {
                        index             = cat21Helper.Compute_Selected_Altitude(message, index);
                        SAS               = cat21Helper.SAS;
                        Source            = cat21Helper.Source;
                        Sel_Altitude      = cat21Helper.Sel_Altitude;
                        Selected_Altitude = cat21Helper.Selected_Altitude;
                    }
                    if (FSPEC[32] == '1')
                    {
                        index = cat21Helper.Compute_Final_State_Selected_Altitude(message, index);
                        MV    = cat21Helper.MV;
                        AH    = cat21Helper.AH;
                        AM    = cat21Helper.AM;
                        Final_State_Altitude = cat21Helper.Final_State_Altitude;
                    }
                    if (FSPEC[33] == '1')
                    {
                        index = cat21Helper.Compute_Trajectory_Intent(message, index);
                        Trajectory_present = cat21Helper.Trajectory_present;
                        subfield1          = cat21Helper.subfield1;
                        subfield2          = cat21Helper.subfield2;
                        NAV      = cat21Helper.NAV;
                        NVB      = cat21Helper.NVB;
                        REP      = cat21Helper.REP;
                        TCA      = cat21Helper.TCA;
                        NC       = cat21Helper.NC;
                        TCP      = cat21Helper.TCP;
                        Altitude = cat21Helper.Altitude;

                        Latitude   = cat21Helper.Latitude;
                        Longitude  = cat21Helper.Longitude;
                        Point_Type = cat21Helper.Point_Type;
                        TD         = cat21Helper.TD;
                        TRA        = cat21Helper.TRA;
                        TOA        = cat21Helper.TOA;
                        TOV        = cat21Helper.TOV;
                        TTR        = cat21Helper.TTR;
                    }
                    if (FSPEC[34] == '1')
                    {
                        index = cat21Helper.Compute_Service_Managment(message, index);
                        RP    = cat21Helper.RP;
                    }
                }
                if (FSPEC.Count() > 36)
                {
                    if (FSPEC[35] == '1')
                    {
                        index    = cat21Helper.Compute_Aircraft_Operational_Status(message, index);
                        RA       = cat21Helper.RA;
                        TC       = cat21Helper.TC;
                        TS       = cat21Helper.TS;
                        ARV      = cat21Helper.ARV;
                        CDTIA    = cat21Helper.CDTIA;
                        Not_TCAS = cat21Helper.Not_TCAS;
                        SA       = cat21Helper.SA;
                    }
                    if (FSPEC[36] == '1')
                    {
                        index          = cat21Helper.Compute_Surface_Capabiliteies_and_Characteristics(message, index);
                        POA            = cat21Helper.POA;
                        CDTIS          = cat21Helper.CDTIS;
                        B2_low         = cat21Helper.B2_low;
                        RAS            = cat21Helper.RAS;
                        IDENT          = cat21Helper.IDENT;
                        LengthandWidth = cat21Helper.LengthandWidth;
                    }
                    if (FSPEC[37] == '1')
                    {
                        index             = cat21Helper.Compute_Message_Amplitude(message, index);
                        Message_Amplitude = cat21Helper.Message_Amplitude;
                    }
                    if (FSPEC[38] == '1')
                    {
                        index     = cat21Helper.Compute_Mode_S_MB_DATA(message, index);
                        MB_Data   = cat21Helper.MB_Data;
                        BDS1      = cat21Helper.BDS1;
                        BDS2      = cat21Helper.BDS2;
                        modeS_rep = cat21Helper.modeS_rep;
                    }
                    if (FSPEC[39] == '1')
                    {
                        index = cat21Helper.Compute_ACAS_Resolution_Advisory_Report(message, index);
                        TYP   = cat21Helper.TYP;
                        STYP  = cat21Helper.STYP;
                        ARA   = cat21Helper.ARA;
                        RAC   = cat21Helper.RAC;
                        RAT   = cat21Helper.RAT;
                        MTE   = cat21Helper.MTE;
                        TTI   = cat21Helper.TTI;
                        TID   = cat21Helper.TID;
                    }
                    if (FSPEC[40] == '1')
                    {
                        index       = cat21Helper.Compute_Receiver_ID(message, index);
                        Receiver_ID = cat21Helper.Receiver_ID;
                    }
                    if (FSPEC[41] == '1')
                    {
                        index             = cat21Helper.Compute_Data_Age(message, index);
                        Data_Ages_present = cat21Helper.Data_Ages_present;
                        AOS         = cat21Helper.AOS;
                        TRD         = cat21Helper.TRD;
                        M3A         = cat21Helper.M3A;
                        QI          = cat21Helper.QI;
                        TI          = cat21Helper.TI;
                        MAM         = cat21Helper.MAM;
                        GH          = cat21Helper.GH;
                        FL          = cat21Helper.FL;
                        ISA         = cat21Helper.ISA;
                        FSA         = cat21Helper.FSA;
                        AS          = cat21Helper.AS;
                        TAS         = cat21Helper.TAS;
                        MH          = cat21Helper.MH;
                        BVR         = cat21Helper.BVR;
                        GVR         = cat21Helper.GVR;
                        GV          = cat21Helper.GV;
                        TAR         = cat21Helper.TAR;
                        TI_DataAge  = cat21Helper.TI_DataAge;
                        TS_DataAge  = cat21Helper.TS_DataAge;
                        MET         = cat21Helper.MET;
                        ROA         = cat21Helper.ROA;
                        ARA_DataAge = cat21Helper.ARA_DataAge;
                        SCC         = cat21Helper.SCC;
                    }
                }
            }
            catch
            {
                message = hexMessageArray;
            }
        }