public Advertisement(Peripheral peripheral, int rssi, int txPower, byte[] data, DateTime timestamp)
 {
     _peripheral = peripheral;
     _rssi       = rssi;
     _txPower    = txPower;
     _data       = data;
     _time       = timestamp;
 }
Ejemplo n.º 2
0
 public PeripheralConnection(Peripheral device, int num)
 {
     _device   = device;
     _context  = SynchronizationContext.Current;
     _loggerId = $"BLEConnection:{device.Uuid.RightHalf:X12}:{num}";
     _logger   = device.Adapter._loggerFactory.CreateLogger(_loggerId);
     _q        = new OperationQueue(_logger);
 }
Ejemplo n.º 3
0
        Peripheral GetPeripheral(BluetoothDevice device)
        {
            var uuid = new Uuid(0, Convert.ToUInt64(device.Address.Replace(":", ""), 16));

            if (_peripherals.TryGetValue(uuid, out var peripheral))
            {
                peripheral.UpdateDevice(device);
                return(peripheral);
            }

            return(_peripherals[uuid] = new Peripheral(this, uuid, device));
        }