¿Cómo obtener la lista de dispositivos Bluetooth disponibles?

Actualmente estoy creando una aplicación para iPhone (Xcode 4.3.1, IOS 5) que podría usar dispositivos Bluetooth. El objetivo principal de esta aplicación es la navegación en interiores (el GPS dentro de los edificios no es realmente preciso).

¡La única solución que veo aquí (para mantener mi aplicación en AppStore) es intentar buscar dispositivos Bluetooth disponibles!

Intenté usar el marco CoreBluetooth, ¡pero no obtengo la lista de dispositivos disponibles! Tal vez no uso estas funciones correctamente

<code>#import <UIKit/UIKit.h>
#import <CoreBluetooth/CoreBluetooth.h>

@interface AboutBhyperView : UIViewController <CBPeripheralDelegate, CBCentralManagerDelegate>
{
    CBCentralManager *mgr;
}
@property (readwrite, nonatomic) CBCentralManager *mgr;
@end



- (void)viewDidLoad
{
    [super viewDidLoad];

    mgr = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}


- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {


    NSLog([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."];
            [mgr scanForPeripheralsWithServices:nil options:nil];
            //[mgr retrieveConnectedPeripherals];

//--- it works, I Do get in this area!

            break;
        }   

    }
    NSLog(messtoshow); 
} 
</code>

No estoy seguro de esta línea, ¿cómo pasar los parámetros correctos?

<code>[mgr scanForPeripheralsWithServices:nil options:nil];
</code>

Eché un vistazo a la referencia de Apple ... y aún no entiendo qué es ese CBUUID ??? ¿Todos los dispositivos tienen alguna identificación de bluetooth? ¿Dónde puedo encontrarlo?

<code>- (void)scanForPeripheralsWithServices:(NSArray *)serviceUUIDs options:(NSDictionary *)options;
</code>

Parámetros serviceUUIDs: una matriz de CBUUID en la que la aplicación está interesada. Opciones: un diccionario para personalizar la exploración, consulte CBCentralManagerScanOptionAllowDuplicatesKey.

¿Hay alguna otra manera de usar Bluetooth en IOS? Quiero decir, los frameworks más antiguos que no usan BLE 4.0!

Cualquier consejo sería apreciado!

¡Gracias!

Respuestas a la pregunta(5)

Su respuesta a la pregunta