- Improve logging levels in Omnipod and RileyLink module

- Code improvements
- Minor translation improvements
- Add some TODOs
This commit is contained in:
Bart Sopers 2020-08-25 22:45:24 +02:00
parent 2fdbbd9057
commit 28df570a6a
48 changed files with 244 additions and 307 deletions

View file

@ -124,16 +124,16 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private final CompositeDisposable disposables = new CompositeDisposable();
// variables for handling statuses and history
protected boolean firstRun = true;
protected boolean hasTimeDateOrTimeZoneChanged = false;
protected boolean displayConnectionMessages = false;
private boolean firstRun = true;
private boolean hasTimeDateOrTimeZoneChanged = false;
private final boolean displayConnectionMessages = false;
private RileyLinkOmnipodService rileyLinkOmnipodService;
private boolean busy = false;
private int timeChangeRetries;
private long nextPodCheck;
private boolean sentIdToFirebase;
private long lastConnectionTimeMillis;
private Handler loopHandler = new Handler();
private final Handler loopHandler = new Handler();
private final Runnable statusChecker;
@ -858,8 +858,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
this.firstRun = false;
}
@NonNull
protected PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
@NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
PumpEnactResult result = executeCommand(OmnipodCommandType.SetBolus, () -> aapsOmnipodManager.bolus(detailedBolusInfo));
if (result.success) {
@ -893,7 +892,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
sp.putLong(statsKey, currentCount);
}
protected TemporaryBasal readTBR() {
private TemporaryBasal readTBR() {
return activePlugin.getActiveTreatments().getTempBasalFromHistory(System.currentTimeMillis());
}

View file

@ -9,7 +9,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class RLHistoryItemOmnipod extends RLHistoryItem {
private OmnipodCommandType omnipodCommandType;
private final OmnipodCommandType omnipodCommandType;
public RLHistoryItemOmnipod(OmnipodCommandType omnipodCommandType) {
super(new LocalDateTime(), RLHistoryItemSource.OmnipodCommand, RileyLinkTargetDevice.Omnipod);

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.definition;
import info.nightscout.androidaps.plugins.pump.omnipod.R;
public class OmnipodStorageKeys {
static final String Prefix = "AAPS.Omnipod.";
private static final String Prefix = "AAPS.Omnipod.";
public static class Prefs {
public static final String PodState = Prefix + "pod_state";
@ -17,7 +17,7 @@ public class OmnipodStorageKeys {
}
public static class Statistics {
public static final String StatsPrefix = "omnipod_";
static final String StatsPrefix = "omnipod_";
public static final String TBRsSet = StatsPrefix + "tbrs_set";
public static final String StandardBoluses = StatsPrefix + "std_boluses_delivered";
public static final String SMBBoluses = StatsPrefix + "smb_boluses_delivered";

View file

@ -40,7 +40,7 @@ public enum PodHistoryEntryType {
UnknownEntryType(99, R.string.omnipod_cmd_unknown_entry);
private int code;
private static Map<Integer, PodHistoryEntryType> instanceMap;
private static final Map<Integer, PodHistoryEntryType> instanceMap;
@StringRes
private int resourceId;

View file

@ -8,7 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.Message
public abstract class MessageBlock {
protected byte[] encodedData = new byte[0];
public MessageBlock() {
protected MessageBlock() {
}
public abstract MessageBlockType getType();

View file

@ -5,7 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodInfo
public abstract class PodInfo {
private final byte[] encodedData;
public PodInfo(byte[] encodedData) {
PodInfo(byte[] encodedData) {
this.encodedData = encodedData;
}

View file

@ -10,7 +10,7 @@ public enum AlertSlot {
SLOT6((byte) 0x06),
SLOT7((byte) 0x07);
private byte value;
private final byte value;
AlertSlot(byte value) {
this.value = value;

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod.driver.definition;
public abstract class AlertTrigger<T> {
protected T value;
abstract class AlertTrigger<T> {
private final T value;
public AlertTrigger(T value) {
AlertTrigger(T value) {
this.value = value;
}
@ -11,4 +11,3 @@ public abstract class AlertTrigger<T> {
return value;
}
}

View file

@ -19,7 +19,7 @@ public enum BeepConfigType {
FIVE_SECONDS_BEEP((byte) 0xE), // can only be used if Pod is currently suspended
NO_BEEP((byte) 0xF);
private byte value;
private final byte value;
BeepConfigType(byte value) {
this.value = value;

View file

@ -11,7 +11,7 @@ public enum BeepRepeat {
EVERY_15_MINUTES_DELAYED((byte) 0x07),
EVERY_5_MINUTES((byte) 0x08);
private byte value;
private final byte value;
BeepRepeat(byte value) {
this.value = value;

View file

@ -12,7 +12,7 @@ public enum BeepType {
BIP_BIP_BIP_BIP_BIP_BIP((byte) 0x07),
BEEEP_BEEEP((byte) 0x08);
private byte value;
private final byte value;
BeepType(byte value) {
this.value = value;

View file

@ -8,7 +8,7 @@ public enum DeliveryStatus {
BOLUS_IN_PROGRESS((byte) 0x05),
BOLUS_AND_TEMP_BASAL((byte) 0x06);
private byte value;
private final byte value;
DeliveryStatus(byte value) {
this.value = value;

View file

@ -6,7 +6,7 @@ public enum DeliveryType {
TEMP_BASAL((byte) 0x02),
BOLUS((byte) 0x04);
private byte value;
private final byte value;
DeliveryType(byte value) {
this.value = value;

View file

@ -122,7 +122,7 @@ public enum FaultEventCode {
BAD_STATE_IN_MAYBE_INC_33_D((byte) 0x97),
VALUES_DO_NOT_MATCH_OR_ARE_GREATER_THAN_0_X_97((byte) 0x98);
private byte value;
private final byte value;
FaultEventCode(byte value) {
this.value = value;

View file

@ -7,7 +7,7 @@ public enum LogEventErrorCode {
INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_3((byte) 0x03),
INSULIN_STATE_TABLE_CORRUPTION((byte) 0x04);
private byte value;
private final byte value;
LogEventErrorCode(byte value) {
this.value = value;

View file

@ -27,7 +27,7 @@ public enum MessageBlockType {
BEEP_CONFIG(0x1e),
CANCEL_DELIVERY(0x1f);
private byte value;
private final byte value;
MessageBlockType(int value) {
this.value = (byte) value;

View file

@ -36,7 +36,7 @@ public class OmnipodCrc {
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
public static final int[] crc8lookup = new int[]{
private static final int[] crc8lookup = new int[]{
0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D,
0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D,
0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,

View file

@ -7,7 +7,7 @@ public enum PacketType {
CON((byte) 0b100),
ACK((byte) 0b010);
private byte value;
private final byte value;
PacketType(byte value) {
this.value = value;

View file

@ -18,7 +18,7 @@ public enum PodProgressStatus {
ACTIVATION_TIME_EXCEEDED((byte) 0x0e), // Took > 2 hours from progress 2 to 3 or > 1 hour from 3 to 8
INACTIVE((byte) 0x0f); // Pod deactivated or a fatal packet state error
private byte value;
private final byte value;
PodProgressStatus(byte value) {
this.value = value;

View file

@ -15,7 +15,7 @@ public class BasalDeliveryTable {
private static final int NUM_SEGMENTS = 48;
private static final int MAX_SEGMENTS_PER_ENTRY = 16;
private List<BasalTableEntry> entries = new ArrayList<>();
private final List<BasalTableEntry> entries = new ArrayList<>();
public BasalDeliveryTable(BasalSchedule schedule) {
TempSegment[] expandedSegments = new TempSegment[48];
@ -97,14 +97,14 @@ public class BasalDeliveryTable {
'}';
}
private class TempSegment {
private int pulses;
private static class TempSegment {
private final int pulses;
public TempSegment(int pulses) {
TempSegment(int pulses) {
this.pulses = pulses;
}
public int getPulses() {
int getPulses() {
return pulses;
}
}

View file

@ -108,7 +108,7 @@ public class BasalSchedule {
private final Duration duration;
private final Duration startTime;
public BasalScheduleDurationEntry(double rate, Duration startTime, Duration duration) {
BasalScheduleDurationEntry(double rate, Duration startTime, Duration duration) {
this.rate = rate;
this.duration = duration;
this.startTime = startTime;
@ -133,7 +133,7 @@ public class BasalSchedule {
private final Duration startTime;
private final Duration duration;
public BasalScheduleLookupResult(int index, BasalScheduleEntry basalScheduleEntry, Duration startTime, Duration duration) {
BasalScheduleLookupResult(int index, BasalScheduleEntry basalScheduleEntry, Duration startTime, Duration duration) {
this.index = index;
this.basalScheduleEntry = basalScheduleEntry;
this.startTime = startTime;
@ -144,7 +144,7 @@ public class BasalSchedule {
return index;
}
public BasalScheduleEntry getBasalScheduleEntry() {
BasalScheduleEntry getBasalScheduleEntry() {
return basalScheduleEntry;
}

View file

@ -5,7 +5,7 @@ public enum InsulinScheduleType {
TEMP_BASAL_SCHEDULE(1),
BOLUS(2);
private byte value;
private final byte value;
InsulinScheduleType(int value) {
this.value = (byte) value;

View file

@ -15,7 +15,7 @@ public class RateEntry implements IRawRepresentable {
// We use a double for the delay between pulses because the Joda time API lacks precision for our calculations
private final double delayBetweenPulsesInSeconds;
public RateEntry(double totalPulses, double delayBetweenPulsesInSeconds) {
private RateEntry(double totalPulses, double delayBetweenPulsesInSeconds) {
this.totalPulses = totalPulses;
this.delayBetweenPulsesInSeconds = delayBetweenPulsesInSeconds;
}

View file

@ -3,12 +3,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver.exception;
public abstract class OmnipodException extends RuntimeException {
private boolean certainFailure;
public OmnipodException(String message, boolean certainFailure) {
OmnipodException(String message, boolean certainFailure) {
super(message);
this.certainFailure = certainFailure;
}
public OmnipodException(String message, Throwable cause, boolean certainFailure) {
OmnipodException(String message, Throwable cause, boolean certainFailure) {
super(message, cause);
this.certainFailure = certainFailure;
}

View file

@ -208,6 +208,7 @@ public class OmnipodManager {
return executeAndVerify(() -> communicationService.executeAction(new SetBasalScheduleAction(podStateManager, schedule,
false, podStateManager.getScheduleOffset(), acknowledgementBeep)));
} catch (OmnipodException ex) {
// TODO try to recover or at least verify whether or not the Pod is suspended
// Treat all exceptions as uncertain failures, because all delivery has been suspended here.
// Setting this to an uncertain failure will enable for the user to get an appropriate warning
ex.setCertainFailure(false);
@ -233,8 +234,9 @@ public class OmnipodManager {
acknowledgementBeep, completionBeep)));
return statusResponse;
} catch (OmnipodException ex) {
// Treat all exceptions as uncertain failures, because all delivery has been suspended here.
// Treat all exceptions as uncertain failures, because the old TBR has been cancelled here
// Setting this to an uncertain failure will enable for the user to get an appropriate warning
// TODO try to recover
ex.setCertainFailure(false);
throw ex;
}
@ -255,7 +257,7 @@ public class OmnipodManager {
try {
return executeAndVerify(() -> {
StatusResponse statusResponse = communicationService.executeAction(new CancelDeliveryAction(podStateManager, deliveryTypes, acknowledgementBeep));
aapsLogger.info(LTag.PUMPBTCOMM, "Status response after cancel delivery[types={}]: {}", deliveryTypes.toString(), statusResponse.toString());
aapsLogger.info(LTag.PUMPCOMM, "Status response after cancel delivery[types={}]: {}", deliveryTypes.toString(), statusResponse.toString());
return statusResponse;
});
} finally {
@ -285,7 +287,7 @@ public class OmnipodManager {
}
// Catch uncertain exceptions as we still want to report bolus progress indication
aapsLogger.error(LTag.PUMPBTCOMM, "Caught exception[certainFailure=false] in bolus", ex);
aapsLogger.error(LTag.PUMPCOMM, "Caught exception[certainFailure=false] in bolus", ex);
commandDeliveryStatus = CommandDeliveryStatus.UNCERTAIN_FAILURE;
}
@ -340,10 +342,10 @@ public class OmnipodManager {
// Substract units not delivered in case of a Pod failure
unitsNotDelivered = ex.getFaultEvent().getInsulinNotDelivered();
aapsLogger.debug(LTag.PUMPBTCOMM, "Caught PodFaultException in bolus completion verification", ex);
aapsLogger.debug(LTag.PUMPCOMM, "Caught PodFaultException in bolus completion verification", ex);
break;
} catch (Exception ex) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Ignoring exception in bolus completion verification", ex);
aapsLogger.debug(LTag.PUMPCOMM, "Ignoring exception in bolus completion verification", ex);
}
}
@ -418,10 +420,6 @@ public class OmnipodManager {
try {
cancelDelivery(EnumSet.allOf(DeliveryType.class), acknowledgementBeeps);
} catch (Exception ex) {
logCommandExecutionFinished("setTime");
throw ex;
}
DateTimeZone oldTimeZone = podStateManager.getTimeZone();
@ -434,9 +432,11 @@ public class OmnipodManager {
} catch (OmnipodException ex) {
// Treat all exceptions as uncertain failures, because all delivery has been suspended here.
// Setting this to an uncertain failure will enable for the user to get an appropriate warning
// TODO try to recover or at least verify whether or not the Pod is suspended
podStateManager.setTimeZone(oldTimeZone);
ex.setCertainFailure(false);
throw ex;
}
} finally {
logCommandExecutionFinished("setTime");
}
@ -454,16 +454,16 @@ public class OmnipodManager {
try {
PodInfoResponse podInfoResponse = communicationService.executeAction(new GetPodInfoAction(podStateManager, PodInfoType.RECENT_PULSE_LOG));
PodInfoRecentPulseLog pulseLogInfo = podInfoResponse.getPodInfo();
aapsLogger.info(LTag.PUMPBTCOMM, "Retrieved pulse log from the pod: {}", pulseLogInfo.toString());
aapsLogger.info(LTag.PUMPCOMM, "Retrieved pulse log from the pod: {}", pulseLogInfo.toString());
} catch (Exception ex) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to retrieve pulse log from the pod", ex);
aapsLogger.warn(LTag.PUMPCOMM, "Failed to retrieve pulse log from the pod", ex);
}
try {
// Always send acknowledgement beeps here. Matches the PDM's behavior
communicationService.executeAction(new DeactivatePodAction(podStateManager, true));
} catch (PodFaultException ex) {
aapsLogger.info(LTag.PUMPBTCOMM, "Ignoring PodFaultException in deactivatePod", ex);
aapsLogger.info(LTag.PUMPCOMM, "Ignoring PodFaultException in deactivatePod", ex);
} finally {
logCommandExecutionFinished("deactivatePod");
}
@ -501,17 +501,17 @@ public class OmnipodManager {
if (isCertainFailure(originalException)) {
throw originalException;
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "Caught exception in executeAndVerify. Verifying command by using cancel none command to verify nonce", originalException);
aapsLogger.warn(LTag.PUMPCOMM, "Caught exception in executeAndVerify. Verifying command by using cancel none command to verify nonce", originalException);
try {
logStartingCommandExecution("verifyCommand");
StatusResponse statusResponse = communicationService.sendCommand(StatusResponse.class, podStateManager,
new CancelDeliveryCommand(podStateManager.getCurrentNonce(), BeepType.NO_BEEP, DeliveryType.NONE), false);
aapsLogger.info(LTag.PUMPBTCOMM, "Command status resolved to SUCCESS. Status response after cancelDelivery[types=DeliveryType.NONE]: {}", statusResponse);
aapsLogger.info(LTag.PUMPCOMM, "Command status resolved to SUCCESS. Status response after cancelDelivery[types=DeliveryType.NONE]: {}", statusResponse);
return statusResponse;
} catch (NonceOutOfSyncException verificationException) {
aapsLogger.error(LTag.PUMPBTCOMM, "Command resolved to FAILURE (CERTAIN_FAILURE)", verificationException);
aapsLogger.error(LTag.PUMPCOMM, "Command resolved to FAILURE (CERTAIN_FAILURE)", verificationException);
if (originalException instanceof OmnipodException) {
((OmnipodException) originalException).setCertainFailure(true);
@ -522,14 +522,14 @@ public class OmnipodManager {
throw newException;
}
} catch (Exception verificationException) {
aapsLogger.error(LTag.PUMPBTCOMM, "Command unresolved (UNCERTAIN_FAILURE)", verificationException);
aapsLogger.error(LTag.PUMPCOMM, "Command unresolved (UNCERTAIN_FAILURE)", verificationException);
throw originalException;
}
}
} finally {
logCommandExecutionFinished("verifyCommand");
}
}
}
}
private void assertReadyForDelivery() {
if (!isPodRunning()) {
@ -560,11 +560,11 @@ public class OmnipodManager {
}
private void logStartingCommandExecution(String action) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Starting command execution for action: " + action);
aapsLogger.debug(LTag.PUMPCOMM, "Starting command execution for action: " + action);
}
private void logCommandExecutionFinished(String action) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Command execution finished for action: " + action);
aapsLogger.debug(LTag.PUMPCOMM, "Command execution finished for action: " + action);
}
private static Duration calculateBolusDuration(double units, double deliveryRate) {
@ -585,7 +585,7 @@ public class OmnipodManager {
private final CommandDeliveryStatus commandDeliveryStatus;
private final SingleSubject<BolusDeliveryResult> deliveryResultSubject;
public BolusCommandResult(CommandDeliveryStatus commandDeliveryStatus, SingleSubject<BolusDeliveryResult> deliveryResultSubject) {
BolusCommandResult(CommandDeliveryStatus commandDeliveryStatus, SingleSubject<BolusDeliveryResult> deliveryResultSubject) {
this.commandDeliveryStatus = commandDeliveryStatus;
this.deliveryResultSubject = deliveryResultSubject;
}
@ -602,7 +602,7 @@ public class OmnipodManager {
public static class BolusDeliveryResult {
private final double unitsDelivered;
public BolusDeliveryResult(double unitsDelivered) {
BolusDeliveryResult(double unitsDelivered) {
this.unitsDelivered = unitsDelivered;
}
@ -619,9 +619,9 @@ public class OmnipodManager {
private static class ActiveBolusData {
private final double units;
private volatile DateTime startDate;
private volatile SingleSubject<BolusDeliveryResult> bolusCompletionSubject;
private volatile CompositeDisposable disposables;
private final DateTime startDate;
private final SingleSubject<BolusDeliveryResult> bolusCompletionSubject;
private final CompositeDisposable disposables;
private ActiveBolusData(double units, DateTime startDate, SingleSubject<BolusDeliveryResult> bolusCompletionSubject, CompositeDisposable disposables) {
this.units = units;
@ -630,23 +630,23 @@ public class OmnipodManager {
this.disposables = disposables;
}
public double getUnits() {
double getUnits() {
return units;
}
public DateTime getStartDate() {
DateTime getStartDate() {
return startDate;
}
public CompositeDisposable getDisposables() {
CompositeDisposable getDisposables() {
return disposables;
}
public SingleSubject<BolusDeliveryResult> getBolusCompletionSubject() {
SingleSubject<BolusDeliveryResult> getBolusCompletionSubject() {
return bolusCompletionSubject;
}
public double estimateUnitsDelivered() {
double estimateUnitsDelivered() {
long elapsedMillis = new Duration(startDate, DateTime.now()).getMillis();
long totalDurationMillis = (long) (units / OmnipodConstants.POD_BOLUS_DELIVERY_RATE * 1000);
double factor = (double) elapsedMillis / totalDurationMillis;

View file

@ -38,7 +38,7 @@ public abstract class PodStateManager {
private final Gson gsonInstance;
private PodState podState;
public PodStateManager(AAPSLogger aapsLogger) {
protected PodStateManager(AAPSLogger aapsLogger) {
this.aapsLogger = aapsLogger;
this.gsonInstance = createGson();
}
@ -619,7 +619,7 @@ public abstract class PodStateManager {
return totalTicksDelivered;
}
public Double getTotalInsulinDelivered() {
Double getTotalInsulinDelivered() {
if (totalTicksDelivered != null) {
return totalTicksDelivered * OmnipodConstants.POD_PULSE_SIZE;
} else {
@ -631,7 +631,7 @@ public abstract class PodStateManager {
this.totalTicksDelivered = totalTicksDelivered;
}
public boolean isSuspended() {
boolean isSuspended() {
return suspended;
}
@ -647,7 +647,7 @@ public abstract class PodStateManager {
this.nonceState = nonceState;
}
public PodProgressStatus getPodProgressStatus() {
PodProgressStatus getPodProgressStatus() {
return podProgressStatus;
}
@ -679,7 +679,7 @@ public abstract class PodStateManager {
this.basalSchedule = basalSchedule;
}
public DateTime getLastBolusStartTime() {
DateTime getLastBolusStartTime() {
return lastBolusStartTime;
}
@ -787,7 +787,7 @@ public abstract class PodStateManager {
return (int) ((table[1] + (table[0] << 16)) & 0xFFFFFFFFL);
}
public int getCurrentNonce() {
int getCurrentNonce() {
return (int) table[(2 + index)];
}

View file

@ -105,7 +105,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
}
public synchronized <T extends MessageBlock> T exchangeMessages(Class<T> responseClass, PodStateManager podStateManager, OmnipodMessage message, Integer addressOverride, Integer ackAddressOverride, boolean automaticallyResyncNonce) {
aapsLogger.debug(LTag.PUMPCOMM, "Exchanging OmnipodMessage: responseClass={}, podStateManager={}, message={}, addressOverride={}, ackAddressOverride={}, automaticallyResyncNonce={}", //
aapsLogger.debug(LTag.PUMPBTCOMM, "Exchanging OmnipodMessage: responseClass={}, podStateManager={}, message={}, addressOverride={}, ackAddressOverride={}, automaticallyResyncNonce={}", //
responseClass.getSimpleName(), podStateManager, message, addressOverride, ackAddressOverride, automaticallyResyncNonce);
try {
@ -123,7 +123,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
throw ex;
}
aapsLogger.debug(LTag.PUMPCOMM, "Received response from the Pod [responseMessageBlock={}]", responseMessageBlock);
aapsLogger.debug(LTag.PUMPBTCOMM, "Received response from the Pod [responseMessageBlock={}]", responseMessageBlock);
if (responseMessageBlock instanceof StatusResponse) {
podStateManager.updateFromStatusResponse((StatusResponse) responseMessageBlock);
@ -138,10 +138,10 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
if (error.getErrorResponseCode() == ErrorResponse.ERROR_RESPONSE_CODE_BAD_NONCE) {
podStateManager.resyncNonce(error.getNonceSearchKey(), message.getSentNonce(), message.getSequenceNumber());
if (automaticallyResyncNonce) {
aapsLogger.warn(LTag.PUMPCOMM, "Received ErrorResponse 0x14 (Nonce out of sync). Resyncing nonce and retrying to send message as automaticallyResyncNonce=true");
aapsLogger.warn(LTag.PUMPBTCOMM, "Received ErrorResponse 0x14 (Nonce out of sync). Resyncing nonce and retrying to send message as automaticallyResyncNonce=true");
message.resyncNonce(podStateManager.getCurrentNonce());
} else {
aapsLogger.warn(LTag.PUMPCOMM, "Received ErrorResponse 0x14 (Nonce out of sync). Not resyncing nonce as automaticallyResyncNonce=true");
aapsLogger.warn(LTag.PUMPBTCOMM, "Received ErrorResponse 0x14 (Nonce out of sync). Not resyncing nonce as automaticallyResyncNonce=true");
podStateManager.setLastFailedCommunication(DateTime.now());
throw new NonceOutOfSyncException();
}
@ -175,7 +175,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
}
if (podStateManager.getMessageNumber() != message.getSequenceNumber()) {
aapsLogger.warn(LTag.PUMPCOMM, "Message number in Pod State [{}] does not match message sequence number [{}]. Setting message number in Pod State to {}", podStateManager.getMessageNumber(), message.getSequenceNumber(), message.getSequenceNumber());
aapsLogger.warn(LTag.PUMPBTCOMM, "Message number in Pod State [{}] does not match message sequence number [{}]. Setting message number in Pod State to {}", podStateManager.getMessageNumber(), message.getSequenceNumber(), message.getSequenceNumber());
podStateManager.setMessageNumber(message.getSequenceNumber());
}
@ -226,7 +226,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
// so it's impossible for the pod to have received the message
newException.setCertainFailure(!lastPacket);
aapsLogger.debug(LTag.PUMPCOMM, "Caught exception in transportMessages. Set certainFailure to {} because encodedMessage.length={}", newException.isCertainFailure(), encodedMessage.length);
aapsLogger.debug(LTag.PUMPBTCOMM, "Caught exception in transportMessages. Set certainFailure to {} because encodedMessage.length={}", newException.isCertainFailure(), encodedMessage.length);
throw newException;
}
@ -331,7 +331,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
podStateManager.increasePacketNumber();
while (System.currentTimeMillis() < timeoutTime) {
OmnipodPacket response = null;
OmnipodPacket response;
try {
response = (OmnipodPacket) sendAndListen(packet, responseTimeoutMilliseconds, repeatCount, 9, preambleExtensionMilliseconds);
} catch (RileyLinkCommunicationException | OmnipodException ex) {

View file

@ -40,7 +40,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
@Inject AapsOmnipodManager aapsOmnipodManager;
@Inject OmnipodRileyLinkCommunicationManager omnipodRileyLinkCommunicationManager;
private IBinder mBinder = new LocalBinder();
private final IBinder mBinder = new LocalBinder();
private boolean rileyLinkAddressChanged = false;
private boolean inPreInit = true;
private String rileyLinkAddress;
@ -52,7 +52,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
@Override
public void onConfigurationChanged(Configuration newConfig) {
aapsLogger.warn(LTag.PUMPCOMM, "onConfigurationChanged");
aapsLogger.warn(LTag.PUMPBTCOMM, "onConfigurationChanged");
super.onConfigurationChanged(newConfig);
}
@ -75,7 +75,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
rfspy.startReader();
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkOmnipodService newly constructed");
aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLinkOmnipodService newly constructed");
}
@Override
@ -115,13 +115,13 @@ public class RileyLinkOmnipodService extends RileyLinkService {
String rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
if (StringUtils.isEmpty(rileyLinkAddress)) {
aapsLogger.debug(LTag.PUMPCOMM, "RileyLink address invalid: no address");
aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLink address invalid: no address");
errorDescription = resourceHelper.gs(R.string.omnipod_error_rileylink_address_invalid);
return false;
} else {
if (!rileyLinkAddress.matches(REGEX_MAC)) {
errorDescription = resourceHelper.gs(R.string.omnipod_error_rileylink_address_invalid);
aapsLogger.debug(LTag.PUMPCOMM, "RileyLink address invalid: {}", rileyLinkAddress);
aapsLogger.debug(LTag.PUMPBTCOMM, "RileyLink address invalid: {}", rileyLinkAddress);
} else {
if (!rileyLinkAddress.equals(this.rileyLinkAddress)) {
this.rileyLinkAddress = rileyLinkAddress;
@ -138,7 +138,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
} catch (Exception ex) {
errorDescription = ex.getMessage();
aapsLogger.error(LTag.PUMPCOMM, "Error on Verification: " + ex.getMessage(), ex);
aapsLogger.error(LTag.PUMPBTCOMM, "Error on Verification: " + ex.getMessage(), ex);
return false;
}
}

View file

@ -48,7 +48,7 @@ import org.joda.time.Duration
import javax.inject.Inject
class OmnipodFragment : DaggerFragment() {
val REFRESH_INTERVAL_MILLIS = 15 * 1000L; // 15 seconds
private val REFRESH_INTERVAL_MILLIS = 15 * 1000L; // 15 seconds
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var resourceHelper: ResourceHelper
@ -179,7 +179,7 @@ class OmnipodFragment : DaggerFragment() {
loopHandler.removeCallbacks(refreshLoop)
}
fun updateUi() {
private fun updateUi() {
updateRileyLinkStatus()
updateOmipodStatus()
updatePodActionButtons()
@ -204,7 +204,7 @@ class OmnipodFragment : DaggerFragment() {
omnipod_rl_status.setTextColor(if (rileyLinkServiceState.isError || rileyLinkError != null) Color.RED else Color.WHITE)
}
fun updateOmipodStatus() {
private fun updateOmipodStatus() {
updateLastConnection()
updatePodStatus()

View file

@ -50,15 +50,14 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
private RecyclerView recyclerView;
private LinearLayoutManager linearLayoutManager;
static TypeList showingType = null;
static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
List<OmnipodHistoryRecord> fullHistoryList = new ArrayList<>();
List<OmnipodHistoryRecord> filteredHistoryList = new ArrayList<>();
private static PumpHistoryEntryGroup selectedGroup = PumpHistoryEntryGroup.All;
private final List<OmnipodHistoryRecord> fullHistoryList = new ArrayList<>();
private final List<OmnipodHistoryRecord> filteredHistoryList = new ArrayList<>();
RecyclerViewAdapter recyclerViewAdapter;
boolean manualChange = false;
private RecyclerViewAdapter recyclerViewAdapter;
private boolean manualChange = false;
List<TypeList> typeListFull;
private List<TypeList> typeListFull;
public PodHistoryActivity() {
@ -162,7 +161,6 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
if (manualChange)
return;
TypeList selected = (TypeList) historyTypeSpinner.getSelectedItem();
showingType = selected;
selectedGroup = selected.entryGroup;
filterHistory(selectedGroup);
}
@ -190,10 +188,10 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
return typeList;
}
public static class TypeList {
static class TypeList {
PumpHistoryEntryGroup entryGroup;
String name;
final PumpHistoryEntryGroup entryGroup;
final String name;
TypeList(PumpHistoryEntryGroup entryGroup) {
this.entryGroup = entryGroup;
@ -216,7 +214,7 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
}
public void setHistoryList(List<OmnipodHistoryRecord> historyList) {
void setHistoryList(List<OmnipodHistoryRecord> historyList) {
this.historyList = historyList;
Collections.sort(this.historyList);
}
@ -326,9 +324,9 @@ public class PodHistoryActivity extends NoSplashAppCompatActivity {
class HistoryViewHolder extends RecyclerView.ViewHolder {
TextView timeView;
TextView typeView;
TextView valueView;
final TextView timeView;
final TextView typeView;
final TextView valueView;
HistoryViewHolder(View itemView) {
super(itemView);

View file

@ -90,7 +90,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
disposables.clear()
}
fun initPodAction() {
private fun initPodAction() {
val pagerSettings = WizardPagerSettings()
var refreshAction = InitPodRefreshAction(injector, PodActionType.InitPod)
@ -119,7 +119,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
this@PodManagementActivity.startActivity(myIntent)
}
fun removePodAction() {
private fun removePodAction() {
val pagerSettings = WizardPagerSettings()
var refreshAction = InitPodRefreshAction(injector, PodActionType.RemovePod)
@ -143,7 +143,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
}
fun resetPodAction() {
private fun resetPodAction() {
OKDialog.showConfirmation(this,
resourceHelper.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
aapsOmnipodManager.resetPodStatus()
@ -151,11 +151,11 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
})
}
fun showPodHistory() {
private fun showPodHistory() {
startActivity(Intent(applicationContext, PodHistoryActivity::class.java))
}
fun refreshButtons() {
private fun refreshButtons() {
initpod_init_pod.isEnabled = !podStateManager.isPodActivationCompleted
initpod_remove_pod.isEnabled = podStateManager.isPodInitialized
initpod_reset_pod.isEnabled = podStateManager.hasPodState()

View file

@ -44,16 +44,16 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
private static boolean isFirstView;
protected PageFragmentCallbacks mCallbacks;
protected String mKey;
private PageFragmentCallbacks mCallbacks;
private String mKey;
protected InitActionPage mPage;
protected ProgressBar progressBar;
protected TextView errorView;
protected Button retryButton;
protected PodInitActionType podInitActionType;
protected List<PodInitActionType> children;
PodInitActionType podInitActionType;
private List<PodInitActionType> children;
protected Map<PodInitActionType, CheckBox> mapCheckBoxes;
protected PumpEnactResult callResult;
@ -209,7 +209,7 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
}
}
public void setCheckBox(PodInitActionType podInitActionType, boolean isSuccess) {
protected void setCheckBox(PodInitActionType podInitActionType, boolean isSuccess) {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(() -> {

View file

@ -21,10 +21,10 @@ public class InitActionPage extends Page {
protected PodInitActionType podInitActionType;
protected boolean actionCompleted = false;
protected boolean actionSuccess = false;
private boolean actionCompleted = false;
private boolean actionSuccess = false;
public InitActionPage(ModelCallbacks callbacks, String title) {
protected InitActionPage(ModelCallbacks callbacks, String title) {
super(callbacks, title);
}

View file

@ -20,7 +20,7 @@ public class InitPodTask extends AsyncTask<Void, Void, String> {
@Inject ProfileFunction profileFunction;
@Inject AapsOmnipodManager aapsOmnipodManager;
@Inject RxBusWrapper rxBus;
private InitActionFragment initActionFragment;
private final InitActionFragment initActionFragment;
public InitPodTask(HasAndroidInjector injector, InitActionFragment initActionFragment) {
injector.androidInjector().inject(this);

View file

@ -8,13 +8,13 @@ import com.tech.freak.wizardpager.model.AbstractWizardModel;
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.pages.PodInfoFragment;
public abstract class InitPodWizardModel extends AbstractWizardModel {
public InitPodWizardModel(Context context) {
abstract class InitPodWizardModel extends AbstractWizardModel {
InitPodWizardModel(Context context) {
super(context);
}
@Override
public Fragment getReviewFragment() {
return PodInfoFragment.create("initPodInfoFragment", true);
return PodInfoFragment.create(true);
}
}

View file

@ -55,7 +55,7 @@ public class RemovePodWizardModel extends AbstractWizardModel {
}
@Override public Fragment getReviewFragment() {
return PodInfoFragment.create("removePodInfoFragment", false);
return PodInfoFragment.create(false);
}
}

View file

@ -26,7 +26,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
*/
public class InitPodRefreshAction extends AbstractCancelAction implements FinishActionInterface {
private PodActionType actionType;
private final PodActionType actionType;
@Inject PodStateManager podStateManager;
@Inject AAPSLogger aapsLogger;

View file

@ -30,20 +30,16 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil;
* Created by andy on 12/11/2019
*/
public class PodInfoFragment extends DaggerFragment {
private static final String ARG_KEY = "key";
private static final String ARG_INIT_POD = "initPod";
@Inject AapsOmnipodUtil aapsOmnipodUtil;
@Inject PodStateManager podStateManager;
private PageFragmentCallbacks mCallbacks;
private String mKey;
public boolean isInitPod;
private boolean isInitPod;
private ArrayList<ReviewItem> mCurrentReviewItems;
public static PodInfoFragment create(String key, boolean initPod) {
public static PodInfoFragment create(boolean initPod) {
Bundle args = new Bundle();
args.putString(ARG_KEY, key);
args.putBoolean(ARG_INIT_POD, initPod);
PodInfoFragment fragment = new PodInfoFragment();
@ -58,7 +54,6 @@ public class PodInfoFragment extends DaggerFragment {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Bundle args = getArguments();
mKey = args.getString(ARG_KEY);
isInitPod = args.getBoolean(ARG_INIT_POD);
}
@ -120,28 +115,16 @@ public class PodInfoFragment extends DaggerFragment {
if (!(activity instanceof PageFragmentCallbacks)) {
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
}
mCallbacks = (PageFragmentCallbacks) activity;
}
@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}
private class PodInfoAdapter extends ArrayAdapter<ReviewItem> {
private ArrayList<ReviewItem> dataSet;
Context mContext;
private int lastPosition = -1;
// View lookup cache
public PodInfoAdapter(ArrayList<ReviewItem> data, Context context) {
private static class PodInfoAdapter extends ArrayAdapter<ReviewItem> {
PodInfoAdapter(ArrayList<ReviewItem> data, Context context) {
super(context, com.tech.freak.wizardpager.R.layout.list_item_review, data);
this.dataSet = data;
this.mContext = context;
}
@ -152,8 +135,6 @@ public class PodInfoFragment extends DaggerFragment {
// Check if an existing view is being reused, otherwise inflate the view
ViewHolder viewHolder; // view lookup cache stored in tag
final View result;
if (convertView == null) {
viewHolder = new ViewHolder();
@ -162,12 +143,9 @@ public class PodInfoFragment extends DaggerFragment {
viewHolder.txtName = (TextView) convertView.findViewById(android.R.id.text1);
viewHolder.txtType = (TextView) convertView.findViewById(android.R.id.text2);
result = convertView;
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
result = convertView;
}
viewHolder.txtName.setText(dataModel.getTitle());

View file

@ -1,34 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.pages;
import androidx.fragment.app.Fragment;
import com.tech.freak.wizardpager.model.ModelCallbacks;
import com.tech.freak.wizardpager.model.Page;
import com.tech.freak.wizardpager.model.ReviewItem;
import java.util.ArrayList;
/**
* Created by andy on 12/11/2019
*/
public class PodInfoPage extends Page {
public PodInfoPage(ModelCallbacks callbacks, String title) {
super(callbacks, title);
}
@Override
public Fragment createFragment() {
return PodInfoFragment.create(getKey(), true);
}
@Override
public void getReviewItems(ArrayList<ReviewItem> dest) {
}
@Override
public boolean isCompleted() {
return true;
}
}

View file

@ -31,7 +31,7 @@ public class AapsOmnipodUtil {
private final ResourceHelper resourceHelper;
private Gson gsonInstance = createGson();
private final Gson gsonInstance = createGson();
@Inject
public AapsOmnipodUtil(ResourceHelper resourceHelper) {

View file

@ -15,35 +15,35 @@
<string name="key_omnipod_beep_tbr_enabled" translatable="false">pref_omnipod_beep_tbr_enabled</string>
<string name="key_omnipod_pod_debugging_options_enabled" translatable="false">pref_omnipod_pod_debugging_options_enabled</string>
<string name="key_omnipod_timechange_enabled" translatable="false">pref_omnipod_timechange_enabled</string>
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
<string name="omnipod_config_beep_tbr_enabled">TBR Beep Enabled</string>
<string name="omnipod_config_pod_debugging_options_enabled">Pod Debugging Options Enabled</string>
<string name="omnipod_config_timechange_enabled">DST/Timezone Detection Enabled</string>
<string name="omnipod_config_beep_bolus_enabled">Bolus beep enabled</string>
<string name="omnipod_config_beep_basal_enabled">Basal beep enabled</string>
<string name="omnipod_config_beep_smb_enabled">SMB beep enabled</string>
<string name="omnipod_config_beep_tbr_enabled">TBR beep enabled</string>
<string name="omnipod_config_pod_debugging_options_enabled">Pod debugging options enabled</string>
<string name="omnipod_config_timechange_enabled">DST/Time zone detection enabled</string>
<!-- Omnipod - Fragment -->
<string name="omnipod_moments_ago">Moments ago</string>
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
<string name="omnipod_pod_status">Pod Status</string>
<string name="omnipod_total_delivered_label">Total Delivered</string>
<string name="omnipod_pod_mgmt">Pod mgmt</string>
<string name="omnipod_pod_status">Pod status</string>
<string name="omnipod_total_delivered_label">Total delivered</string>
<string name="omnipod_total_delivered">%1$.2f U</string>
<string name="omnipod_reservoir_left">%1$.2f U left</string>
<string name="omnipod_reservoir_over50">Over 50 U</string>
<string name="omnipod_pod_address">Pod Address</string>
<string name="omnipod_pod_expiry">Pod Expires</string>
<string name="omnipod_pod_address">Pod address</string>
<string name="omnipod_pod_expiry">Pod expires</string>
<string name="omnipod_warning">Warning</string>
<string name="omnipod_pod_status_no_active_pod">No active Pod</string>
<string name="omnipod_pod_status_waiting_for_pair_and_prime">Setup in progress (waiting for pair and prime)</string>
<string name="omnipod_pod_status_waiting_for_cannula_insertion">Setup in progress (waiting for cannula insertion)</string>
<string name="omnipod_pod_status_running">Running</string>
<string name="omnipod_pod_status_suspended">Suspended</string>
<string name="omnipod_pod_status_pod_fault">Pod Fault</string>
<string name="omnipod_pod_status_pod_fault">Pod fault</string>
<string name="omnipod_pod_status_activation_time_exceeded">Activation time exceeded</string>
<string name="omnipod_pod_status_inactive">Inactive</string>
<string name="omnipod_pod_status_pod_fault_description">Pod Fault: %1$s %2$s</string>
<string name="omnipod_pod_active_alerts">Active Pod Alerts</string>
<string name="omnipod_ack_short">Ack Alerts</string>
<string name="omnipod_pod_status_pod_fault_description">Pod fault: %1$s %2$s</string>
<string name="omnipod_pod_active_alerts">Active Pod alerts</string>
<string name="omnipod_ack_short">Ack alerts</string>
<string name="omnipod_last_bolus" translatable="false">%1$.2f %2$s (%3$s)</string>
<string name="omnipod_pod_status_initalizing">Initializing</string>
@ -53,52 +53,52 @@
<!-- Omnipod - Error -->
<string name="omnipod_error_rileylink_address_invalid">RileyLink Address invalid.</string>
<string name="omnipod_error_rileylink_address_invalid">RileyLink address invalid.</string>
<string name="omnipod_error_operation_not_possible_no_configuration">Operation is not possible.\n\nYou need to configure Omnipod first, before you can use this operation.</string>
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait few minutes, until AAPS tries to set profile for first time.</string>
<string name="omnipod_error_operation_not_possible_no_profile">Operation is not possible.\n\n You need to wait a few minutes, until AAPS tries to set basal profile for first time.</string>
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
<string name="omnipod_error_pod_not_attached">No active pod.</string>
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed.</string>
<string name="omnipod_error_pod_not_attached">No active Pod</string>
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed</string>
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occurred. Please report! (type: %1$s).</string>
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters.</string>
<string name="omnipod_driver_error_communication_failed_timeout">Communication failed: timeout.</string>
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters</string>
<string name="omnipod_driver_error_communication_failed_timeout">Communication failed: timeout</string>
<string name="omnipod_driver_error_communication_failed_unexpected_exception">Communication failed: an unexpected error occurred. Please report!</string>
<string name="omnipod_driver_error_crc_mismatch">Communication failed: message integrity verification failed.</string>
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod.</string>
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state.</string>
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod.</string>
<string name="omnipod_driver_error_invalid_message_sequence_number">Communication failed: received a message with an invalid sequence number from the Pod.</string>
<string name="omnipod_driver_error_invalid_message_address">Communication failed: received a message with an invalid address from the Pod.</string>
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod.</string>
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed.</string>
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync.</string>
<string name="omnipod_driver_error_not_enough_data">Communication failed: not enough data received from the Pod.</string>
<string name="omnipod_driver_error_pod_fault">A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one.</string>
<string name="omnipod_driver_error_pod_returned_error_response">Communication failed: the Pod returned an error response.</string>
<string name="omnipod_driver_error_crc_mismatch">Communication failed: message integrity verification failed</string>
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod</string>
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state</string>
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod</string>
<string name="omnipod_driver_error_invalid_message_sequence_number">Communication failed: received a message with an invalid sequence number from the Pod</string>
<string name="omnipod_driver_error_invalid_message_address">Communication failed: received a message with an invalid address from the Pod</string>
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod</string>
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed</string>
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync</string>
<string name="omnipod_driver_error_not_enough_data">Communication failed: not enough data received from the Pod</string>
<string name="omnipod_driver_error_pod_fault">A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one</string>
<string name="omnipod_driver_error_pod_returned_error_response">Communication failed: the Pod returned an error response</string>
<!-- Omnipod - Pod Mgmt -->
<string name="omnipod_pod_mgmt_title">Pod Management</string>
<string name="omnipod_pod_mgmt_title">Pod management</string>
<string name="omnipod_cmd_init_pod">Init Pod</string>
<string name="omnipod_cmd_deactivate_pod">Deactivate Pod</string>
<string name="omnipod_cmd_reset_pod">Reset Pod</string>
<string name="omnipod_cmd_pod_history">Pod History</string>
<string name="omnipod_cmd_set_bolus">Set Bolus</string>
<string name="omnipod_cmd_cancel_bolus">Cancel Bolus</string>
<string name="omnipod_cmd_set_tbr">Set Temporary Basal</string>
<string name="omnipod_cmd_cancel_tbr">Cancel Temporary Basal (Internally by driver)</string>
<string name="omnipod_cmd_cancel_tbr_forced">Cancel Temporary Basal (Forced by user)</string>
<string name="omnipod_cmd_set_basal_schedule">Set Basal Schedule</string>
<string name="omnipod_cmd_get_pod_status">Get Pod Status</string>
<string name="omnipod_cmd_get_pod_info">Get Pod Info</string>
<string name="omnipod_cmd_set_time">Set Time</string>
<string name="omnipod_cmd_configure_alerts">Configure Alerts</string>
<string name="omnipod_cmd_acknowledge_alerts">Acknowledge Alerts</string>
<string name="omnipod_cmd_suspend_delivery">Suspend Delivery</string>
<string name="omnipod_cmd_resume_delivery">Resume Delivery</string>
<string name="omnipod_cmd_unknown_entry">Unknown Entry</string>
<string name="omnipod_cmd_pod_history">Pod history</string>
<string name="omnipod_cmd_set_bolus">Set bolus</string>
<string name="omnipod_cmd_cancel_bolus">Cancel bolus</string>
<string name="omnipod_cmd_set_tbr">Set temporary basal</string>
<string name="omnipod_cmd_cancel_tbr">Cancel temporary basal (internally by driver)</string>
<string name="omnipod_cmd_cancel_tbr_forced">Cancel temporary casal (forced by user)</string>
<string name="omnipod_cmd_set_basal_schedule">Set basal schedule</string>
<string name="omnipod_cmd_get_pod_status">Get Pod status</string>
<string name="omnipod_cmd_get_pod_info">Get Pod info</string>
<string name="omnipod_cmd_set_time">Set time</string>
<string name="omnipod_cmd_configure_alerts">Configure alerts</string>
<string name="omnipod_cmd_acknowledge_alerts">Acknowledge alerts</string>
<string name="omnipod_cmd_suspend_delivery">Suspend delivery</string>
<string name="omnipod_cmd_resume_delivery">Resume delivery</string>
<string name="omnipod_cmd_unknown_entry">Unknown entry</string>
<string name="omnipod_cmd_bolus_value">%1$.2f U</string>
<string name="omnipod_cmd_bolus_value_with_carbs">%1$.2f U, CH=%2$.1f g</string>
<string name="omnipod_cmd_tbr_value">Rate: %1$.2f U, Duration: %2$d min</string>
<string name="omnipod_cmd_tbr_value">Rate: %1$.2f U, duration: %2$d min</string>
<string name="omnipod_cmd_reset_pod_desc">If you press <b>OK</b>, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.</string>
<string name="omnipod_cmd_pod_history_na">Pod History not available at the moment.</string>
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
@ -109,7 +109,7 @@
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
<string name="omnipod_init_pod_wizard_step4_action_header">Trying to set initial basal schedule and insert the cannula.\n\nWhen all items are checked, you can press <b>Next</b>.</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod info</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t.</string>
<string name="omnipod_remove_pod_wizard_step1_title">Deactivate Pod</string>
<string name="omnipod_remove_pod_wizard_step1_desc">\nPress <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
@ -118,15 +118,12 @@
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod deactivated.\n\nPlease remove the Pod from your body and discard it.</string>
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
<string name="omnipod_init_pod_set_basal_profile">Set Basal Profile</string>
<string name="omnipod_deactivate_pod_cancel_delivery">Cancel Delivery</string>
<string name="omnipod_init_pod_fill_cannula">Fill cannula</string>
<string name="omnipod_init_pod_set_basal_profile">Set basal profile</string>
<string name="omnipod_deactivate_pod_cancel_delivery">Cancel delivery</string>
<string name="omnipod_deactivate_pod_deactivate_pod">Deactivate Pod</string>
<!-- Omnipod - Base -->
<string name="omnipod_dash_name" translatable="false">Omnipod Dash</string>
<string name="omnipod_dash_name_short" translatable="false">DASH</string>
<string name="description_pump_omnipod_dash">Pump integration for Omnipod Dash.</string>
<string name="omnipod_alert_finish_pairing_reminder">Finish pairing reminder</string>
<string name="omnipod_alert_finish_setup_reminder_reminder">Finish setup reminder</string>
<string name="omnipod_alert_expiration">Pod will expire soon</string>
@ -135,19 +132,19 @@
<string name="omnipod_alert_low_reservoir">Low reservoir</string>
<string name="omnipod_alert_unknown_alert">Unknown alert</string>
<string name="omnipod_error_set_basal_failed_uncertain">Setting basal profile might have failed. Delivery might be suspended! Please refresh Pod status.</string>
<string name="omnipod_error_set_temp_basal_failed_uncertain">Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh pod status.</string>
<string name="omnipod_error_set_temp_basal_failed_uncertain">Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh Pod status.</string>
<string name="omnipod_error_set_time_failed_uncertain">Setting time might have failed. Delivery might be suspended! Please refresh Pod status.</string>
<string name="omnipod_bolus_failed_uncertain">Unable to verify whether the bolus succeeded. Please verify that your Pod is bolusing or cancel the bolus.</string>
<string name="omnipod_rl_stats">RL Stats</string>
<string name="omnipod_read_pulse_log_short">Pulse Log</string>
<string name="omnipod_rl_stats">RL stats</string>
<string name="omnipod_read_pulse_log_short">Pulse log</string>
<string name="omnipod_pod_lot">LOT</string>
<string name="omnipod_pod_tid">TID</string>
<string name="omnipod_pod_firmware_version">Firmware version</string>
<string name="omnipod_pod_firmware_version_value" translatable="false">PM %1$s / PI %2$s</string>
<string name="omnipod_errors">Errors</string>
<string name="omnipod_cmd_basal_profile_not_set_is_same">Basal profile is the same, so it will not be set again.</string>
<string name="omnipod_custom_action_reset_rileylink">Reset RileyLink Config</string>
<string name="omnipod_time_or_timezone_change">Time and/or Timezone change on pump</string>
<string name="omnipod_custom_action_reset_rileylink">Reset RileyLink config</string>
<string name="omnipod_time_or_timezone_change">Time and/or time zone changed on the Pod</string>
<string name="omnipod_composite_time">%1$s and %2$s</string>
<string name="omnipod_time_ago">%1$s ago</string>
<string name="omnipod_waiting_for_rileylink_connection">Waiting for RileyLink connection...</string>

View file

@ -73,7 +73,7 @@ public abstract class RileyLinkCommunicationManager {
// internal flag
boolean showPumpMessages = true;
if (showPumpMessages) {
aapsLogger.info(LTag.PUMPCOMM, "Sent:" + ByteUtil.shortHexString(msg.getTxData()));
aapsLogger.info(LTag.PUMPBTCOMM, "Sent:" + ByteUtil.shortHexString(msg.getTxData()));
}
RFSpyResponse rfSpyResponse = rfspy.transmitThenReceive(new RadioPacket(injector, msg.getTxData()),
@ -86,7 +86,7 @@ public abstract class RileyLinkCommunicationManager {
// Mark this as the last time we heard from the pump.
rememberLastGoodDeviceCommunicationTime();
} else {
aapsLogger.warn(LTag.PUMPCOMM, "isDeviceReachable. Response is invalid ! [interrupted={}, timeout={}, unknownCommand={}, invalidParam={}]", rfSpyResponse.wasInterrupted(),
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Response is invalid ! [interrupted={}, timeout={}, unknownCommand={}, invalidParam={}]", rfSpyResponse.wasInterrupted(),
rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam());
if (rfSpyResponse.wasTimeout()) {
@ -96,7 +96,7 @@ public abstract class RileyLinkCommunicationManager {
long diff = System.currentTimeMillis() - getPumpDevice().getLastConnectionTimeMillis();
if (diff > ALLOWED_PUMP_UNREACHABLE) {
aapsLogger.warn(LTag.PUMPCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
aapsLogger.warn(LTag.PUMPBTCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
serviceTaskExecutor.startTask(new WakeAndTuneTask(injector));
timeoutCount = 0;
}
@ -109,7 +109,7 @@ public abstract class RileyLinkCommunicationManager {
}
if (showPumpMessages) {
aapsLogger.info(LTag.PUMPCOMM, "Received:" + ByteUtil.shortHexString(rfSpyResponse.getRadioResponse(injector).getPayload()));
aapsLogger.info(LTag.PUMPBTCOMM, "Received:" + ByteUtil.shortHexString(rfSpyResponse.getRadioResponse(injector).getPayload()));
}
return response;
@ -145,18 +145,18 @@ public abstract class RileyLinkCommunicationManager {
nextWakeUpRequired = 0L;
if (System.currentTimeMillis() > nextWakeUpRequired) {
aapsLogger.info(LTag.PUMPCOMM, "Waking pump...");
aapsLogger.info(LTag.PUMPBTCOMM, "Waking pump...");
byte[] pumpMsgContent = createPumpMessageContent(RLMessageType.ReadSimpleData); // simple
RFSpyResponse resp = rfspy.transmitThenReceive(new RadioPacket(injector, pumpMsgContent), (byte) 0, (byte) 200,
(byte) 0, (byte) 0, 25000, (byte) 0);
aapsLogger.info(LTag.PUMPCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.info(LTag.PUMPBTCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
// FIXME wakeUp successful !!!!!!!!!!!!!!!!!!
nextWakeUpRequired = System.currentTimeMillis() + (receiverDeviceAwakeForMinutes * 60 * 1000);
} else {
aapsLogger.debug(LTag.PUMPCOMM, "Last pump communication was recent, not waking pump.");
aapsLogger.debug(LTag.PUMPBTCOMM, "Last pump communication was recent, not waking pump.");
}
// long lastGoodPlus = getLastGoodReceiverCommunicationTime() + (receiverDeviceAwakeForMinutes * 60 * 1000);
@ -213,7 +213,7 @@ public abstract class RileyLinkCommunicationManager {
private double scanForDevice(double[] frequencies) {
aapsLogger.info(LTag.PUMPCOMM, "Scanning for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPBTCOMM, "Scanning for receiver ({})", receiverDeviceID);
wakeUp(receiverDeviceAwakeForMinutes, false);
FrequencyScanResults results = new FrequencyScanResults();
@ -230,7 +230,7 @@ public abstract class RileyLinkCommunicationManager {
RFSpyResponse resp = rfspy.transmitThenReceive(new RadioPacket(injector, pumpMsgContent), (byte) 0, (byte) 0,
(byte) 0, (byte) 0, 1250, (byte) 0);
if (resp.wasTimeout()) {
aapsLogger.error(LTag.PUMPCOMM, "scanForPump: Failed to find pump at frequency {}", frequencies[i]);
aapsLogger.error(LTag.PUMPBTCOMM, "scanForPump: Failed to find pump at frequency {}", frequencies[i]);
} else if (resp.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
@ -244,17 +244,17 @@ public abstract class RileyLinkCommunicationManager {
trial.rssiList.add(rssi);
trial.successes++;
} else {
aapsLogger.warn(LTag.PUMPCOMM, "Failed to parse radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to parse radio response: " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
} catch (RileyLinkCommunicationException rle) {
aapsLogger.warn(LTag.PUMPCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
} else {
aapsLogger.error(LTag.PUMPCOMM, "scanForPump: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.error(LTag.PUMPBTCOMM, "scanForPump: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
trial.tries++;
@ -278,7 +278,7 @@ public abstract class RileyLinkCommunicationManager {
+ one.frequencyMHz, "" + one.averageRSSI + ", RSSIs =" + one.rssiList));
}
aapsLogger.info(LTag.PUMPCOMM, stringBuilder.toString());
aapsLogger.info(LTag.PUMPBTCOMM, stringBuilder.toString());
results.sort(); // sorts in ascending order
@ -286,10 +286,10 @@ public abstract class RileyLinkCommunicationManager {
results.bestFrequencyMHz = bestTrial.frequencyMHz;
if (bestTrial.successes > 0) {
rfspy.setBaseFrequency(results.bestFrequencyMHz);
aapsLogger.debug(LTag.PUMPCOMM, "Best frequency found: " + results.bestFrequencyMHz);
aapsLogger.debug(LTag.PUMPBTCOMM, "Best frequency found: " + results.bestFrequencyMHz);
return results.bestFrequencyMHz;
} else {
aapsLogger.error(LTag.PUMPCOMM, "No pump response during scan.");
aapsLogger.error(LTag.PUMPBTCOMM, "No pump response during scan.");
return 0.0;
}
}
@ -318,22 +318,22 @@ public abstract class RileyLinkCommunicationManager {
RadioPacket pkt = new RadioPacket(injector, pumpMsgContent);
RFSpyResponse resp = rfspy.transmitThenReceive(pkt, (byte) 0, (byte) 0, (byte) 0, (byte) 0, SCAN_TIMEOUT, (byte) 0);
if (resp.wasTimeout()) {
aapsLogger.warn(LTag.PUMPCOMM, "tune_tryFrequency: no pump response at frequency {}", freqMHz);
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: no pump response at frequency {}", freqMHz);
} else if (resp.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
try {
radioResponse.init(resp.getRaw());
if (radioResponse.isValid()) {
aapsLogger.warn(LTag.PUMPCOMM, "tune_tryFrequency: saw response level {} at frequency {}", radioResponse.rssi, freqMHz);
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: saw response level {} at frequency {}", radioResponse.rssi, freqMHz);
return calculateRssi(radioResponse.rssi);
} else {
aapsLogger.warn(LTag.PUMPCOMM, "tune_tryFrequency: invalid radio response:"
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: invalid radio response:"
+ ByteUtil.shortHexString(radioResponse.getPayload()));
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
}
}
@ -360,13 +360,13 @@ public abstract class RileyLinkCommunicationManager {
}
if (betterFrequency == 0.0) {
// we've failed... caller should try a full scan for pump
aapsLogger.error(LTag.PUMPCOMM, "quickTuneForPump: failed to find pump");
aapsLogger.error(LTag.PUMPBTCOMM, "quickTuneForPump: failed to find pump");
} else {
rfspy.setBaseFrequency(betterFrequency);
if (betterFrequency != startFrequencyMHz) {
aapsLogger.info(LTag.PUMPCOMM, "quickTuneForPump: new frequency is {}MHz", betterFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: new frequency is {}MHz", betterFrequency);
} else {
aapsLogger.info(LTag.PUMPCOMM, "quickTuneForPump: pump frequency is the same: {}MHz", startFrequencyMHz);
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: pump frequency is the same: {}MHz", startFrequencyMHz);
}
}
return betterFrequency;
@ -374,7 +374,7 @@ public abstract class RileyLinkCommunicationManager {
private double quickTunePumpStep(double startFrequencyMHz, double stepSizeMHz) {
aapsLogger.info(LTag.PUMPCOMM, "Doing quick radio tune for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPBTCOMM, "Doing quick radio tune for receiver ({})", receiverDeviceID);
wakeUp(false);
int startRssi = tune_tryFrequency(startFrequencyMHz);
double lowerFrequency = startFrequencyMHz - stepSizeMHz;
@ -413,7 +413,7 @@ public abstract class RileyLinkCommunicationManager {
// Might still be zero, but that's fine.
}
double minutesAgo = (System.currentTimeMillis() - lastGoodReceiverCommunicationTime) / (1000.0 * 60.0);
aapsLogger.debug(LTag.PUMPCOMM, "Last good pump communication was " + minutesAgo + " minutes ago.");
aapsLogger.debug(LTag.PUMPBTCOMM, "Last good pump communication was " + minutesAgo + " minutes ago.");
return lastGoodReceiverCommunicationTime;
}

View file

@ -118,7 +118,7 @@ public class RadioResponse {
receivedCRC = decodeThis[decodeThis.length - 1];
byte calculatedCRC = CRC.crc8(decodedPayload);
if (receivedCRC != calculatedCRC) {
aapsLogger.error(LTag.PUMPCOMM, String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x",
aapsLogger.error(LTag.PUMPBTCOMM, String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x",
calculatedCRC, receivedCRC));
}
} else {

View file

@ -55,7 +55,7 @@ public class CharacteristicReadOperation extends BLECommOperation {
public void gattOperationCompletionCallback(UUID uuid, byte[] value) {
super.gattOperationCompletionCallback(uuid, value);
if (!characteristic.getUuid().equals(uuid)) {
aapsLogger.error(LTag.PUMPCOMM, String.format(
aapsLogger.error(LTag.PUMPBTCOMM, String.format(
"Completion callback: UUID does not match! out of sequence? Found: %s, should be %s",
GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid)));
}

View file

@ -58,7 +58,7 @@ public class CharacteristicWriteOperation extends BLECommOperation {
@Override
public void gattOperationCompletionCallback(UUID uuid, byte[] value) {
if (!characteristic.getUuid().equals(uuid)) {
aapsLogger.error(LTag.PUMPCOMM, String.format(
aapsLogger.error(LTag.PUMPBTCOMM, String.format(
"Completion callback: UUID does not match! out of sequence? Found: %s, should be %s",
GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid)));
}

View file

@ -94,20 +94,20 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
super.onReceive(context, intent);
if (intent == null) {
aapsLogger.error(LTag.PUMPCOMM, "onReceive: received null intent");
aapsLogger.error(LTag.PUMPBTCOMM, "onReceive: received null intent");
} else {
String action = intent.getAction();
if (action == null) {
aapsLogger.error("onReceive: null action");
} else {
aapsLogger.debug(LTag.PUMPCOMM, "Received Broadcast: " + action);
aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: " + action);
if (!processBluetoothBroadcasts(action) && //
!processRileyLinkBroadcasts(action, context) && //
!processTuneUpBroadcasts(action) && //
!processApplicationSpecificBroadcasts(action, intent) //
) {
aapsLogger.error(LTag.PUMPCOMM, "Unhandled broadcast: action=" + action);
aapsLogger.error(LTag.PUMPBTCOMM, "Unhandled broadcast: action=" + action);
}
}
}
@ -143,7 +143,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
return true;
} else if (action.equals(RileyLinkConst.Intents.RileyLinkReady)) {
aapsLogger.warn(LTag.PUMPCOMM, "RileyLinkConst.Intents.RileyLinkReady");
aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLinkConst.Intents.RileyLinkReady");
// sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump);
rileyLinkService.rileyLinkBLE.enableNotifications();
@ -154,16 +154,16 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
RileyLinkFirmwareVersion rlVersion = rileyLinkServiceData.firmwareVersion;
// if (isLoggingEnabled())
aapsLogger.debug(LTag.PUMPCOMM, "RfSpy version (BLE113): " + bleVersion);
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): " + bleVersion);
rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion;
// if (isLoggingEnabled())
aapsLogger.debug(LTag.PUMPCOMM, "RfSpy Radio version (CC110): " + rlVersion.name());
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name());
this.rileyLinkServiceData.versionCC110 = rlVersion;
ServiceTask task = new InitializePumpManagerTask(injector, context);
serviceTaskExecutor.startTask(task);
aapsLogger.info(LTag.PUMPCOMM, "Announcing RileyLink open For business");
aapsLogger.info(LTag.PUMPBTCOMM, "Announcing RileyLink open For business");
return true;
} else if (action.equals(RileyLinkConst.Intents.RileyLinkNewAddressSet)) {
@ -192,13 +192,13 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
public boolean processBluetoothBroadcasts(String action) {
if (action.equals(RileyLinkConst.Intents.BluetoothConnected)) {
aapsLogger.debug(LTag.PUMPCOMM, "Bluetooth - Connected");
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Connected");
serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector));
return true;
} else if (action.equals(RileyLinkConst.Intents.BluetoothReconnected)) {
aapsLogger.debug(LTag.PUMPCOMM, "Bluetooth - Reconnecting");
aapsLogger.debug(LTag.PUMPBTCOMM, "Bluetooth - Reconnecting");
getServiceInstance().bluetoothInit();
serviceTaskExecutor.startTask(new DiscoverGattServicesTask(injector, true));

View file

@ -81,14 +81,14 @@ public abstract class RileyLinkService extends DaggerService {
@Override
public boolean onUnbind(Intent intent) {
//aapsLogger.warn(LTag.PUMPCOMM, "onUnbind");
//aapsLogger.warn(LTag.PUMPBTCOMM, "onUnbind");
return super.onUnbind(intent);
}
@Override
public void onRebind(Intent intent) {
//aapsLogger.warn(LTag.PUMPCOMM, "onRebind");
//aapsLogger.warn(LTag.PUMPBTCOMM, "onRebind");
super.onRebind(intent);
}
@ -123,7 +123,7 @@ public abstract class RileyLinkService extends DaggerService {
public boolean bluetoothInit() {
aapsLogger.debug(LTag.PUMPCOMM, "bluetoothInit: attempting to get an adapter");
aapsLogger.debug(LTag.PUMPBTCOMM, "bluetoothInit: attempting to get an adapter");
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.BluetoothInitializing);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
@ -153,10 +153,10 @@ public abstract class RileyLinkService extends DaggerService {
if (rileyLinkBLE.isConnected()) {
if (deviceAddress.equals(rileyLinkServiceData.rileylinkAddress)) {
aapsLogger.info(LTag.PUMPCOMM, "No change to RL address. Not reconnecting.");
aapsLogger.info(LTag.PUMPBTCOMM, "No change to RL address. Not reconnecting.");
return false;
} else {
aapsLogger.warn(LTag.PUMPCOMM, "Disconnecting from old RL (" + rileyLinkServiceData.rileylinkAddress
aapsLogger.warn(LTag.PUMPBTCOMM, "Disconnecting from old RL (" + rileyLinkServiceData.rileylinkAddress
+ "), reconnecting to new: " + deviceAddress);
rileyLinkBLE.disconnect();
@ -168,7 +168,7 @@ public abstract class RileyLinkService extends DaggerService {
return true;
}
} else {
aapsLogger.debug(LTag.PUMPCOMM, "Using RL " + deviceAddress);
aapsLogger.debug(LTag.PUMPBTCOMM, "Using RL " + deviceAddress);
if (rileyLinkServiceData.getRileyLinkServiceState() == RileyLinkServiceState.NotStarted) {
if (!bluetoothInit()) {
@ -203,7 +203,7 @@ public abstract class RileyLinkService extends DaggerService {
newFrequency = getDeviceCommunicationManager().tuneForDevice();
if ((newFrequency != 0.0) && (newFrequency != lastGoodFrequency)) {
aapsLogger.info(LTag.PUMPCOMM, "Saving new pump frequency of {} MHz", newFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Saving new pump frequency of {} MHz", newFrequency);
sp.putDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, newFrequency);
rileyLinkServiceData.lastGoodFrequency = newFrequency;
rileyLinkServiceData.tuneUpDone = true;

View file

@ -74,7 +74,7 @@ public class InitializePumpManagerTask extends ServiceTask {
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady);
aapsLogger.info(LTag.PUMPCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency);
@ -103,7 +103,7 @@ public class InitializePumpManagerTask extends ServiceTask {
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady);
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod; // TODO shouldn't be needed
aapsLogger.info(LTag.PUMPCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency);