Core Bluetooth:无法发现 Ring Scanner

Core Bluetooth : Not able to discover Ring Scanner

我正在尝试连接摩托罗拉指环式扫描仪 "R1000BT",我面临的问题是当我触发 scanForPeripheralsWithServices: 时,委托方法 didDiscoverPeripheral: 从未被调用。

我寻找过类似的问题,但 none 个帮助了我。

到目前为止我的代码是:

#define RING_SCANNER_SERVICE_UUID @"1813"

-(void)viewDidLoad{
    CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
    self.centralManager = centralManager;
}

- (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");

        NSArray *uuidArray  = [NSArray arrayWithObjects:[CBUUID UUIDWithString:RING_SCANNER_SERVICE_UUID], nil];
        NSDictionary    *options    = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];
        [central scanForPeripheralsWithServices:uuidArray options:options];
    }
    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
{
    NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
    if ([localName length] > 0) {
        NSLog(@"Found the ring scanner: %@", localName);
        [self.centralManager stopScan];
        self.ringScannerPeripheral = peripheral;
        peripheral.delegate = self;
        [self.centralManager connectPeripheral:peripheral options:nil];
    }
}

请帮我解决这个问题,我有 iOS 8.1。

根据product data,此设备是一款蓝牙 3.0 设备,它实现了串行端口协议 (SPP) 和人机接口设备 (HID) 协议。因此,iOS.

上的 Core Bluetooth 将不支持它

看来您应该将其设置为 HID 模式并将其作为键盘与 iOS 设备配对。

您尝试使用的服务 UUID 0x1813 称为 "scan parameters" 但这与条形码扫描无关 - 它是允许控制 BLE 扫描速率的服务用于电源管理的设备。