public void resolver_dataitems() { CAT = Convert.ToInt32(stringbinary[0], 2); int count = 0; if (listboolean_fspec.Count == 8) { count = 1; } else if (listboolean_fspec.Count == 16) { count = 2; } else if (listboolean_fspec.Count == 24) { count = 3; } else if (listboolean_fspec.Count == 32) { count = 4; } else if (listboolean_fspec.Count == 40) { count = 5; } else if (listboolean_fspec.Count == 48) { count = 6; } for (int i = (3 + count); i < stringbinary.Length; i++) { if (DI_010 == true) //VERDADERO HECHO { DI_010_buffer1 = stringbinary[i]; i++; DI_010_buffer2 = stringbinary[i]; DI_010 = false; SAC = Convert.ToInt32(DI_010_buffer1, 2); SIC = Convert.ToInt32(DI_010_buffer2, 2); } else if (DI_020 == true)//VERDADERO HECHO { DI_020_buffer1 = stringbinary[i]; char[] prov = DI_020_buffer1.ToArray(); if (Convert.ToInt32(prov[prov.Length - 1]) == '1') { i++; DI_020_buffer2 = stringbinary[i]; } DI_020 = false; if (prov[0] == '1') { D020_SSR = "Non-Mode S 1090MHz multilateration"; } else { D020_SSR = "no Non-Mode S 1090MHz multilateration"; } if (prov[1] == '1') { D020_MS = "Mode-S 1090 MHz multilateration"; } else { D020_MS = "no Mode-s 1090 MHz multilateration"; } if (prov[2] == '1') { D020_HF = "HF multilateration"; } else { D020_HF = "no HF multilateration"; } if (prov[3] == '1') { D020_VDL4 = "VDL Mode 4 multilateration"; } else { D020_VDL4 = "no VDL Mode 4 multilateration"; } if (prov[4] == '1') { D020_UAT = "UAT multilateration"; } else { D020_UAT = "no UAT multilateration"; } if (prov[5] == '1') { D020_DME = "DME/TACAN multilateration"; } else { D020_DME = "no DME/TACAN multilateration"; } if (prov[6] == '1') { D020_OT = "Other Tecnology Multilateration"; } else { D020_OT = "No Other Tecnology Multilateration"; } if (DI_020_buffer2 != null) { char[] prov2 = DI_020_buffer2.ToArray(); if (prov2[0] == '1') { D020_RAB = "Report from field monitor"; } else { D020_RAB = "Report from target transponder"; } if (prov2[1] == '1') { D020_SPI = "Special Position Identification"; } else { D020_SPI = "Absence of SPI "; } if (prov2[2] == '1') { D020_CHN = "Chain 2"; } else { D020_CHN = "Chain 1"; } if (prov2[3] == '1') { D020_GBS = "Transponder Ground bit set"; } else { D020_GBS = "Transponder Ground bit not set"; } if (prov2[4] == '1') { D020_CRT = "Corrupted replies in multilateration"; } else { D020_CRT = "No Corrupted reply in multilateration"; } if (prov2[5] == '1') { D020_SIM = "Simulated target report"; } else { D020_SIM = "Actual target report "; } if (prov2[6] == '1') { D020_TST = "Test Target"; } else { D020_TST = "Default"; } } } else if (DI_140 == true)//VERDADERO HECHO { DI_140_buffer1 = stringbinary[i]; i++; DI_140_buffer2 = stringbinary[i]; i++; DI_140_buffer3 = stringbinary[i]; DI_140 = false; int DI_140_bff = Convert.ToInt32(String.Concat(DI_140_buffer1, DI_140_buffer2, DI_140_buffer3), 2); double seconds = Math.Round(Convert.ToDouble(DI_140_bff) / 128, 3); myTime = TimeSpan.FromSeconds(seconds); //Time = time.ToString(@"hh\:mm\:ss\.fff"); } else if (DI_041 == true) { DI_041_buffer1 = stringbinary[i]; i++; DI_041_buffer2 = stringbinary[i]; i++; DI_041_buffer3 = stringbinary[i]; i++; DI_041_buffer4 = stringbinary[i]; i++; DI_041_buffer5 = stringbinary[i]; i++; DI_041_buffer6 = stringbinary[i]; i++; DI_041_buffer7 = stringbinary[i]; i++; DI_041_buffer8 = stringbinary[i]; DI_041 = false; } else if (DI_042 == true)//VERDADERO COMPROBADO { DI_042_buffer1 = stringbinary[i]; i++; DI_042_buffer2 = stringbinary[i]; i++; DI_042_buffer3 = stringbinary[i]; i++; DI_042_buffer4 = stringbinary[i]; i++; DI_042_buffer5 = stringbinary[i]; i++; DI_042_buffer6 = stringbinary[i]; DI_042 = false; string oc1 = String.Concat(DI_042_buffer1, DI_042_buffer2, DI_042_buffer3); string oc2 = String.Concat(DI_042_buffer4, DI_042_buffer5, DI_042_buffer6); X = CA2todec(oc1) * 0.5; if (X < 0) { X = X + 0.5; } Y = CA2todec(oc2) * 0.5; if (Y < 0) { Y = Y + 0.5; } double gradlat = 41; double gradlon = 2; double mintogradlat = (Convert.ToDouble(17) / 60); double mintogradlon = (Convert.ToDouble(4) / 60); double sectogradlat = Convert.ToDouble(49.426) / 3600; double sectogradlon = Convert.ToDouble(42.410) / 3600; double latitud = (Convert.ToDouble(gradlat) + Convert.ToDouble(mintogradlat)) + Convert.ToDouble(sectogradlat); double longitud = (Convert.ToDouble(gradlon) + Convert.ToDouble(mintogradlon)) + Convert.ToDouble(sectogradlon); double lat_original = latitud; latitud = latitud + (X / 6378000) * (180 / Math.PI); longitud = longitud + (Y / 6378000) * (180 / Math.PI) / Math.Cos(lat_original * (Math.PI / 180));; punto = new PointLatLng(latitud, longitud); string[] separados1lat; string[] separados1lon; separados1lat = Convert.ToString(latitud).Split(','); separados1lon = Convert.ToString(longitud).Split(','); string gradoslat = separados1lat[0]; string gradoslon = separados1lon[0]; string uno = String.Concat("0,", separados1lat[1]); string dos = String.Concat("0,", separados1lon[1]); double mindeclat = Convert.ToDouble(uno) * 60; double mindeclon = Convert.ToDouble(dos) * 60; string[] separados2lat = Convert.ToString(mindeclat).Split(','); string[] separados2lon = Convert.ToString(mindeclon).Split(','); string minlat = separados2lat[0]; string minlon = separados2lon[0]; double segdeclat = Convert.ToDouble(String.Concat("0,", separados2lat[1])) * 60; double segdeclon = Convert.ToDouble(String.Concat("0,", separados2lon[1])) * 60; string seclat = (Math.Round(segdeclat, 3)).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); string seclon = (Math.Round(segdeclon, 3)).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); string latitudd, longitudd; if (latitud > 0) { latitudd = String.Concat(gradoslat, "º", minlat, "'", seclat, '"', 'N'); } else { latitudd = String.Concat(gradoslat, 'º', minlat, "'", seclat, '"', 'S'); } if (longitud > 0) { longitudd = String.Concat(gradoslon, 'º', minlon, "'", seclon, '"', 'E'); } else { longitudd = String.Concat(gradoslon, 'º', minlon, "'", seclon, '"', 'O'); } coordinates = String.Concat(latitudd, longitudd); } else if (DI_161 == true)//VERDADERO HECHO { DI_161_buffer1 = stringbinary[i]; i++; DI_161_buffer2 = stringbinary[i]; DI_161 = false; char[] buf1 = DI_161_buffer1.ToArray(); string conc = String.Concat(buf1[4], buf1[5], buf1[6], buf1[7], DI_161_buffer2); TRACK_NUM = Convert.ToString(Convert.ToInt32(conc, 2)); } else if (DI_170 == true)//VERDADERO HECHO { DI_170_buffer1 = stringbinary[i]; char[] prov = DI_170_buffer1.ToArray(); if (prov[prov.Length - 1] == '1') { i++; DI_170_buffer2 = stringbinary[i]; } DI_170 = false; char[] oc1 = DI_170_buffer1.ToArray(); string oc34 = String.Concat(oc1[3], oc1[4]); if (oc1[0] == '1') { TRACKSTATUS_CNF = "Initiation phase"; } else { TRACKSTATUS_CNF = "Confirmed track"; } if (oc1[1] == '1') { TRACKSTATUS_TRE = "Last report for a track "; } else { TRACKSTATUS_TRE = "Default"; } if (oc1[2] == '1') { TRACKSTATUS_CST = "Extrapolated"; } else { TRACKSTATUS_CST = "Not extrapolated"; } if (String.Compare(oc34, "00") == 0) { TRACKSTATUS_CDM = "Maintaning"; } else if (String.Compare(oc34, "01") == 0) { TRACKSTATUS_CDM = "Cruising"; } else if (String.Compare(oc34, "10") == 0) { TRACKSTATUS_CDM = "Descending"; } else { TRACKSTATUS_CDM = "Invalid"; } if (oc1[5] == '1') { TRACKSTATUS_MAH = "Horizontal manouvre"; } else { TRACKSTATUS_MAH = "Default"; } if (oc1[6] == '1') { TRACKSTATUS_STH = "Smoothed position"; } else { TRACKSTATUS_STH = "Mesured position"; } if (DI_170_buffer2 != null) { char[] oc2 = DI_170_buffer2.ToArray(); if (oc2[0] == '1') { TRACKSTATUS_GHO = "Ghost track"; } else { TRACKSTATUS_GHO = "Default"; } } } else if (DI_070 == true)//VERDADERO HECHO { DI_070_buffer1 = stringbinary[i]; i++; DI_070_buffer2 = stringbinary[i]; DI_070 = false; char[] oc1 = DI_070_buffer1.ToArray(); char[] oc2 = DI_070_buffer2.ToArray(); string bit4_6 = String.Concat(oc1[4], oc1[5], oc1[6]); string bit7_9 = String.Concat(oc1[7], oc2[0], oc2[1]); string bit10_12 = String.Concat(oc2[2], oc2[3], oc2[4]); string bit13_15 = String.Concat(oc2[5], oc2[6], oc2[7]); int bbit4_6 = Convert.ToInt32(bit4_6, 2); int bbit7_9 = Convert.ToInt32(bit7_9, 2); int bbit10_12 = Convert.ToInt32(bit10_12, 2); int bbit13_15 = Convert.ToInt32(bit13_15, 2); MODE_3A = String.Concat(bbit4_6, bbit7_9, bbit10_12, bbit13_15); } else if (DI_202 == true)//VERDADERO LA MAYORIA BIEN! { DI_202_buffer1 = stringbinary[i]; i++; DI_202_buffer2 = stringbinary[i]; i++; DI_202_buffer3 = stringbinary[i]; i++; DI_202_buffer4 = stringbinary[i]; DI_202 = false; string oc1 = String.Concat(DI_202_buffer1, DI_202_buffer2); string oc2 = String.Concat(DI_202_buffer3, DI_202_buffer4); VX = CA2todec(oc1) * 0.25; if (VX < 0) { VX = VX + 0.25; } VY = CA2todec(oc2) * 0.25;//PUEDE FALLAR ESTE POR EL ÚLTIMO VALOR DEL TERCER OCTETO!!! if (VY < 0) { VY = VY + 0.25; } } else if (DI_090 == true)//VERDADERO HECHO { DI_090_buffer1 = stringbinary[i]; i++; DI_090_buffer2 = stringbinary[i]; DI_090 = false; char[] oc1 = DI_090_buffer1.ToArray(); string ocfinal = String.Concat(oc1[2], oc1[3], oc1[4], oc1[5], oc1[6], oc1[7], DI_090_buffer2); MODE_C = Convert.ToDouble(Convert.ToInt32(ocfinal, 2)) * 0.25; } else if (DI_100 == true) { DI_100_buffer1 = stringbinary[i]; i++; DI_100_buffer2 = stringbinary[i]; i++; DI_100_buffer3 = stringbinary[i]; i++; DI_100_buffer4 = stringbinary[i]; DI_100 = false; } else if (DI_220 == true)//VERDADERO HECHO { DI_220_buffer1 = stringbinary[i]; i++; DI_220_buffer2 = stringbinary[i]; i++; DI_220_buffer3 = stringbinary[i]; DI_220 = false; if (stringhex[i].Count() == 1) { stringhex[i] = String.Concat("0", stringhex[i]); } if (stringhex[i - 1].Count() == 1) { stringhex[i - 1] = String.Concat("0", stringhex[i]); } if (stringhex[i - 2].Count() == 1) { stringhex[i - 2] = String.Concat("0", stringhex[i]); } ADDRESS = String.Concat(stringhex[i - 2], stringhex[i - 1], stringhex[i]); } else if (DI_245 == true)//VERDADERO HECHO { DI_245_buffer1 = stringbinary[i]; i++; DI_245_buffer2 = stringbinary[i]; i++; DI_245_buffer3 = stringbinary[i]; i++; DI_245_buffer4 = stringbinary[i]; i++; DI_245_buffer5 = stringbinary[i]; i++; DI_245_buffer6 = stringbinary[i]; i++; DI_245_buffer7 = stringbinary[i]; DI_245 = false; string fulloctet = String.Concat(DI_245_buffer1, DI_245_buffer2, DI_245_buffer3, DI_245_buffer4, DI_245_buffer5, DI_245_buffer6, DI_245_buffer7); char[] fulloctetchar = fulloctet.ToArray(); string oc1 = String.Concat(Convert.ToString(fulloctetchar[8]), Convert.ToString(fulloctetchar[9]), Convert.ToString(fulloctetchar[10]), Convert.ToString(fulloctetchar[11]), Convert.ToString(fulloctetchar[12]), Convert.ToString(fulloctetchar[13])); string oc2 = String.Concat(Convert.ToString(fulloctetchar[14]), Convert.ToString(fulloctetchar[15]), Convert.ToString(fulloctetchar[16]), Convert.ToString(fulloctetchar[17]), Convert.ToString(fulloctetchar[18]), Convert.ToString(fulloctetchar[19])); string oc3 = String.Concat(Convert.ToString(fulloctetchar[20]), Convert.ToString(fulloctetchar[21]), Convert.ToString(fulloctetchar[22]), Convert.ToString(fulloctetchar[23]), Convert.ToString(fulloctetchar[24]), Convert.ToString(fulloctetchar[25])); string oc4 = String.Concat(Convert.ToString(fulloctetchar[26]), Convert.ToString(fulloctetchar[27]), Convert.ToString(fulloctetchar[28]), Convert.ToString(fulloctetchar[29]), Convert.ToString(fulloctetchar[30]), Convert.ToString(fulloctetchar[31])); string oc5 = String.Concat(Convert.ToString(fulloctetchar[32]), Convert.ToString(fulloctetchar[33]), Convert.ToString(fulloctetchar[34]), Convert.ToString(fulloctetchar[35]), Convert.ToString(fulloctetchar[36]), Convert.ToString(fulloctetchar[37])); string oc6 = String.Concat(Convert.ToString(fulloctetchar[38]), Convert.ToString(fulloctetchar[39]), Convert.ToString(fulloctetchar[40]), Convert.ToString(fulloctetchar[41]), Convert.ToString(fulloctetchar[42]), Convert.ToString(fulloctetchar[43])); string oc7 = String.Concat(Convert.ToString(fulloctetchar[44]), Convert.ToString(fulloctetchar[45]), Convert.ToString(fulloctetchar[46]), Convert.ToString(fulloctetchar[47]), Convert.ToString(fulloctetchar[48]), Convert.ToString(fulloctetchar[49])); ACID_palabra = ACID(oc1, oc2, oc3, oc4, oc5, oc6, oc7); } else if (DI_110 == true) { DI_110_buffer1 = stringbinary[i]; i++; DI_110_buffer2 = stringbinary[i]; DI_110 = false; } else if (DI_105 == true) { DI_105_buffer1 = stringbinary[i]; i++; DI_105_buffer2 = stringbinary[i]; DI_105 = false; } else if (DI_210 == true) { DI_210_buffer1 = stringbinary[i]; i++; DI_210_buffer2 = stringbinary[i]; DI_210 = false; } else if (DI_300 == true) { DI_300_buffer1 = stringbinary[i]; DI_300 = false; } else if (DI_310 == true) { DI_310_buffer1 = stringbinary[i]; DI_310 = false; } else if (DI_500 == true)//VERDADERO (NO SÉ SI ES NECESARIO) { DI_500_buffer1 = stringbinary[i]; char[] buff1 = DI_500_buffer1.ToArray(); if (buff1[0] == '1') { i++; DI_500_buffer2 = stringbinary[i]; i++; DI_500_buffer3 = stringbinary[i]; i++; DI_500_buffer4 = stringbinary[i]; i++; DI_500_buffer5 = stringbinary[i]; i++; DI_500_buffer6 = stringbinary[i]; i++; DI_500_buffer7 = stringbinary[i]; } if (buff1[1] == '1') { i++; DI_500_buffer8 = stringbinary[i]; i++; DI_500_buffer9 = stringbinary[i]; i++; DI_500_buffer10 = stringbinary[i]; i++; DI_500_buffer11 = stringbinary[i]; i++; DI_500_buffer12 = stringbinary[i]; i++; DI_500_buffer13 = stringbinary[i]; } if (buff1[2] == '1') { i++; DI_500_buffer14 = stringbinary[i]; i++; DI_500_buffer15 = stringbinary[i]; } DI_500 = false; } else if (DI_400 == true)//VERDADERO HECHO { DI_400_buffer1 = stringbinary[i]; i++; DI_400_buffer2 = stringbinary[i]; i++; DI_400_buffer3 = stringbinary[i]; i++; DI_400_buffer4 = stringbinary[i]; i++; DI_400_buffer5 = stringbinary[i]; i++; DI_400_buffer6 = stringbinary[i]; i++; DI_400_buffer7 = stringbinary[i]; i++; DI_400_buffer8 = stringbinary[i]; i++; DI_400_buffer9 = stringbinary[i]; i++; DI_400 = false; char[] oc1 = DI_400_buffer1.ToArray(); char[] oc2 = DI_400_buffer2.ToArray(); char[] oc3 = DI_400_buffer3.ToArray(); char[] oc4 = DI_400_buffer4.ToArray(); char[] oc5 = DI_400_buffer5.ToArray(); char[] oc6 = DI_400_buffer6.ToArray(); char[] oc7 = DI_400_buffer7.ToArray(); char[] oc8 = DI_400_buffer8.ToArray(); char[] oc9 = DI_400_buffer9.ToArray(); int suma = 0; for (int d = 0; d < oc1.Length; d++) { if (oc1[d] == '1') { suma++; } if (oc2[d] == '1') { suma++; } if (oc3[d] == '1') { suma++; } if (oc4[d] == '1') { suma++; } if (oc5[d] == '1') { suma++; } if (oc6[d] == '1') { suma++; } if (oc7[d] == '1') { suma++; } if (oc8[d] == '1') { suma++; } if (oc9[d] == '1') { suma++; } } RECEIVERS = suma - 1; } else if (DI_250 == true) { DI_250_buffer1 = stringbinary[i]; DI_250 = false; } else if (DI_230 == true) { DI_230_buffer1 = stringbinary[i]; i++; DI_230_buffer2 = stringbinary[i]; DI_230 = false; } else if (DI_260 == true) { DI_260_buffer1 = stringbinary[i]; i++; DI_260_buffer2 = stringbinary[i]; i++; DI_260_buffer3 = stringbinary[i]; i++; DI_260_buffer4 = stringbinary[i]; i++; DI_260_buffer5 = stringbinary[i]; i++; DI_260_buffer6 = stringbinary[i]; i++; DI_260_buffer7 = stringbinary[i]; DI_260 = false; } else if (DI_030 == true) { DI_030_buffer1 = stringbinary[i]; char[] prov = DI_030_buffer1.ToArray(); if (prov[prov.Length - 1] == '1') { i++; DI_030_buffer2 = stringbinary[i]; } DI_030 = false; } else if (DI_055 == true) { DI_055_buffer1 = stringbinary[i]; DI_055 = false; } else if (DI_050 == true) { DI_050_buffer1 = stringbinary[i]; i++; DI_050_buffer2 = stringbinary[i]; DI_050 = false; } } //myTime = DateTime.ParseExact(Time, "HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture); }
public void resolver_dataitems() { CAT = Convert.ToInt32(stringbinary[0], 2); int count = 0; if (listboolean_fspec.Count == 8) { count = 1; } else if (listboolean_fspec.Count == 16) { count = 2; } else if (listboolean_fspec.Count == 24) { count = 3; } else if (listboolean_fspec.Count == 32) { count = 4; } else if (listboolean_fspec.Count == 40) { count = 5; } else if (listboolean_fspec.Count == 48) { count = 6; } for (int i = (3 + count); i < stringbinary.Length; i++) { if (DI_010 == true) //VERDADERO HECHO { DI_010_buffer1 = stringbinary[i]; i++; DI_010_buffer2 = stringbinary[i]; DI_010 = false; SAC = Convert.ToInt32(DI_010_buffer1, 2); SIC = Convert.ToInt32(DI_010_buffer2, 2); } else if (DI_000 == true)//VERDADERO COMPROBAR { DI_000_buffer1 = stringbinary[i]; DI_000 = false; int messg = Convert.ToInt32(DI_000_buffer1, 2); if (messg == 1) { Message_type = "Target Report"; } else if (messg == 2) { Message_type = "Start of Update Cycle"; } else if (messg == 3) { Message_type = "Periodic Status Message"; } else { Message_type = "Event-triggered Status Message"; } } else if (DI_020 == true)//VERDADERO COMPROBAR { DI_020_buffer1 = stringbinary[i]; char[] prov = DI_020_buffer1.ToArray(); int TYP = Convert.ToInt32(String.Concat(prov[0], prov[1], prov[2])); if (TYP == 0) { TARGET_TYP = "SSR multilateration"; } else if (TYP == 1) { TARGET_TYP = "Mode S multilateration"; } else if (TYP == 10) { TARGET_TYP = "ADS-B"; } else if (TYP == 11) { TARGET_TYP = "PSR"; } else if (TYP == 100) { TARGET_TYP = "Magnetic Loop System"; } else if (TYP == 101) { TARGET_TYP = "HF multilateration"; } else if (TYP == 110) { TARGET_TYP = "Not defined"; } else if (TYP == 111) { TARGET_TYP = "Other types"; } if (prov[3] == '0') { TARGET_DCR = "No differential correction"; } else { TARGET_DCR = "Differential correction"; } if (prov[4] == '0') { TARGET_CHN = "Chain 1"; } else { TARGET_CHN = "Chain 2"; } if (prov[5] == '0') { TARGET_GBS = "Transponder Ground bit not set"; } else { TARGET_GBS = "Transponder Ground bit set"; } if (prov[6] == '0') { TARGET_CRT = "No Corrupted reply in multilateration "; } else { TARGET_CRT = "No Corrupted reply in multilateration "; } if (prov[prov.Length - 1] == '1') { i++; DI_020_buffer2 = stringbinary[i]; char[] prov2 = DI_020_buffer2.ToArray(); int LOP = Convert.ToInt32(String.Concat(prov[3], prov[4])); int TOT = Convert.ToInt32(String.Concat(prov[5], prov[6])); if (prov2[0] == '0') { TARGET_SIM = "Actual target report "; } else { TARGET_SIM = "Simulated target report "; } if (prov2[1] == '0') { TARGET_TST = "Default"; } else { TARGET_TST = "Test Target"; } if (prov2[2] == '0') { TARGET_RAB = "Report from target transponder "; } else { TARGET_RAB = "Report from field monitor"; } if (LOP == 0) { TARGET_LOP = "Undetermined "; } else if (LOP == 1) { TARGET_LOP = "Loop start"; } else if (LOP == 10) { TARGET_LOP = "Loop finish"; } if (TOT == 0) { TARGET_TOT = "Undeterminated"; } else if (TOT == 1) { TARGET_TOT = "Aircraft"; } else if (TOT == 10) { TARGET_TOT = "Ground vehicle "; } else { TARGET_TOT = "Helicopter "; } if (prov2[prov.Length - 1] == '1') { i++; DI_020_buffer3 = stringbinary[i]; if (DI_020_buffer3[0] == '0') { TARGET_SPI = "Absence of SPI"; } else { TARGET_SPI = "Special Position Identification"; } } } DI_020 = false; } else if (DI_140 == true)//VERDADERO COMPROBAR { DI_140_buffer1 = stringbinary[i]; i++; DI_140_buffer2 = stringbinary[i]; i++; DI_140_buffer3 = stringbinary[i]; DI_140 = false; int DI_140_bff = Convert.ToInt32(String.Concat(DI_140_buffer1, DI_140_buffer2, DI_140_buffer3), 2); double seconds = Math.Round(Convert.ToDouble(DI_140_bff) / 128, 3); myTime = TimeSpan.FromSeconds(seconds); //Time = time.ToString(@"hh\:mm\:ss\.fff"); } else if (DI_041 == true) { DI_041_buffer1 = stringbinary[i]; i++; DI_041_buffer2 = stringbinary[i]; i++; DI_041_buffer3 = stringbinary[i]; i++; DI_041_buffer4 = stringbinary[i]; i++; DI_041_buffer5 = stringbinary[i]; i++; DI_041_buffer6 = stringbinary[i]; i++; DI_041_buffer7 = stringbinary[i]; i++; DI_041_buffer8 = stringbinary[i]; DI_041 = false; } else if (DI_040 == true) { DI_040_buffer1 = stringbinary[i]; i++; DI_040_buffer2 = stringbinary[i]; i++; DI_040_buffer3 = stringbinary[i]; i++; DI_040_buffer4 = stringbinary[i]; DI_040 = false; } else if (DI_042 == true)//VERDADERO COMPROBAR { DI_042_buffer1 = stringbinary[i]; i++; DI_042_buffer2 = stringbinary[i]; i++; DI_042_buffer3 = stringbinary[i]; i++; DI_042_buffer4 = stringbinary[i]; DI_042 = false; string oc1 = String.Concat(DI_042_buffer1, DI_042_buffer2); string oc2 = String.Concat(DI_042_buffer3, DI_042_buffer4); X = CA2todec(oc1); Y = CA2todec(oc2); double latitud, longitud; double lat_original; if (SAC == 107) { double gradlat = 41; double gradlon = 2; double mintogradlat = (Convert.ToDouble(17) / 60); double mintogradlon = (Convert.ToDouble(4) / 60); double sectogradlat = Convert.ToDouble(44.426) / 3600; double sectogradlon = Convert.ToDouble(42.410) / 3600; latitud = (Convert.ToDouble(gradlat) + Convert.ToDouble(mintogradlat)) + Convert.ToDouble(sectogradlat); longitud = (Convert.ToDouble(gradlon) + Convert.ToDouble(mintogradlon)) + Convert.ToDouble(sectogradlon); lat_original = latitud; } else { double gradlat = 41; double gradlon = 2; double mintogradlat = (Convert.ToDouble(17) / 60); double mintogradlon = (Convert.ToDouble(5) / 60); double sectogradlat = Convert.ToDouble(44.226) / 3600; double sectogradlon = Convert.ToDouble(42.411) / 3600; latitud = (Convert.ToDouble(gradlat) + Convert.ToDouble(mintogradlat)) + Convert.ToDouble(sectogradlat); longitud = (Convert.ToDouble(gradlon) + Convert.ToDouble(mintogradlon)) + Convert.ToDouble(sectogradlon); lat_original = latitud; } latitud = latitud + (Y / 6378000) * (180 / Math.PI); longitud = longitud + (X / 6378000) * (180 / Math.PI) / Math.Cos(lat_original * (180 / Math.PI)); punto = new PointLatLng(latitud, longitud); string[] separados1lat; string[] separados1lon; separados1lat = Convert.ToString(latitud).Split(','); separados1lon = Convert.ToString(longitud).Split(','); string gradoslat = separados1lat[0]; string gradoslon = separados1lon[0]; string uno = String.Concat("0,", separados1lat[1]); string dos = String.Concat("0,", separados1lon[1]); double mindeclat = Convert.ToDouble(uno) * 60; double mindeclon = Convert.ToDouble(dos) * 60; string[] separados2lat = Convert.ToString(mindeclat).Split(','); string[] separados2lon = Convert.ToString(mindeclon).Split(','); string minlat = separados2lat[0]; string minlon = separados2lon[0]; double segdeclat = Convert.ToDouble(String.Concat("0,", separados2lat[1])) * 60; double segdeclon = Convert.ToDouble(String.Concat("0,", separados2lon[1])) * 60; string seclat = (Math.Round(segdeclat, 3)).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); string seclon = (Math.Round(segdeclon, 3)).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); string latitudd, longitudd; if (latitud > 0) { latitudd = String.Concat(gradoslat, "º", minlat, "'", seclat, '"', 'N'); } else { latitudd = String.Concat(gradoslat, 'º', minlat, "'", seclat, '"', 'S'); } if (longitud > 0) { longitudd = String.Concat(gradoslon, 'º', minlon, "'", seclon, '"', 'E'); } else { longitudd = String.Concat(gradoslon, 'º', minlon, "'", seclon, '"', 'O'); } coordinates = String.Concat(latitudd, longitudd); } else if (DI_200 == true)//VERDADERO { DI_200_buffer1 = stringbinary[i]; i++; DI_200_buffer2 = stringbinary[i]; i++; DI_200_buffer3 = stringbinary[i]; i++; DI_200_buffer4 = stringbinary[i]; DI_200 = false; } else if (DI_202 == true)//VERDADERO COMPROBAR { DI_202_buffer1 = stringbinary[i]; i++; DI_202_buffer2 = stringbinary[i]; i++; DI_202_buffer3 = stringbinary[i]; i++; DI_202_buffer4 = stringbinary[i]; DI_202 = false; string oc1 = String.Concat(DI_202_buffer1, DI_202_buffer2); string oc2 = String.Concat(DI_202_buffer3, DI_202_buffer4); VX = CA2todec(oc1) * 0.25; { VX = VX + 0.25; } VY = CA2todec(oc2) * 0.25; { VY = VY + 0.25; } } else if (DI_161 == true)//VERDADERO COMPROBAR { DI_161_buffer1 = stringbinary[i]; i++; DI_161_buffer2 = stringbinary[i]; DI_161 = false; string oc = String.Concat(DI_161_buffer1[3], DI_161_buffer1[4], DI_161_buffer1[5], DI_161_buffer1[6], DI_161_buffer1[7], DI_161_buffer2); TRACKNUMBER = Convert.ToInt32(oc, 2); } else if (DI_170 == true)//VERDADERO COMPROBAR { DI_170_buffer1 = stringbinary[i]; char[] prov = DI_170_buffer1.ToArray(); if (prov[0] == '0') { TRACKSTATUS_CNF = "Confirmed track"; } else { TRACKSTATUS_CNF = "Track in initialisation phase"; } if (prov[1] == '0') { TRACKSTATUS_TRE = "Default"; } else { TRACKSTATUS_TRE = "Last report for a track"; } int bit65 = Convert.ToInt32(String.Concat(prov[2], prov[3])); if (bit65 == 0) { TRACKSTATUS_CST = "No extrapolation"; } else if (bit65 == 1) { TRACKSTATUS_CST = "Predictable extrapolation due to sensor refresh period"; } else if (bit65 == 10) { TRACKSTATUS_CST = "Predictable extrapolation in masked area"; } else if (bit65 == 11) { TRACKSTATUS_CST = "Extrapolation due to unpredictable absence of detection"; } if (prov[4] == '0') { TRACKSTATUS_MAH = "Default"; } else { TRACKSTATUS_MAH = "Horizontal manoeuvre"; } if (prov[5] == '0') { TRACKSTATUS_TCC = "Slant range correction and a suitable projection technique"; } else { TRACKSTATUS_TCC = "Sensor plane "; } if (prov[6] == '0') { TRACKSTATUS_STH = "Measured position"; } else { TRACKSTATUS_STH = "Smoothed position "; } if (prov[prov.Length - 1] == '1') { i++; DI_170_buffer2 = stringbinary[i]; char[] prov2 = DI_170_buffer2.ToArray(); int TOM = Convert.ToInt32(String.Concat(prov2[0], prov2[1])); int DOU = Convert.ToInt32(String.Concat(prov2[2], prov2[3], prov2[4])); int MRS = Convert.ToInt32(String.Concat(prov2[5], prov2[6])); if (TOM == 0) { TRACKSTATUS_TOM = "Unknown type of movement"; } else if (TOM == 1) { TRACKSTATUS_TOM = "Taking-off"; } else if (TOM == 10) { TRACKSTATUS_TOM = "Lading"; } else if (TOM == 11) { TRACKSTATUS_TOM = "Other types of movement"; } if (DOU == 0) { TRACKSTATUS_DOU = "No doubt"; } else if (DOU == 1) { TRACKSTATUS_DOU = "Doubtful correlation (undetermined reason)"; } else if (DOU == 10) { TRACKSTATUS_DOU = "Doubtful correlation in clutter"; } else if (DOU == 11) { TRACKSTATUS_DOU = " Loss of accuracy"; } else if (DOU == 100) { TRACKSTATUS_DOU = "Loss of accuracy in clutter"; } else if (DOU == 101) { TRACKSTATUS_DOU = "Unstable track"; } else if (DOU == 110) { TRACKSTATUS_DOU = "Previously coasted"; } if (MRS == 0) { TRACKSTATUS_MRS = "Merge or split indication undetermined "; } else if (MRS == 1) { TRACKSTATUS_MRS = "Track merged by association to plot"; } else if (MRS == 10) { TRACKSTATUS_MRS = "Track merged by non-association to plot "; } else if (MRS == 11) { TRACKSTATUS_MRS = "Split track"; } if (prov2[7] == '1') { i++; DI_170_buffer3 = stringbinary[i]; if (DI_170_buffer3[0] == '0') { TRACKSTATUS_GHO = "Default"; } else { TRACKSTATUS_GHO = "Ghost track"; } } } DI_170 = false; } else if (DI_060 == true)//VERDADERO COMPROBAR { DI_060_buffer1 = stringbinary[i]; i++; DI_060_buffer2 = stringbinary[i]; DI_060 = false; char[] oc1 = DI_060_buffer1.ToArray(); char[] oc2 = DI_060_buffer2.ToArray(); string bit4_6 = String.Concat(oc1[4], oc1[5], oc1[6]); string bit7_9 = String.Concat(oc1[7], oc2[0], oc2[1]); string bit10_12 = String.Concat(oc2[2], oc2[3], oc2[4]); string bit13_15 = String.Concat(oc2[5], oc2[6], oc2[7]); int bbit4_6 = Convert.ToInt32(bit4_6, 2); int bbit7_9 = Convert.ToInt32(bit7_9, 2); int bbit10_12 = Convert.ToInt32(bit10_12, 2); int bbit13_15 = Convert.ToInt32(bit13_15, 2); MODE_3A = String.Concat(bbit4_6, bbit7_9, bbit10_12, bbit13_15); } else if (DI_220 == true)//VERDADERO COMPROBAR { DI_220_buffer1 = stringbinary[i]; i++; DI_220_buffer2 = stringbinary[i]; i++; DI_220_buffer3 = stringbinary[i]; DI_220 = false; if (stringhex[i].Count() == 1) { stringhex[i] = String.Concat("0", stringhex[i]); } //AÑADIMOS UN 0 SI SOLO HAY UNA LETRA O NÚMERO PORQUE EL 0 DESAPARECE AL PRINCIPIO if (stringhex[i - 1].Count() == 1) { stringhex[i - 1] = String.Concat("0", stringhex[i]); } if (stringhex[i - 2].Count() == 1) { stringhex[i - 2] = String.Concat("0", stringhex[i]); } ADDRESS = String.Concat(stringhex[i - 2], stringhex[i - 1], stringhex[i]); } else if (DI_245 == true)//VERDADERO COMPROBAR { DI_245_buffer1 = stringbinary[i]; i++; DI_245_buffer2 = stringbinary[i]; i++; DI_245_buffer3 = stringbinary[i]; i++; DI_245_buffer4 = stringbinary[i]; i++; DI_245_buffer5 = stringbinary[i]; i++; DI_245_buffer6 = stringbinary[i]; i++; DI_245_buffer7 = stringbinary[i]; DI_245 = false; string fulloctet = String.Concat(DI_245_buffer1, DI_245_buffer2, DI_245_buffer3, DI_245_buffer4, DI_245_buffer5, DI_245_buffer6, DI_245_buffer7); char[] fulloctetchar = fulloctet.ToArray(); string oc1 = String.Concat(Convert.ToString(fulloctetchar[8]), Convert.ToString(fulloctetchar[9]), Convert.ToString(fulloctetchar[10]), Convert.ToString(fulloctetchar[11]), Convert.ToString(fulloctetchar[12]), Convert.ToString(fulloctetchar[13])); string oc2 = String.Concat(Convert.ToString(fulloctetchar[14]), Convert.ToString(fulloctetchar[15]), Convert.ToString(fulloctetchar[16]), Convert.ToString(fulloctetchar[17]), Convert.ToString(fulloctetchar[18]), Convert.ToString(fulloctetchar[19])); string oc3 = String.Concat(Convert.ToString(fulloctetchar[20]), Convert.ToString(fulloctetchar[21]), Convert.ToString(fulloctetchar[22]), Convert.ToString(fulloctetchar[23]), Convert.ToString(fulloctetchar[24]), Convert.ToString(fulloctetchar[25])); string oc4 = String.Concat(Convert.ToString(fulloctetchar[26]), Convert.ToString(fulloctetchar[27]), Convert.ToString(fulloctetchar[28]), Convert.ToString(fulloctetchar[29]), Convert.ToString(fulloctetchar[30]), Convert.ToString(fulloctetchar[31])); string oc5 = String.Concat(Convert.ToString(fulloctetchar[32]), Convert.ToString(fulloctetchar[33]), Convert.ToString(fulloctetchar[34]), Convert.ToString(fulloctetchar[35]), Convert.ToString(fulloctetchar[36]), Convert.ToString(fulloctetchar[37])); string oc6 = String.Concat(Convert.ToString(fulloctetchar[38]), Convert.ToString(fulloctetchar[39]), Convert.ToString(fulloctetchar[40]), Convert.ToString(fulloctetchar[41]), Convert.ToString(fulloctetchar[42]), Convert.ToString(fulloctetchar[43])); string oc7 = String.Concat(Convert.ToString(fulloctetchar[44]), Convert.ToString(fulloctetchar[45]), Convert.ToString(fulloctetchar[46]), Convert.ToString(fulloctetchar[47]), Convert.ToString(fulloctetchar[48]), Convert.ToString(fulloctetchar[49])); string oc8 = String.Concat(Convert.ToString(fulloctetchar[50]), Convert.ToString(fulloctetchar[51]), Convert.ToString(fulloctetchar[52]), Convert.ToString(fulloctetchar[53]), Convert.ToString(fulloctetchar[54]), Convert.ToString(fulloctetchar[55])); ACID_palabra = ACID(oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8); } else if (DI_250 == true) { DI_250_buffer1 = stringbinary[i]; DI_250 = false; } else if (DI_300 == true) { DI_300_buffer1 = stringbinary[i]; DI_300 = false; } else if (DI_090 == true)//VERDADERO COMPROBAR { DI_090_buffer1 = stringbinary[i]; i++; DI_090_buffer2 = stringbinary[i]; DI_090 = false; string flighlvl = String.Concat(DI_090_buffer1[2], DI_090_buffer1[3], DI_090_buffer1[4], DI_090_buffer1[5], DI_090_buffer1[6], DI_090_buffer1[7], DI_090_buffer2); FLIGHTLEVEL = Convert.ToDouble(Convert.ToInt32(flighlvl, 2)) / 4; } else if (DI_091 == true) { DI_091_buffer1 = stringbinary[i]; i++; DI_091_buffer2 = stringbinary[i]; DI_091 = false; } else if (DI_270 == true)//VERDADERO { DI_270_buffer1 = stringbinary[i]; char[] prov = DI_270_buffer1.ToArray(); if (prov[prov.Length - 1] == 1) { i++; DI_270_buffer2 = stringbinary[i]; } DI_270 = false; } else if (DI_550 == true) { DI_550_buffer1 = stringbinary[i]; DI_550 = false; } else if (DI_310 == true) { DI_310_buffer1 = stringbinary[i]; DI_310 = false; } else if (DI_500 == true) { DI_500_buffer1 = stringbinary[i]; i++; DI_500_buffer2 = stringbinary[i]; i++; DI_500_buffer3 = stringbinary[i]; i++; DI_500_buffer4 = stringbinary[i]; DI_550 = false; } else if (DI_280 == true) { DI_280_buffer1 = stringbinary[i]; DI_280 = false; } else if (DI_131 == true) { DI_131_buffer1 = stringbinary[i]; DI_131 = false; } else if (DI_210 == true) { DI_210_buffer1 = stringbinary[i]; i++; DI_210_buffer2 = stringbinary[i]; DI_210 = false; } } //myTime = DateTime.ParseExact(Time, "HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture); //roww = new DataRow(SAC, SIC, Message_type, "Target", myTime, X, Y, VX, VY, TRACKNUMBER, "Track Status", MODE_3A, ADDRESS, ACID_palabra, FLIGHTLEVEL); }