From 3bd6e9023e011336da840e11a9d48bb31c7a0261 Mon Sep 17 00:00:00 2001
From: 陈奇 <1650699704@qq.com>
Date: Wed, 07 Nov 2018 09:31:59 +0800
Subject: [PATCH] [*]将电磁版本的唤醒心跳改成两秒,唤醒之后回到30一次心跳 [*]整体版本页面显示的绝对安全换成了安全 [*]自定义语音修改和优化,添加了无声的选择

---
 FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java b/FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java
index c06b92f..0707b79 100644
--- a/FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java
+++ b/FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java
@@ -102,6 +102,7 @@
             descriptor = characteristic.getDescriptor(descriptorUUID);
         }
 
+
         return this;
     }
 
@@ -117,7 +118,7 @@
 
 
 
-     /*------------------------------- main operation ----------------------------------- */
+    /*------------------------------- main operation ----------------------------------- */
 
 
     /**
@@ -128,6 +129,8 @@
         if (getCharacteristic() != null
                 && (getCharacteristic().getProperties() | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
             BleLog.w(TAG, "characteristic.getProperties():" + getCharacteristic().getProperties());
+
+            System.out.println("chenqi enableCharacteristicNotify =>" + uuid_notify);
 
             handleCharacteristicNotificationCallback(bleCallback, uuid_notify);
 
@@ -343,19 +346,22 @@
 
             listenAndTimer(bleCallback, MSG_NOTIFY_CHA, uuid_notify, new BluetoothGattCallback() {
                 AtomicBoolean msgRemoved = new AtomicBoolean(false);
-
                 @Override
                 public void onCharacteristicChanged(BluetoothGatt gatt,
                                                     BluetoothGattCharacteristic characteristic) {
-
                     if (!msgRemoved.getAndSet(true)) {
                         handler.removeMessages(MSG_NOTIFY_CHA, this);
                     }
+
+                    System.out.println("chenqi Notify Hex ->" + BleBluetooth.dumpHex(characteristic.getValue()));
+
                     if (characteristic.getUuid().equals(UUID.fromString(uuid_notify))) {
                         bleCallback.onSuccess(characteristic);
                     }
                 }
             });
+
+
         }
     }
 
@@ -372,7 +378,7 @@
                 @Override
                 public void onCharacteristicChanged(BluetoothGatt gatt,
                                                     BluetoothGattCharacteristic characteristic) {
-
+                    System.out.println("chenqi Notify Hex indicate->" + BleBluetooth.dumpHex(characteristic.getValue()));
                     if (!msgRemoved.getAndSet(true)) {
                         handler.removeMessages(MSG_INDICATE_DES, this);
                     }
@@ -396,6 +402,8 @@
                 public void onCharacteristicWrite(BluetoothGatt gatt,
                                                   BluetoothGattCharacteristic characteristic, int status) {
                     handler.removeMessages(MSG_WRITE_CHA, this);
+                    System.out.println("chenqi Notify Hex write->" + BleBluetooth.dumpHex(characteristic.getValue()));
+
 
                     if (status == BluetoothGatt.GATT_SUCCESS) {
                         if (characteristic.getUuid().equals(UUID.fromString(uuid_write))) {
@@ -421,6 +429,8 @@
                 @Override
                 public void onCharacteristicRead(BluetoothGatt gatt,
                                                  BluetoothGattCharacteristic characteristic, int status) {
+                    System.out.println("chenqi Notify Hex indicate read->" + BleBluetooth.dumpHex(characteristic.getValue()));
+
                     if (!msgRemoved.getAndSet(true)) {
                         handler.removeMessages(MSG_READ_CHA, this);
                     }
@@ -446,6 +456,8 @@
                 @Override
                 public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
                     handler.removeMessages(MSG_READ_RSSI, this);
+                    System.out.println("chenqi Notify Hex rssi->" + BleBluetooth.dumpHex(characteristic.getValue()));
+
                     if (status == BluetoothGatt.GATT_SUCCESS) {
                         bleCallback.onSuccess(rssi);
                     } else {
@@ -473,7 +485,6 @@
     private void listenAndTimer(BleCallback bleCallback, int what, String uuid, BluetoothGattCallback callback) {
         bleCallback.setBluetoothGattCallback(callback);
         bleBluetooth.addGattCallback(uuid, callback);
-
         Message msg = handler.obtainMessage(what, bleCallback);
         handler.sendMessageDelayed(msg, timeOutMillis);
     }

--
Gitblit v1.8.0