Get device name before setting up the callback

In case the callback is very quick, the name might not have been set yet?
This commit is contained in:
AdrianLxM 2018-10-28 20:35:37 +01:00 committed by GitHub
parent a4e8ace6c4
commit 667cbe0b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,9 +144,9 @@ public class BLEComm {
if (L.isEnabled(L.PUMPBTCOMM)) if (L.isEnabled(L.PUMPBTCOMM))
log.debug("Trying to create a new connection from: " + from); log.debug("Trying to create a new connection from: " + from);
mBluetoothDeviceName = device.getName();
mBluetoothGatt = device.connectGatt(service.getApplicationContext(), false, mGattCallback); mBluetoothGatt = device.connectGatt(service.getApplicationContext(), false, mGattCallback);
setCharacteristicNotification(getUARTReadBTGattChar(), true); setCharacteristicNotification(getUARTReadBTGattChar(), true);
mBluetoothDeviceName = device.getName();
return true; return true;
} }