V4.2.4a - check for null gatt characteristic before writing - should fix #158
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:versionCode="137"
|
android:versionCode="138"
|
||||||
android:versionName="4.2.3">
|
android:versionName="4.2.4a">
|
||||||
<!-- android:allowBackup="false" -->
|
<!-- android:allowBackup="false" -->
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
|||||||
@@ -392,6 +392,7 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
* @param nBytes - number of bytes to send.
|
* @param nBytes - number of bytes to send.
|
||||||
*/
|
*/
|
||||||
private void executeWriteCharacteristic(BluetoothGattCharacteristic gattCharacteristic, byte[] valBytes) {
|
private void executeWriteCharacteristic(BluetoothGattCharacteristic gattCharacteristic, byte[] valBytes) {
|
||||||
|
if (gattCharacteristic != null) {
|
||||||
gattCharacteristic.setValue(valBytes);
|
gattCharacteristic.setValue(valBytes);
|
||||||
boolean retVal = mBluetoothGatt.writeCharacteristic(gattCharacteristic);
|
boolean retVal = mBluetoothGatt.writeCharacteristic(gattCharacteristic);
|
||||||
if (retVal) {
|
if (retVal) {
|
||||||
@@ -405,6 +406,9 @@ public class SdDataSourceBLE extends SdDataSource {
|
|||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.i(TAG,"ExecuteWriteCharacteristic() - gatCharacteristic is null, so not doing anything");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user