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上找到这些服务的信息 .
2 回答
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上找到这些服务的信息 .
是的,您可以将任何BLE设备连接到支持BLE的iOS设备 .
关于您正在讨论的示例代码,它会查找温度传感器的特定服务UUID:
由于市场上没有我能找到的温度传感器,您可能需要使用nil来扫描任何和所有设备:
要试验这一点,您可以使用app LightBlue或iTunes Link,它可以让您将iPhone变成具有您定义的任何服务/特征的外围设备 .