diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5ee9a9f..8d42d03 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="4.2.4b"> diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java index 093c949..61c61c0 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java @@ -368,17 +368,21 @@ public class SdDataSourceBLE extends SdDataSource { * @param gattCharacteristic - the characteristic to be read. */ private void executeReadCharacteristic(BluetoothGattCharacteristic gattCharacteristic) { - boolean retVal = mBluetoothGatt.readCharacteristic(gattCharacteristic); - if (retVal) { - Log.d(TAG, "executeReadCharacteristic - read initiated successfully"); + if (gattCharacteristic != null) { + boolean retVal = mBluetoothGatt.readCharacteristic(gattCharacteristic); + if (retVal) { + Log.d(TAG, "executeReadCharacteristic - read initiated successfully"); + } else { + Log.d(TAG, "executeReadCharacteristic - read initiation failed - waiting, then re-trying"); + mHandler.postDelayed(new Runnable() { + public void run() { + Log.w(TAG, "Executing delayed read of characteristic"); + executeReadCharacteristic(gattCharacteristic); + } + }, 100); + } } else { - Log.d(TAG, "executeReadCharacteristic - read initiation failed - waiting, then re-trying"); - mHandler.postDelayed(new Runnable() { - public void run() { - Log.w(TAG, "Executing delayed read of characteristic"); - executeReadCharacteristic(gattCharacteristic); - } - }, 100); + Log.i(TAG,"ExecuteReadCharacteristic() - gatCharacteristic is null, so not doing anything"); } }