public void Process(GravityChanged @event) { Console.WriteLine($"Gravity : {@event.X}, {@event.Y}, {@event.Z}"); var hub = _hubs.Get <VesselOrientationHub>(); hub.GravityChanged(@event.X, @event.Y, @event.Z); }
public void Process(ThrottleChanged @event) { _logger.Information($"Throttle Changed : {@event.EngineA} - {@event.EngineB} - {@event.Target}"); var actualThrottle = @event.Target / 100f; //var request = (HttpWebRequest)WebRequest.Create($"http://{_ipAddress}:8080?engine={@event.Engine}&throttle={actualThrottle}"); //request.GetResponse(); var hub = _hubs.Get <VesselOrientationHub>(); if (@event.EngineA) { hub.ThrottleChanged(0, @event.Target); } if (@event.EngineB) { hub.ThrottleChanged(1, @event.Target); } }
public void Get( [FromQuery] float longitude, [FromQuery] float latitude) { var url = $"http://api.openweathermap.org/data/2.5/weather?lat={latitude}&lon={longitude}&appid=370678173d62334da13aac92efa77910"; var request = (HttpWebRequest)WebRequest.Create(url); request.GetResponseAsync().ContinueWith(obj => { var response = obj.Result; using (var reader = new StreamReader(response.GetResponseStream())) { var jsonAsString = reader.ReadToEnd(); var weather = _serializer.FromJson <Weather>(jsonAsString); var weatherHub = _hubs.Get <WeatherHub>(); weatherHub.WeatherChanged(new WeatherData { WindSpeed = weather.Wind.Speed, WindDirection = weather.Wind.Deg }); } }); }