Bug fixed - app crashing when DFU Version char. is protected.

This commit is contained in:
Aleksander Nowakowski 2015-11-18 13:10:12 +01:00
parent a5a000281e
commit d978d0e60c
3 changed files with 16 additions and 9 deletions

View File

@ -15,7 +15,7 @@ apply plugin: 'com.jfrog.bintray'
ext {
PUBLISH_GROUP_ID = 'no.nordicsemi.android'
PUBLISH_ARTIFACT_ID = 'dfu'
PUBLISH_VERSION = '0.6'
PUBLISH_VERSION = '0.6.1'
bintrayRepo = 'android'
bintrayName = 'dfu-library'
@ -47,7 +47,7 @@ android {
minSdkVersion 18
targetSdkVersion 23
versionCode 2
versionName "0.6"
versionName "0.6.1"
}
buildTypes {
release {
@ -59,7 +59,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.code.gson:gson:2.3.1'
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":dfu" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="no.nordicsemi.android" external.system.module.version="0.6" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":dfu" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="no.nordicsemi.android" external.system.module.version="0.6.1" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
@ -65,6 +65,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@ -72,7 +73,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@ -85,13 +86,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/release" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
</component>
</module>

View File

@ -1264,7 +1264,7 @@ public abstract class DfuBaseService extends IntentService {
try {
sendLogBroadcast(LOG_LEVEL_DEBUG, "wait(1000)");
wait(1000);
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
// do nothing
}
}
@ -2196,13 +2196,16 @@ public abstract class DfuBaseService extends IntentService {
logi("Reading DFU version number...");
sendLogBroadcast(LOG_LEVEL_VERBOSE, "Reading DFU version number...");
characteristic.setValue((byte[])null);
gatt.readCharacteristic(characteristic);
// We have to wait until device receives a response or an error occur
try {
synchronized (mLock) {
while ((!mRequestCompleted && mConnectionState == STATE_CONNECTED_AND_READY && mError == 0 && !mAborted) || mPaused)
while (((!mRequestCompleted || characteristic.getValue() == null ) && mConnectionState == STATE_CONNECTED_AND_READY && mError == 0 && !mAborted) || mPaused) {
mRequestCompleted = false;
mLock.wait();
}
}
} catch (final InterruptedException e) {
loge("Sleeping interrupted", e);