- fixed log support, it still used {} as data placeholders, which doesn't work with aapsLogger

This commit is contained in:
Andy Rozman 2021-03-19 20:50:58 +00:00
parent ba8c436136
commit 2c6f64b71f
25 changed files with 168 additions and 169 deletions

View file

@ -329,7 +329,7 @@ class MedtronicFragment : DaggerFragment() {
medtronicPumpPlugin.rileyLinkService?.verifyConfiguration()
binding.errors.text = medtronicPumpStatus.errorInfo
var showRileyLinkBatteryLevel: Boolean = medtronicPumpStatus.showRileyLinkBatteryLevel
var showRileyLinkBatteryLevel: Boolean = rileyLinkServiceData.showBatteryLevel
if (showRileyLinkBatteryLevel) {
binding.rlBatteryView.visibility = View.VISIBLE

View file

@ -780,7 +780,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) {
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump.", timeDiff);
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is %d s. Set time on pump.", timeDiff);
rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock);
@ -790,13 +790,13 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
}
} else {
if ((clock.localDeviceTime.getYear() > 2015)) {
aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff={} s]. Doing nothing.", timeDiff);
aapsLogger.error("MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference over 24h requested [diff=%d s]. Doing nothing.", timeDiff);
medtronicUtil.sendNotification(MedtronicNotificationType.TimeChangeOver24h, getResourceHelper(), rxBus);
}
}
} else {
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Do nothing.", timeDiff);
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is %d s. Do nothing.", timeDiff);
}
scheduleNextRefresh(MedtronicStatusRefreshType.PumpTime, 0);
@ -1068,7 +1068,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
@NonNull @Override
public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) {
public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) {
if (percent == 0) {
return setTempBasalAbsolute(0.0d, durationInMinutes, profile, enforceNew);
} else {

View file

@ -171,7 +171,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage pumpResponse = createResponseMessage(radioResponse.getPayload());
if (!pumpResponse.isValid()) {
aapsLogger.warn(LTag.PUMPCOMM, "Response is invalid ! [interrupted={}, timeout={}]", rfSpyResponse.wasInterrupted(),
aapsLogger.warn(LTag.PUMPCOMM, "Response is invalid ! [interrupted=%b, timeout=%b]", rfSpyResponse.wasInterrupted(),
rfSpyResponse.wasTimeout());
} else {
@ -186,7 +186,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
medtronicUtil.setMedtronicPumpModel(pumpModel);
}
aapsLogger.debug(LTag.PUMPCOMM, "isDeviceReachable. PumpModel is {} - Valid: {} (rssi={})", pumpModel.name(), valid,
aapsLogger.debug(LTag.PUMPCOMM, "isDeviceReachable. PumpModel is %s - Valid: %b (rssi=%d)", pumpModel.name(), valid,
radioResponse.rssi);
if (valid) {
@ -245,7 +245,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
rval = sendAndListen(msg);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPCOMM, "2nd Response: {}", rval);
aapsLogger.debug(LTag.PUMPCOMM, "2nd Response: %s", rval);
return rval;
} else {
@ -258,7 +258,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private PumpMessage runCommandWithFrames(MedtronicCommandType commandType, List<List<Byte>> frames)
throws RileyLinkCommunicationException {
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: {}", commandType.name());
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: %s", commandType.name());
PumpMessage rval = null;
PumpMessage shortMessage = makePumpMessage(commandType, new CarelinkShortMessageBody(new byte[]{0}));
@ -288,14 +288,14 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
// aapsLogger.debug(LTag.PUMPCOMM,"PumpResponse: " + rval);
if (rval.commandType != MedtronicCommandType.CommandACK) {
aapsLogger.error(LTag.PUMPCOMM, "runCommandWithFrames: Pump did not ACK frame #{}", frameNr);
aapsLogger.error(LTag.PUMPCOMM, "runCommandWithFrames: Pump did not ACK frame #%d", frameNr);
aapsLogger.error(LTag.PUMPCOMM, "Run command with Frames FAILED (command={}, response={})", commandType.name(),
aapsLogger.error(LTag.PUMPCOMM, "Run command with Frames FAILED (command=%s, response=%s)", commandType.name(),
rval.toString());
return new PumpMessage(aapsLogger, "No ACK after frame #" + frameNr);
} else {
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: Got ACK response for frame #{}", (frameNr));
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: Got ACK response for frame #%d", frameNr);
}
frameNr++;
@ -326,7 +326,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage getHistoryMsg = makePumpMessage(MedtronicCommandType.GetHistoryData,
new GetHistoryPageCarelinkMessageBody(pageNumber));
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Page {}", pageNumber);
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Page %d", pageNumber);
// aapsLogger.info(LTag.PUMPCOMM,"getPumpHistoryPage("+pageNumber+"): "+ByteUtil.shortHexString(getHistoryMsg.getTxData()));
// Ask the pump to transfer history (we get first frame?)
@ -342,7 +342,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
failed = false;
break;
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPCOMM, "First call for PumpHistory failed (retry={})", retries);
aapsLogger.error(LTag.PUMPCOMM, "First call for PumpHistory failed (retry=%d)", retries);
failed = true;
}
}
@ -379,7 +379,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
medtronicUtil.setCurrentCommand(MedtronicCommandType.GetHistoryData, pageNumber,
currentResponse.getFrameNumber());
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Got frame {} of Page {}", currentResponse.getFrameNumber(), pageNumber);
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Got frame %d of Page %d", currentResponse.getFrameNumber(), pageNumber);
// Do we need to ask for the next frame?
if (expectedFrameNum < 16) { // This number may not be correct for pumps other than 522/722
expectedFrameNum++;
@ -390,7 +390,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (frameData == null) {
aapsLogger.error(LTag.PUMPCOMM, "null frame data, retrying");
} else if (currentResponse.getFrameNumber() != expectedFrameNum) {
aapsLogger.warn(LTag.PUMPCOMM, "Expected frame number {}, received {} (retrying)", expectedFrameNum,
aapsLogger.warn(LTag.PUMPCOMM, "Expected frame number %d, received %d (retrying)", expectedFrameNum,
currentResponse.getFrameNumber());
} else if (frameData.length == 0) {
aapsLogger.warn(LTag.PUMPCOMM, "Frame has zero length, retrying");
@ -398,7 +398,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
failures++;
if (failures == 6) {
aapsLogger.error(LTag.PUMPCOMM,
"getPumpHistory: 6 failures in attempting to download frame {} of page {}, giving up.",
"getPumpHistory: 6 failures in attempting to download frame %d of page %d, giving up.",
expectedFrameNum, pageNumber);
done = true; // failure completion.
doneWithError = true;
@ -415,7 +415,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
nextMsg = sendAndListen(ackMsg);
break;
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPCOMM, "Problem acknowledging frame response. (retry={})", retries);
aapsLogger.error(LTag.PUMPCOMM, "Problem acknowledging frame response. (retry=%d)", retries);
}
}
@ -447,11 +447,11 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
List<PumpHistoryEntry> medtronicHistoryEntries = medtronicPumpHistoryDecoder.processPageAndCreateRecords(rawHistoryPage);
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Found {} history entries.", medtronicHistoryEntries.size());
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Found %d history entries.", medtronicHistoryEntries.size());
pumpTotalResult.addHistoryEntries(medtronicHistoryEntries, pageNumber);
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Search status: Search finished: {}", pumpTotalResult.isSearchFinished());
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Search status: Search finished: %b", pumpTotalResult.isSearchFinished());
if (pumpTotalResult.isSearchFinished()) {
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Sleeping);
@ -563,7 +563,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private Object sendAndGetResponseWithCheck(MedtronicCommandType commandType, byte[] bodyData) {
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: {}", commandType);
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: %s", commandType);
for (int retries = 0; retries < MAX_COMMAND_TRIES; retries++) {
@ -578,7 +578,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (dataResponse != null) {
this.errorMessage = null;
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for {} is {}.", commandType.name(), dataResponse);
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for %s is %s.", commandType.name(), dataResponse);
return dataResponse;
} else {
@ -590,7 +590,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error=%s, retry=%d)", e.getMessage(), retries + 1);
}
}
@ -611,7 +611,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (contents != null) {
if (contents.length >= expectedLength) {
aapsLogger.debug(LTag.PUMPCOMM, "{}: Content: {}", method, ByteUtil.shortHexString(contents));
aapsLogger.debug(LTag.PUMPCOMM, "%s: Content: %s", method, ByteUtil.shortHexString(contents));
return null;
} else {
@ -656,7 +656,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
MedtronicCommandType commandType = MedtronicCommandType.GetBasalProfileSTD;
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: {}", commandType);
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: %s", commandType);
medtronicUtil.setCurrentCommand(commandType);
@ -714,7 +714,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
BasalProfile basalProfile = (BasalProfile) medtronicConverter.convertResponse(medtronicPumpPlugin.getPumpDescription().getPumpType(), commandType, data);
if (basalProfile != null) {
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for {} is {}.", commandType.name(), basalProfile);
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for %s is %s.", commandType.name(), basalProfile);
medtronicUtil.setCurrentCommand(null);
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Sleeping);
@ -723,7 +723,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.error(LTag.PUMPCOMM, "Error getting response from RileyLink (error=%s, retry=%d)", e.getMessage(), retries + 1);
}
}
@ -850,7 +850,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
wakeUp(false);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPCOMM, "{}: Body - {}", commandType.getCommandDescription(),
aapsLogger.debug(LTag.PUMPCOMM, "%s: Body - %s", commandType.getCommandDescription(),
ByteUtil.getHex(body));
PumpMessage msg = makePumpMessage(commandType, new CarelinkLongMessageBody(body));
@ -858,16 +858,16 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage pumpMessage = runCommandWithArgs(msg);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPCOMM, "{}: {}", commandType.getCommandDescription(), pumpMessage.getResponseContent());
aapsLogger.debug(LTag.PUMPCOMM, "%s: %s", commandType.getCommandDescription(), pumpMessage.getResponseContent());
if (pumpMessage.commandType == MedtronicCommandType.CommandACK) {
return true;
} else {
aapsLogger.warn(LTag.PUMPCOMM, "We received non-ACK response from pump: {}", pumpMessage.getResponseContent());
aapsLogger.warn(LTag.PUMPCOMM, "We received non-ACK response from pump: %s", pumpMessage.getResponseContent());
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error=%s, retry=%d)", e.getMessage(), retries + 1);
}
}
@ -903,11 +903,11 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return true;
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error=%s, retry=%d)", e.getMessage(), retries + 1);
}
if (responseMessage != null)
aapsLogger.warn(LTag.PUMPCOMM, "Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
aapsLogger.warn(LTag.PUMPCOMM, "Set Basal Profile: Invalid response: commandType=%s,rawData=%s", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
else
aapsLogger.warn(LTag.PUMPCOMM, "Set Basal Profile: Null response.");
}

View file

@ -46,7 +46,7 @@ public class MedtronicConverter {
Object convertResponse(PumpType pumpType, MedtronicCommandType commandType, byte[] rawContent) {
if ((rawContent == null || rawContent.length < 1) && commandType != MedtronicCommandType.PumpModel) {
aapsLogger.warn(LTag.PUMPCOMM, "Content is empty or too short, no data to convert (type={},isNull={},length={})",
aapsLogger.warn(LTag.PUMPCOMM, "Content is empty or too short, no data to convert (type=%s,isNull=%b,length=%s)",
commandType.name(), rawContent == null, rawContent == null ? "-" : rawContent.length);
return null;
}
@ -120,7 +120,7 @@ public class MedtronicConverter {
String rawModel = StringUtil.fromBytes(ByteUtil.substring(rawContent, 1, 3));
MedtronicDeviceType pumpModel = MedtronicDeviceType.getByDescription(rawModel);
aapsLogger.debug(LTag.PUMPCOMM, "PumpModel: [raw={}, resolved={}]", rawModel, pumpModel.name());
aapsLogger.debug(LTag.PUMPCOMM, "PumpModel: [raw=%s, resolved=%s]", rawModel, pumpModel.name());
if (pumpModel != MedtronicDeviceType.Unknown_Device) {
if (!medtronicUtil.isModelSet()) {
@ -177,7 +177,7 @@ public class MedtronicConverter {
startIdx = 2;
}
int reqLength = startIdx+1;
int reqLength = startIdx + 1;
float value = 0;
if (reqLength >= rawData.length) {

View file

@ -121,7 +121,7 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
aapsLogger.info(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
if (unknownOpCodes.size() > 0) {
aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: {}", sb.toString());
aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: %s", sb.toString());
}
for (Map.Entry<RecordDecodeStatus, Map<String, String>> entry : mapStatistics.entrySet()) {
@ -137,9 +137,9 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
String spaces = StringUtils.repeat(" ", 14 - entry.getKey().name().length());
aapsLogger.info(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
aapsLogger.info(LTag.PUMPCOMM, " %s%s - %d. Elements: %s", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
} else {
aapsLogger.info(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
aapsLogger.info(LTag.PUMPCOMM, " %s - %d", entry.getKey().name(), entry.getValue().size());
}
}
}

View file

@ -171,7 +171,7 @@ public abstract class MedtronicHistoryEntry implements MedtronicHistoryEntryInte
StringBuilder sb = new StringBuilder();
if (this.DT == null) {
LOG.error("DT is null. RawData={}", ByteUtil.getHex(this.rawData));
LOG.error("DT is null. RawData=%s", ByteUtil.getHex(this.rawData));
}
sb.append(getToStringStart());

View file

@ -53,7 +53,7 @@ public class RawHistoryPage {
int crcStored = ByteUtil.toInt(data[1022], data[1023]);
if (crcCalculated != crcStored) {
aapsLogger.error(LTag.PUMPBTCOMM, "Stored CRC ({}) is different than calculated ({}), but ignored for now.", crcStored,
aapsLogger.error(LTag.PUMPBTCOMM, "Stored CRC (%d) is different than calculated (%d), but ignored for now.", crcStored,
crcCalculated);
} else {
if (MedtronicUtil.isLowLevelDebug())
@ -81,6 +81,6 @@ public class RawHistoryPage {
offset += linesize;
}
aapsLogger.debug(LTag.PUMPBTCOMM, "History Page Data:\n{}", sb.toString());
aapsLogger.debug(LTag.PUMPBTCOMM, "History Page Data:\n%s", sb.toString());
}
}

View file

@ -176,7 +176,7 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
try {
return decodeRecord(record, false);
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPBTCOMM, " Error decoding: type={}, ex={}", record.getEntryType().name(), ex.getMessage(), ex);
aapsLogger.error(LTag.PUMPBTCOMM, " Error decoding: type=%s, ex=%s", record.getEntryType().name(), ex.getMessage(), ex);
return RecordDecodeStatus.Error;
}
}
@ -418,7 +418,7 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
//LOG.info("Basal Profile Start: offset={}, rate={}, index={}, body_raw={}", offset, rate, index, body);
if (rate == null) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Basal Profile Start (ERROR): offset={}, rate={}, index={}, body_raw={}", offset, rate, index, body);
aapsLogger.warn(LTag.PUMPBTCOMM, "Basal Profile Start (ERROR): offset=%d, rate=%.3f, index=%d, body_raw=%s", offset, rate, index, ByteUtil.getHex(body));
return RecordDecodeStatus.Error;
} else {
entry.addDecodedData("Value", getFormattedFloat(rate, 3));
@ -680,7 +680,7 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
//LOG.debug("DT: {} {} {}", year, month, dayOfMonth);
if (dayOfMonth == 32) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Entry: Day 32 {} = [{}] {}", entry.getEntryType().name(),
aapsLogger.warn(LTag.PUMPBTCOMM, "Entry: Day 32 %s = [%s] %s", entry.getEntryType().name(),
ByteUtil.getHex(entry.getRawData()), entry);
}

View file

@ -89,13 +89,13 @@ public class PumpHistoryResult {
}
break;
case Date: {
aapsLogger.debug(LTag.PUMPCOMM, "PE. Date search: Search date: {}", this.searchDate);
aapsLogger.debug(LTag.PUMPCOMM, "PE. Date search: Search date: %d", this.searchDate);
for (PumpHistoryEntry unprocessedEntry : unprocessedEntries) {
if (unprocessedEntry.atechDateTime == null || unprocessedEntry.atechDateTime == 0) {
aapsLogger.debug(LTag.PUMPCOMM, "PE. PumpHistoryResult. Search entry date: Entry with no date: {}", unprocessedEntry);
aapsLogger.debug(LTag.PUMPCOMM, "PE. PumpHistoryResult. Search entry date: Entry with no date: %s", unprocessedEntry);
continue;
}

View file

@ -85,10 +85,10 @@ public class MedtronicUIPostprocessor {
} else {
uiTask.responseType = MedtronicUIResponseType.Error;
uiTask.errorDescription = "No profile found.";
aapsLogger.error("Basal Profile was NOT valid. [{}]", basalProfile.basalProfileToStringError());
aapsLogger.error("Basal Profile was NOT valid. [%s]", basalProfile.basalProfileToStringError());
}
} catch (Exception ex) {
aapsLogger.error("Basal Profile was returned, but was invalid. [{}]", basalProfile.basalProfileToStringError());
aapsLogger.error("Basal Profile was returned, but was invalid. [%s]", basalProfile.basalProfileToStringError());
uiTask.responseType = MedtronicUIResponseType.Error;
uiTask.errorDescription = "No profile found.";
}
@ -121,7 +121,7 @@ public class MedtronicUIPostprocessor {
case SetRealTimeClock: {
boolean response = (Boolean) uiTask.returnData;
aapsLogger.debug(LTag.PUMP, "New time was {} set.", response ? "" : "NOT");
aapsLogger.debug(LTag.PUMP, "New time was %s set.", response ? "" : "NOT");
if (response) {
medtronicUtil.getPumpTime().timeDifference = 0;
@ -139,7 +139,7 @@ public class MedtronicUIPostprocessor {
medtronicPumpStatus.batteryVoltage = batteryStatusDTO.voltage;
}
aapsLogger.debug(LTag.PUMP, "BatteryStatus: {}", batteryStatusDTO.toString());
aapsLogger.debug(LTag.PUMP, "BatteryStatus: %s", batteryStatusDTO.toString());
}
break;
@ -162,7 +162,7 @@ public class MedtronicUIPostprocessor {
default:
break;
//aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
//aapsLogger.error(LTag.PUMP, "Post-processing not implemented for {}.", uiTask.commandType.name());
}
@ -236,14 +236,14 @@ public class MedtronicUIPostprocessor {
checkValue = settings.get("PCFG_MAX_BOLUS");
if (!MedtronicUtil.isSame(Double.parseDouble(checkValue.value), medtronicPumpStatus.maxBolus)) {
aapsLogger.error("Wrong Max Bolus set on Pump (current={}, required={}).", checkValue.value, medtronicPumpStatus.maxBolus);
aapsLogger.error("Wrong Max Bolus set on Pump (current=%s, required=%.2f).", checkValue.value, medtronicPumpStatus.maxBolus);
medtronicUtil.sendNotification(MedtronicNotificationType.PumpWrongMaxBolusSet, resourceHelper, rxBus, medtronicPumpStatus.maxBolus);
}
checkValue = settings.get("PCFG_MAX_BASAL");
if (!MedtronicUtil.isSame(Double.parseDouble(checkValue.value), medtronicPumpStatus.maxBasal)) {
aapsLogger.error("Wrong Max Basal set on Pump (current={}, required={}).", checkValue.value, medtronicPumpStatus.maxBasal);
aapsLogger.error("Wrong Max Basal set on Pump (current=%s, required=%.2f).", checkValue.value, medtronicPumpStatus.maxBasal);
medtronicUtil.sendNotification(MedtronicNotificationType.PumpWrongMaxBasalSet, resourceHelper, rxBus, medtronicPumpStatus.maxBasal);
}

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.BasalProfile;
@ -16,7 +17,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIResponseType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
@ -59,7 +59,7 @@ public class MedtronicUITask {
public void execute(MedtronicCommunicationManager communicationManager) {
aapsLogger.debug(LTag.PUMP, "MedtronicUITask: @@@ In execute. {}", commandType);
aapsLogger.debug(LTag.PUMP, "MedtronicUITask: @@@ In execute. %s", commandType);
switch (commandType) {
case PumpModel: {
@ -141,7 +141,7 @@ public class MedtronicUITask {
break;
default: {
aapsLogger.warn(LTag.PUMP, "This commandType is not supported (yet) - {}.", commandType);
aapsLogger.warn(LTag.PUMP, "This commandType is not supported (yet) - %s.", commandType);
// invalid = true;
responseType = MedtronicUIResponseType.Invalid;
}
@ -194,7 +194,7 @@ public class MedtronicUITask {
void postProcess(MedtronicUIPostprocessor postprocessor) {
aapsLogger.debug(LTag.PUMP, "MedtronicUITask: @@@ In execute. {}", commandType);
aapsLogger.debug(LTag.PUMP, "MedtronicUITask: @@@ In execute. %s", commandType);
if (responseType == MedtronicUIResponseType.Data) {
postprocessor.postProcessData(this);

View file

@ -171,7 +171,7 @@ public class MedtronicHistoryData {
if (StringUtils.isNotBlank(data)) {
for (final String token : StringUtil.splitString(data, 3500)) {
aapsLogger.debug(LTag.PUMP, "{}", token);
aapsLogger.debug(LTag.PUMP, "%s", token);
}
} else {
aapsLogger.debug(LTag.PUMP, "No data.");
@ -232,7 +232,7 @@ public class MedtronicHistoryData {
sort(this.newHistory);
}
aapsLogger.debug(LTag.PUMP, "New History entries found: {}", this.newHistory.size());
aapsLogger.debug(LTag.PUMP, "New History entries found: %d", this.newHistory.size());
showLogs("List of history (after filtering): [" + this.newHistory.size() + "]", gson().toJson(this.newHistory));
@ -291,7 +291,7 @@ public class MedtronicHistoryData {
try {
dt = DateTimeUtil.toLocalDateTime(pheLast.atechDateTime);
} catch (Exception ex) {
aapsLogger.error("Problem decoding date from last record: {}" + pheLast);
aapsLogger.error("Problem decoding date from last record: " + pheLast);
}
if (dt != null) {
@ -313,7 +313,7 @@ public class MedtronicHistoryData {
this.sort(this.allHistory);
aapsLogger.debug(LTag.PUMP, "All History records [afterFilterCount={}, removedItemsCount={}, newItemsCount={}]",
aapsLogger.debug(LTag.PUMP, "All History records [afterFilterCount=%d, removedItemsCount=%d, newItemsCount=%d]",
allHistory.size(), removeList.size(), newHistory.size());
} else {
aapsLogger.error("Since we couldn't determine date, we don't clean full history. This is just workaround.");
@ -360,7 +360,7 @@ public class MedtronicHistoryData {
pumpHistoryEntryType == PumpHistoryEntryType.BatteryChange || //
pumpHistoryEntryType == PumpHistoryEntryType.Prime);
aapsLogger.debug(LTag.PUMP, "isPumpSuspended. Last entry type={}, isSuspended={}", pumpHistoryEntryType, isSuspended);
aapsLogger.debug(LTag.PUMP, "isPumpSuspended. Last entry type=%s, isSuspended=%b", pumpHistoryEntryType, isSuspended);
return isSuspended;
} else
@ -433,7 +433,7 @@ public class MedtronicHistoryData {
// Prime (for reseting autosense)
List<PumpHistoryEntry> primeRecords = getFilteredItems(PumpHistoryEntryType.Prime);
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Prime [count={}, items={}]", primeRecords.size(), gson().toJson(primeRecords));
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Prime [count=%d, items=%s]", primeRecords.size(), gson().toJson(primeRecords));
if (isCollectionNotEmpty(primeRecords)) {
try {
@ -447,7 +447,7 @@ public class MedtronicHistoryData {
// Rewind (for marking insulin change)
List<PumpHistoryEntry> rewindRecords = getFilteredItems(PumpHistoryEntryType.Rewind);
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Rewind [count={}, items={}]", rewindRecords.size(), gson().toJson(rewindRecords));
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Rewind [count=%d, items=%s]", rewindRecords.size(), gson().toJson(rewindRecords));
if (isCollectionNotEmpty(rewindRecords)) {
try {
@ -461,7 +461,7 @@ public class MedtronicHistoryData {
// TDD
List<PumpHistoryEntry> tdds = getFilteredItems(PumpHistoryEntryType.EndResultTotals, getTDDType());
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: TDD [count={}, items={}]", tdds.size(), gson().toJson(tdds));
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: TDD [count=%d, items=%s]", tdds.size(), gson().toJson(tdds));
if (isCollectionNotEmpty(tdds)) {
try {
@ -477,7 +477,7 @@ public class MedtronicHistoryData {
// Bolus
List<PumpHistoryEntry> treatments = getFilteredItems(PumpHistoryEntryType.Bolus);
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Bolus [count={}, items={}]", treatments.size(), gson().toJson(treatments));
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: Bolus [count=%d, items=%s]", treatments.size(), gson().toJson(treatments));
if (treatments.size() > 0) {
try {
@ -491,7 +491,7 @@ public class MedtronicHistoryData {
// TBR
List<PumpHistoryEntry> tbrs = getFilteredItems(PumpHistoryEntryType.TempBasalCombined);
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: TBRs Processed [count={}, items={}]", tbrs.size(), gson().toJson(tbrs));
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: TBRs Processed [count=%d, items=%s]", tbrs.size(), gson().toJson(tbrs));
if (tbrs.size() > 0) {
try {
@ -512,7 +512,7 @@ public class MedtronicHistoryData {
throw ex;
}
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: 'Delivery Suspend' Processed [count={}, items={}]", suspends.size(),
aapsLogger.debug(LTag.PUMP, "ProcessHistoryData: 'Delivery Suspend' Processed [count=%d, items=%s]", suspends.size(),
gson().toJson(suspends));
if (isCollectionNotEmpty(suspends)) {
@ -597,7 +597,7 @@ public class MedtronicHistoryData {
List<PumpHistoryEntry> tdds = filterTDDs(tddsIn);
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "TDDs found: {}.\n{}", tdds.size(), gson().toJson(tdds));
aapsLogger.debug(LTag.PUMP, getLogPrefix() + "TDDs found: %d.\n%s", tdds.size(), gson().toJson(tdds));
List<TDD> tddsDb = databaseHelper.getTDDsForLastXDays(3);
@ -613,7 +613,7 @@ public class MedtronicHistoryData {
TDD tddNew = new TDD();
totalsDTO.setTDD(tddNew);
aapsLogger.debug(LTag.PUMP, "TDD Add: {}", tddNew);
aapsLogger.debug(LTag.PUMP, "TDD Add: %s", tddNew);
databaseHelper.createOrUpdateTDD(tddNew);
@ -622,7 +622,7 @@ public class MedtronicHistoryData {
if (!totalsDTO.doesEqual(tddDbEntry)) {
totalsDTO.setTDD(tddDbEntry);
aapsLogger.debug(LTag.PUMP, "TDD Edit: {}", tddDbEntry);
aapsLogger.debug(LTag.PUMP, "TDD Edit: %s", tddDbEntry);
databaseHelper.createOrUpdateTDD(tddDbEntry);
}
@ -656,7 +656,7 @@ public class MedtronicHistoryData {
List<? extends DbObjectBase> entriesFromHistory = getDatabaseEntriesByLastTimestamp(oldestTimestamp, ProcessHistoryRecord.Bolus);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: List (before filter): {}, FromDb={}", gson().toJson(entryList),
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: List (before filter): %s, FromDb=%s", gson().toJson(entryList),
gsonCore().toJson(entriesFromHistory));
filterOutAlreadyAddedEntries(entryList, entriesFromHistory);
@ -670,23 +670,23 @@ public class MedtronicHistoryData {
filterOutNonInsulinEntries(entriesFromHistory);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: List (after filter): {}, FromDb={}", gson().toJson(entryList),
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: List (after filter): %s, FromDb=%s", gson().toJson(entryList),
gsonCore().toJson(entriesFromHistory));
if (isCollectionEmpty(entriesFromHistory)) {
for (PumpHistoryEntry treatment : entryList) {
aapsLogger.debug(LTag.PUMP, "Add Bolus (no db entry): " + treatment);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: Add Bolus: FromDb=null, Treatment={}", treatment);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: Add Bolus: FromDb=null, Treatment=%s", treatment);
addBolus(treatment, null);
}
} else {
for (PumpHistoryEntry treatment : entryList) {
DbObjectBase treatmentDb = findDbEntry(treatment, entriesFromHistory);
aapsLogger.debug(LTag.PUMP, "Add Bolus {} - (entryFromDb={}) ", treatment, treatmentDb);
aapsLogger.debug(LTag.PUMP, "Add Bolus %s - (entryFromDb=%s) ", treatment, treatmentDb);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: Add Bolus: FromDb={}, Treatment={}", treatmentDb, treatment);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: Add Bolus: FromDb=%s, Treatment=%s", treatmentDb, treatment);
addBolus(treatment, (Treatment) treatmentDb);
}
@ -734,7 +734,7 @@ public class MedtronicHistoryData {
List<? extends DbObjectBase> entriesFromHistory = getDatabaseEntriesByLastTimestamp(oldestTimestamp, ProcessHistoryRecord.TBR);
aapsLogger.debug(LTag.PUMP, ProcessHistoryRecord.TBR.getDescription() + " List (before filter): {}, FromDb={}", gson().toJson(entryList),
aapsLogger.debug(LTag.PUMP, ProcessHistoryRecord.TBR.getDescription() + " List (before filter): %s, FromDb=%s", gson().toJson(entryList),
gson().toJson(entriesFromHistory));
@ -755,7 +755,7 @@ public class MedtronicHistoryData {
readOldItem = false;
}
} else {
aapsLogger.error("processDTO was null - shouldn't happen. ItemTwo={}", treatment);
aapsLogger.error("processDTO was null - shouldn't happen. ItemTwo=%s", treatment);
}
} else {
if (processDTO != null) {
@ -787,9 +787,9 @@ public class MedtronicHistoryData {
databaseHelper.createOrUpdate(tempBasal);
aapsLogger.debug(LTag.PUMP, "Edit " + ProcessHistoryRecord.TBR.getDescription() + " - (entryFromDb={}) ", tempBasal);
aapsLogger.debug(LTag.PUMP, "Edit " + ProcessHistoryRecord.TBR.getDescription() + " - (entryFromDb=%s) ", tempBasal);
} else {
aapsLogger.error("TempBasal not found. Item: {}", tempBasalProcessDTO.itemOne);
aapsLogger.error("TempBasal not found. Item: %s", tempBasalProcessDTO.itemOne);
}
} else {
@ -805,7 +805,7 @@ public class MedtronicHistoryData {
if (tempBasal == null) {
DbObjectBase treatmentDb = findDbEntry(treatment, entriesFromHistory);
aapsLogger.debug(LTag.PUMP, "Add " + ProcessHistoryRecord.TBR.getDescription() + " {} - (entryFromDb={}) ", treatment, treatmentDb);
aapsLogger.debug(LTag.PUMP, "Add " + ProcessHistoryRecord.TBR.getDescription() + " %s - (entryFromDb=%s) ", treatment, treatmentDb);
addTBR(treatment, (TemporaryBasal) treatmentDb);
} else {
@ -854,22 +854,22 @@ public class MedtronicHistoryData {
//proposedTime += (this.pumpTime.timeDifference * 1000);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment={}, FromDb={}", treatment, gson().toJson(entriesFromHistory));
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment=%s, FromDb=%s", treatment, gson().toJson(entriesFromHistory));
if (entriesFromHistory.size() == 0) {
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment={}, FromDb=null", treatment);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment=%s, FromDb=null", treatment);
return null;
} else if (entriesFromHistory.size() == 1) {
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment={}, FromDb={}. Type=SingleEntry", treatment, entriesFromHistory.get(0));
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Treatment=%s, FromDb=%s. Type=SingleEntry", treatment, entriesFromHistory.get(0));
// TODO: Fix db code
// if difference is bigger than 2 minutes we discard entry
long maxMillisAllowed = DateTimeUtil.getMillisFromATDWithAddedMinutes(treatment.atechDateTime, 2);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry maxMillisAllowed={}, AtechDateTime={} (add 2 minutes). ", maxMillisAllowed, treatment.atechDateTime);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry maxMillisAllowed=%d, AtechDateTime=%d (add 2 minutes). ", maxMillisAllowed, treatment.atechDateTime);
if (entriesFromHistory.get(0).getDate() > maxMillisAllowed) {
if (doubleBolusDebug)
@ -907,10 +907,10 @@ public class MedtronicHistoryData {
}
if (min == 0 && sec == 10 && outList.size() > 1) {
aapsLogger.error("Too many entries (with too small diff): (timeDiff=[min={},sec={}],count={},list={})",
aapsLogger.error("Too many entries (with too small diff): (timeDiff=[min=%d,sec=%d],count=%d,list=%s)",
min, sec, outList.size(), gson().toJson(outList));
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Error - Too many entries (with too small diff): (timeDiff=[min={},sec={}],count={},list={})",
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: findDbEntry Error - Too many entries (with too small diff): (timeDiff=[min=%d,sec=%d],count=%d,list=%s)",
min, sec, outList.size(), gson().toJson(outList));
}
}
@ -960,7 +960,7 @@ public class MedtronicHistoryData {
}
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: filterOutAlreadyAddedEntries: PumpHistory={}, Treatments={}",
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: filterOutAlreadyAddedEntries: PumpHistory=%s, Treatments=%s",
gson().toJson(removeTreatmentsFromPH),
gsonCore().toJson(removeTreatmentsFromHistory));
@ -974,7 +974,7 @@ public class MedtronicHistoryData {
if (treatment == null) {
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): Bolus={}", bolusDTO);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): Bolus=%s", bolusDTO);
switch (bolusDTO.getBolusType()) {
case Normal: {
@ -988,13 +988,13 @@ public class MedtronicHistoryData {
addCarbsFromEstimate(detailedBolusInfo, bolus);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): DetailedBolusInfo={}", detailedBolusInfo);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): DetailedBolusInfo=%s", detailedBolusInfo);
boolean newRecord = activePlugin.getActiveTreatments().addToHistoryTreatment(detailedBolusInfo, false);
bolus.setLinkedObject(detailedBolusInfo);
aapsLogger.debug(LTag.PUMP, "addBolus - [date={},pumpId={}, insulin={}, newRecord={}]", detailedBolusInfo.date,
aapsLogger.debug(LTag.PUMP, "addBolus - [date=%d,pumpId=%d, insulin=%.2f, newRecord=%b]", detailedBolusInfo.date,
detailedBolusInfo.pumpId, detailedBolusInfo.insulin, newRecord);
}
break;
@ -1012,11 +1012,11 @@ public class MedtronicHistoryData {
bolus.setLinkedObject(extendedBolus);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): ExtendedBolus={}", extendedBolus);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament==null): ExtendedBolus=%s", extendedBolus);
activePlugin.getActiveTreatments().addToHistoryExtendedBolus(extendedBolus);
aapsLogger.debug(LTag.PUMP, "addBolus - Extended [date={},pumpId={}, insulin={}, duration={}]", extendedBolus.date,
aapsLogger.debug(LTag.PUMP, "addBolus - Extended [date=%d,pumpId=%d, insulin=%.3f, duration=%d]", extendedBolus.date,
extendedBolus.pumpId, extendedBolus.insulin, extendedBolus.durationInMinutes);
}
@ -1026,7 +1026,7 @@ public class MedtronicHistoryData {
} else {
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(OldTreatment={}): Bolus={}", treatment, bolusDTO);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(OldTreatment=%s): Bolus=%s", treatment, bolusDTO);
treatment.source = Source.PUMP;
treatment.pumpId = bolus.getPumpId();
@ -1035,9 +1035,9 @@ public class MedtronicHistoryData {
TreatmentUpdateReturn updateReturn = activePlugin.getActiveTreatments().createOrUpdateMedtronic(treatment, false);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament!=null): NewTreatment={}, UpdateReturn={}", treatment, updateReturn);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addBolus(tretament!=null): NewTreatment=%s, UpdateReturn=%s", treatment, updateReturn);
aapsLogger.debug(LTag.PUMP, "editBolus - [date={},pumpId={}, insulin={}, newRecord={}]", treatment.date,
aapsLogger.debug(LTag.PUMP, "editBolus - [date=%d,pumpId=%d, insulin=%.3f, newRecord=%s]", treatment.date,
treatment.pumpId, treatment.insulin, updateReturn.toString());
bolus.setLinkedObject(treatment);
@ -1053,7 +1053,7 @@ public class MedtronicHistoryData {
BolusWizardDTO bolusWizard = (BolusWizardDTO) bolus.getDecodedData().get("Estimate");
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addCarbsFromEstimate: Bolus={}, BolusWizardDTO={}", bolus, bolusWizard);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: addCarbsFromEstimate: Bolus=%s, BolusWizardDTO=%s", bolus, bolusWizard);
detailedBolusInfo.carbs = bolusWizard.carbs;
}
@ -1084,7 +1084,7 @@ public class MedtronicHistoryData {
databaseHelper.createOrUpdate(temporaryBasalDb);
aapsLogger.debug(LTag.PUMP, operation + " - [date={},pumpId={}, rate={} {}, duration={}]", //
aapsLogger.debug(LTag.PUMP, operation + " - [date=%d,pumpId=%d, rate=%s %s, duration=%d]", //
temporaryBasalDb.date, //
temporaryBasalDb.pumpId, //
temporaryBasalDb.isAbsolute ? String.format(Locale.ENGLISH, "%.2f", temporaryBasalDb.absoluteRate) :
@ -1372,7 +1372,7 @@ public class MedtronicHistoryData {
// oldestEntryTime = oldestEntryTime.plusSeconds(this.pumpTime.timeDifference);
// }
} catch (Exception ex) {
aapsLogger.error("Problem decoding date from last record: {}" + currentTreatment);
aapsLogger.error("Problem decoding date from last record: " + currentTreatment);
return 8; // default return of 6 minutes
}
@ -1381,7 +1381,7 @@ public class MedtronicHistoryData {
Minutes minutes = Minutes.minutesBetween(oldestEntryTime, now);
// returns oldest time in history, with calculated time difference between pump and phone, minus 5 minutes
aapsLogger.debug(LTag.PUMP, "Oldest entry: {}, pumpTimeDifference={}, newDt={}, currentTime={}, differenceMin={}", dt,
aapsLogger.debug(LTag.PUMP, "Oldest entry: %d, pumpTimeDifference=%d, newDt=%s, currentTime=%s, differenceMin=%d", dt,
this.pumpTime.timeDifference, oldestEntryTime, now, minutes.getMinutes());
return minutes.getMinutes();
@ -1402,22 +1402,22 @@ public class MedtronicHistoryData {
}
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. Oldest entry found: time={}, object={}", dt, currentTreatment);
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. Oldest entry found: time=%d, object=%s", dt, currentTreatment);
try {
GregorianCalendar oldestEntryTime = DateTimeUtil.toGregorianCalendar(dt);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. oldestEntryTime: {}", DateTimeUtil.toString(oldestEntryTime));
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. oldestEntryTime: %s", DateTimeUtil.toString(oldestEntryTime));
oldestEntryTime.add(Calendar.MINUTE, -2);
if (doubleBolusDebug)
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. oldestEntryTime (-2m): {}, timeInMillis={}", DateTimeUtil.toString(oldestEntryTime), oldestEntryTime.getTimeInMillis());
aapsLogger.debug(LTag.PUMP, "DoubleBolusDebug: getOldestTimestamp. oldestEntryTime (-2m): %s, timeInMillis=%d", DateTimeUtil.toString(oldestEntryTime), oldestEntryTime.getTimeInMillis());
return oldestEntryTime.getTimeInMillis();
} catch (Exception ex) {
aapsLogger.error("Problem decoding date from last record: {}", currentTreatment);
aapsLogger.error("Problem decoding date from last record: %s", currentTreatment);
return 8; // default return of 6 minutes
}

View file

@ -1,8 +1,9 @@
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto;
import androidx.annotation.NonNull;
import com.google.gson.annotations.Expose;
import androidx.annotation.NonNull;
import org.joda.time.Instant;
import java.util.ArrayList;
@ -47,7 +48,7 @@ public class BasalProfile {
public BasalProfile(AAPSLogger aapsLogger, byte[] data) {
this .aapsLogger = aapsLogger;
this.aapsLogger = aapsLogger;
setRawData(data);
}
@ -68,7 +69,7 @@ public class BasalProfile {
private boolean setRawData(byte[] data) {
if (data == null) {
aapsLogger.error(LTag.PUMPCOMM,"setRawData: buffer is null!");
aapsLogger.error(LTag.PUMPCOMM, "setRawData: buffer is null!");
return false;
}
@ -91,7 +92,7 @@ public class BasalProfile {
public boolean setRawDataFromHistory(byte[] data) {
if (data == null) {
aapsLogger.error(LTag.PUMPCOMM,"setRawData: buffer is null!");
aapsLogger.error(LTag.PUMPCOMM, "setRawData: buffer is null!");
return false;
}
@ -116,14 +117,14 @@ public class BasalProfile {
public void dumpBasalProfile() {
aapsLogger.debug(LTag.PUMPCOMM,"Basal Profile entries:");
aapsLogger.debug(LTag.PUMPCOMM, "Basal Profile entries:");
List<BasalProfileEntry> entries = getEntries();
for (int i = 0; i < entries.size(); i++) {
BasalProfileEntry entry = entries.get(i);
String startString = entry.startTime.toString("HH:mm");
// this doesn't work
aapsLogger.debug(LTag.PUMPCOMM,String.format("Entry %d, rate=%.3f (0x%02X), start=%s (0x%02X)", i + 1, entry.rate,
entry.rate_raw, startString, entry.startTime_raw));
aapsLogger.debug(LTag.PUMPCOMM, "Entry %d, rate=%.3f (0x%02X), start=%s (0x%02X)", i + 1, entry.rate,
entry.rate_raw, startString, entry.startTime_raw);
}
}
@ -169,14 +170,14 @@ public class BasalProfile {
BasalProfileEntry rval = new BasalProfileEntry();
List<BasalProfileEntry> entries = getEntries();
if (entries.size() == 0) {
aapsLogger.warn(LTag.PUMPCOMM,String.format("getEntryForTime(%s): table is empty",
when.toDateTime().toLocalTime().toString("HH:mm")));
aapsLogger.warn(LTag.PUMPCOMM, "getEntryForTime(%s): table is empty",
when.toDateTime().toLocalTime().toString("HH:mm"));
return rval;
}
// Log.w(TAG,"Assuming first entry");
rval = entries.get(0);
if (entries.size() == 1) {
aapsLogger.debug(LTag.PUMPCOMM,"getEntryForTime: Only one entry in profile");
aapsLogger.debug(LTag.PUMPCOMM, "getEntryForTime: Only one entry in profile");
return rval;
}
@ -186,17 +187,17 @@ public class BasalProfile {
while (!done) {
BasalProfileEntry entry = entries.get(i);
if (DEBUG_BASALPROFILE) {
aapsLogger.debug(LTag.PUMPCOMM,String.format("Comparing 'now'=%s to entry 'start time'=%s", when.toDateTime().toLocalTime()
.toString("HH:mm"), entry.startTime.toString("HH:mm")));
aapsLogger.debug(LTag.PUMPCOMM, "Comparing 'now'=%s to entry 'start time'=%s", when.toDateTime().toLocalTime()
.toString("HH:mm"), entry.startTime.toString("HH:mm"));
}
if (localMillis >= entry.startTime.getMillisOfDay()) {
rval = entry;
if (DEBUG_BASALPROFILE)
aapsLogger.debug(LTag.PUMPCOMM,"Accepted Entry");
aapsLogger.debug(LTag.PUMPCOMM, "Accepted Entry");
} else {
// entry at i has later start time, keep older entry
if (DEBUG_BASALPROFILE)
aapsLogger.debug(LTag.PUMPCOMM,"Rejected Entry");
aapsLogger.debug(LTag.PUMPCOMM, "Rejected Entry");
done = true;
}
i++;
@ -205,9 +206,9 @@ public class BasalProfile {
}
}
if (DEBUG_BASALPROFILE) {
aapsLogger.debug(LTag.PUMPCOMM,String.format("getEntryForTime(%s): Returning entry: rate=%.3f (%d), start=%s (%d)", when
aapsLogger.debug(LTag.PUMPCOMM, "getEntryForTime(%s): Returning entry: rate=%.3f (%d), start=%s (%d)", when
.toDateTime().toLocalTime().toString("HH:mm"), rval.rate, rval.rate_raw,
rval.startTime.toString("HH:mm"), rval.startTime_raw));
rval.startTime.toString("HH:mm"), rval.startTime_raw);
}
return rval;
}
@ -217,7 +218,7 @@ public class BasalProfile {
List<BasalProfileEntry> entries = new ArrayList<>();
if (mRawData == null || mRawData[2] == 0x3f) {
aapsLogger.warn(LTag.PUMPCOMM,"Raw Data is empty.");
aapsLogger.warn(LTag.PUMPCOMM, "Raw Data is empty.");
return entries; // an empty list
}
int r, st;
@ -236,7 +237,7 @@ public class BasalProfile {
try {
entries.add(new BasalProfileEntry(aapsLogger, r, st));
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPCOMM,"Error decoding basal profile from bytes: {}", ByteUtil.shortHexString(mRawData));
aapsLogger.error(LTag.PUMPCOMM, "Error decoding basal profile from bytes: %s", ByteUtil.shortHexString(mRawData));
throw ex;
}
@ -285,10 +286,10 @@ public class BasalProfile {
try {
entries = getEntries();
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPCOMM,"=============================================================================");
aapsLogger.error(LTag.PUMPCOMM," Error generating entries. Ex.: " + ex, ex);
aapsLogger.error(LTag.PUMPCOMM," rawBasalValues: " + ByteUtil.shortHexString(this.getRawData()));
aapsLogger.error(LTag.PUMPCOMM,"=============================================================================");
aapsLogger.error(LTag.PUMPCOMM, "=============================================================================");
aapsLogger.error(LTag.PUMPCOMM, " Error generating entries. Ex.: " + ex, ex);
aapsLogger.error(LTag.PUMPCOMM, " rawBasalValues: " + ByteUtil.shortHexString(this.getRawData()));
aapsLogger.error(LTag.PUMPCOMM, "=============================================================================");
//FabricUtil.createEvent("MedtronicBasalProfileGetByHourError", null);
}

View file

@ -53,7 +53,7 @@ public class BasalProfileEntry {
startTime = new LocalTime(startTimeInterval / 2, (startTimeInterval % 2) * 30);
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPCOMM,
"Error creating BasalProfileEntry: startTimeInterval={}, startTime_raw={}, hours={}, rateStrokes={}",
"Error creating BasalProfileEntry: startTimeInterval=%d, startTime_raw=%d, hours=%d, rateStrokes=%d",
startTimeInterval, startTime_raw, startTimeInterval / 2, rateStrokes);
throw ex;
}

View file

@ -76,7 +76,7 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo
durationMinutes = MedtronicUtil.makeUnsignedShort(response[4], response[5]);
}
aapsLogger.warn(LTag.PUMPBTCOMM, "TempBasalPair (with {} byte response): {}", response.length, toString());
aapsLogger.warn(LTag.PUMPBTCOMM, "TempBasalPair (with %d byte response): %s", response.length, toString());
}

View file

@ -43,7 +43,6 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump
public String pumpFrequency = null;
public Double maxBolus;
public Double maxBasal;
public boolean showRileyLinkBatteryLevel;
// statuses
private PumpDeviceState pumpDeviceState = PumpDeviceState.NeverContacted;

View file

@ -261,7 +261,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
} else {
if (!rileyLinkAddress.matches(regexMac)) {
medtronicPumpStatus.errorDescription = resourceHelper.gs(R.string.medtronic_error_rileylink_address_invalid);
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: {}", rileyLinkAddress);
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: %s", rileyLinkAddress);
} else {
if (!rileyLinkAddress.equals(this.rileyLinkAddress)) {
this.rileyLinkAddress = rileyLinkAddress;
@ -317,7 +317,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
//boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
//MedtronicHistoryData.doubleBolusDebug = bolusDebug;
medtronicPumpStatus.showRileyLinkBatteryLevel = sp.getBoolean(RileyLinkConst.Prefs.ShowBatteryLevel, false);
rileyLinkServiceData.showBatteryLevel = sp.getBoolean(RileyLinkConst.Prefs.ShowBatteryLevel, false);
reconfigureService(forceRileyLinkAddressRenewal);
@ -368,7 +368,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
try {
val = Double.parseDouble(value);
} catch (Exception ex) {
aapsLogger.error("Error parsing setting: {}, value found {}", key, value);
aapsLogger.error("Error parsing setting: %s, value found %s", key, value);
val = defaultValueDouble;
}

View file

@ -20,8 +20,8 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.ClockDTO;
@ -31,7 +31,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandTy
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType;
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/**
@ -276,7 +275,7 @@ public class MedtronicUtil {
byte[] payload = sendPayloadBuffer.array();
aapsLogger.debug(LTag.PUMPCOMM, "buildCommandPayload [{}]", ByteUtil.shortHexString(payload));
aapsLogger.debug(LTag.PUMPCOMM, "buildCommandPayload [%s]", ByteUtil.shortHexString(payload));
// int crc = computeCRC8WithPolynomial(payload, 0, payload.length - 1);

View file

@ -85,7 +85,7 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
// Mark this as the last time we heard from the pump.
rememberLastGoodDeviceCommunicationTime();
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Response is invalid ! [noResponseFromRileyLink={}, interrupted={}, timeout={}, unknownCommand={}, invalidParam={}]",
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Response is invalid ! [noResponseFromRileyLink=%b, interrupted=%b, timeout=%b, unknownCommand=%b, invalidParam=%b]",
rfSpyResponse.wasNoResponseFromRileyLink(), rfSpyResponse.wasInterrupted(), rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam());
if (rfSpyResponse.wasTimeout()) {
@ -214,7 +214,7 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
private double scanForDevice(double[] frequencies) {
aapsLogger.info(LTag.PUMPBTCOMM, "Scanning for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPBTCOMM, "Scanning for receiver (%s)", receiverDeviceID);
wakeUp(receiverDeviceAwakeForMinutes, false);
FrequencyScanResults results = new FrequencyScanResults();
@ -231,7 +231,7 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
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.PUMPBTCOMM, "scanForPump: Failed to find pump at frequency {}", frequencies[i]);
aapsLogger.error(LTag.PUMPBTCOMM, "scanForPump: Failed to find pump at frequency %.3f", frequencies[i]);
} else if (resp.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
@ -319,14 +319,14 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
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.PUMPBTCOMM, "tune_tryFrequency: no pump response at frequency {}", freqMHz);
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: no pump response at frequency %.3f", freqMHz);
} else if (resp.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
try {
radioResponse.init(resp.getRaw());
if (radioResponse.isValid()) {
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: saw response level {} at frequency {}", radioResponse.rssi, freqMHz);
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: saw response level %d at frequency %.3f", radioResponse.rssi, freqMHz);
return calculateRssi(radioResponse.rssi);
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: invalid radio response:"
@ -365,9 +365,9 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
} else {
rfspy.setBaseFrequency(betterFrequency);
if (betterFrequency != startFrequencyMHz) {
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: new frequency is {}MHz", betterFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: new frequency is %.3fMHz", betterFrequency);
} else {
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: pump frequency is the same: {}MHz", startFrequencyMHz);
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: pump frequency is the same: %.3fMHz", startFrequencyMHz);
}
}
return betterFrequency;
@ -375,7 +375,7 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
private double quickTunePumpStep(double startFrequencyMHz, double stepSizeMHz) {
aapsLogger.info(LTag.PUMPBTCOMM, "Doing quick radio tune for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPBTCOMM, "Doing quick radio tune for receiver (%s)", receiverDeviceID);
wakeUp(false);
int startRssi = tune_tryFrequency(startFrequencyMHz);
double lowerFrequency = startFrequencyMHz - stepSizeMHz;

View file

@ -115,7 +115,7 @@ public class RFSpy {
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
if (ArrayUtils.isNotEmpty(result.value)) {
int value = result.value[0];
aapsLogger.debug(LTag.PUMPBTCOMM, "BLE battery level: {}", value);
aapsLogger.debug(LTag.PUMPBTCOMM, "BLE battery level: %d", value);
return value;
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "getBatteryLevel received an empty result. Value: " + result.value);
@ -150,7 +150,7 @@ public class RFSpy {
byte[] getVersionRaw = getByteArray(RileyLinkCommandType.GetVersion.code);
byte[] response = writeToDataRaw(getVersionRaw, 5000);
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version. GetVersion [response={}]", ByteUtil.shortHexString(response));
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version. GetVersion [response=%s]", ByteUtil.shortHexString(response));
if (response != null) { // && response[0] == (byte) 0xDD) {
@ -171,14 +171,14 @@ public class RFSpy {
static RileyLinkFirmwareVersion getFirmwareVersion(AAPSLogger aapsLogger, String bleVersion, String cc1110Version) {
if (cc1110Version != null) {
RileyLinkFirmwareVersion version = RileyLinkFirmwareVersion.getByVersionString(cc1110Version);
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version string: {}, resolved to {}.", cc1110Version, version);
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version string: %s, resolved to %s.", cc1110Version, version);
if (version != RileyLinkFirmwareVersion.UnknownVersion) {
return version;
}
}
aapsLogger.error(LTag.PUMPBTCOMM, "Firmware Version can't be determined. Checking with BLE Version [{}].", bleVersion);
aapsLogger.error(LTag.PUMPBTCOMM, "Firmware Version can't be determined. Checking with BLE Version [%s].", bleVersion);
if (bleVersion.contains(" 2.")) {
return RileyLinkFirmwareVersion.Version_2_0;
@ -201,7 +201,7 @@ public class RFSpy {
// prepend length, and send it.
byte[] prepended = ByteUtil.concat(new byte[]{(byte) (bytes.length)}, bytes);
aapsLogger.debug(LTag.PUMPBTCOMM, "writeToData (raw={})", ByteUtil.shortHexString(prepended));
aapsLogger.debug(LTag.PUMPBTCOMM, "writeToData (raw=%s)", ByteUtil.shortHexString(prepended));
BLECommOperationResult writeCheck = rileyLinkBle.writeCharacteristic_blocking(radioServiceUUID, radioDataUUID,
prepended);
@ -292,7 +292,7 @@ public class RFSpy {
updateRegister(CC111XRegister.freq0, (byte) (value & 0xff));
updateRegister(CC111XRegister.freq1, (byte) ((value >> 8) & 0xff));
updateRegister(CC111XRegister.freq2, (byte) ((value >> 16) & 0xff));
aapsLogger.info(LTag.PUMPBTCOMM, "Set frequency to {} MHz", freqMHz);
aapsLogger.info(LTag.PUMPBTCOMM, "Set frequency to %.3f MHz", freqMHz);
this.currentFrequencyMHz = freqMHz;
@ -350,7 +350,7 @@ public class RFSpy {
setPreamble(0x6665);
break;
default:
aapsLogger.warn(LTag.PUMPBTCOMM, "No region configuration for RfSpy and {}", frequency.name());
aapsLogger.warn(LTag.PUMPBTCOMM, "No region configuration for RfSpy and %s", frequency.name());
break;
}
@ -359,7 +359,7 @@ public class RFSpy {
private void setMedtronicEncoding() {
RileyLinkEncodingType encoding = RileyLinkEncodingType.FourByteSixByteLocal;
if (rileyLinkServiceData.firmwareVersion!=null &&
if (rileyLinkServiceData.firmwareVersion != null &&
rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) {
if (sp.getString(RileyLinkConst.Prefs.Encoding, "None")
.equals(resourceHelper.gs(R.string.key_medtronic_pump_encoding_4b6b_rileylink))) {

View file

@ -148,12 +148,12 @@ public class RileyLinkBLE {
if (status == BluetoothGatt.GATT_SUCCESS) {
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothConnected, context);
} else {
aapsLogger.debug(LTag.PUMPBTCOMM, "BT State connected, GATT status {} ({})", status, getGattStatusMessage(status));
aapsLogger.debug(LTag.PUMPBTCOMM, "BT State connected, GATT status %d (%s)", status, getGattStatusMessage(status));
}
} else if ((newState == BluetoothProfile.STATE_CONNECTING) || //
(newState == BluetoothProfile.STATE_DISCONNECTING)) {
aapsLogger.debug(LTag.PUMPBTCOMM, "We are in {} state.", status == BluetoothProfile.STATE_CONNECTING ? "Connecting" :
aapsLogger.debug(LTag.PUMPBTCOMM, "We are in %s state.", status == BluetoothProfile.STATE_CONNECTING ? "Connecting" :
"Disconnecting");
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnected, context);
@ -161,7 +161,7 @@ public class RileyLinkBLE {
close();
aapsLogger.warn(LTag.PUMPBTCOMM, "RileyLink Disconnected.");
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "Some other state: (status={},newState={})", status, newState);
aapsLogger.warn(LTag.PUMPBTCOMM, "Some other state: (status=%d, newState=%d)", status, newState);
}
}

View file

@ -17,8 +17,8 @@ public abstract class Encoding4b6bAbstract implements Encoding4b6b {
* The 6 bit codes are what is used on the RF side of the RileyLink to communicate
* with a Medtronic pump.
*/
public static final byte[] encode4b6bList = new byte[] {
0x15, 0x31, 0x32, 0x23, 0x34, 0x25, 0x26, 0x16, 0x1a, 0x19, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x1c };
public static final byte[] encode4b6bList = new byte[]{
0x15, 0x31, 0x32, 0x23, 0x34, 0x25, 0x26, 0x16, 0x1a, 0x19, 0x2a, 0x0b, 0x2c, 0x0d, 0x0e, 0x1c};
// 21, 49, 50, 35, 52, 37, 38, 22, 26, 25, 42, 11, 44, 13, 14, 28
@ -53,12 +53,12 @@ public abstract class Encoding4b6bAbstract implements Encoding4b6b {
public void writeError(Logger LOG, byte[] raw, String errorData) {
LOG.error("\n=============================================================================\n" + //
" Decoded payload length is zero.\n" +
" encodedPayload: {}\n" +
" errors: {}\n" +
"=============================================================================", //
ByteUtil.getHex(raw), errorData);
LOG.error(String.format("\n=============================================================================\n" + //
" Decoded payload length is zero.\n" +
" encodedPayload: %s\n" +
" errors: %s\n" +
"=============================================================================", //
ByteUtil.getHex(raw), errorData));
//FabricUtil.createEvent("MedtronicDecode4b6bError", null);

View file

@ -174,7 +174,7 @@ public abstract class RileyLinkService extends DaggerService {
if (rileyLinkServiceData.getRileyLinkServiceState() == RileyLinkServiceState.NotStarted) {
if (!bluetoothInit()) {
aapsLogger.error("RileyLink can't get activated, Bluetooth is not functioning correctly. {}",
aapsLogger.error("RileyLink can't get activated, Bluetooth is not functioning correctly. %s",
getError() != null ? getError().name() : "Unknown error (null)");
return false;
}
@ -205,7 +205,7 @@ public abstract class RileyLinkService extends DaggerService {
newFrequency = getDeviceCommunicationManager().tuneForDevice();
if ((newFrequency != 0.0) && (newFrequency != lastGoodFrequency)) {
aapsLogger.info(LTag.PUMPBTCOMM, "Saving new pump frequency of {} MHz", newFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Saving new pump frequency of %.3f MHz", newFrequency);
sp.putDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, newFrequency);
rileyLinkServiceData.lastGoodFrequency = newFrequency;
rileyLinkServiceData.tuneUpDone = true;

View file

@ -38,6 +38,7 @@ public class RileyLinkServiceData {
public String rileyLinkAddress;
public String rileyLinkName;
public Integer batteryLevel;
public boolean showBatteryLevel = false;
long lastTuneUpTime = 0L;
public Double lastGoodFrequency;
@ -83,7 +84,7 @@ public class RileyLinkServiceData {
lastServiceStateChange = System.currentTimeMillis();
this.rileyLinkError = errorCode;
aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name());
aapsLogger.info(LTag.PUMP, "RileyLink State Changed: %s %s", newState, errorCode == null ? "" : " - Error State: " + errorCode.name());
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice));
rxBus.send(new EventRileyLinkDeviceStatusChange(targetDevice, newState, errorCode));

View file

@ -5,7 +5,6 @@ import android.content.Context;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
@ -83,7 +82,7 @@ public class InitializePumpManagerTask extends ServiceTask {
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to %.3f MHz", lastGoodFrequency);
rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency);
@ -112,7 +111,7 @@ public class InitializePumpManagerTask extends ServiceTask {
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady);
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod; // TODO shouldn't be needed
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to %.3f MHz", lastGoodFrequency);
rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency);