首页 文章

是否所有支持BLE 4.0的设备都可以在支持BLE 4.0的iOS设备上连接?

提问于
浏览
5

关于蓝牙低功耗 . 我知道iOS 4及以上的iPhone 4S,iPhone 5,iPad 3支持BLE 4.0 . 我从Apple那里阅读了示例代码TemperatureSensor . 我的问题是传感器的要求是什么?换句话说,在这个应用中可以连接什么样的传感器?是否所有支持BLE 4.0的设备都可以在支持BLE 4.0的iOS设备上连接?

2 回答

  • 10

    BLE通信基于GATT(通用属性),它实质上是服务下不同特征值的交换 . 如果您通过Bluetooth SIG预先定义了've read the TemperatureSensor sample code, you must have seen that it starts to discover devices according to a service UUID, and then read/write characteristics, still based on UUID, under the service. Therefore, as long as the sensor supports BLE and you know about its services (its UUID, its characteristics and properties), you can program your iOS app to communicate with it. Some of the services are ',那么您可以在Bluetooth SIG website上找到这些服务的信息 .

  • 8

    是的,您可以将任何BLE设备连接到支持BLE的iOS设备 .

    关于您正在讨论的示例代码,它会查找温度传感器的特定服务UUID:

    [centralManager scanForPeripheralsWithServices:uuidArray options:options];
    

    由于市场上没有我能找到的温度传感器,您可能需要使用nil来扫描任何和所有设备:

    [centralManager scanForPeripheralsWithServices:nil options:options];
    

    要试验这一点,您可以使用app LightBlueiTunes Link,它可以让您将iPhone变成具有您定义的任何服务/特征的外围设备 .

相关问题