Desktop_BluetoothDevice.cs 641 B

123456789101112131415161718192021222324
  1. using BluetoothLENet;
  2. namespace InABox.Avalonia.Platform.Desktop;
  3. public class Desktop_BluetoothDevice : IBluetoothDevice
  4. {
  5. public Desktop_BluetoothDevice(BLEDevice device)
  6. {
  7. Device = device;
  8. LastSeen = device.LastSeen;
  9. }
  10. public BLEDevice? Device { get; private set; }
  11. public string ID => Device?.MacAddress ?? string.Empty;
  12. public string Name => Device?.Native?.Name ?? "Unknown Device";
  13. public Guid[] AvailableServices => Device?.AvailableServices ?? [];
  14. public DateTime LastSeen { get; set; }
  15. public void Dispose()
  16. {
  17. Device?.Dispose();
  18. Device = null;
  19. }
  20. }