从设备获取CBUUID
答
使用Plugin.BLE(https://www.nuget.org/packages/Plugin.BLE/)
foreach(AdvertisementRecord record in e.Device.AdvertisementRecords)
{
if (record.Type == AdvertisementRecordType.UuidsComplete128Bit || record.Type == AdvertisementRecordType.UuidsComplete16Bit)
{
b.ServiceUUID = record.Data;
break;
}
}
然后
foreach(Beacon beacon in beaconList)
{
cbuuidList.Add(CBUUID.FromBytes(beacon.ServiceUUID));
}
CBUUID[] uuid = cbuuidList.ToArray();
BLEManager.ScanForPeripherals(uuid);
这里详细:https://forums.xamarin.com/discussion/92838/proper-way-to-retrieve-uuid-of-device