From 271946671a0e747f31517bdb932758e959423259 Mon Sep 17 00:00:00 2001 From: LeonXtp <1965976573@qq.com> Date: Wed, 16 Aug 2017 14:15:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=9B=91=E5=90=AC=E8=80=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../bluetooth/library/BluetoothClient.java | 8 ++++++++ .../bluetooth/library/BluetoothClientImpl.java | 18 +++++++++++++++++- .../bluetooth/library/IBluetoothClient.java | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 2005598b..6294d8e1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 86803929..58732690 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/library/src/main/java/com/inuker/bluetooth/library/BluetoothClient.java b/library/src/main/java/com/inuker/bluetooth/library/BluetoothClient.java index 18faf051..1a748a49 100644 --- a/library/src/main/java/com/inuker/bluetooth/library/BluetoothClient.java +++ b/library/src/main/java/com/inuker/bluetooth/library/BluetoothClient.java @@ -99,6 +99,14 @@ public void notify(String mac, UUID service, UUID character, BleNotifyResponse r mClient.notify(mac, service, character, response); } + @Override + public void unnotify(String mac, UUID service, UUID character, BleNotifyResponse response) { + BluetoothLog.v(String.format("unnotify %s: service = %s, character = %s", mac, service, character)); + + response = ProxyUtils.getUIProxy(response); + mClient.unnotify(mac, service, character, response); + } + @Override public void unnotify(String mac, UUID service, UUID character, BleUnnotifyResponse response) { BluetoothLog.v(String.format("unnotify %s: service = %s, character = %s", mac, service, character)); diff --git a/library/src/main/java/com/inuker/bluetooth/library/BluetoothClientImpl.java b/library/src/main/java/com/inuker/bluetooth/library/BluetoothClientImpl.java index fb328468..ddd7aa9a 100644 --- a/library/src/main/java/com/inuker/bluetooth/library/BluetoothClientImpl.java +++ b/library/src/main/java/com/inuker/bluetooth/library/BluetoothClientImpl.java @@ -372,6 +372,22 @@ protected void onAsyncResponse(int code, Bundle data) { }); } + @Override + public void unnotify(String mac, UUID service, UUID character, BleNotifyResponse response) { + checkRuntime(true); + if (response == null) { + return; + } + HashMap> listenerMap = mNotifyResponses.get(mac); + if (listenerMap != null) { + String key = generateCharacterKey(service, character); + List reponseList = listenerMap.get(key); + if (reponseList != null) { + reponseList.remove(response); + } + } + } + @Override public void unnotify(final String mac, final UUID service, final UUID character, final BleUnnotifyResponse response) { Bundle args = new Bundle(); @@ -414,7 +430,7 @@ protected void onAsyncResponse(int code, Bundle data) { @Override public void unindicate(String mac, UUID service, UUID character, BleUnnotifyResponse response) { - unnotify(mac, service, character, response); + unnotify(mac, service, character, response); } @Override diff --git a/library/src/main/java/com/inuker/bluetooth/library/IBluetoothClient.java b/library/src/main/java/com/inuker/bluetooth/library/IBluetoothClient.java index a871c808..14e5664e 100644 --- a/library/src/main/java/com/inuker/bluetooth/library/IBluetoothClient.java +++ b/library/src/main/java/com/inuker/bluetooth/library/IBluetoothClient.java @@ -40,6 +40,8 @@ public interface IBluetoothClient { void notify(String mac, UUID service, UUID character, BleNotifyResponse response); + void unnotify(String mac, UUID service, UUID character, BleNotifyResponse response); + void unnotify(String mac, UUID service, UUID character, BleUnnotifyResponse response); void indicate(String mac, UUID service, UUID character, BleNotifyResponse response); From 5885ad58ee68b98fde81eb15a305cedf4e17402a Mon Sep 17 00:00:00 2001 From: LeonXtp <1965976573@qq.com> Date: Sat, 7 Oct 2017 16:17:32 +0800 Subject: [PATCH 2/2] my gradle --- library/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 035cb25a..31d64b4c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'com.jfrog.bintray' version="1.4.0" android { - compileSdkVersion 23 - buildToolsVersion '25.0.0' + compileSdkVersion 25 + buildToolsVersion '25.0.3' resourcePrefix "bluetoothkit_" defaultConfig { - minSdkVersion 9 + minSdkVersion 18 targetSdkVersion 21 versionCode 1 versionName "1.0"