parent
f544f19a02
commit
08cae9a3bb
4 changed files with 67 additions and 31 deletions
|
@ -105,7 +105,7 @@ android {
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
versionCode 1500
|
versionCode 1500
|
||||||
// dev_version: 2.3.1-dev
|
// dev_version: 2.3.1-dev
|
||||||
version "medtronic-0.11.8-SNAPSHOT"
|
version "medtronic-0.11.9-SNAPSHOT"
|
||||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||||
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
||||||
|
|
|
@ -26,7 +26,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
/**
|
/**
|
||||||
* This file was taken from GGC - GNU Gluco Control (ggc.sourceforge.net), application for diabetes
|
* This file was taken from GGC - GNU Gluco Control (ggc.sourceforge.net), application for diabetes
|
||||||
* management and modified/extended for AAPS.
|
* management and modified/extended for AAPS.
|
||||||
* <p>
|
*
|
||||||
* Author: Andy {andy.rozman@gmail.com}
|
* Author: Andy {andy.rozman@gmail.com}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
List<Byte> listRawData = new ArrayList<Byte>();
|
List<Byte> listRawData = new ArrayList<Byte>();
|
||||||
listRawData.add((byte) opCode);
|
listRawData.add((byte) opCode);
|
||||||
|
|
||||||
if (entryType == PumpHistoryEntryType.UnabsorbedInsulin) {
|
if (entryType == PumpHistoryEntryType.UnabsorbedInsulin
|
||||||
|
|| entryType == PumpHistoryEntryType.UnabsorbedInsulin512) {
|
||||||
int elements = dataClear.get(counter);
|
int elements = dataClear.get(counter);
|
||||||
listRawData.add((byte) elements);
|
listRawData.add((byte) elements);
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -227,7 +228,6 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
case ChangeWatchdogEnable:
|
case ChangeWatchdogEnable:
|
||||||
case ChangeOtherDeviceID:
|
case ChangeOtherDeviceID:
|
||||||
case ReadOtherDevicesIDs:
|
case ReadOtherDevicesIDs:
|
||||||
case BolusWizardEstimate512:
|
|
||||||
case BGReceived512:
|
case BGReceived512:
|
||||||
case SensorStatus:
|
case SensorStatus:
|
||||||
case ReadCaptureEventEnabled:
|
case ReadCaptureEventEnabled:
|
||||||
|
@ -263,6 +263,7 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
return RecordDecodeStatus.Ignored;
|
return RecordDecodeStatus.Ignored;
|
||||||
|
|
||||||
case UnabsorbedInsulin:
|
case UnabsorbedInsulin:
|
||||||
|
case UnabsorbedInsulin512:
|
||||||
return RecordDecodeStatus.Ignored;
|
return RecordDecodeStatus.Ignored;
|
||||||
|
|
||||||
// **** Implemented records ****
|
// **** Implemented records ****
|
||||||
|
@ -320,9 +321,11 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
case SaveSettings:
|
case SaveSettings:
|
||||||
return RecordDecodeStatus.OK;
|
return RecordDecodeStatus.OK;
|
||||||
|
|
||||||
case BolusWizardEstimate:
|
case BolusWizard:
|
||||||
decodeBolusWizard(entry);
|
return decodeBolusWizard(entry);
|
||||||
return RecordDecodeStatus.OK;
|
|
||||||
|
case BolusWizard512:
|
||||||
|
return decodeBolusWizard512(entry);
|
||||||
|
|
||||||
case Prime:
|
case Prime:
|
||||||
decodePrime(entry);
|
decodePrime(entry);
|
||||||
|
@ -335,7 +338,6 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
case UnknownBasePacket:
|
case UnknownBasePacket:
|
||||||
return RecordDecodeStatus.Error;
|
return RecordDecodeStatus.Error;
|
||||||
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
LOG.debug("Not supported: " + entry.getEntryType());
|
LOG.debug("Not supported: " + entry.getEntryType());
|
||||||
return RecordDecodeStatus.NotSupported;
|
return RecordDecodeStatus.NotSupported;
|
||||||
|
@ -432,17 +434,17 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void decodeBolusWizard(PumpHistoryEntry entry) {
|
private RecordDecodeStatus decodeBolusWizard(PumpHistoryEntry entry) {
|
||||||
byte[] body = entry.getBody();
|
byte[] body = entry.getBody();
|
||||||
|
|
||||||
BolusWizardDTO dto = new BolusWizardDTO();
|
BolusWizardDTO dto = new BolusWizardDTO();
|
||||||
|
|
||||||
float bolus_strokes = 10.0f;
|
float bolusStrokes = 10.0f;
|
||||||
|
|
||||||
if (MedtronicDeviceType.isSameDevice(MedtronicUtil.getMedtronicPumpModel(),
|
if (MedtronicDeviceType.isSameDevice(MedtronicUtil.getMedtronicPumpModel(),
|
||||||
MedtronicDeviceType.Medtronic_523andHigher)) {
|
MedtronicDeviceType.Medtronic_523andHigher)) {
|
||||||
// https://github.com/ps2/minimed_rf/blob/master/lib/minimed_rf/log_entries/bolus_wizard.rb#L102
|
// https://github.com/ps2/minimed_rf/blob/master/lib/minimed_rf/log_entries/bolus_wizard.rb#L102
|
||||||
bolus_strokes = 40.0f;
|
bolusStrokes = 40.0f;
|
||||||
|
|
||||||
dto.carbs = ((body[1] & 0x0c) << 6) + body[0];
|
dto.carbs = ((body[1] & 0x0c) << 6) + body[0];
|
||||||
|
|
||||||
|
@ -451,31 +453,65 @@ public class MedtronicPumpHistoryDecoder extends MedtronicHistoryDecoder<PumpHis
|
||||||
// carb_ratio (?) = (((self.body[2] & 0x07) << 8) + self.body[3]) /
|
// carb_ratio (?) = (((self.body[2] & 0x07) << 8) + self.body[3]) /
|
||||||
// 10.0s
|
// 10.0s
|
||||||
dto.insulinSensitivity = new Float(body[4]);
|
dto.insulinSensitivity = new Float(body[4]);
|
||||||
dto.bgTargetLow = (int) body[5];
|
dto.bgTargetLow = (int)body[5];
|
||||||
dto.bgTargetHigh = (int) body[14];
|
dto.bgTargetHigh = (int)body[14];
|
||||||
dto.correctionEstimate = (((body[9] & 0x38) << 5) + body[6]) / bolus_strokes;
|
dto.correctionEstimate = (((body[9] & 0x38) << 5) + body[6]) / bolusStrokes;
|
||||||
dto.foodEstimate = ((body[7] << 8) + body[8]) / bolus_strokes;
|
dto.foodEstimate = ((body[7] << 8) + body[8]) / bolusStrokes;
|
||||||
dto.unabsorbedInsulin = ((body[10] << 8) + body[11]) / bolus_strokes;
|
dto.unabsorbedInsulin = ((body[10] << 8) + body[11]) / bolusStrokes;
|
||||||
dto.bolusTotal = ((body[12] << 8) + body[13]) / bolus_strokes;
|
dto.bolusTotal = ((body[12] << 8) + body[13]) / bolusStrokes;
|
||||||
} else {
|
} else {
|
||||||
dto.bloodGlucose = (((body[1] & 0x0F) << 8) | entry.getHead()[0]);
|
dto.bloodGlucose = (((body[1] & 0x0F) << 8) | entry.getHead()[0]);
|
||||||
dto.carbs = (int) body[0];
|
dto.carbs = (int)body[0];
|
||||||
dto.carbRatio = Float.valueOf(body[2]);
|
dto.carbRatio = Float.valueOf(body[2]);
|
||||||
dto.insulinSensitivity = new Float(body[3]);
|
dto.insulinSensitivity = new Float(body[3]);
|
||||||
dto.bgTargetLow = (int) body[4];
|
dto.bgTargetLow = (int)body[4];
|
||||||
dto.bgTargetHigh = (int) body[12];
|
dto.bgTargetHigh = (int)body[12];
|
||||||
dto.bolusTotal = body[11] / 10.0f;
|
dto.bolusTotal = body[11] / bolusStrokes;
|
||||||
dto.foodEstimate = body[6] / 10.0f;
|
dto.foodEstimate = body[6] / bolusStrokes;
|
||||||
dto.unabsorbedInsulin = body[9] / 10.0f;
|
dto.unabsorbedInsulin = body[9] / bolusStrokes;
|
||||||
dto.bolusTotal = body[11] / 10.0f;
|
dto.bolusTotal = body[11] / bolusStrokes;
|
||||||
dto.correctionEstimate = (body[7] + (body[5] & 0x0F)) / 10.0f;
|
dto.correctionEstimate = (body[7] + (body[5] & 0x0F)) / bolusStrokes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.bloodGlucose != null && dto.bloodGlucose < 0) {
|
||||||
|
dto.bloodGlucose = ByteUtil.convertUnsignedByteToInt(dto.bloodGlucose.byteValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.atechDateTime = entry.atechDateTime;
|
dto.atechDateTime = entry.atechDateTime;
|
||||||
entry.addDecodedData("Object", dto);
|
entry.addDecodedData("Object", dto);
|
||||||
entry.setDisplayableValue(dto.getDisplayableValue());
|
entry.setDisplayableValue(dto.getDisplayableValue());
|
||||||
|
|
||||||
// this.writeData(PumpBaseType.Event, PumpEventType.BolusWizard, dto.getValue(), entry.getATechDate());
|
return RecordDecodeStatus.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private RecordDecodeStatus decodeBolusWizard512(PumpHistoryEntry entry) {
|
||||||
|
byte[] body = entry.getBody();
|
||||||
|
|
||||||
|
BolusWizardDTO dto = new BolusWizardDTO();
|
||||||
|
|
||||||
|
float bolusStrokes = 10.0f;
|
||||||
|
|
||||||
|
dto.bloodGlucose = ((body[1] & 0x03 << 8) | entry.getHead()[0]);
|
||||||
|
dto.carbs = (body[1] & 0xC) << 6 | body[0]; // (int)body[0];
|
||||||
|
dto.carbRatio = Float.valueOf(body[2]);
|
||||||
|
dto.insulinSensitivity = new Float(body[3]);
|
||||||
|
dto.bgTargetLow = (int)body[4];
|
||||||
|
dto.foodEstimate = body[6] / 10.0f;
|
||||||
|
dto.correctionEstimate = (body[7] + (body[5] & 0x0F)) / bolusStrokes;
|
||||||
|
dto.unabsorbedInsulin = body[9] / bolusStrokes;
|
||||||
|
dto.bolusTotal = body[11] / bolusStrokes;
|
||||||
|
dto.bgTargetHigh = dto.bgTargetLow;
|
||||||
|
|
||||||
|
if (dto.bloodGlucose != null && dto.bloodGlucose < 0) {
|
||||||
|
dto.bloodGlucose = ByteUtil.convertUnsignedByteToInt(dto.bloodGlucose.byteValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.atechDateTime = entry.atechDateTime;
|
||||||
|
entry.addDecodedData("Object", dto);
|
||||||
|
entry.setDisplayableValue(dto.getDisplayableValue());
|
||||||
|
|
||||||
|
return RecordDecodeStatus.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ public enum PumpHistoryEntryType // implements CodeEnum
|
||||||
ChangeMaxBasal(0x2c, "Change Max Basal", PumpHistoryEntryGroup.Configuration), //
|
ChangeMaxBasal(0x2c, "Change Max Basal", PumpHistoryEntryGroup.Configuration), //
|
||||||
BolusWizardEnabled(0x2d, "Bolus Wizard Enabled", PumpHistoryEntryGroup.Configuration), // V3 ?
|
BolusWizardEnabled(0x2d, "Bolus Wizard Enabled", PumpHistoryEntryGroup.Configuration), // V3 ?
|
||||||
/**/EventUnknown_MM512_0x2e(0x2e, "Unknown Event 0x2e", PumpHistoryEntryGroup.Unknown), //
|
/**/EventUnknown_MM512_0x2e(0x2e, "Unknown Event 0x2e", PumpHistoryEntryGroup.Unknown), //
|
||||||
/**/BolusWizardEstimate512(0x2f, "Bolus Wizard Estimate (512)", PumpHistoryEntryGroup.Configuration), //
|
BolusWizard512(0x2f, "Bolus Wizard (512)", PumpHistoryEntryGroup.Bolus, 2, 5, 12), //
|
||||||
UnabsorbedInsulin512(0x30, "Unabsorbed Insulin (512)", PumpHistoryEntryGroup.Statistic), // FIXME
|
UnabsorbedInsulin512(0x30, "Unabsorbed Insulin (512)", PumpHistoryEntryGroup.Statistic, 5, 0, 0), // FIXME
|
||||||
ChangeBGReminderOffset(0x31, "Change BG Reminder Offset", PumpHistoryEntryGroup.Configuration), //
|
ChangeBGReminderOffset(0x31, "Change BG Reminder Offset", PumpHistoryEntryGroup.Configuration), //
|
||||||
ChangeAlarmClockTime(0x32, "Change Alarm Clock Time", PumpHistoryEntryGroup.Configuration), //
|
ChangeAlarmClockTime(0x32, "Change Alarm Clock Time", PumpHistoryEntryGroup.Configuration), //
|
||||||
TempBasalRate(0x33, "TBR Rate", PumpHistoryEntryGroup.Basal, 2, 5, 1), //
|
TempBasalRate(0x33, "TBR Rate", PumpHistoryEntryGroup.Basal, 2, 5, 1), //
|
||||||
|
@ -104,7 +104,7 @@ public enum PumpHistoryEntryType // implements CodeEnum
|
||||||
// Andy58(0x58, "Unknown", 13, 5, 0), // TO DO is this one really there ???
|
// Andy58(0x58, "Unknown", 13, 5, 0), // TO DO is this one really there ???
|
||||||
|
|
||||||
ChangeBolusWizardSetup(0x5a, "Bolus Wizard Setup (512)", PumpHistoryEntryGroup.Configuration, 2, 5, 137), // V2: 522+[B=143] // V6 124 -> 144
|
ChangeBolusWizardSetup(0x5a, "Bolus Wizard Setup (512)", PumpHistoryEntryGroup.Configuration, 2, 5, 137), // V2: 522+[B=143] // V6 124 -> 144
|
||||||
BolusWizardEstimate(0x5b, "Bolus Wizard Estimate", PumpHistoryEntryGroup.Configuration, 2, 5, 13), // 15 //
|
BolusWizard(0x5b, "Bolus Wizard Estimate", PumpHistoryEntryGroup.Configuration, 2, 5, 13), // 15 //
|
||||||
UnabsorbedInsulin(0x5c, "Unabsorbed Insulin", PumpHistoryEntryGroup.Statistic, 5, 0, 0), // head[1] -> body
|
UnabsorbedInsulin(0x5c, "Unabsorbed Insulin", PumpHistoryEntryGroup.Statistic, 5, 0, 0), // head[1] -> body
|
||||||
SaveSettings(0x5d, "Save Settings", PumpHistoryEntryGroup.Configuration), //
|
SaveSettings(0x5d, "Save Settings", PumpHistoryEntryGroup.Configuration), //
|
||||||
ChangeVariableBolus(0x5e, "Change Variable Bolus", PumpHistoryEntryGroup.Configuration), //
|
ChangeVariableBolus(0x5e, "Change Variable Bolus", PumpHistoryEntryGroup.Configuration), //
|
||||||
|
@ -220,7 +220,7 @@ public enum PumpHistoryEntryType // implements CodeEnum
|
||||||
// has
|
// has
|
||||||
// old
|
// old
|
||||||
// form
|
// form
|
||||||
BolusWizardEstimate.addSpecialRuleBody(new SpecialRule(MedtronicDeviceType.Medtronic_523andHigher, 15));
|
BolusWizard.addSpecialRuleBody(new SpecialRule(MedtronicDeviceType.Medtronic_523andHigher, 15));
|
||||||
BolusReminder.addSpecialRuleBody(new SpecialRule(MedtronicDeviceType.Medtronic_523andHigher, 2));
|
BolusReminder.addSpecialRuleBody(new SpecialRule(MedtronicDeviceType.Medtronic_523andHigher, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class MedtronicHistoryData {
|
||||||
|
|
||||||
if (type == PumpHistoryEntryType.TempBasalRate || type == PumpHistoryEntryType.TempBasalDuration) {
|
if (type == PumpHistoryEntryType.TempBasalRate || type == PumpHistoryEntryType.TempBasalDuration) {
|
||||||
TBRs.add(pumpHistoryEntry);
|
TBRs.add(pumpHistoryEntry);
|
||||||
} else if (type == PumpHistoryEntryType.BolusWizardEstimate) {
|
} else if (type == PumpHistoryEntryType.BolusWizard || type == PumpHistoryEntryType.BolusWizard512) {
|
||||||
bolusEstimates.add(pumpHistoryEntry);
|
bolusEstimates.add(pumpHistoryEntry);
|
||||||
newHistory2.add(pumpHistoryEntry);
|
newHistory2.add(pumpHistoryEntry);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue