- fixed 4 (or more) crashalytics problems

This commit is contained in:
Andy Rozman 2019-08-07 11:48:37 +01:00
parent 9d27b5f83e
commit d06c5fdcc8
3 changed files with 37 additions and 12 deletions

View file

@ -370,13 +370,21 @@ public class RileyLinkBLE {
rileyLinkDevice = bluetoothAdapter.getRemoteDevice(RileyLinkAddress);
// if this succeeds, we get a connection state change callback?
if (rileyLinkDevice!=null)
if (rileyLinkDevice!=null) {
connectGatt();
} else {
LOG.error("RileyLink device not found with address: " + RileyLinkAddress);
}
}
// This function must be run on UI thread.
public void connectGatt() {
if (this.rileyLinkDevice==null) {
LOG.error("RileyLink device is null, can't do connectGatt.");
return;
}
bluetoothConnectionGatt = rileyLinkDevice.connectGatt(context, true, bluetoothGattCallback);
// , BluetoothDevice.TRANSPORT_LE
if (bluetoothConnectionGatt == null) {
@ -384,7 +392,7 @@ public class RileyLinkBLE {
} else {
if (gattDebugEnabled) {
if (isLogEnabled())
LOG.debug("Gatt Connected?");
LOG.debug("Gatt Connected.");
}
}
}
@ -526,6 +534,12 @@ public class RileyLinkBLE {
}
if (mCurrentOperation != null) {
rval.resultCode = BLECommOperationResult.RESULT_BUSY;
} else {
if (bluetoothConnectionGatt.getService(serviceUUID) == null) {
// Catch if the service is not supported by the BLE device
rval.resultCode = BLECommOperationResult.RESULT_NONE;
LOG.error("BT Device not supported");
// TODO: 11/07/2016 UI update for user
} else {
BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID).getCharacteristic(
charaUUID);
@ -540,6 +554,7 @@ public class RileyLinkBLE {
rval.value = mCurrentOperation.getValue();
}
}
}
mCurrentOperation = null;
gattOperationSema.release();
} else {

View file

@ -742,6 +742,15 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
ClockDTO clock = MedtronicUtil.getPumpTime();
if (clock==null) { // retry
medtronicUIComm.executeCommand(MedtronicCommandType.GetRealTimeClock);
clock = MedtronicUtil.getPumpTime();
}
if (clock==null)
return;
int timeDiff = Math.abs(clock.timeDifference);
if (timeDiff > 20) {

View file

@ -68,6 +68,7 @@ public class MedtronicUITask {
case GetRealTimeClock: {
returnData = communicationManager.getPumpTime();
MedtronicUtil.setPumpTime(null);
}
break;