void Win32AuthCallback__(EventHandler <BluetoothWin32AuthenticationEventArgs> handler) { console.WriteLine("Making PC discoverable"); InTheHand.Net.Bluetooth.BluetoothRadio radio = InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio; InTheHand.Net.Bluetooth.RadioMode origRadioMode = radio.Mode; radio.Mode = InTheHand.Net.Bluetooth.RadioMode.Discoverable; // using (InTheHand.Net.Bluetooth.BluetoothWin32Authentication auther = new InTheHand.Net.Bluetooth.BluetoothWin32Authentication(handler)) { console.Pause("Continue to stop authenticating>"); } radio.Mode = origRadioMode; }
public void Win32AuthCallbackInduceFinalisationFault() { console.WriteLine("Authenticate a device two times"); console.WriteLine("Making PC discoverable"); InTheHand.Net.Bluetooth.BluetoothRadio radio = InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio; InTheHand.Net.Bluetooth.RadioMode origRadioMode = radio.Mode; radio.Mode = InTheHand.Net.Bluetooth.RadioMode.Discoverable; // Object auther; auther = new InTheHand.Net.Bluetooth.BluetoothWin32Authentication(Win32AuthCallbackTwoSeparateAuthenticationsHandler); console.Pause("Continue to clear and GC"); auther = "foo"; GC.Collect(); console.Pause("Continue to complete"); radio.Mode = origRadioMode; }
internal BluetoothMonitor() { if (!InTheHand.Net.Bluetooth.BluetoothRadio.IsSupported) { throw new PlatformNotSupportedException("Bluetooth Radio not detected"); } //make device discoverable, store old mode to restore afterwards previousMode = InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio.Mode; InTheHand.Net.Bluetooth.BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable; //client provides discovery services client = new BluetoothClient(); authentication = new BluetoothWin32Authentication(new EventHandler<BluetoothWin32AuthenticationEventArgs>(AuthenticationHandler)); }