我在我的應用程序中使用了Core Bluetooth Framework。在iOS IOS7中檢測啓用了藍牙的iPhone設備
我知道如何掃描從它的外圍設備和獲取值。(如心率監視器)
但我要的是檢索支持BLE 4.0和藍牙啓用那些周圍的iPhone設備列表中。
我提到下面的鏈接..
Uses CoreBluetooth For Getting Peripherals not the Devices List
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
// I'm not sure how to make this work
NSLog (@"Discovered peripheral: %@", [peripheral name]);
[self.list addObject:peripheral.name]; // add peripheral name to foundarray
NSLog (@"UUID peripheral: %@", [peripheral UUID]);
NSLog (@"peripheral services before connected: %@", [peripheral services]);
NSLog(@"adversting data %@",[NSString stringWithFormat:@"%@",[advertisementData description]]);
NSLog(@"foundArray is %@", self.list);
}
- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
NSLog(@"Central manager's state is updated to: %@", central);
if(central.state == CBCentralManagerStatePoweredOn)
{
//okay your good to go and can now scan
}
else
{
//Unable to use CentralManager methods so print out the central.state and find out why
}
}
我不知道蘋果是否提供這種或不..
任何建議或想法可以理解的。 。
提前致謝。
BLE被支撐因爲iPhone 4S以上,ipad公司3及以上。您不會通過代碼獲取列表。無論如何,看到CBCentralManager狀態應該給你,如果設備支持BLE或不(CBCentralManagerStateUnsupported)。 – Larme