void Start()
    {
        List <InputDevice> devices = new List <InputDevice>();

        InputDevices.GetDevicesWithCharacteristics(controllerCharacteristics, devices);

        InputDevices.GetDevices(devices);
        foreach (var item in devices)
        {
            Debug.Log(item.name + item.characteristics);
        }

        if (devices.Count > 0)
        {
            targetDevice = devices[0];
            Debug.Log("get target device");
            GameObject prefab = controllerPrefabs.Find(controller => controller.name == targetDevice.name);
            if (prefab)
            {
                spawnedController = Instantiate(prefab, transform);
            }
            else
            {
                Debug.Log("Did not find corresponding controller model");
                spawnedController = Instantiate(controllerPrefabs[0], transform);
            }

            spawnedHand = Instantiate(handPrefabs, transform);
        }
    }
Exemplo n.º 2
0
    // This is called by TestRunner scripts.
    // Simply entering playmode won't start this, and we don't want it to start twice via Start() or Awake()
    // Please refer to the readme in this project's root folder for more information
    public override IEnumerator RunTest()
    {
        List <InputDevice> m_Devices = new List <InputDevice>();

        InputDevices.GetDevices(m_Devices);
        if (m_Devices.Count == 0)
        {
            RecordStatus(OverallTestStatus.Failed, "No devices detected.  Test failing due to invalid setup.");
            yield break;
        }

        instructionCanvas.Instructions.text = "For each device, and each tracking property (position, rotation, velocity, angular velocity, acceleration, and angular acceleration):" +
                                              "\n - If the tracking property is marked as NOT tracking, its value must default to (0, 0, 0) for Vector3 type usages and (0, 0, 0, 1) for Quaternion usages." +
                                              "\n - If the tracking property is marked as YES tracking, verify that its values are update when you move the device." +
                                              "\n\nActivate \"Continue\" to cycle through devices.";

        m_Devices = new List <InputDevice>();
        InputDevices.GetDevices(m_Devices);
        Debug.Log(m_Devices.Count + " devices detected");

        while (m_DeviceIndex < m_Devices.Count)
        {
            Debug.Log("Testing device [" + m_DeviceIndex + "] " + m_Devices[m_DeviceIndex].name);
            DisplayNextDevice(m_Devices[m_DeviceIndex]);
            yield return(WaitForContinue());
        }

        // If your test successfully reaches its conclusion, RecordStatus() as passed.
        // The second parameter of RecordStatus allows you to give more information
        // for a success or failure in the results log.
        if (overallStatus == OverallTestStatus.NotRun)
        {
            RecordStatus(OverallTestStatus.Passed, "All haptic tests have been manually approved");
        }
    }
Exemplo n.º 3
0
        public static void WriteTrialResults(List <ITrialResult> t, StreamWriter writer)
        {
            if (t.Count == 0)
            {
                return;
            }
            writer.WriteLine($"meta:");
            writer.WriteLine($"  timestamp: \"{DateTime.Now}\"");
            // https://stackoverflow.com/questions/17632584/how-to-get-the-unix-timestamp-in-c-sharp
            writer.WriteLine($"  unixseconds: {DateTimeOffset.UtcNow.ToUnixTimeSeconds()}");
            writer.WriteLine($"  platform: {Application.platform}");
            List <InputDevice> devices = new List <InputDevice>();

            InputDevices.GetDevices(devices);
            writer.WriteLine($"  xrdevices: {(devices.Count > 0 ? "" : "[]")}");
            foreach (var device in devices)
            {
                writer.WriteLine($"    {device.name}: {(device.characteristics == 0 ? "None" : "")}");
                uint max = (uint)InputDeviceCharacteristics.Simulated6DOF;
                for (int i = 1; i <= max; i <<= 1)
                {
                    var flag = (InputDeviceCharacteristics)i;
                    if ((device.characteristics & flag) == flag)
                    {
                        writer.WriteLine($"      - {Enum.GetName(typeof(InputDeviceCharacteristics), flag)}");
                    }
                }
            }

            writer.WriteLine("trial:");
            foreach (var item in t)
            {
                item.Write(writer);
            }
        }
Exemplo n.º 4
0
        private void Awake()
        {
            // Destroy any duplicate instances that may have been created
            if (_instance != null && _instance != this)
            {
                Destroy(this);
                return;
            }

            _instance = this;

#if UNITY_2019_3_OR_NEWER
            InputDevices.deviceConfigChanged += onDeviceChanged;
            InputDevices.deviceConnected     += onDeviceChanged;
            InputDevices.deviceDisconnected  += onDeviceChanged;
#endif

            // Update all device properties
            List <InputDevice> devices = new List <InputDevice>();
            InputDevices.GetDevices(devices);

            setDeviceProperties();

            // Init Tracking Origin. Deprecated, but currently the only working solution.
            XRDevice.SetTrackingSpaceType(TrackingSpaceType);
        }
Exemplo n.º 5
0
        public static void GetNodeStates(List <ClarteXRNodeState> nodes)
        {
            nodes.Clear();

#if UNITY_2019_3_OR_NEWER
            List <InputDevice> devices = new List <InputDevice>();
            InputDevices.GetDevices(devices);
            foreach (InputDevice node in devices)
            {
                nodes.Add(new ClarteXRNodeState()
                {
                    node = node, hashedId = (ulong)node.name.GetHashCode()
                });
            }
#else
            List <XRNodeState> lnodes = new List <XRNodeState>();
            InputTracking.GetNodeStates(lnodes);
            foreach (XRNodeState node in lnodes)
            {
                nodes.Add(new ClarteXRNodeState()
                {
                    node = node
                });
            }
#endif
        }
Exemplo n.º 6
0
 public PokeXRInputDevices(bool _debugMode)
 {
     debugMode = _debugMode;
     InputDevices.GetDevices(XRInputDevices);
     PokeXRInputTracking = new PokeXRInputTracking(debugMode);
     PokeXRInputTracking.refreshInputDevices();
     if (debugMode)
     {
         for (i = 0; i < XRInputDevices.Count; i++)
         {
             List <InputFeatureUsage> ifu = new List <InputFeatureUsage>();
             string a = "XRInputDevice " + i + ": " + XRInputDevices[i].name + ", isValid: " + XRInputDevices[i].isValid;
             XRInputDevices[i].TryGetFeatureUsages(ifu);
             for (int j = 0; j < ifu.Count; j++)
             {
                 a += "\nfu = " + ifu[j].name;
             }
             Debug.Log(a);
         }
         Debug.Log(PokeXRInputTracking.toString());
     }
     if (XRInputDevices.Count > 0)
     {
         Player1InputDevice = XRInputDevices[0];
         Player1Body        = PokeXRInputTracking.getPokeBody();
         pokeXRDeviceBody   = PokeXRInputTracking.getPokeDeviceBody();
     }
     else
     {
         Debug.LogWarning("Failed to detect and");
     }
 }
Exemplo n.º 7
0
        public static void Load()
        {
            int defaultKeycode;
            List <InputDevice> inputDevices = new List <InputDevice>();

            InputDevices.GetDevices(inputDevices);

            if (inputDevices.Exists(x => x.name.IndexOf("rift", StringComparison.InvariantCultureIgnoreCase) != -1))
            {
                defaultKeycode = (int)ConInput.Oculus.LeftThumbstickPress;
            }
            else if (inputDevices.Exists(x => x.name.IndexOf("vive", StringComparison.InvariantCultureIgnoreCase) != -1))
            {
                defaultKeycode = (int)ConInput.Vive.LeftTrackpadPress;
            }
            else
            {
                defaultKeycode = (int)ConInput.WinMR.LeftThumbstickPress;
            }

            DisplayLyrics = ModPrefs.GetBool(PrefsSection, "Enabled", true);
            ToggleKeyCode = ModPrefs.GetInt(PrefsSection, nameof(ToggleKeyCode), defaultKeycode);

            DisplayDelay = ModPrefs.GetFloat(PrefsSection, nameof(DisplayDelay), -.1f);
            HideDelay    = ModPrefs.GetFloat(PrefsSection, nameof(HideDelay), 0f);

            VerboseLogging = ModPrefs.GetBool(PrefsSection, nameof(VerboseLogging), false);
        }
    // This is called by TestRunner scripts.
    // Simply entering playmode won't start this, and we don't want it to start twice via Start() or Awake()
    // Please refer to the readme in this project's root folder for more information
    public override IEnumerator RunTest()
    {
        List <InputDevice> m_Devices = new List <InputDevice>();

        InputDevices.GetDevices(m_Devices);
        if (m_Devices.Count == 0)
        {
            RecordStatus(OverallTestStatus.Failed, "No devices detected.  Test failing due to invalid setup.");
            yield break;
        }

        instructionCanvas.Instructions.text = "Activating Recenter corrects your position and yaw." +
                                              "\nFor each input subsystem that supports Device TrackingOriginMode, do the following:" +
                                              "\n- Move away from your starting position if possible." +
                                              "\n- Look away from +Z" +
                                              "\n- Recenter" +
                                              "\n- Verify that your position is reset and your \"forward\" direction aligns with +Z." +
                                              "\n\nThen verify that nothing occurs if you try to recenter in other supported TrackingOriginModes";

        ShowSubsystems();
        yield return(WaitForContinue());

        // If your test successfully reaches its conclusion, RecordStatus() as passed.
        // The second parameter of RecordStatus allows you to give more information
        // for a success or failure in the results log.
        if (overallStatus == OverallTestStatus.NotRun)
        {
            RecordStatus(OverallTestStatus.Passed, "All haptic tests have been manually approved");
        }
    }
    // This is called by TestRunner scripts.
    // Simply entering playmode won't start this, and we don't want it to start twice via Start() or Awake()
    // Please refer to the readme in this project's root folder for more information
    public override IEnumerator RunTest()
    {
        List <InputDevice> m_Devices = new List <InputDevice>();

        InputDevices.GetDevices(m_Devices);
        if (m_Devices.Count == 0)
        {
            RecordStatus(OverallTestStatus.Failed, "No devices detected.  Test failing due to invalid setup.");
            yield break;
        }

        instructionCanvas.Instructions.text = "Verify that the name for each device is clear, succinct, and recognizeable by mass market consumers (not a code name).  It must not be blank.  Then either fail or continue.";

        yield return(WaitForContinue());

        instructionCanvas.Instructions.text = "Verify that the manufacturer for each device is clear, succinct, and recognizeable by mass market consumers (not a code name).  It must not be blank.  Then either fail or continue.";

        yield return(WaitForContinue());

        instructionCanvas.Instructions.text = "Verify that the serial number for each device matches the serial number on the actual device or is blank.  Then either fail or continue.";

        yield return(WaitForContinue());

        // If your test successfully reaches its conclusion, RecordStatus() as passed.
        // The second parameter of RecordStatus allows you to give more information
        // for a success or failure in the results log.
        if (overallStatus == OverallTestStatus.NotRun)
        {
            RecordStatus(OverallTestStatus.Passed, "All haptic tests have been manually approved");
        }
    }
    void OnEnable()
    {
        m_LeftTeleportDeactivated  = false;
        m_RightTeleportDeactivated = false;

        m_RightControllerState.Initialize();
        m_LeftControllerState.Initialize();

        m_RightControllerState.SetGameObject(ControllerStates.Select, m_RightBaseController);
        m_RightControllerState.SetGameObject(ControllerStates.Teleport, m_RightTeleportController);

        m_LeftControllerState.SetGameObject(ControllerStates.Select, m_LeftBaseController);
        m_LeftControllerState.SetGameObject(ControllerStates.Teleport, m_LeftTeleportController);

        m_LeftControllerState.ClearAll();
        m_RightControllerState.ClearAll();

        InputDevices.deviceConnected += RegisterDevices;
        List <InputDevice> devices = new List <InputDevice>();

        InputDevices.GetDevices(devices);
        for (int i = 0; i < devices.Count; i++)
        {
            RegisterDevices(devices[i]);
        }
    }
Exemplo n.º 11
0
    void TryInitialize()
    {
        List <InputDevice> devices = new List <InputDevice>();

        InputDevices.GetDevices(devices);
        InputDevices.GetDevicesWithCharacteristics(ControllerCharacteristic, devices);

        var device = devices.FirstOrDefault();

        if (device == null)
        {
            return;
        }

        targetDevice = device;
        Debug.Log($"Device name: {device.name} and characteristics: {device.characteristics}");

        GameObject prefab = ControllerPrefabs.Find(controller => controller.name.Contains(device.name));

        if (prefab)
        {
            spawnedController = Instantiate(prefab, transform);
        }
        else
        {
            Debug.LogError("Did not find controller model");
            spawnedController = ControllerPrefabs.FirstOrDefault();
        }
        spawnedHandModel = Instantiate(handModelPrefab, transform);
        handAnimator     = spawnedHandModel.GetComponent <Animator>();
    }
    // This is called by TestRunner scripts.
    // Simply entering playmode won't start this, and we don't want it to start twice via Start() or Awake()
    // Please refer to the readme in this project's root folder for more information
    public override IEnumerator RunTest()
    {
        List <InputDevice> m_Devices = new List <InputDevice>();

        InputDevices.GetDevices(m_Devices);
        if (m_Devices.Count == 0)
        {
            RecordStatus(OverallTestStatus.Failed, "No devices detected.  Test failing due to invalid setup.");
            yield break;
        }

        instructionCanvas.Instructions.text = "For each input subsystem:" +
                                              "\n - Verify that a the current TrackingOriginMode is in the list of available tracking modes." +
                                              "\n - Verify that \"Unknown\" does not appear as the current TrackingOriginMode or in the list of available TrackingOriginModes." +
                                              "\n - Verify that you can switch to any of the available tracking modes." +
                                              "\n - Verify that you can NOT switch to any tracking mode that is not listed as available." +
                                              "\n - Verify that each input subsystem that should have a boundary does. Boundary start points are labeled with its subsystem number and must be enumerated clockwise (from above) and in sequence." +
                                              "\n - For each supported TrackingOriginMode, try recenter.  If it changes your position or orientation, verify that the bounds are still correct and that both OnBoundaryChanged and TrackingOriginUpdated fire.  If the subsystem under test allows you to recenter through it, verify this line using both that action and through the recenter buttons corresponding to that subsystem." +
                                              "\n - If applicable, verify that changing the boundary in the runtime under test while running this test will trigger OnBoundaryChanged." +
                                              "\n\nActivate \"Continue\" when finished";

        ShowSubsystems();
        yield return(WaitForContinue());

        // If your test successfully reaches its conclusion, RecordStatus() as passed.
        // The second parameter of RecordStatus allows you to give more information
        // for a success or failure in the results log.
        if (overallStatus == OverallTestStatus.NotRun)
        {
            RecordStatus(OverallTestStatus.Passed, "All haptic tests have been manually approved");
        }
    }
        static TreeViewItem BuildInputDevicesTree()
        {
            var rootItem = new Item
            {
                id          = 1,
                displayName = "Devices",
                depth       = 0,
            };

            // Build children.
            var inputDevices = new List <InputDevice>();

            InputDevices.GetDevices(inputDevices);

            var deviceChildren = new List <TreeViewItem>();

            // Add device children
            foreach (var device in inputDevices)
            {
                var deviceItem = new Item
                {
                    id          = device.GetHashCode(),
                    displayName = device.name,
                    // TODO Need to display new characteristics API here.
#pragma warning disable 612, 618
                    deviceRole = device.role.ToString(),
#pragma warning restore 612, 618
                    depth  = 1,
                    parent = rootItem,
                };

                var featureUsages = new List <InputFeatureUsage>();
                device.TryGetFeatureUsages(featureUsages);

                var featureChildren = new List <TreeViewItem>();
                foreach (var featureUsage in featureUsages)
                {
                    var featureItem = new Item
                    {
                        id           = device.GetHashCode() ^ (featureUsage.GetHashCode() >> 1),
                        displayName  = featureUsage.name,
                        featureType  = featureUsage.type.ToString(),
                        featureValue = GetFeatureValue(device, featureUsage),
                        depth        = 2,
                        parent       = deviceItem,
                    };
                    featureChildren.Add(featureItem);
                }

                deviceItem.children = featureChildren;
                deviceChildren.Add(deviceItem);
            }

            // Sort deviceChildren by name.
            deviceChildren.Sort((a, b) => string.Compare(a.displayName, b.displayName));
            rootItem.children = deviceChildren;

            return(rootItem);
        }
Exemplo n.º 14
0
    void tryInitialize()
    {
        List <InputDevice> devices    = new List <InputDevice>();
        List <InputDevice> allDevices = new List <InputDevice>();

        InputDevices.GetDevicesWithCharacteristics(headsetCharacteristics, devices);
        InputDevices.GetDevices(allDevices);
    }
Exemplo n.º 15
0
        public static List <InputDevice> GetAllInputDevices()
        {
            var inputDevices = new List <InputDevice>();

            InputDevices.GetDevices(inputDevices);

            return(inputDevices);
        }
Exemplo n.º 16
0
    // Start is called before the first frame update
    void Start()
    {
        InputDevices.GetDevices(inputDevices);

        myBody           = gameObject.GetComponent <Rigidbody>();
        originalPosition = new Vector3(0.0f, 3.0f, 0.0f);
        grounded         = false;
    }
Exemplo n.º 17
0
        TreeViewItem BuildInteractableTree()
        {
            int id       = 0;
            var rootItem = new Item
            {
                id          = id++,
                displayName = "Devices",
                depth       = 0
            };

            // Build children.
            var inputDevices = new List <InputDevice>();

            InputDevices.GetDevices(inputDevices);

            var deviceChildren = new List <TreeViewItem>();

            // Add device children
            foreach (var device in inputDevices)
            {
                var deviceItem = new Item
                {
                    id          = device.GetHashCode(),
                    displayName = device.name,
                    deviceRole  = device.role.ToString(),
                    depth       = 1
                };
                deviceItem.parent = rootItem;

                List <InputFeatureUsage> featureUsages = new List <InputFeatureUsage>();
                device.TryGetFeatureUsages(featureUsages);

                var featureChildren = new List <TreeViewItem>();
                foreach (var featureUsage in featureUsages)
                {
                    Type featureType = featureUsage.type;
                    var  featureItem = new Item
                    {
                        id           = device.GetHashCode() ^ (featureUsage.GetHashCode() >> 1),
                        displayName  = featureUsage.name,
                        featureType  = featureType.ToString(),
                        featureValue = GetFeatureValue(device, featureUsage),
                        depth        = 2
                    };
                    featureItem.parent = deviceItem;
                    featureChildren.Add(featureItem);
                }

                deviceItem.children = featureChildren;
                deviceChildren.Add(deviceItem);
            }

            // Sort deviceChildren by name.
            deviceChildren.Sort((a, b) => string.Compare(a.displayName, b.displayName));
            rootItem.children = deviceChildren;

            return(rootItem);
        }
Exemplo n.º 18
0
        public InputDevice GetLeftController()
        {
            InputDevices.GetDevices(devices);

            var leftHandedControllers = new List <InputDevice>();
            var dc = InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Left | InputDeviceCharacteristics.Controller;

            InputDevices.GetDevicesWithCharacteristics(dc, leftHandedControllers);
            return(leftHandedControllers.FirstOrDefault());
        }
Exemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        List <InputDevice> devices = new List <InputDevice>();

        InputDevices.GetDevices(devices);
        foreach (var item in devices)
        {
            Debug.Log(item.name + item.characteristics);
        }
    }
Exemplo n.º 20
0
    private void UpdateDeviceList()
    {
        _devices.Clear();
        _devices.AddRange(devices);
        InputDevices.GetDevices(devices);

        devices.Except(_devices).ToList().ForEach(HandleNewDevice);
        devices.Union(_devices).ToList().ForEach(HandleDeviceUpdate);
        _devices.Except(devices).ToList().ForEach(HandleDeviceRemoved);
    }
Exemplo n.º 21
0
        public static bool TryGetDevices()
        {
            if (!head.isValid || !secondaryController.isValid || !primaryController.isValid)
            {
                var inputDevices = new List <InputDevice>();
                InputDevices.GetDevices(inputDevices);
                foreach (var device in inputDevices)
                {
                    if (device.characteristics == (InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice))
                    {
                        head = device;
                    }
                    if (device.characteristics == (InputDeviceCharacteristics.Right | InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.TrackedDevice))
                    {
                        primaryController = device;
                    }
                    if (device.characteristics == (InputDeviceCharacteristics.Left | InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.TrackedDevice))
                    {
                        secondaryController = device;
                    }
                    //Debug.Log(string.Format("Device found with name '{0}' and role '{1}'", device.name, device.characteristics.ToString()));
                }
                if (!head.isValid)
                {
                    Debug.LogWarning("Generic device not found !!");
                }
                if (!secondaryController.isValid)
                {
                    Debug.LogWarning("Left device not found !!");
                }
                else
                {
                    currentControllerValues[secondaryController] = secondaryControllerValues;
                    prevControllerValues[secondaryController]    = secondaryControllerValues;
                }
                if (!primaryController.isValid)
                {
                    Debug.LogWarning("Right device not found !!");
                }
                else
                {
                    currentControllerValues[primaryController] = primaryControllerValues;
                    prevControllerValues[primaryController]    = primaryControllerValues;
                }
                if (currentControllerValues.Count == 2 && !invertedController.ContainsKey(head))
                {
                    GlobalState.Instance.VRControllers.InitializeControllers(primaryController.name);
                    InitInvertedControllers();
                    FillCurrentControllerValues();
                    UpdateControllerValues();
                }
            }

            return(head.isValid && secondaryController.isValid && primaryController.isValid);
        }
Exemplo n.º 22
0
        private void OnEnable()
        {
            InputDevices.deviceConnected += RegisterDevices;
            List <InputDevice> devices = new List <InputDevice>();

            InputDevices.GetDevices(devices);
            for (int i = 0; i < devices.Count; i++)
            {
                RegisterDevices(devices[i]);
            }
        }
Exemplo n.º 23
0
        public InputDevice GetHMD()
        {
            InputDevices.GetDevices(devices);

            var hmds = new List <InputDevice>();
            var dc1  = InputDeviceCharacteristics.HeadMounted;

            InputDevices.GetDevicesWithCharacteristics(dc1, hmds);

            return(hmds.FirstOrDefault());
        }
Exemplo n.º 24
0
        private void GetCurrentDevices()
        {
            List <InputDevice> allDevices = new List <InputDevice>();

            InputDevices.GetDevices(allDevices);

            foreach (InputDevice device in allDevices)
            {
                OnDeviceConnected(device);
            }
        }
Exemplo n.º 25
0
    private void OnEnable()
    {
        List <InputDevice> allDevices = new List <InputDevice>();

        InputDevices.GetDevices(allDevices);
        foreach (InputDevice device in allDevices)
        {
            InputDevices_deviceConnected(device);
        }
        InputDevices.deviceConnected    += InputDevices_deviceConnected;
        InputDevices.deviceDisconnected += InputDevices_deviceDisconnected;
    }
Exemplo n.º 26
0
    void Start()
    {
        InvokeRepeating("tryInitialize", 0, 0.5f);
        List <InputDevice> allDevices = new List <InputDevice>();

        InputDevices.GetDevices(allDevices);
        foreach (var device in allDevices)
        {
            Debug.Log(string.Format("Device found with name '{0}' and role '{1}'",
                                    device.name, device.characteristics.ToString()));
        }
    }
    private void TryInitialize()
    {
        List <InputDevice> devices = new List <InputDevice>();

        InputDevices.GetDevices(devices);

        if (devices.Count > 0)
        {
            targetDevice = devices[0];
        }

        spawnedHandModel = Instantiate(handModelPrefab, transform);
    }
        private void OnEnable()
        {
            InputDevices.deviceConnected += RegisterDevice;

            List <InputDevice> devices = new List <InputDevice>();

            InputDevices.GetDevices(devices);

            foreach (InputDevice device in devices)
            {
                RegisterDevice(device);
            }
        }
Exemplo n.º 29
0
        void Start()
        {
            if (trackedObj1 == null)
            {
                return;
            }

            var allDevices = new List <InputDevice>();

            InputDevices.GetDevices(allDevices);
            tracker  = allDevices.Find(d => d.role == InputDeviceRole.HardwareTracker);
            tracker2 = allDevices.Find(d => d.role == InputDeviceRole.HardwareTracker && d != tracker);
        }
Exemplo n.º 30
0
        private void InitialiseHandDevices()
        {
            controllers.Clear();
            var collection = new List <InputDevice>();

            InputDevices.GetDevices(collection);
            foreach (var item in collection)
            {
                InputDevices_deviceConnected(item);
            }
            InputDevices.deviceConnected += InputDevices_deviceConnected;
            initialised = true;
        }