Fixed problems found on Crashalytics (5 of them)
This commit is contained in:
parent
27ec907611
commit
de00fb83ea
5 changed files with 27 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue