IBluetooth.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections.ObjectModel;
  2. using System.Security.Cryptography.X509Certificates;
  3. using InABox.Core;
  4. namespace InABox.Avalonia.Platform;
  5. public interface IBluetoothDevice
  6. {
  7. String ID { get; }
  8. String Name { get; }
  9. }
  10. public interface IConnectedBluetoothDevice : IBluetoothDevice
  11. {
  12. Task<bool> WriteAsync(Guid serviceid, Guid characteristicid, byte[] data);
  13. Task<byte[]?> ReadAsync(Guid serviceid, Guid characteristicid);
  14. }
  15. public interface IBluetooth : ILoggable
  16. {
  17. Logger? Logger { get; set; }
  18. Task<bool> IsAvailable();
  19. //Task<IBluetoothDevice?> FindDevice(Guid serviceId, TimeSpan timeout);
  20. Task<bool> StartScanningAsync(Guid serviceId);
  21. Task<bool> StopScanningAsync();
  22. Task<IConnectedBluetoothDevice?> Connect(IBluetoothDevice deviceid);
  23. Task<bool> Disconnect(IConnectedBluetoothDevice device);
  24. event EventHandler? Changed;
  25. CoreObservableCollection<IBluetoothDevice> Devices { get; }
  26. }