Disconnect() public method

Disconnect from the controller and stop reading data from it
public Disconnect ( ) : void
return void
コード例 #1
0
 public virtual IEnumerator <ITask> DropHandler(dflt.Drop drop)
 {
     // drop the connection to the Wiimote
     _wm.Disconnect();
     yield break;
 }
コード例 #2
0
        private void teardownWiimoteConnection(Wiimote pDevice)
        {
            if (pDevice != null)
            {
                pDeviceMutex.WaitOne();
                pDevice.WiimoteChanged -= this.wiimoteChangedEventHandler;
                pDevice.WiimoteExtensionChanged -= this.wiimoteExtensionChangedEventHandler;
                int wiimoteid;
                if (pWiimoteMap.Keys.Contains(pDevice.HIDDevicePath))
                {
                    wiimoteid = this.pWiimoteMap[pDevice.HIDDevicePath].Status.ID;
                    this.pWiimoteMap[pDevice.HIDDevicePath].Teardown();
                    this.pWiimoteMap.Remove(pDevice.HIDDevicePath);
                }
                else
                {
                    wiimoteid = this.pWiimoteMap.Count + 1;
                }
                pDeviceMutex.ReleaseMutex();

                pDevice.SetReportType(InputReport.Status, false);

                pDevice.SetRumble(false);
                pDevice.SetLEDs(true, true, true, true);

                // Close the connection and dispose of the device.
                pDevice.Disconnect();
                pDevice.Dispose();

                OnDisconnect(wiimoteid, this.pWiimoteMap.Count);
            }
        }