【问题标题】:Find bluetooth devices around an iPhone?在 iPhone 周围寻找蓝牙设备?
【发布时间】:2014-10-14 13:38:34
【问题描述】:

我正在尝试使用 iPhone 查找已打开蓝牙的设备。

我应该寻找哪个蓝牙服务 UUID?

这是我尝试过的代码,使用模拟器我找不到任何设备:

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

[centralManager scanForPeripheralsWithServices:
        @[[CBUUID UUIDWithString:@"1101"],
          [CBUUID UUIDWithString:@"1102"],
          [CBUUID UUIDWithString:@"1105"],
          [CBUUID UUIDWithString:@"1106"],
          [CBUUID UUIDWithString:@"1115"],
          [CBUUID UUIDWithString:@"1116"],
          [CBUUID UUIDWithString:@"1117"],
          [CBUUID UUIDWithString:@"0001"],
          [CBUUID UUIDWithString:@"0003"],
          [CBUUID UUIDWithString:@"0008"],
          [CBUUID UUIDWithString:@"0100"],
          [CBUUID UUIDWithString:@"000F"],
          [CBUUID UUIDWithString:@"1101"],
          [CBUUID UUIDWithString:@"1116"],
          [CBUUID UUIDWithString:@"1000"],
          [CBUUID UUIDWithString:@"1001"],
          [CBUUID UUIDWithString:@"1002"],
          [CBUUID UUIDWithString:@"0010"],
          [CBUUID UUIDWithString:@"0011"],
          [CBUUID UUIDWithString:@"0012"],
          [CBUUID UUIDWithString:@"0013"],
          [CBUUID UUIDWithString:@"0014"],
          [CBUUID UUIDWithString:@"0015"],
          [CBUUID UUIDWithString:@"0016"],
          [CBUUID UUIDWithString:@"0017"],
          [CBUUID UUIDWithString:@"0018"],
          [CBUUID UUIDWithString:@"0019"],
          [CBUUID UUIDWithString:@"001B"],
          [CBUUID UUIDWithString:@"001E"],
          [CBUUID UUIDWithString:@"001F"],

          ]
                                       options:nil];

【问题讨论】:

  • 模拟器无法使用蓝牙功能。
  • 有没有办法在不支付 100 美元的情况下试用蓝牙 API?
  • :) 据我所知,这是不可能的

标签: ios objective-c bluetooth


【解决方案1】:

ExternalAccessory 框架为您提供了一种使用 EAAccessoryManager 列出可用设备的简单方法。

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];

您不能在模拟器中执行此操作。

【讨论】:

  • 这只会列出连接的设备,而不是所有可能可用的设备,对吧?
  • 是的。它只列出通过设置连接的那些
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-25
相关资源
最近更新 更多