private void LATandLON_Tick(object sender, EventArgs e) { FSUIPCGets.GetCurrent(); lat = txtLAT.Text = FSUIPCGets.GetCurrent().Latitude.ToString(); lon = txtLON.Text = FSUIPCGets.GetCurrent().Longitude.ToString(); hdg = FSUIPCGets.GetCurrent().Compass.ToString("0"); alt = FSUIPCGets.GetCurrent().Altitude.ToString("0"); gs = FSUIPCGets.GetCurrent().GroundSpeed.ToString("0"); FSUIPCConnection.AITrafficServices.RefreshAITrafficInformation(); var aiTfc = FSUIPCConnection.AITrafficServices.AllTraffic; Console.WriteLine(aiTfc.ToString()); string[] data = new string[8]; data[0] = txtMsg.Text; data[1] = txtCallsign.Text; data[2] = txtAircraft.Text; data[3] = lat; data[4] = lon; data[5] = hdg; data[6] = alt; data[7] = gs; int s = sck.Send(Encoding.Default.GetBytes(data[0] + '/' + data[1] + '/' + data[2] + '/' + data[3] + '/' + data[4] + '/' + data[5] + '/' + data[6] + '/' + data[7])); }
public static FSUIPCGets GetCurrent() { FSUIPCGets result = new FSUIPCGets(); // snapshot data try { FSUIPCConnection.Process(); } catch (Exception crap) { // failed to connect to the sim? return(null); } // capture values result.Latitude = FSUIPCOffsets.latitude.Value * (90.0 / (10001750.0 * 65536.0 * 65536.0)); result.Longitude = FSUIPCOffsets.longitude.Value * (360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0)); result.Compass = FSUIPCOffsets.compass.Value; result.GroundSpeed = (FSUIPCOffsets.groundspeed.Value / 65536) * 1.94384449; result.Altitude = (FSUIPCOffsets.altitude.Value * 3.2808399); result.AiTfraffic = FSUIPCOffsets.AiTfraffic.Value; result.AiTfrafficInsert = FSUIPCOffsets.AiTfrafficInsert.Value; return(result); }