public void RemoveDevice(BluetoothDevice device) { foreach (var deviceInfo in mDevices) { if (deviceInfo.Device == device) { lock (mDevices) { mDevices.Remove(deviceInfo); } mDeviceEvent.Set(); break; } } }
public void AddDevice(BluetoothDevice device) { if (mDeviceNames == null || mDeviceNames.Length == 0) { Log.Warning("WARNING: No devices available on this machine. Please pair '{0}' with this machine.", device.BtName); return; } // Make sure the device name exist string name = Array.Find(mDeviceNames, x => x.Equals(device.BtName)); if (name == null) throw new Exception("Device name not found. Has the device not been paired to this machine?"); lock (mDevices) { mDevices.Add(new DeviceInfo(device)); } mDeviceEvent.Set(); }
public BluetoothDeviceEvent(BluetoothDevice device, bool inRange) { Device = device; InRange = inRange; }
// At this point we cannot force an update for only a single device. The closest is to use the device event to wakt up the scan thread and check all devices... public void ForceDeviceUpdate(BluetoothDevice device) { mIntensiveScan = true; mDeviceEvent.Set(); }
public DeviceInfo(BluetoothDevice device) { Device = device; LastTime = DateTime.Now; }