Exemple #1
0
        public ActionResult <InputDeviceDetails> InputDeviceDetails(string id)
        {
            var inputDevice = inputDeviceManager.FindInputDevice(id);

            if (inputDevice == null)
            {
                return(NotFound());
            }
            return(new InputDeviceDetails
            {
                Id = inputDevice.UniqueId,
                Name = inputDevice.DisplayName,
                HardwareId = inputDevice.HardwareID,
                Inputs = inputDevice.GetInputDevices().Select(d => new InputDeviceInputDetails {
                    Running = d.Running,
                    Sources = d.Sources.Select(s => new InputDeviceSource {
                        Offset = s.Offset,
                        Name = s.DisplayName,
                        Type = FromType(s.Type),
                    }).ToList(),
                    ForceFeedbacks = d.ForceFeedbacks.Select(s => new InputForceFeedback {
                        Offset = s.Offset
                    }).ToList(),
                    InputMethod = d.InputMethod.ToString(),
                }).ToList(),
            });
        }
Exemple #2
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>()),
            });
        }