diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9d91629..5ee9a9f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="138" + android:versionName="4.2.4a"> diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java index 634c5a8..093c949 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java @@ -392,18 +392,22 @@ public class SdDataSourceBLE extends SdDataSource { * @param nBytes - number of bytes to send. */ private void executeWriteCharacteristic(BluetoothGattCharacteristic gattCharacteristic, byte[] valBytes) { - gattCharacteristic.setValue(valBytes); - boolean retVal = mBluetoothGatt.writeCharacteristic(gattCharacteristic); - if (retVal) { - Log.d(TAG, "executeWriteCharacteristic - write initiated successfully"); + if (gattCharacteristic != null) { + gattCharacteristic.setValue(valBytes); + boolean retVal = mBluetoothGatt.writeCharacteristic(gattCharacteristic); + if (retVal) { + Log.d(TAG, "executeWriteCharacteristic - write initiated successfully"); + } else { + Log.d(TAG, "executeWriteCharacteristic - write initiation failed - waiting, then re-trying"); + mHandler.postDelayed(new Runnable() { + public void run() { + Log.w(TAG, "Executing delayed write of characteristic"); + executeWriteCharacteristic(gattCharacteristic, valBytes); + } + }, 100); + } } else { - Log.d(TAG, "executeWriteCharacteristic - write initiation failed - waiting, then re-trying"); - mHandler.postDelayed(new Runnable() { - public void run() { - Log.w(TAG, "Executing delayed write of characteristic"); - executeWriteCharacteristic(gattCharacteristic, valBytes); - } - }, 100); + Log.i(TAG,"ExecuteWriteCharacteristic() - gatCharacteristic is null, so not doing anything"); } }