Need help if someone has experience with linux.bluetooth library or has some other one that can do the job. I need to pair with device that has key and I have the key but no method supports that.
I have to support linux environment so need nuget package that can work with that OS.
Working in C# and currently using https://github.com/SuessLabs/Linux.Bluetooth/tree/master
latest version. Did not find any example how to do that.
My code currently looks like this
<code>public async Task Pair(BluetoothInfoData infoData, string? pairKey = null)
{
IAdapter1? adapter = (await BlueZManager.GetAdaptersAsync()).FirstOrDefault();
if (adapter != null)
{
var device = await adapter.GetDeviceAsync(infoData.Address);
await device.SetTrustedAsync(true);
}
}
</code>
<code>public async Task Pair(BluetoothInfoData infoData, string? pairKey = null)
{
IAdapter1? adapter = (await BlueZManager.GetAdaptersAsync()).FirstOrDefault();
if (adapter != null)
{
var device = await adapter.GetDeviceAsync(infoData.Address);
await device.SetTrustedAsync(true);
}
}
</code>
public async Task Pair(BluetoothInfoData infoData, string? pairKey = null)
{
IAdapter1? adapter = (await BlueZManager.GetAdaptersAsync()).FirstOrDefault();
if (adapter != null)
{
var device = await adapter.GetDeviceAsync(infoData.Address);
await device.SetTrustedAsync(true);
}
}
After setting trusted to true or I can remove that also I can connect to device. Pairing without key is not an option.