Hi.
I'm using your nuget to connect to a Bluetooth device, I'm using my phone as a sandbox to test my code.
My basic code is this
internal class Program
{
static bool IsServicesResolved;
static async Task Main(string[] args)
{
Console.WriteLine("Searching Bluetooth devices");
var adapter = await BlueZManager.GetAdapterAsync("hci0");
adapter.DeviceFound += adapter_DeviceFoundAsync;
Console.WriteLine("Searching devices");
await adapter.StartDiscoveryAsync();
await Task.Delay(TimeSpan.FromSeconds(10));
await adapter.StopDiscoveryAsync();
var devices = await adapter.GetDevicesAsync();
Console.WriteLine("Choose Device");
for (int i = 0; i < devices.Count; i++)
{
Console.WriteLine($"{(i + 1)} => {(await devices[i].GetNameAsync())}");
}
var index = Console.ReadLine();
var device = devices[int.Parse(index) - 1];
device.ServicesResolved += device_ServicesResolved;
await device.ConnectAsync();
await Task.Delay(TimeSpan.FromSeconds(5));
var connected = await device.GetConnectedAsync();
Console.WriteLine($"Device connected: {connected}");
var paired = await device.GetPairedAsync();
if (!paired)
{
await device.PairAsync();
await Task.Delay(TimeSpan.FromSeconds(5));
paired = await device.GetPairedAsync();
}
Console.WriteLine($"Device is paired: {paired}");
while (!IsServicesResolved)
{
Console.Clear();
Console.WriteLine($"{DateTime.Now}");
await Task.Delay(TimeSpan.FromSeconds(500));
}
Console.WriteLine("Services resolved");
var services = await device.GetServicesAsync();
var deviceProp = await device.GetPropertiesAsync();
var deviceUUID = await device.GetUUIDsAsync();
foreach (var uuid in deviceUUID)
{
var service = await device.GetServiceAsync(uuid);
if (service == null)
Console.WriteLine($"No service for UUID: {uuid}");
else
Console.WriteLine($"Service for UUID: {uuid}");
}
Console.ReadLine();
}
private static Task device_ServicesResolved(Device sender, BlueZEventArgs eventArgs)
{
IsServicesResolved = true;
return Task.CompletedTask;
}
private static async Task adapter_DeviceFoundAsync(Adapter sender, DeviceFoundEventArgs eventArgs)
{
Console.WriteLine($"Device Found: {(await eventArgs.Device.GetNameAsync())}");
}
}
The issue I'm facing is that I don't have any services that I can connect to, this is the console output:
Searching devices
Device Found: OPPO A73 5G
Choose Device
1 => OPPO A73 5G
1
Device connected: True
Device is paired: True
Services resolved
No service for UUID: 00001101-0000-1000-8000-00805f9b34fb
No service for UUID: 00001105-0000-1000-8000-00805f9b34fb
No service for UUID: 0000110a-0000-1000-8000-00805f9b34fb
No service for UUID: 0000110c-0000-1000-8000-00805f9b34fb
No service for UUID: 0000110d-0000-1000-8000-00805f9b34fb
No service for UUID: 0000110e-0000-1000-8000-00805f9b34fb
No service for UUID: 00001112-0000-1000-8000-00805f9b34fb
No service for UUID: 00001115-0000-1000-8000-00805f9b34fb
No service for UUID: 00001116-0000-1000-8000-00805f9b34fb
No service for UUID: 0000111f-0000-1000-8000-00805f9b34fb
No service for UUID: 0000112d-0000-1000-8000-00805f9b34fb
No service for UUID: 0000112f-0000-1000-8000-00805f9b34fb
No service for UUID: 00001132-0000-1000-8000-00805f9b34fb
No service for UUID: 00001200-0000-1000-8000-00805f9b34fb
No service for UUID: 00001800-0000-1000-8000-00805f9b34fb
No service for UUID: 00001801-0000-1000-8000-00805f9b34fb
No service for UUID: 0000aa15-0000-1000-8000-00805f9b34fb
No service for UUID: a49eaa15-cb06-495c-9f4f-bb80a90cdf00
Can anybody give some idea on this, because the same list of UUIDS in the Bluetooth linux console returns the UUIDS names
00001101-0000-1000-8000-00805f9b34fb Serial Port
00001105-0000-1000-8000-00805f9b34fb OBEX Object Push
0000110a-0000-1000-8000-00805f9b34fb Audio Source
0000110c-0000-1000-8000-00805f9b34fb Remote Control Target
0000110d-0000-1000-8000-00805f9b34fb Advanced Audio
0000110e-0000-1000-8000-00805f9b34fb Remote Control
00001112-0000-1000-8000-00805f9b34fb Headset Audio Gateway
00001115-0000-1000-8000-00805f9b34fb PANU
00001116-0000-1000-8000-00805f9b34fb Network Access Point
0000111f-0000-1000-8000-00805f9b34fb Handsfree Audio Gateway
0000112d-0000-1000-8000-00805f9b34fb SIM Access (SAP)
0000112f-0000-1000-8000-00805f9b34fb Phonebook Access (PBAP) - PSE
00001132-0000-1000-8000-00805f9b34fb Message Access Server
00001200-0000-1000-8000-00805f9b34fb PnP Information
00001800-0000-1000-8000-00805f9b34fb Generic Access
00001801-0000-1000-8000-00805f9b34fb Generic Attribute
0000aa15-0000-1000-8000-00805f9b34fb Unknown
a49eaa15-cb06-495c-9f4f-bb80a90cdf00 Proprietary
Hi. I'm using your nuget to connect to a Bluetooth device, I'm using my phone as a sandbox to test my code. My basic code is this
The issue I'm facing is that I don't have any services that I can connect to, this is the console output:
Can anybody give some idea on this, because the same list of UUIDS in the Bluetooth linux console returns the UUIDS names
Thanks