fix NPE
This commit is contained in:
parent
bb21f2ae7b
commit
9797f6e5f4
1 changed files with 8 additions and 7 deletions
|
@ -278,6 +278,10 @@ public class BLEComm {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeCharacteristic_NO_RESPONSE(final BluetoothGattCharacteristic characteristic, final byte[] data) {
|
public void writeCharacteristic_NO_RESPONSE(final BluetoothGattCharacteristic characteristic, final byte[] data) {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
SystemClock.sleep(WRITE_DELAY_MILLIS);
|
||||||
|
|
||||||
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
if ((mBluetoothAdapter == null) || (mBluetoothGatt == null)) {
|
||||||
log.debug("BluetoothAdapter not initialized_ERROR");
|
log.debug("BluetoothAdapter not initialized_ERROR");
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
|
@ -285,9 +289,6 @@ public class BLEComm {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
SystemClock.sleep(WRITE_DELAY_MILLIS);
|
|
||||||
characteristic.setValue(data);
|
characteristic.setValue(data);
|
||||||
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
|
characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
|
||||||
log.debug("writeCharacteristic:" + DanaRS_Packet.toHexString(data));
|
log.debug("writeCharacteristic:" + DanaRS_Packet.toHexString(data));
|
||||||
|
|
Loading…
Reference in a new issue