I have detected Peripheral devices using CBCentralManager
,
Code i have used is this,
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.navigationController setNavigationBarHidden: YES animated:NO];
cbMgr = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
//NSLog([NSString stringWithFormat:@"%@",[advertisementData description]]);
NSLog (@"Discovered peripheral: %@", [peripheral name]);
NSLog (@"Discovered peripheral identifier: %@", [peripheral identifier]);
NSLog (@"peripheral services before connected: %@", [peripheral services]);
NSLog (@"Discovered peripheral RSSI: %@", [peripheral RSSI]);
NSLog (@"\n===============================================");
// NSLog(@"adversting data %@",[NSString stringWithFormat:@"%@",[advertisementData description]]);
}
-(void)centralManager:(CBCentralManager *)central didRetrievePeripherals:(NSArray *)peripherals{
NSLog(@"This is it!");
}
- (void)centralManagerDidUpdateState:(CBCentralManager *)central{
NSString *messtoshow;
switch (central.state) {
case CBCentralManagerStateUnknown:
{
messtoshow=[NSString stringWithFormat:@"State unknown, update imminent."];
break;
}
case CBCentralManagerStateResetting:
{
messtoshow=[NSString stringWithFormat:@"The connection with the system service was momentarily lost, update imminent."];
break;
}
case CBCentralManagerStateUnsupported:
{
messtoshow=[NSString stringWithFormat:@"The platform doesn't support Bluetooth Low Energy"];
break;
}
case CBCentralManagerStateUnauthorized:
{
messtoshow=[NSString stringWithFormat:@"The app is not authorized to use Bluetooth Low Energy"];
break;
}
case CBCentralManagerStatePoweredOff:
{
messtoshow=[NSString stringWithFormat:@"Bluetooth is currently powered off."];
break;
}
case CBCentralManagerStatePoweredOn:
{
messtoshow=[NSString stringWithFormat:@"Bluetooth is currently powered on and available to use."];
[cbMgr scanForPeripheralsWithServices:nil options:nil];
//[mgr retrieveConnectedPeripherals];
//--- it works, I Do get in this area!
break;
}
}
}
Now i want detail like this,
Company ID:
Beacon Type:
Proximity UUID:
Major:
Minor:
Measured Power:
Is it possible to get this detail, I have tried to range beacon using the NSConcreteUUID
but it does not return beacon data (as expected)..