I have a bluetooth bracelet which connects to my iPhone 5s via Bluetooth; it comes with an App called Zeroner. Now I want to obtain the information from the **connected and paired up** bracelet without using the App. Here is what I attempted to do:

1. Setup `CBCentralManager`
2. Use `retrieveConnectedPeripheralsWithServices:` to obtain connected devices

Here is the code:

**CBConnectedDevicesVC.h**

```
#import <UIKit/UIKit.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import SERVICE_ID @"FB694B90-F49E-4597-8306-171BBA78F846"

@interface CBConnectedDevicesVC : UIViewController <CBCentralManagerDelegate, CBPeripheralDelegate>

@property (strong, nonatomic) CBCentralManager *centralManager;
@property (strong, nonatomic) CBPeripheral *discoveredPeripheral;

@end

```

**CBConnectedDevicesVC.m**

```
#import "CBConnectedDevicesVC.h"

@implementation CBConnectedDevicesVC

- (void)viewDidLoad {
    [super viewDidLoad];
    _centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
    if (central.state != CBCentralManagerStatePoweredOn) {
        return;
    }

    if (central.state == CBCentralManagerStatePoweredOn) {
        NSArray* connectedDevices = [_centralManager retrieveConnectedPeripheralsWithServices:@[[CBUUID UUIDWithString:SERVICE_UUID]]];
        for (CBUUID *uuid in connectedDevices) {
            NSLog(@"Device Found. UUID = %@", uuid);
        }
    }
}

@end

```

For the above codes, I have to specify the service ID in `SERVICE_UUID`, which I don't know what the value of the bracelet is. Is there any alternatives to obtain the information from the connected bracelet?

---

**UPDATE** about test result of LightBlue App

After unpaired from Zeroner App and "Forget this Device" in Settings > Bluetooth > choose the device named "Bracelet-0366", LightBlue App discovers the device (finally!).

Here is the result screenshot:

![LightBlue screenshot](https://i.stack.imgur.com/DrD7k.png)

I got several values here, but I'm not sure which values I should use.

Further Test Results:

If I put the UUID (starts with 4EFF) found in LightBlue into `SERVICE_ID`, no delegate is called with the above codes.

Another piece of code I tried is (obtained from [Tut+ tutorial](http://code.tutsplus.com/tutorials/ios-7-sdk-core-bluetooth-practical-lesson--mobile-20741)):

```
NSArray *serviceID;

@implementation CBCentralManagerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    serviceID = @[[CBUUID UUIDWithString:TRANSFER_SERVICE_UUID]];
    _centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
    _data = [[NSMutableData alloc] init];
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
    // You should test all scenarios
    if (central.state != CBCentralManagerStatePoweredOn) {
        return;
    }

    if (central.state == CBCentralManagerStatePoweredOn) {
        // Scan for devices
        [_centralManager scanForPeripheralsWithServices:serviceID options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
        NSLog(@"Scanning started");
    }
}

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

    NSLog(@"Discovered %@ at %@", peripheral.name, RSSI);

    if (_discoveredPeripheral != peripheral) {
        // Save a local copy of the peripheral, so CoreBluetooth doesn't get rid of it
        _discoveredPeripheral = peripheral;

        // And connect
        NSLog(@"Connecting to peripheral %@", peripheral);
        [_centralManager connectPeripheral:peripheral options:nil];
    }
}

- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error {
    NSLog(@"Failed to connect");
    [self cleanup];
}

- (void)cleanup {

    // See if we are subscribed to a characteristic on the peripheral
    if (_discoveredPeripheral.services != nil) {
        for (CBService *service in _discoveredPeripheral.services) {
            if (service.characteristics != nil) {
                for (CBCharacteristic *characteristic in service.characteristics) {
                    if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:TRANSFER_CHARACTERISTIC_UUID]]) {
                        if (characteristic.isNotifying) {
                            [_discoveredPeripheral setNotifyValue:NO forCharacteristic:characteristic];
                            return;
                        }
                    }
                }
            }
        }
    }

    [_centralManager cancelPeripheralConnection:_discoveredPeripheral];
}

- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
    NSLog(@"Connected");

    [_centralManager stopScan];
    NSLog(@"Scanning stopped");

    [_data setLength:0];

    peripheral.delegate = self;

    [peripheral discoverServices:serviceID];
}

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
    if (error) {
        [self cleanup];
        return;
    }

    for (CBService *service in peripheral.services) {
        [peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:TRANSFER_CHARACTERISTIC_UUID]] forService:service];
    }
    // Discover other characteristics
}

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error {
    if (error) {
        [self cleanup];
        return;
    }

    for (CBCharacteristic *characteristic in service.characteristics) {
        if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:TRANSFER_CHARACTERISTIC_UUID]]) {
            [peripheral setNotifyValue:YES forCharacteristic:characteristic];
        }
    }
}

- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
    if (error) {
        NSLog(@"Error");
        return;
    }

    NSString *stringFromData = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];

    // Have we got everything we need?
    if ([stringFromData isEqualToString:@"EOM"]) {

        [_textview setText:[[NSString alloc] initWithData:self.data encoding:NSUTF8StringEncoding]];

        [peripheral setNotifyValue:NO forCharacteristic:characteristic];

        [_centralManager cancelPeripheralConnection:peripheral];
    }

    [_data appendData:characteristic.value];
}

- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {

    if (![characteristic.UUID isEqual:[CBUUID UUIDWithString:TRANSFER_CHARACTERISTIC_UUID]]) {
        return;
    }

    if (characteristic.isNotifying) {
        NSLog(@"Notification began on %@", characteristic);
    } else {
        // Notification has stopped
        [_centralManager cancelPeripheralConnection:peripheral];
    }
}

- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error {
    _discoveredPeripheral = nil;

    //
    [_centralManager scanForPeripheralsWithServices:serviceID options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
}

```

With the above code, there are 2 constants defined `TRANSFER_SERVICE_ID` and `TRANSFER_CHARACTERISTIC_ID`. From the tutorial, the `TRANSFER_SERVICE_ID` should be set to the one starts with `4EFF` and the `TRANSFER_CHARACTERISTIC_ID` should be set to `0xFF20` or `FF20`. However, this piece of code does not detect the bracelet at all, even though the bracelet is unpaired & disconnected. What did I miss this time?