Rahul Ganguly Rahul Ganguly - 2 months ago 28
C# Question

C# connecting to an already paired device using 32feet.NET

I am trying to connect to a Blood Pressure Machine via bluetooth. The device is already paired with my laptop. When I use nuget pacage inTheNet. I am able to get a list of devices near by, but am unable to get the device that is already paired

string macAddress = FindMACAddress();
_blueToothEndPoint = new BluetoothEndPoint(BluetoothAddress.Parse(macAddress), BluetoothService.BluetoothBase);
_blueToothClient = new BluetoothClient(_blueToothEndPoint);
BluetoothDeviceInfo[] devices = _blueToothClient.DiscoverDevices();
foreach (BluetoothDeviceInfo device in devices)
{
Console.WriteLine(device.DeviceAddress);
}

Answer

This seems to work with the device.Remembered property.

BluetoothDeviceInfo[] devices;

foreach (var device in devices)
{

if (device.Remembered == true) return "Already Paired";
else return "Not Paired";

}

Hope this helps!

Chris

Comments