public IDevice Connect(IDeviceInfo deviceInfo)
        {
            BluesoleilDeviceInfo bluetoothDeviceInfo = (BluesoleilDeviceInfo)deviceInfo;

            Thread.Sleep(100);

            BluetoothConnection connection = BluesoleilService.Instance.ConnectService(bluetoothDeviceInfo.Service);

            ReportDevice device = null;

            foreach (KeyValuePair <string, SafeFileHandle> pair in MsHidDeviceProviderHelper.GetWiiDeviceHandles())
            {
                string         devicePath          = pair.Key;
                SafeFileHandle fileHandle          = pair.Value;
                Stream         communicationStream = new MsHidStream(fileHandle);

                // determine the device type
                if (bluetoothDeviceInfo.Name == "Nintendo RVL-WBC-01")
                {
                    device = new ReportBalanceBoard(deviceInfo, communicationStream);
                }
                else if (bluetoothDeviceInfo.Name == "Nintendo RVL-CNT-01")
                {
                    device = new ReportWiimote(deviceInfo, communicationStream);
                }
                else
                {
                    throw new ArgumentException("The specified deviceInfo with name '" + bluetoothDeviceInfo.Name + "' is not supported.", "deviceInfo");
                }

                if (MsHidDeviceProviderHelper.TryConnect(device, communicationStream, devicePath, fileHandle))
                {
                    break;
                }
                device = null;
            }
            if (device == null)
            {
                bluesoleil.DisconnectService(connection);
                throw new DeviceConnectException("The connected bluetooth device was not found in the HID-list.");
            }

            device.Disconnected += new EventHandler(device_Disconnected);
            lookupConnection.Add(bluetoothDeviceInfo.Address, connection);
            OnDeviceConnected(device);
            return(device);
        }