コード例 #1
0
 public void RemoveDevice(BluetoothDevice device)
 {
     foreach (var deviceInfo in mDevices)
     {
         if (deviceInfo.Device == device)
         {
             lock (mDevices)
             {
                 mDevices.Remove(deviceInfo);
             }
             mDeviceEvent.Set();
             break;
         }
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
ファイル: BluetoothDevice.cs プロジェクト: Necat0r/Automation
 public BluetoothDeviceEvent(BluetoothDevice device, bool inRange)
 {
     Device = device;
     InRange = inRange;
 }
コード例 #4
0
 // 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();
 }
コード例 #5
0
 public DeviceInfo(BluetoothDevice device)
 {
     Device = device;
     LastTime = DateTime.Now;
 }
コード例 #6
0
 public BluetoothDeviceEvent(BluetoothDevice device, bool inRange)
 {
     Device  = device;
     InRange = inRange;
 }