iHealth Gluco监控系统(BLE设备),无法发现设备

时间:2016-05-06 10:02:50

标签: objective-c bluetooth-lowenergy ios9.2

我目前正在尝试通过蓝牙连接iHealth gluco设备和我们自己的应用程序。 我使用Service UUID作为:1808,特征ID:2A18  在这里,我无法连接该外围设备。

In viewDidLoad:
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];



// method called whenever the device state changes.
- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
    // Determine the state of the peripheral
    if ([central state] == CBCentralManagerStatePoweredOff) {
        NSLog(@"CoreBluetooth BLE hardware is powered off");
    }
    else if ([central state] == CBCentralManagerStatePoweredOn) {
        NSLog(@"CoreBluetooth BLE hardware is powered on and ready");

      [centralManager scanForPeripheralsWithServices:nil options:nil];
    }
    else if ([central state] == CBCentralManagerStateUnauthorized) {
        NSLog(@"CoreBluetooth BLE state is unauthorized");
    }
    else if ([central state] == CBCentralManagerStateUnknown) {
        NSLog(@"CoreBluetooth BLE state is unknown");
    }
    else if ([central state] == CBCentralManagerStateUnsupported) {
        NSLog(@"CoreBluetooth BLE hardware is unsupported on this platform");
    }
}




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

NSLog("advertisement data :%@",advertisementData);
        NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
        if (![localName isEqual:@""]) {

            [self.centralManager stopScan];
            self.polarH7HRMPeripheral = peripheral;
            peripheral.delegate = self;
            [self.centralManager connectPeripheral:peripheral options:nil];
        }
    }

这里上面的方法根本没有触发....请帮我连接设备并从设备读取数据。

0 个答案:

没有答案