【发布时间】:2013-09-09 13:23:03
【问题描述】:
我已经实现了一个 Android LE 蓝牙示例,它可以找到一个心率监测器并连接到它。然而,这个例子有一个类定义 GATT 配置文件,如下所示:
private static HashMap<String, String> attributes = new HashMap();
public static String HEART_RATE_MEASUREMENT = "00002a37-0000-1000-8000-00805f9b34fb";
public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
static {
// Sample Services.
attributes.put("0000180d-0000-1000-8000-00805f9b34fb", "Heart Rate Service");
attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
// Sample Characteristics.
attributes.put(HEART_RATE_MEASUREMENT, "Heart Rate Measurement");
attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
}
public static String lookup(String uuid, String defaultName) {
String name = attributes.get(uuid);
return name == null ? defaultName : name;
}
现在,我想做的是更改它,以便该程序可以找到任何带有蓝牙 le 的设备,但我不知道 Google 是如何获得客户端特征配置的心率测量信息的。
【问题讨论】: