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,6 +369,8 @@ public class RileyLinkBLE {
rileyLinkDevice = bluetoothAdapter.getRemoteDevice(RileyLinkAddress); rileyLinkDevice = bluetoothAdapter.getRemoteDevice(RileyLinkAddress);
// if this succeeds, we get a connection state change callback? // if this succeeds, we get a connection state change callback?
if (rileyLinkDevice!=null)
connectGatt(); 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.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; 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.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.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
@ -94,6 +95,9 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice(); RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice();
if (RileyLinkUtil.getServiceState()==null)
this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice)));
else
this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice))); this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice)));
if (rileyLinkServiceData != null) { if (rileyLinkServiceData != null) {

View file

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

View file

@ -951,11 +951,13 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return true; return true;
} catch (RileyLinkCommunicationException e) { } 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);
} }
if (responseMessage!=null)
LOG.warn("Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent())); 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; return false;

View file

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