public override bool Equals(MsHidDeviceInfo other)
 {
     MsBluetoothDeviceInfo msbtOther = other as MsBluetoothDeviceInfo;
     if (msbtOther == null)
         return false;
     return Equals(msbtOther);
 }
Ejemplo n.º 2
0
        public override bool Equals(MsHidDeviceInfo other)
        {
            MsBluetoothDeviceInfo msbtOther = other as MsBluetoothDeviceInfo;

            if (msbtOther == null)
            {
                return(false);
            }
            return(Equals(msbtOther));
        }
Ejemplo n.º 3
0
        public override bool Equals(MsHidDeviceInfo other)
        {
            BluesoleilDeviceInfo bsdiOther = other as BluesoleilDeviceInfo;

            if (bsdiOther == null)
            {
                return(false);
            }
            return(Equals(bsdiOther));
        }
Ejemplo n.º 4
0
        private bool TryConnect(MsHidDeviceInfo hidDeviceInfo, out ReportWiimote wiimote)
        {
            Stream hidStream;
            if (UseSetOutputReport)
                hidStream = new MsHidSetOutputReportStream(hidDeviceInfo.DevicePath);
            else
                hidStream = new MsHidStream(hidDeviceInfo.DevicePath);

            try
            {
                wiimote = new ReportWiimote(hidDeviceInfo, hidStream);
                wiimote.Initialize();
            }
            catch (TimeoutException)
            {
                hidStream.Dispose();
                wiimote = null;
                return false;
            }
            catch (Exception)
            {
                hidStream.Dispose();
                throw;
            }
            return true;
        }
Ejemplo n.º 5
0
        public void Update()
        {
            if (IsDiscovering)
                throw new InvalidOperationException("This provider is already discovering.");
            _IsDiscovering = true;
            List<string> devicePaths = new List<string>(MsHidDeviceProviderHelper.GetWiiDevicePaths());

            foreach (string devicePath in devicePaths)
            {
                if (!_FoundDevices.ContainsKey(devicePath))
                {
                    MsHidDeviceInfo deviceInfo = new MsHidDeviceInfo(devicePath);
                    _FoundDevices.Add(devicePath, deviceInfo);
                    OnDeviceFound(new DeviceInfoEventArgs(deviceInfo));
                }
            }
            if (devicePaths.Count < _FoundDevices.Count)
            {
                List<string> devicesToBeRemoved = new List<string>();
                foreach (KeyValuePair<string, IDeviceInfo> pair in _FoundDevices)
                {
                    if (!devicePaths.Contains(pair.Key))
                    {
                        devicesToBeRemoved.Add(pair.Key);
                    }
                }
                foreach (string devicePathToBeRemoved in devicesToBeRemoved)
                {
                    OnDeviceLost(new DeviceInfoEventArgs(_FoundDevices[devicePathToBeRemoved]));
                    _FoundDevices.Remove(devicePathToBeRemoved);
                }
            }
            _IsDiscovering = false;
        }