u012131702
欧拉啊旺
2016-03-21 14:31

Android的BLE技术中的GattAttributes是干什么的?

  • android
  • ble
  • 蓝牙

最近在研究BLE技术发现了这个东西有一点不明白,有一个GattAttributes的文件

/**

  • This class includes a small subset of standard GATT attributes for demonstration purposes.
    */
    public class SampleGattAttributes {
    private static HashMap 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;
    }
    }

翻译说是一种协议,请问用来干嘛的?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换