MTBeaconUUID.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.mt.lib.mtblesdk;
  2. import android.bluetooth.BluetoothGattCharacteristic;
  3. import java.util.HashMap;
  4. public class MTBeaconUUID {
  5. public static final String SERVICE_UUID = "0000F1E0-0000-1000-8000-00805F9B34FB";
  6. public static final String CMD_UUID = "0000F1E5-0000-1000-8000-00805F9B34FB";
  7. private static HashMap<String, String> attributes_uuid = new HashMap();
  8. private static HashMap<String, BluetoothGattCharacteristic> attributes_char = new HashMap();
  9. static {
  10. attributes_uuid.put("00002a19-0000-1000-8000-00805f9b34fb", "battery");
  11. // Sample Services.
  12. attributes_uuid.put("0000fae1-0000-1000-8000-00805f9b34fb", "UUID");
  13. attributes_uuid.put("0000fae2-0000-1000-8000-00805f9b34fb", "major");
  14. attributes_uuid.put("0000fae3-0000-1000-8000-00805f9b34fb", "minor");
  15. attributes_uuid.put("0000fae4-0000-1000-8000-00805f9b34fb", "Txpower");
  16. attributes_uuid.put("0000fae5-0000-1000-8000-00805f9b34fb", "ATCMD");
  17. }
  18. // 添加特征值
  19. public static void AddChar(String name, BluetoothGattCharacteristic c)
  20. {
  21. attributes_char.put(name, c);
  22. }
  23. // 获取特征值
  24. public static BluetoothGattCharacteristic GetChar(String name)
  25. {
  26. return attributes_char.get(name);
  27. }
  28. public static String lookup(String uuid) {
  29. String name = attributes_uuid.get(uuid);
  30. return name;
  31. }
  32. }