public void Reset() { name = ""; side = 0; Position = new DcsPosition(); LngLngPosition = new DCSLatLngPosition(); }
public void UpdatePlayerPosition(DcsPosition dcsPosition, DCSLatLngPosition latLngPosition) { PlayerCoaltionLocationMetadata.LngLngPosition = latLngPosition; PlayerCoaltionLocationMetadata.Position = dcsPosition; DcsPlayerRadioInfo.pos = dcsPosition; DcsPlayerRadioInfo.latLng = latLngPosition; }
public SRSClientSyncHandler(string guid, DCSPlayerRadioInfo gameState, string name, int coalition, DCSLatLngPosition position) { _guid = guid; this.gameState = gameState; this.name = name; this.coalition = coalition; this.position = position; }
public void Reset() { name = ""; pos = new DcsPosition(); latLng = new DCSLatLngPosition(); ptt = false; selected = 0; unit = ""; simultaneousTransmission = false; LastUpdate = 0; }
public void Reset() { name = ""; latLng = new DCSLatLngPosition(); ptt = false; selected = 0; unit = ""; simultaneousTransmission = false; simultaneousTransmissionControl = SimultaneousTransmissionControl.EXTERNAL_DCS_CONTROL; LastUpdate = 0; }
public void Reset() { name = ""; latLng = new DCSLatLngPosition(); ptt = false; selected = 0; unit = ""; simultaneousTransmission = false; simultaneousTransmissionControl = SimultaneousTransmissionControl.EXTERNAL_DCS_CONTROL; LastUpdate = 0; for (var i = 0; i < 11; i++) { radios[i] = new RadioInformation(); } }
public static double CalculateDistanceHaversine(DCSLatLngPosition myLatLng, DCSLatLngPosition clientLatLng) { if (myLatLng.lat == clientLatLng.lat || myLatLng.lng == clientLatLng.lng) { //the above will cause a divide by 0 error so this is protection against that.... //should be *almost* impossible... return(0); } const double r = 6371; // meters var sdlat = Math.Sin((clientLatLng.lat - myLatLng.lat) / 2); var sdlon = Math.Sin((clientLatLng.lng - myLatLng.lng) / 2); var q = sdlat * sdlat + Math.Cos(myLatLng.lat) * Math.Cos(clientLatLng.lat) * sdlon * sdlon; var d = 2 * r * Math.Asin(Math.Sqrt(q)); return(Math.Abs(PythagDistance(d, myLatLng.alt - clientLatLng.alt))); }
public static double CalculateDistanceHaversine(DCSLatLngPosition myLatLng, DCSLatLngPosition clientLatLng) { if (myLatLng.lat == clientLatLng.lat || myLatLng.lng == clientLatLng.lng) { //the above will cause a divide by 0 error so this is protection against that.... //should be *almost* impossible... return(Math.Abs(myLatLng.alt - clientLatLng.alt)); } const double R = 6371e3; // meters var φ1 = DegreeToRadian(myLatLng.lat); var φ2 = DegreeToRadian(clientLatLng.lat); var Δφ = DegreeToRadian(clientLatLng.lat - myLatLng.lat); var Δλ = DegreeToRadian(clientLatLng.lng - myLatLng.lng); var a = Math.Sin(Δφ / 2) * Math.Sin(Δφ / 2) + Math.Cos(φ1) * Math.Cos(φ2) * Math.Sin(Δλ / 2) * Math.Sin(Δλ / 2); var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a)); var d = R * c; return(Math.Abs(PythagDistance(d, myLatLng.alt - clientLatLng.alt))); }
public void Start() { MessageHub.Instance.Subscribe <ReadyMessage>(ReadyToSend); MessageHub.Instance.Subscribe <DisconnectedMessage>(Disconnected); gameState = new DCSPlayerRadioInfo(); gameState.radios[1].modulation = modulation[0]; gameState.radios[1].freq = freq[0]; // get into Hz gameState.radios[1].name = opts.Name; Logger.Info($"Starting with params:"); for (int i = 0; i < freq.Length; i++) { Logger.Info($"Frequency: {freq[i]} Hz - {modulation[i]} "); } DCSLatLngPosition position = new DCSLatLngPosition() { alt = opts.Altitude, lat = opts.Latitude, lng = opts.Longitude }; var srsClientSyncHandler = new SRSClientSyncHandler(Guid, gameState, opts.Name, opts.Coalition, position); srsClientSyncHandler.TryConnect(new IPEndPoint(IPAddress.Loopback, opts.Port)); //wait for it to end finished.Token.WaitHandle.WaitOne(); Logger.Info("Finished - Closing"); udpVoiceHandler?.RequestStop(); srsClientSyncHandler?.Disconnect(); MessageHub.Instance.ClearSubscriptions(); }