首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LightBlue发现的设备,但没有iOS CoreBluetooth

LightBlue发现的设备,但没有iOS CoreBluetooth
EN

Stack Overflow用户
提问于 2015-11-17 03:17:36
回答 1查看 424关注 0票数 2

我在Arduino上使用了BLE盾牌- LightBlue正确地检测到了BLE屏蔽。现在,我正在尝试做一个应用程序,扫描所有的BLE设备,并连接到正确的一个,以便我可以发送一些信息到我的屏蔽从我的应用。

但是这个应用程序没有检测到BLE盾牌(它检测到另一个BLE设备,尽管.)。

我的代码如下:

代码语言:javascript
复制
- (void)centralManagerDidUpdateState:(CBCentralManager *)central{

    switch (central.state) {
        case CBCentralManagerStatePoweredOn:
            msg=[NSString stringWithFormat:@"Bluetooth is currently powered on and available to use."];
            [cbcManager scanForPeripheralsWithServices:[NSArray arrayWithObject:[CBUUID UUIDWithString:@"180A"]] options:nil];
            break;
    }
}

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:   (CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
    NSLog(@"%@\n--------------------", advertisementData.description);
}

我查过LightBlue,180 A是我盾的正确服务UUID。我还试图通过传递一个零值而不是服务UUID来进行扫描,但是仍然无法检测到它。

这段代码似乎是我的BLE设备之一,是found...Any的想法,为什么我的屏蔽可以被LightBlue检测到,而不是这段代码?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-17 04:08:30

您可以尝试在扫描时传递“允许复制”选项,因为如果它认为它是一个副本,则可能会抑制它的发现。

代码语言:javascript
复制
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];    

[cbcManager scanForPeripheralsWithServices:nil options:options];
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33748553

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档