From 75e83be13a8c4ccf081c4dc07a262e4096783c7e Mon Sep 17 00:00:00 2001
From: 陈奇 <1650699704@qq.com>
Date: Fri, 02 Nov 2018 17:34:21 +0800
Subject: [PATCH] [*]修改电磁版本 配合电子修改bug

---
 FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 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..39a8596 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 ----------------------------------- */
 
 
     /**
@@ -341,21 +342,35 @@
                                                           final String uuid_notify) {
         if (bleCallback != null) {
 
+//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+//                bluetoothGatt.requestMtu(10);
+//            }
             listenAndTimer(bleCallback, MSG_NOTIFY_CHA, uuid_notify, new BluetoothGattCallback() {
                 AtomicBoolean msgRemoved = new AtomicBoolean(false);
+
+
+                @Override
+                public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+                    super.onConnectionStateChange(gatt, status, newState);
+                }
 
                 @Override
                 public void onCharacteristicChanged(BluetoothGatt gatt,
                                                     BluetoothGattCharacteristic characteristic) {
-
                     if (!msgRemoved.getAndSet(true)) {
                         handler.removeMessages(MSG_NOTIFY_CHA, this);
                     }
+
+
                     if (characteristic.getUuid().equals(UUID.fromString(uuid_notify))) {
+                        System.out.println("chenqi Notify ->" + characteristic.getValue().length);
+                        System.out.println("chenqi Notify Hex ->" + BleBluetooth.dumpHex(characteristic.getValue()));
                         bleCallback.onSuccess(characteristic);
                     }
                 }
             });
+
+
         }
     }
 
@@ -372,7 +387,6 @@
                 @Override
                 public void onCharacteristicChanged(BluetoothGatt gatt,
                                                     BluetoothGattCharacteristic characteristic) {
-
                     if (!msgRemoved.getAndSet(true)) {
                         handler.removeMessages(MSG_INDICATE_DES, this);
                     }

--
Gitblit v1.8.0