public List <IMessageHandler> CreateHandlers(HttpContext context, CloseFunction closeFunction, SenderFunction sendFunction)
 {
     return(new List <IMessageHandler>
     {
         new DebugMessageHandler(),
         new MappableDeviceMessageHandler(mappableDevices, sendFunction.GetTyped <MappableDeviceFeedbackMessage>()),
     });
 }
Пример #2
0
        public List <IMessageHandler> CreateHandlers(HttpListenerContext context, SenderFunction sendFunction)
        {
            string emulatorName = context.Request.Url.LocalPath.Replace($"/{DeviceType}/", "");
            var    emulator     = emulatorService.FindEmulator <IXboxEmulator>(DeviceTypes.MicrosoftXbox360, emulatorName);
            var    device       = emulator.CreateDevice();

            return(new List <IMessageHandler>
            {
                new DebugMessageHandler(),
                new XboxFeedbackMessageHandler(device, sendFunction.GetTyped <XboxFeedbackMessage>()),
                new XboxInputMessageHandler(device),
            });
        }
Пример #3
0
        public List <IMessageHandler> CreateHandlers(HttpContext context, CloseFunction closeFunction, SenderFunction sendFunction)
        {
            string deviceId = context.Request.Path.Value.Replace($"/ws/input/", "");
            var    device   = inputDeviceManager.FindInputDevice(deviceId);

            if (device == null)
            {
                throw new ArgumentException();
            }
            return(new List <IMessageHandler>
            {
                new DebugMessageHandler(),
                new SourceValuesMessageHandler(device, sendFunction.GetTyped <InputValuesMessage>()),
            });
        }
Пример #4
0
        public List <IMessageHandler> CreateHandlers(HttpContext context, CloseFunction closeFunction, SenderFunction sendFunction)
        {
            string emulatorName = context.Request.Path.Value.Replace($"/ws/{DeviceType}/", "");
            var    emulator     = emulatorService.FindEmulator <IDs4Emulator>(XOutput.Emulation.DeviceTypes.SonyDualShock4, emulatorName);
            var    device       = emulator.CreateDs4Device();
            DeviceDisconnectedEvent disconnectedEvent = (sender, args) => closeFunction();

            device.Closed += disconnectedEvent;
            var ip = context.Request.HttpContext.Connection.RemoteIpAddress?.ToString();

            deviceInfoService.Add(new NetworkDeviceInfo
            {
                Device     = device,
                IPAddress  = ip,
                DeviceType = XOutput.Emulation.DeviceTypes.SonyDualShock4,
                Emulator   = emulator.Name,
            });
            return(new List <IMessageHandler>
            {
                new DebugMessageHandler(),
                new Ds4FeedbackMessageHandler(device, sendFunction.GetTyped <Ds4FeedbackMessage>()),
                new Ds4InputMessageHandler(device, disconnectedEvent),
            });
        }