Merge pull request #1914 from andyrozman/mdt_crashalytics_1

Fixed problems found on Crashalytics (5 of them)
This commit is contained in:
Milos Kozak 2019-07-30 13:29:38 +02:00 committed by GitHub
commit a03ef80913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 9 deletions

View file

@ -369,7 +369,9 @@ public class RileyLinkBLE {
rileyLinkDevice = bluetoothAdapter.getRemoteDevice(RileyLinkAddress);
// if this succeeds, we get a connection state change callback?
connectGatt();
if (rileyLinkDevice!=null)
connectGatt();
}

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
@ -94,7 +95,10 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice();
this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice)));
if (RileyLinkUtil.getServiceState()==null)
this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice)));
else
this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice)));
if (rileyLinkServiceData != null) {
this.configuredAddress.setText(rileyLinkServiceData.rileylinkAddress);

View file

@ -384,11 +384,15 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
RileyLinkServiceState rileyLinkServiceState = MedtronicUtil.getServiceState();
if (rileyLinkServiceState==null) {
LOG.error("RileyLink unreachable. RileyLinkServiceState is null.");
return false;
}
if (rileyLinkServiceState != RileyLinkServiceState.PumpConnectorReady //
&& rileyLinkServiceState != RileyLinkServiceState.RileyLinkReady //
&& rileyLinkServiceState != RileyLinkServiceState.TuneUpDevice) {
if (isLoggingEnabled())
LOG.error("RileyLink unreachable.");
LOG.error("RileyLink unreachable.");
return false;
}

View file

@ -951,11 +951,13 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return true;
} catch (RileyLinkCommunicationException e) {
if (isLogEnabled())
LOG.warn("Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
LOG.warn("Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
}
LOG.warn("Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
if (responseMessage!=null)
LOG.warn("Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
else
LOG.warn("Set Basal Profile: Null response.");
}
return false;

View file

@ -63,7 +63,7 @@ public class TempBasalPair {
public TempBasalPair(byte[] response) {
if (L.isEnabled(L.PUMPCOMM))
LOG.debug("Received response: " + response);
LOG.debug("Received TempBasal response: " + ByteUtil.getHex(response));
isPercent = response[0] == 1;
@ -75,7 +75,13 @@ public class TempBasalPair {
insulinRate = strokes / 40.0d;
}
durationMinutes = MedtronicUtil.makeUnsignedShort(response[4], response[5]);
if (response.length<6) {
durationMinutes = ByteUtil.asUINT8(response[4]);
} else {
durationMinutes = MedtronicUtil.makeUnsignedShort(response[4], response[5]);
}
LOG.warn("TempBasalPair (with {} byte response): {}", response.length, toString());
}