【问题标题】:Always the same Bluetooth Mac-Address using BLE.Plugin in Xamarin在 Xamarin 中使用 BLE.Plugin 始终使用相同的蓝牙 Mac 地址
【发布时间】:2021-06-23 20:45:24
【问题描述】:

我正在使用 BLE.Plugin 来扫描 Xamarin 中的其他设备。扫描没有问题,插件找到了一些设备,但所有设备都有相同的mac-address。找到的地址与它应该找到的设备的设备地址不匹配。在我正在使用的代码下方。

adapter.DeviceDiscovered += (s, a) =>
{
    if (a.Device.NativeDevice is BluetoothDevice device)
    {
        if (addresses.Contains(device.Address))
        {
...
        }
    }
};
await adapter.StartScanningForDevicesAsync();

【问题讨论】:

    标签: c# xamarin bluetooth-lowenergy


    【解决方案1】:

    你需要使用 NativeDevice 吗? a.Device 上的 Id 字段是找到的每个蓝牙外设的唯一 ID。

    看来你无论如何都不能在 iOS 上使用 Mac 地址,而且 Id 跨平台兼容 -> How to get Mac Address From CBPeripheral And CBCenter

    【讨论】:

    • 应用程序的目标是检测存储在数据库中的mac地址。一个用户正在共享他自己设备的 MAC 地址,而另一个用户正在检测该 MAC 地址。这样,设备应该知道谁在他们附近,而无需相互连接。我知道存在许多安全问题,因此 android 试图使其无法实现。
    猜你喜欢
    • 1970-01-01
    • 2015-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-06
    • 2016-01-27
    • 2015-12-30
    相关资源
    最近更新 更多