2017-08-02 9 views
0

私のアプリが現在実行中のデバイスからCBUUIDを取得するにはどうすればよいですか?私はXamarinを使っていますが、objective-cやswiftの答えも良いでしょう。その後デバイスからCBUUIDを取得

答えて

1

使用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

関連する問題