I am trying to use code sample for my case from Pair bluetooth devices to a computer with 32feet .NET Bluetooth library
In this, xmashallax have mentioned local mac address. To get local address I am trying this-
public static BluetoothAddress GetBTMacAddress()
{
var nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface nic in nics)
{
// Only consider Bluetooth network interfaces
if (nic.NetworkInterfaceType != NetworkInterfaceType.FastEthernetFx &&
nic.NetworkInterfaceType != NetworkInterfaceType.Wireless80211 && nic.Description.Contains("Bluetooth"))
{
return new BluetoothEndPoint(nic.GetPhysicalAddress().GetAddressBytes(), BluetoothService.SerialPort);
}
}
return null;
}
I am getting error here "The requested address is not valid in its context
"
ErrorCode: AddressNotAvailable
Can you please suggest what should be the right way to get the mac address of current local PC?