fix logging

This commit is contained in:
Milos Kozak 2020-04-28 00:48:43 +02:00
parent 7b773ae800
commit bb39dd994a
13 changed files with 146 additions and 148 deletions

View file

@ -26,7 +26,7 @@ class AAPSLoggerProduction : AAPSLogger {
override fun debug(tag: LTag, format: String, vararg arguments: Any?) {
if (L.isEnabled(tag.tag))
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + String.format(format, arguments))
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + format, arguments)
}
override fun warn(tag: LTag, message: String) {
@ -36,7 +36,7 @@ class AAPSLoggerProduction : AAPSLogger {
}
override fun warn(tag: LTag, format: String, vararg arguments: Any?) {
LoggerFactory.getLogger(tag.tag).warn(stackLogMarker() + String.format(format, arguments))
LoggerFactory.getLogger(tag.tag).warn(stackLogMarker() + format, arguments)
}
override fun info(tag: LTag, message: String) {
@ -47,7 +47,7 @@ class AAPSLoggerProduction : AAPSLogger {
}
override fun info(tag: LTag, format: String, vararg arguments: Any?) {
LoggerFactory.getLogger(tag.tag).info(stackLogMarker() + String.format(format, arguments))
LoggerFactory.getLogger(tag.tag).info(stackLogMarker() + format, arguments)
}
override fun error(tag: LTag, message: String) {
@ -65,7 +65,7 @@ class AAPSLoggerProduction : AAPSLogger {
}
override fun error(format: String, vararg arguments: Any?) {
LoggerFactory.getLogger(LTag.CORE.tag).error(stackLogMarker() + String.format(format, arguments))
LoggerFactory.getLogger(LTag.CORE.tag).error(stackLogMarker() + format, arguments)
}
override fun error(tag: LTag, message: String, throwable: Throwable) {
@ -76,7 +76,7 @@ class AAPSLoggerProduction : AAPSLogger {
override fun error(tag: LTag, format: String, vararg arguments: Any?) {
if (L.isEnabled(tag.tag)) {
LoggerFactory.getLogger(tag.tag).error(stackLogMarker() + String.format(format, arguments))
LoggerFactory.getLogger(tag.tag).error(stackLogMarker() + format, arguments)
}
}
}

View file

@ -9,8 +9,6 @@ import info.nightscout.androidaps.logging.L;
public class TempBasalPair {
private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
@Expose
protected double insulinRate = 0.0d;
@Expose

View file

@ -83,7 +83,7 @@ public abstract class RileyLinkCommunicationManager {
// internal flag
boolean showPumpMessages = true;
if (showPumpMessages) {
aapsLogger.info(LTag.PUMPBTCOMM, "Sent:" + ByteUtil.shortHexString(msg.getTxData()));
aapsLogger.info(LTag.PUMPCOMM, "Sent:" + ByteUtil.shortHexString(msg.getTxData()));
}
RFSpyResponse rfSpyResponse = rfspy.transmitThenReceive(new RadioPacket(injector, msg.getTxData()),
@ -96,7 +96,7 @@ public abstract class RileyLinkCommunicationManager {
// Mark this as the last time we heard from the pump.
rememberLastGoodDeviceCommunicationTime();
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Response is invalid ! [interrupted={}, timeout={}, unknownCommand={}, invalidParam={}]", rfSpyResponse.wasInterrupted(),
aapsLogger.warn(LTag.PUMPCOMM, "isDeviceReachable. Response is invalid ! [interrupted={}, timeout={}, unknownCommand={}, invalidParam={}]", rfSpyResponse.wasInterrupted(),
rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam());
if (rfSpyResponse.wasTimeout()) {
@ -106,7 +106,7 @@ public abstract class RileyLinkCommunicationManager {
long diff = System.currentTimeMillis() - getPumpStatus().lastConnection;
if (diff > ALLOWED_PUMP_UNREACHABLE) {
aapsLogger.warn(LTag.PUMPBTCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
aapsLogger.warn(LTag.PUMPCOMM, "We reached max time that Pump can be unreachable. Starting Tuning.");
serviceTaskExecutor.startTask(new WakeAndTuneTask(injector));
timeoutCount = 0;
}
@ -119,7 +119,7 @@ public abstract class RileyLinkCommunicationManager {
}
if (showPumpMessages) {
aapsLogger.info(LTag.PUMPBTCOMM, "Received:" + ByteUtil.shortHexString(rfSpyResponse.getRadioResponse(injector).getPayload()));
aapsLogger.info(LTag.PUMPCOMM, "Received:" + ByteUtil.shortHexString(rfSpyResponse.getRadioResponse(injector).getPayload()));
}
return response;
@ -156,18 +156,18 @@ public abstract class RileyLinkCommunicationManager {
nextWakeUpRequired = 0L;
if (System.currentTimeMillis() > nextWakeUpRequired) {
aapsLogger.info(LTag.PUMPBTCOMM, "Waking pump...");
aapsLogger.info(LTag.PUMPCOMM, "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.PUMPBTCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.info(LTag.PUMPCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
// FIXME wakeUp successful !!!!!!!!!!!!!!!!!!
nextWakeUpRequired = System.currentTimeMillis() + (receiverDeviceAwakeForMinutes * 60 * 1000);
} else {
aapsLogger.debug(LTag.PUMPBTCOMM, "Last pump communication was recent, not waking pump.");
aapsLogger.debug(LTag.PUMPCOMM, "Last pump communication was recent, not waking pump.");
}
// long lastGoodPlus = getLastGoodReceiverCommunicationTime() + (receiverDeviceAwakeForMinutes * 60 * 1000);
@ -224,7 +224,7 @@ public abstract class RileyLinkCommunicationManager {
private double scanForDevice(double[] frequencies) {
aapsLogger.info(LTag.PUMPBTCOMM, "Scanning for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPCOMM, "Scanning for receiver ({})", receiverDeviceID);
wakeUp(receiverDeviceAwakeForMinutes, false);
FrequencyScanResults results = new FrequencyScanResults();
@ -241,7 +241,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.PUMPBTCOMM, "scanForPump: Failed to find pump at frequency {}", frequencies[i]);
aapsLogger.error(LTag.PUMPCOMM, "scanForPump: Failed to find pump at frequency {}", frequencies[i]);
} else if (resp.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
@ -255,17 +255,17 @@ public abstract class RileyLinkCommunicationManager {
trial.rssiList.add(rssi);
trial.successes++;
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to parse radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPCOMM, "Failed to parse radio response: " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
} catch (RileyLinkCommunicationException rle) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "scanForPump: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.error(LTag.PUMPCOMM, "scanForPump: raw response is " + ByteUtil.shortHexString(resp.getRaw()));
trial.rssiList.add(-99);
}
trial.tries++;
@ -297,10 +297,10 @@ public abstract class RileyLinkCommunicationManager {
results.bestFrequencyMHz = bestTrial.frequencyMHz;
if (bestTrial.successes > 0) {
rfspy.setBaseFrequency(results.bestFrequencyMHz);
aapsLogger.debug(LTag.PUMPBTCOMM, "Best frequency found: " + results.bestFrequencyMHz);
aapsLogger.debug(LTag.PUMPCOMM, "Best frequency found: " + results.bestFrequencyMHz);
return results.bestFrequencyMHz;
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "No pump response during scan.");
aapsLogger.error(LTag.PUMPCOMM, "No pump response during scan.");
return 0.0;
}
}
@ -329,22 +329,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.PUMPBTCOMM, "tune_tryFrequency: no pump response at frequency {}", freqMHz);
aapsLogger.warn(LTag.PUMPCOMM, "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.PUMPBTCOMM, "tune_tryFrequency: saw response level {} at frequency {}", radioResponse.rssi, freqMHz);
aapsLogger.warn(LTag.PUMPCOMM, "tune_tryFrequency: saw response level {} at frequency {}", radioResponse.rssi, freqMHz);
return calculateRssi(radioResponse.rssi);
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "tune_tryFrequency: invalid radio response:"
aapsLogger.warn(LTag.PUMPCOMM, "tune_tryFrequency: invalid radio response:"
+ ByteUtil.shortHexString(radioResponse.getPayload()));
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
aapsLogger.warn(LTag.PUMPCOMM, "Failed to decode radio response: " + ByteUtil.shortHexString(resp.getRaw()));
}
}
@ -371,13 +371,13 @@ public abstract class RileyLinkCommunicationManager {
}
if (betterFrequency == 0.0) {
// we've failed... caller should try a full scan for pump
aapsLogger.error(LTag.PUMPBTCOMM, "quickTuneForPump: failed to find pump");
aapsLogger.error(LTag.PUMPCOMM, "quickTuneForPump: failed to find pump");
} else {
rfspy.setBaseFrequency(betterFrequency);
if (betterFrequency != startFrequencyMHz) {
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: new frequency is {}MHz", betterFrequency);
aapsLogger.info(LTag.PUMPCOMM, "quickTuneForPump: new frequency is {}MHz", betterFrequency);
} else {
aapsLogger.info(LTag.PUMPBTCOMM, "quickTuneForPump: pump frequency is the same: {}MHz", startFrequencyMHz);
aapsLogger.info(LTag.PUMPCOMM, "quickTuneForPump: pump frequency is the same: {}MHz", startFrequencyMHz);
}
}
return betterFrequency;
@ -385,7 +385,7 @@ public abstract class RileyLinkCommunicationManager {
private double quickTunePumpStep(double startFrequencyMHz, double stepSizeMHz) {
aapsLogger.info(LTag.PUMPBTCOMM, "Doing quick radio tune for receiver ({})", receiverDeviceID);
aapsLogger.info(LTag.PUMPCOMM, "Doing quick radio tune for receiver ({})", receiverDeviceID);
wakeUp(false);
int startRssi = tune_tryFrequency(startFrequencyMHz);
double lowerFrequency = startFrequencyMHz - stepSizeMHz;
@ -423,7 +423,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.PUMPBTCOMM, "Last good pump communication was " + minutesAgo + " minutes ago.");
aapsLogger.debug(LTag.PUMPCOMM, "Last good pump communication was " + minutesAgo + " minutes ago.");
return lastGoodReceiverCommunicationTime;
}

View file

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

View file

@ -69,7 +69,7 @@ public class InitializePumpManagerTask extends ServiceTask {
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkReady);
aapsLogger.info(LTag.PUMPBTCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
aapsLogger.info(LTag.PUMPCOMM, "Setting radio frequency to {} MHz", lastGoodFrequency);
rileyLinkCommunicationManager.setRadioFrequencyForPump(lastGoodFrequency);

View file

@ -118,7 +118,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
for (int retry = 0; retry < 5; retry++) {
aapsLogger.debug(LTag.PUMPBTCOMM, "isDeviceReachable. Waking pump... " + (retry != 0 ? " (retry " + retry + ")" : ""));
aapsLogger.debug(LTag.PUMPCOMM, "isDeviceReachable. Waking pump... " + (retry != 0 ? " (retry " + retry + ")" : ""));
boolean connected = connectToDevice();
@ -152,10 +152,10 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
byte[] pumpMsgContent = createPumpMessageContent(RLMessageType.ReadSimpleData); // simple
RFSpyResponse rfSpyResponse = rfspy.transmitThenReceive(new RadioPacket(injector, pumpMsgContent), (byte) 0, (byte) 200,
(byte) 0, (byte) 0, 25000, (byte) 0);
aapsLogger.info(LTag.PUMPBTCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(rfSpyResponse.getRaw()));
aapsLogger.info(LTag.PUMPCOMM, "wakeup: raw response is " + ByteUtil.shortHexString(rfSpyResponse.getRaw()));
if (rfSpyResponse.wasTimeout()) {
aapsLogger.error(LTag.PUMPBTCOMM, "isDeviceReachable. Failed to find pump (timeout).");
aapsLogger.error(LTag.PUMPCOMM, "isDeviceReachable. Failed to find pump (timeout).");
} else if (rfSpyResponse.looksLikeRadioPacket()) {
RadioResponse radioResponse = new RadioResponse(injector);
@ -168,7 +168,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage pumpResponse = createResponseMessage(radioResponse.getPayload(), PumpMessage.class);
if (!pumpResponse.isValid()) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Response is invalid ! [interrupted={}, timeout={}]", rfSpyResponse.wasInterrupted(),
aapsLogger.warn(LTag.PUMPCOMM, "Response is invalid ! [interrupted={}, timeout={}]", rfSpyResponse.wasInterrupted(),
rfSpyResponse.wasTimeout());
} else {
@ -183,7 +183,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
medtronicUtil.setMedtronicPumpModel(pumpModel);
}
aapsLogger.debug(LTag.PUMPBTCOMM, "isDeviceReachable. PumpModel is {} - Valid: {} (rssi={})", pumpModel.name(), valid,
aapsLogger.debug(LTag.PUMPCOMM, "isDeviceReachable. PumpModel is {} - Valid: {} (rssi={})", pumpModel.name(), valid,
radioResponse.rssi);
if (valid) {
@ -204,17 +204,17 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Failed to parse radio response: "
aapsLogger.warn(LTag.PUMPCOMM, "isDeviceReachable. Failed to parse radio response: "
+ ByteUtil.shortHexString(rfSpyResponse.getRaw()));
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Failed to decode radio response: "
aapsLogger.warn(LTag.PUMPCOMM, "isDeviceReachable. Failed to decode radio response: "
+ ByteUtil.shortHexString(rfSpyResponse.getRaw()));
}
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "isDeviceReachable. Unknown response: " + ByteUtil.shortHexString(rfSpyResponse.getRaw()));
aapsLogger.warn(LTag.PUMPCOMM, "isDeviceReachable. Unknown response: " + ByteUtil.shortHexString(rfSpyResponse.getRaw()));
}
return false;
@ -230,7 +230,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private PumpMessage runCommandWithArgs(PumpMessage msg) throws RileyLinkCommunicationException {
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPBTCOMM, "Run command with Args: ");
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Args: ");
PumpMessage rval;
PumpMessage shortMessage = makePumpMessage(msg.commandType, new CarelinkShortMessageBody(new byte[]{0}));
@ -238,15 +238,15 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage shortResponse = sendAndListen(shortMessage);
if (shortResponse.commandType == MedtronicCommandType.CommandACK) {
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPBTCOMM, "Run command with Args: Got ACK response");
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Args: Got ACK response");
rval = sendAndListen(msg);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPBTCOMM, "2nd Response: {}", rval);
aapsLogger.debug(LTag.PUMPCOMM, "2nd Response: {}", rval);
return rval;
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "runCommandWithArgs: Pump did not ack Attention packet");
aapsLogger.error(LTag.PUMPCOMM, "runCommandWithArgs: Pump did not ack Attention packet");
return new PumpMessage(aapsLogger, "No ACK after Attention packet.");
}
}
@ -255,7 +255,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private PumpMessage runCommandWithFrames(MedtronicCommandType commandType, List<List<Byte>> frames)
throws RileyLinkCommunicationException {
aapsLogger.debug(LTag.PUMPBTCOMM, "Run command with Frames: {}", commandType.name());
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: {}", commandType.name());
PumpMessage rval = null;
PumpMessage shortMessage = makePumpMessage(commandType, new CarelinkShortMessageBody(new byte[]{0}));
@ -263,11 +263,11 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage shortResponse = sendAndListen(shortMessage);
if (shortResponse.commandType != MedtronicCommandType.CommandACK) {
aapsLogger.error(LTag.PUMPBTCOMM, "runCommandWithFrames: Pump did not ack Attention packet");
aapsLogger.error(LTag.PUMPCOMM, "runCommandWithFrames: Pump did not ack Attention packet");
return new PumpMessage(aapsLogger, "No ACK after start message.");
} else {
aapsLogger.debug(LTag.PUMPBTCOMM, "Run command with Frames: Got ACK response for Attention packet");
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: Got ACK response for Attention packet");
}
int frameNr = 1;
@ -276,23 +276,23 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
byte[] frameData = medtronicUtil.createByteArray(frame);
// aapsLogger.debug(LTag.PUMPBTCOMM,"Frame {} data:\n{}", frameNr, ByteUtil.getCompactString(frameData));
// aapsLogger.debug(LTag.PUMPCOMM,"Frame {} data:\n{}", frameNr, ByteUtil.getCompactString(frameData));
PumpMessage msg = makePumpMessage(commandType, new CarelinkLongMessageBody(frameData));
rval = sendAndListen(msg);
// aapsLogger.debug(LTag.PUMPBTCOMM,"PumpResponse: " + rval);
// aapsLogger.debug(LTag.PUMPCOMM,"PumpResponse: " + rval);
if (rval.commandType != MedtronicCommandType.CommandACK) {
aapsLogger.error(LTag.PUMPBTCOMM, "runCommandWithFrames: Pump did not ACK frame #{}", frameNr);
aapsLogger.error(LTag.PUMPCOMM, "runCommandWithFrames: Pump did not ACK frame #{}", frameNr);
aapsLogger.error(LTag.PUMPBTCOMM, "Run command with Frames FAILED (command={}, response={})", commandType.name(),
aapsLogger.error(LTag.PUMPCOMM, "Run command with Frames FAILED (command={}, response={})", commandType.name(),
rval.toString());
return new PumpMessage(aapsLogger, "No ACK after frame #" + frameNr);
} else {
aapsLogger.debug(LTag.PUMPBTCOMM, "Run command with Frames: Got ACK response for frame #{}", (frameNr));
aapsLogger.debug(LTag.PUMPCOMM, "Run command with Frames: Got ACK response for frame #{}", (frameNr));
}
frameNr++;
@ -311,7 +311,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (doWakeUpBeforeCommand)
wakeUp(receiverDeviceAwakeForMinutes, false);
aapsLogger.debug(LTag.PUMPBTCOMM, "Current command: " + medtronicUtil.getCurrentCommand());
aapsLogger.debug(LTag.PUMPCOMM, "Current command: " + medtronicUtil.getCurrentCommand());
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Active);
boolean doneWithError = false;
@ -323,8 +323,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage getHistoryMsg = makePumpMessage(MedtronicCommandType.GetHistoryData,
new GetHistoryPageCarelinkMessageBody(pageNumber));
aapsLogger.info(LTag.PUMPBTCOMM, "getPumpHistory: Page {}", pageNumber);
// aapsLogger.info(LTag.PUMPBTCOMM,"getPumpHistoryPage("+pageNumber+"): "+ByteUtil.shortHexString(getHistoryMsg.getTxData()));
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Page {}", pageNumber);
// aapsLogger.info(LTag.PUMPCOMM,"getPumpHistoryPage("+pageNumber+"): "+ByteUtil.shortHexString(getHistoryMsg.getTxData()));
// Ask the pump to transfer history (we get first frame?)
PumpMessage firstResponse = null;
@ -339,7 +339,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
failed = false;
break;
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPBTCOMM, "First call for PumpHistory failed (retry={})", retries);
aapsLogger.error(LTag.PUMPCOMM, "First call for PumpHistory failed (retry={})", retries);
failed = true;
}
}
@ -349,7 +349,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return pumpTotalResult;
}
// aapsLogger.info(LTag.PUMPBTCOMM,"getPumpHistoryPage("+pageNumber+"): " + ByteUtil.shortHexString(firstResponse.getContents()));
// aapsLogger.info(LTag.PUMPCOMM,"getPumpHistoryPage("+pageNumber+"): " + ByteUtil.shortHexString(firstResponse.getContents()));
PumpMessage ackMsg = makePumpMessage(MedtronicCommandType.CommandACK, new PumpAckMessageBody());
GetHistoryPageCarelinkMessageBody currentResponse = new GetHistoryPageCarelinkMessageBody(firstResponse
@ -366,7 +366,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
&& currentResponse.getFrameNumber() == expectedFrameNum) {
// success! got a frame.
if (frameData.length != 64) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Expected frame of length 64, got frame of length " + frameData.length);
aapsLogger.warn(LTag.PUMPCOMM, "Expected frame of length 64, got frame of length " + frameData.length);
// but append it anyway?
}
// handle successful frame data
@ -376,7 +376,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
medtronicUtil.setCurrentCommand(MedtronicCommandType.GetHistoryData, pageNumber,
currentResponse.getFrameNumber());
aapsLogger.info(LTag.PUMPBTCOMM, "getPumpHistory: Got frame {} of Page {}", currentResponse.getFrameNumber(), pageNumber);
aapsLogger.info(LTag.PUMPCOMM, "getPumpHistory: Got frame {} of Page {}", 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++;
@ -385,16 +385,16 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} else {
if (frameData == null) {
aapsLogger.error(LTag.PUMPBTCOMM, "null frame data, retrying");
aapsLogger.error(LTag.PUMPCOMM, "null frame data, retrying");
} else if (currentResponse.getFrameNumber() != expectedFrameNum) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Expected frame number {}, received {} (retrying)", expectedFrameNum,
aapsLogger.warn(LTag.PUMPCOMM, "Expected frame number {}, received {} (retrying)", expectedFrameNum,
currentResponse.getFrameNumber());
} else if (frameData.length == 0) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Frame has zero length, retrying");
aapsLogger.warn(LTag.PUMPCOMM, "Frame has zero length, retrying");
}
failures++;
if (failures == 6) {
aapsLogger.error(LTag.PUMPBTCOMM,
aapsLogger.error(LTag.PUMPCOMM,
"getPumpHistory: 6 failures in attempting to download frame {} of page {}, giving up.",
expectedFrameNum, pageNumber);
done = true; // failure completion.
@ -412,26 +412,26 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
nextMsg = sendAndListen(ackMsg);
break;
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPBTCOMM, "Problem acknowledging frame response. (retry={})", retries);
aapsLogger.error(LTag.PUMPCOMM, "Problem acknowledging frame response. (retry={})", retries);
}
}
if (nextMsg != null)
currentResponse = new GetHistoryPageCarelinkMessageBody(nextMsg.getMessageBody().getTxData());
else {
aapsLogger.error(LTag.PUMPBTCOMM, "We couldn't acknowledge frame from pump, aborting operation.");
aapsLogger.error(LTag.PUMPCOMM, "We couldn't acknowledge frame from pump, aborting operation.");
}
}
}
if (rawHistoryPage.getLength() != 1024) {
aapsLogger.warn(LTag.PUMPBTCOMM, "getPumpHistory: short page. Expected length of 1024, found length of "
aapsLogger.warn(LTag.PUMPCOMM, "getPumpHistory: short page. Expected length of 1024, found length of "
+ rawHistoryPage.getLength());
doneWithError = true;
}
if (!rawHistoryPage.isChecksumOK()) {
aapsLogger.error(LTag.PUMPBTCOMM, "getPumpHistory: checksum is wrong");
aapsLogger.error(LTag.PUMPCOMM, "getPumpHistory: checksum is wrong");
doneWithError = true;
}
@ -444,11 +444,11 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
List<PumpHistoryEntry> medtronicHistoryEntries = medtronicPumpHistoryDecoder.processPageAndCreateRecords(rawHistoryPage);
aapsLogger.debug(LTag.PUMPBTCOMM, "getPumpHistory: Found {} history entries.", medtronicHistoryEntries.size());
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Found {} history entries.", medtronicHistoryEntries.size());
pumpTotalResult.addHistoryEntries(medtronicHistoryEntries, pageNumber);
aapsLogger.debug(LTag.PUMPBTCOMM, "getPumpHistory: Search status: Search finished: {}", pumpTotalResult.isSearchFinished());
aapsLogger.debug(LTag.PUMPCOMM, "getPumpHistory: Search status: Search finished: {}", pumpTotalResult.isSearchFinished());
if (pumpTotalResult.isSearchFinished()) {
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Sleeping);
@ -559,7 +559,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private Object sendAndGetResponseWithCheck(MedtronicCommandType commandType, byte[] bodyData) {
aapsLogger.debug(LTag.PUMPBTCOMM, "getDataFromPump: {}", commandType);
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: {}", commandType);
for (int retries = 0; retries < MAX_COMMAND_TRIES; retries++) {
@ -574,7 +574,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (dataResponse != null) {
this.errorMessage = null;
aapsLogger.debug(LTag.PUMPBTCOMM, "Converted response for {} is {}.", commandType.name(), dataResponse);
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for {} is {}.", commandType.name(), dataResponse);
return dataResponse;
} else {
@ -586,7 +586,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
}
}
@ -599,7 +599,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (!response.isValid()) {
String responseData = String.format("%s: Invalid response.", method);
aapsLogger.warn(LTag.PUMPBTCOMM, responseData);
aapsLogger.warn(LTag.PUMPCOMM, responseData);
return responseData;
}
@ -607,7 +607,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
if (contents != null) {
if (contents.length >= expectedLength) {
aapsLogger.debug(LTag.PUMPBTCOMM, "{}: Content: {}", method, ByteUtil.shortHexString(contents));
aapsLogger.debug(LTag.PUMPCOMM, "{}: Content: {}", method, ByteUtil.shortHexString(contents));
return null;
} else {
@ -615,12 +615,12 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
"%s: Cannot return data. Data is too short [expected=%s, received=%s].", method, ""
+ expectedLength, "" + contents.length);
aapsLogger.warn(LTag.PUMPBTCOMM, responseData);
aapsLogger.warn(LTag.PUMPCOMM, responseData);
return responseData;
}
} else {
String responseData = String.format("%s: Cannot return data. Null response.", method);
aapsLogger.warn(LTag.PUMPBTCOMM, responseData);
aapsLogger.warn(LTag.PUMPCOMM, responseData);
return responseData;
}
}
@ -652,7 +652,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
MedtronicCommandType commandType = MedtronicCommandType.GetBasalProfileSTD;
aapsLogger.debug(LTag.PUMPBTCOMM, "getDataFromPump: {}", commandType);
aapsLogger.debug(LTag.PUMPCOMM, "getDataFromPump: {}", commandType);
medtronicUtil.setCurrentCommand(commandType);
@ -670,8 +670,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage response = sendAndListen(msg, DEFAULT_TIMEOUT + (DEFAULT_TIMEOUT * retries));
// aapsLogger.debug(LTag.PUMPBTCOMM,"1st Response: " + HexDump.toHexStringDisplayable(response.getRawContent()));
// aapsLogger.debug(LTag.PUMPBTCOMM,"1st Response: " + HexDump.toHexStringDisplayable(response.getMessageBody().getTxData()));
// aapsLogger.debug(LTag.PUMPCOMM,"1st Response: " + HexDump.toHexStringDisplayable(response.getRawContent()));
// aapsLogger.debug(LTag.PUMPCOMM,"1st Response: " + HexDump.toHexStringDisplayable(response.getMessageBody().getTxData()));
String check = checkResponseContent(response, commandType.commandDescription, 1);
@ -687,8 +687,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
response = sendAndListen(ackMsg, DEFAULT_TIMEOUT + (DEFAULT_TIMEOUT * retries));
// aapsLogger.debug(LTag.PUMPBTCOMM,"{} Response: {}", runs, HexDump.toHexStringDisplayable(response2.getRawContent()));
// aapsLogger.debug(LTag.PUMPBTCOMM,"{} Response: {}", runs,
// aapsLogger.debug(LTag.PUMPCOMM,"{} Response: {}", runs, HexDump.toHexStringDisplayable(response2.getRawContent()));
// aapsLogger.debug(LTag.PUMPCOMM,"{} Response: {}", runs,
// HexDump.toHexStringDisplayable(response2.getMessageBody().getTxData()));
String check2 = checkResponseContent(response, commandType.commandDescription, 1);
@ -699,7 +699,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
} else {
this.errorMessage = check2;
aapsLogger.error(LTag.PUMPBTCOMM, "Error with response got GetProfile: " + check2);
aapsLogger.error(LTag.PUMPCOMM, "Error with response got GetProfile: " + check2);
}
}
@ -710,7 +710,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
BasalProfile basalProfile = (BasalProfile) medtronicConverter.convertResponse(medtronicPumpPlugin.getPumpDescription().pumpType, commandType, data);
if (basalProfile != null) {
aapsLogger.debug(LTag.PUMPBTCOMM, "Converted response for {} is {}.", commandType.name(), basalProfile);
aapsLogger.debug(LTag.PUMPCOMM, "Converted response for {} is {}.", commandType.name(), basalProfile);
medtronicUtil.setCurrentCommand(null);
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Sleeping);
@ -719,11 +719,11 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.error(LTag.PUMPBTCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.error(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
}
}
aapsLogger.warn(LTag.PUMPBTCOMM, "Error reading profile in max retries.");
aapsLogger.warn(LTag.PUMPCOMM, "Error reading profile in max retries.");
medtronicUtil.setCurrentCommand(null);
medtronicPumpStatus.setPumpDeviceState(PumpDeviceState.Sleeping);
@ -741,7 +741,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
int last = responseRaw.length - 1;
aapsLogger.debug(LTag.PUMPBTCOMM, "Length: " + data.length);
aapsLogger.debug(LTag.PUMPCOMM, "Length: " + data.length);
if (data.length >= BasalProfile.MAX_RAW_DATA_SIZE) {
return false;
@ -793,7 +793,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
public Boolean setBolus(double units) {
aapsLogger.info(LTag.PUMPBTCOMM, "setBolus: " + units);
aapsLogger.info(LTag.PUMPCOMM, "setBolus: " + units);
return setCommand(MedtronicCommandType.SetBolus, medtronicUtil.getBolusStrokes(units));
@ -802,7 +802,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
public boolean setTBR(TempBasalPair tbr) {
aapsLogger.info(LTag.PUMPBTCOMM, "setTBR: " + tbr.getDescription());
aapsLogger.info(LTag.PUMPCOMM, "setTBR: " + tbr.getDescription());
return setCommand(MedtronicCommandType.SetTemporaryBasal, tbr.getAsRawData());
}
@ -813,7 +813,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
GregorianCalendar gc = new GregorianCalendar();
gc.add(Calendar.SECOND, 5);
aapsLogger.info(LTag.PUMPBTCOMM, "setPumpTime: " + DateTimeUtil.toString(gc));
aapsLogger.info(LTag.PUMPCOMM, "setPumpTime: " + DateTimeUtil.toString(gc));
int i = 1;
byte[] data = new byte[8];
@ -830,7 +830,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
data[i + 5] = (byte) (gc.get(Calendar.MONTH) + 1);
data[i + 6] = (byte) gc.get(Calendar.DAY_OF_MONTH);
//aapsLogger.info(LTag.PUMPBTCOMM,"setPumpTime: Body: " + ByteUtil.getHex(data));
//aapsLogger.info(LTag.PUMPCOMM,"setPumpTime: Body: " + ByteUtil.getHex(data));
return setCommand(MedtronicCommandType.SetRealTimeClock, data);
@ -846,7 +846,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
wakeUp(false);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPBTCOMM, "{}: Body - {}", commandType.getCommandDescription(),
aapsLogger.debug(LTag.PUMPCOMM, "{}: Body - {}", commandType.getCommandDescription(),
ByteUtil.getHex(body));
PumpMessage msg = makePumpMessage(commandType, new CarelinkLongMessageBody(body));
@ -854,16 +854,16 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
PumpMessage pumpMessage = runCommandWithArgs(msg);
if (debugSetCommands)
aapsLogger.debug(LTag.PUMPBTCOMM, "{}: {}", commandType.getCommandDescription(), pumpMessage.getResponseContent());
aapsLogger.debug(LTag.PUMPCOMM, "{}: {}", commandType.getCommandDescription(), pumpMessage.getResponseContent());
if (pumpMessage.commandType == MedtronicCommandType.CommandACK) {
return true;
} else {
aapsLogger.warn(LTag.PUMPBTCOMM, "We received non-ACK response from pump: {}", pumpMessage.getResponseContent());
aapsLogger.warn(LTag.PUMPCOMM, "We received non-ACK response from pump: {}", pumpMessage.getResponseContent());
}
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
}
}
@ -899,13 +899,13 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
return true;
} catch (RileyLinkCommunicationException e) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
aapsLogger.warn(LTag.PUMPCOMM, "Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
}
if (responseMessage != null)
aapsLogger.warn(LTag.PUMPBTCOMM, "Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
aapsLogger.warn(LTag.PUMPCOMM, "Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
else
aapsLogger.warn(LTag.PUMPBTCOMM, "Set Basal Profile: Null response.");
aapsLogger.warn(LTag.PUMPCOMM, "Set Basal Profile: Null response.");
}
return false;

View file

@ -46,12 +46,12 @@ public class MedtronicConverter {
Object convertResponse(PumpType pumpType, MedtronicCommandType commandType, byte[] rawContent) {
if ((rawContent == null || rawContent.length < 1) && commandType != MedtronicCommandType.PumpModel) {
aapsLogger.warn(LTag.PUMPBTCOMM, "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={},isNull={},length={})",
commandType.name(), rawContent == null, rawContent == null ? "-" : rawContent.length);
return null;
}
aapsLogger.debug(LTag.PUMPBTCOMM, "Raw response before convert: " + ByteUtil.shortHexString(rawContent));
aapsLogger.debug(LTag.PUMPCOMM, "Raw response before convert: " + ByteUtil.shortHexString(rawContent));
switch (commandType) {
@ -114,13 +114,13 @@ public class MedtronicConverter {
private MedtronicDeviceType decodeModel(byte[] rawContent) {
if ((rawContent == null || rawContent.length < 4)) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Error reading PumpModel, returning Unknown_Device");
aapsLogger.warn(LTag.PUMPCOMM, "Error reading PumpModel, returning Unknown_Device");
return MedtronicDeviceType.Unknown_Device;
}
String rawModel = StringUtil.fromBytes(ByteUtil.substring(rawContent, 1, 3));
MedtronicDeviceType pumpModel = MedtronicDeviceType.getByDescription(rawModel);
aapsLogger.debug(LTag.PUMPBTCOMM, "PumpModel: [raw={}, resolved={}]", rawModel, pumpModel.name());
aapsLogger.debug(LTag.PUMPCOMM, "PumpModel: [raw={}, resolved={}]", rawModel, pumpModel.name());
if (pumpModel != MedtronicDeviceType.Unknown_Device) {
if (!medtronicUtil.isModelSet()) {
@ -173,7 +173,7 @@ public class MedtronicConverter {
float value = ByteUtil.toInt(rawData[startIdx], rawData[startIdx + 1]) / (1.0f * strokes);
aapsLogger.debug(LTag.PUMPBTCOMM, "Remaining insulin: " + value);
aapsLogger.debug(LTag.PUMPCOMM, "Remaining insulin: " + value);
return value;
}
@ -190,7 +190,7 @@ public class MedtronicConverter {
LocalDateTime pumpTime = new LocalDateTime(year, month, day, hours, minutes, seconds);
return pumpTime;
} catch (IllegalFieldValueException e) {
aapsLogger.error(LTag.PUMPBTCOMM,
aapsLogger.error(LTag.PUMPCOMM,
"decodeTime: Failed to parse pump time value: year=%d, month=%d, hours=%d, minutes=%d, seconds=%d",
year, month, day, hours, minutes, seconds);
return null;

View file

@ -62,7 +62,7 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
// }
if (medtronicUtil.getMedtronicPumpModel() == null) {
aapsLogger.error(LTag.PUMPBTCOMM, "Device Type is not defined.");
aapsLogger.error(LTag.PUMPCOMM, "Device Type is not defined.");
return byteList;
}
@ -118,10 +118,10 @@ public abstract class MedtronicHistoryDecoder<T extends MedtronicHistoryEntry> i
StringUtil.appendToStringBuilder(sb, "" + unknownEntry.getKey(), ", ");
}
aapsLogger.error(LTag.PUMPBTCOMM, "STATISTICS OF PUMP DECODE");
aapsLogger.error(LTag.PUMPCOMM, "STATISTICS OF PUMP DECODE");
if (unknownOpCodes.size() > 0) {
aapsLogger.warn(LTag.PUMPBTCOMM, "Unknown Op Codes: {}", sb.toString());
aapsLogger.warn(LTag.PUMPCOMM, "Unknown Op Codes: {}", 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.error(LTag.PUMPBTCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
aapsLogger.error(LTag.PUMPCOMM, " {}{} - {}. Elements: {}", entry.getKey().name(), spaces, entry.getValue().size(), sb.toString());
} else {
aapsLogger.error(LTag.PUMPBTCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
aapsLogger.error(LTag.PUMPCOMM, " {} - {}", entry.getKey().name(), entry.getValue().size());
}
}
}

View file

@ -31,16 +31,16 @@ public class PumpHistoryResult {
/*
* this.searchEntry = searchEntry;
* this.searchType = SearchType.LastEntry;
* aapsLogger.debug(LTag.PUMPBTCOMM,"PumpHistoryResult. Search parameters: Last Entry: " + searchEntry.atechDateTime + " type="
* aapsLogger.debug(LTag.PUMPCOMM,"PumpHistoryResult. Search parameters: Last Entry: " + searchEntry.atechDateTime + " type="
* + searchEntry.getEntryType().name());
*/
this.searchDate = searchEntry.atechDateTime;
this.searchType = SearchType.Date;
aapsLogger.debug(LTag.PUMPBTCOMM, "PumpHistoryResult. Search parameters: Date(with searchEntry): " + targetDate);
aapsLogger.debug(LTag.PUMPCOMM, "PumpHistoryResult. Search parameters: Date(with searchEntry): " + targetDate);
} else if (targetDate != null) {
this.searchDate = targetDate;
this.searchType = SearchType.Date;
aapsLogger.debug(LTag.PUMPBTCOMM, "PumpHistoryResult. Search parameters: Date: " + targetDate);
aapsLogger.debug(LTag.PUMPCOMM, "PumpHistoryResult. Search parameters: Date: " + targetDate);
}
// this.unprocessedEntries = new ArrayList<>();
@ -50,7 +50,7 @@ public class PumpHistoryResult {
public void addHistoryEntries(List<PumpHistoryEntry> entries, int page) {
this.unprocessedEntries = entries;
//aapsLogger.debug(LTag.PUMPBTCOMM,"PumpHistoryResult. Unprocessed entries: {}", MedtronicUtil.getGsonInstance().toJson(entries));
//aapsLogger.debug(LTag.PUMPCOMM,"PumpHistoryResult. Unprocessed entries: {}", MedtronicUtil.getGsonInstance().toJson(entries));
processEntries();
}
@ -62,47 +62,47 @@ public class PumpHistoryResult {
switch (searchType) {
case None:
//aapsLogger.debug(LTag.PUMPBTCOMM,"PE. None search");
//aapsLogger.debug(LTag.PUMPCOMM,"PE. None search");
this.validEntries.addAll(this.unprocessedEntries);
break;
case LastEntry: {
aapsLogger.debug(LTag.PUMPBTCOMM, "PE. Last entry search");
aapsLogger.debug(LTag.PUMPCOMM, "PE. Last entry search");
//Collections.sort(this.unprocessedEntries, new PumpHistoryEntry.Comparator());
aapsLogger.debug(LTag.PUMPBTCOMM, "PE. PumpHistoryResult. Search entry date: " + searchEntry.atechDateTime);
aapsLogger.debug(LTag.PUMPCOMM, "PE. PumpHistoryResult. Search entry date: " + searchEntry.atechDateTime);
Long date = searchEntry.atechDateTime;
for (PumpHistoryEntry unprocessedEntry : unprocessedEntries) {
if (unprocessedEntry.equals(searchEntry)) {
//aapsLogger.debug(LTag.PUMPBTCOMM,"PE. Item found {}.", unprocessedEntry);
//aapsLogger.debug(LTag.PUMPCOMM,"PE. Item found {}.", unprocessedEntry);
searchFinished = true;
break;
}
//aapsLogger.debug(LTag.PUMPBTCOMM,"PE. Entry {} added.", unprocessedEntry);
//aapsLogger.debug(LTag.PUMPCOMM,"PE. Entry {} added.", unprocessedEntry);
this.validEntries.add(unprocessedEntry);
}
}
break;
case Date: {
aapsLogger.debug(LTag.PUMPBTCOMM, "PE. Date search: Search date: {}", this.searchDate);
aapsLogger.debug(LTag.PUMPCOMM, "PE. Date search: Search date: {}", this.searchDate);
for (PumpHistoryEntry unprocessedEntry : unprocessedEntries) {
if (unprocessedEntry.atechDateTime == null || unprocessedEntry.atechDateTime == 0) {
aapsLogger.debug(LTag.PUMPBTCOMM, "PE. PumpHistoryResult. Search entry date: Entry with no date: {}", unprocessedEntry);
aapsLogger.debug(LTag.PUMPCOMM, "PE. PumpHistoryResult. Search entry date: Entry with no date: {}", unprocessedEntry);
continue;
}
if (unprocessedEntry.isAfter(this.searchDate)) {
this.validEntries.add(unprocessedEntry);
} else {
// aapsLogger.debug(LTag.PUMPBTCOMM,"PE. PumpHistoryResult. Not after.. Unprocessed Entry [year={},entry={}]",
// aapsLogger.debug(LTag.PUMPCOMM,"PE. PumpHistoryResult. Not after.. Unprocessed Entry [year={},entry={}]",
// DateTimeUtil.getYear(unprocessedEntry.atechDateTime), unprocessedEntry);
if (DateTimeUtil.getYear(unprocessedEntry.atechDateTime) > 2015)
olderEntries++;
@ -119,7 +119,7 @@ public class PumpHistoryResult {
} // switch
//aapsLogger.debug(LTag.PUMPBTCOMM,"PE. Valid Entries: {}", validEntries);
//aapsLogger.debug(LTag.PUMPCOMM,"PE. Valid Entries: {}", validEntries);
}

View file

@ -66,7 +66,7 @@ public class PumpMessage implements RLMessage {
if (rxData.length > 4) {
this.commandType = MedtronicCommandType.getByCode(rxData[4]);
if (this.commandType == MedtronicCommandType.InvalidCommand) {
aapsLogger.error(LTag.PUMPBTCOMM, "PumpMessage - Unknown commandType " + rxData[4]);
aapsLogger.error(LTag.PUMPCOMM, "PumpMessage - Unknown commandType " + rxData[4]);
}
}
if (rxData.length > 5) {

View file

@ -68,7 +68,7 @@ public class BasalProfile {
private boolean setRawData(byte[] data) {
if (data == null) {
aapsLogger.error(LTag.PUMPBTCOMM,"setRawData: buffer is null!");
aapsLogger.error(LTag.PUMPCOMM,"setRawData: buffer is null!");
return false;
}
@ -91,7 +91,7 @@ public class BasalProfile {
public boolean setRawDataFromHistory(byte[] data) {
if (data == null) {
aapsLogger.error(LTag.PUMPBTCOMM,"setRawData: buffer is null!");
aapsLogger.error(LTag.PUMPCOMM,"setRawData: buffer is null!");
return false;
}
@ -116,13 +116,13 @@ public class BasalProfile {
public void dumpBasalProfile() {
aapsLogger.debug(LTag.PUMPBTCOMM,"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.PUMPBTCOMM,String.format("Entry %d, rate=%.3f (0x%02X), start=%s (0x%02X)", i + 1, entry.rate,
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));
}
@ -169,14 +169,14 @@ public class BasalProfile {
BasalProfileEntry rval = new BasalProfileEntry();
List<BasalProfileEntry> entries = getEntries();
if (entries.size() == 0) {
aapsLogger.warn(LTag.PUMPBTCOMM,String.format("getEntryForTime(%s): table is empty",
aapsLogger.warn(LTag.PUMPCOMM,String.format("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.PUMPBTCOMM,"getEntryForTime: Only one entry in profile");
aapsLogger.debug(LTag.PUMPCOMM,"getEntryForTime: Only one entry in profile");
return rval;
}
@ -186,17 +186,17 @@ public class BasalProfile {
while (!done) {
BasalProfileEntry entry = entries.get(i);
if (DEBUG_BASALPROFILE) {
aapsLogger.debug(LTag.PUMPBTCOMM,String.format("Comparing 'now'=%s to entry 'start time'=%s", when.toDateTime().toLocalTime()
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")));
}
if (localMillis >= entry.startTime.getMillisOfDay()) {
rval = entry;
if (DEBUG_BASALPROFILE)
aapsLogger.debug(LTag.PUMPBTCOMM,"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.PUMPBTCOMM,"Rejected Entry");
aapsLogger.debug(LTag.PUMPCOMM,"Rejected Entry");
done = true;
}
i++;
@ -205,7 +205,7 @@ public class BasalProfile {
}
}
if (DEBUG_BASALPROFILE) {
aapsLogger.debug(LTag.PUMPBTCOMM,String.format("getEntryForTime(%s): Returning entry: rate=%.3f (%d), start=%s (%d)", when
aapsLogger.debug(LTag.PUMPCOMM,String.format("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));
}
@ -217,7 +217,7 @@ public class BasalProfile {
List<BasalProfileEntry> entries = new ArrayList<>();
if (mRawData == null || mRawData[2] == 0x3f) {
aapsLogger.warn(LTag.PUMPBTCOMM,"Raw Data is empty.");
aapsLogger.warn(LTag.PUMPCOMM,"Raw Data is empty.");
return entries; // an empty list
}
boolean done = false;
@ -237,7 +237,7 @@ public class BasalProfile {
try {
entries.add(new BasalProfileEntry(aapsLogger, r, st));
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPBTCOMM,"Error decoding basal profile from bytes: {}", ByteUtil.shortHexString(mRawData));
aapsLogger.error(LTag.PUMPCOMM,"Error decoding basal profile from bytes: {}", ByteUtil.shortHexString(mRawData));
throw ex;
}
@ -286,10 +286,10 @@ public class BasalProfile {
try {
entries = getEntries();
} catch (Exception ex) {
aapsLogger.error(LTag.PUMPBTCOMM,"=============================================================================");
aapsLogger.error(LTag.PUMPBTCOMM," Error generating entries. Ex.: " + ex, ex);
aapsLogger.error(LTag.PUMPBTCOMM," rawBasalValues: " + ByteUtil.shortHexString(this.getRawData()));
aapsLogger.error(LTag.PUMPBTCOMM,"=============================================================================");
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

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

View file

@ -275,7 +275,7 @@ public class MedtronicUtil {
byte[] payload = sendPayloadBuffer.array();
aapsLogger.debug(LTag.PUMPBTCOMM, "buildCommandPayload [{}]", ByteUtil.shortHexString(payload));
aapsLogger.debug(LTag.PUMPCOMM, "buildCommandPayload [{}]", ByteUtil.shortHexString(payload));
// int crc = computeCRC8WithPolynomial(payload, 0, payload.length - 1);