Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
6
600SeriesAndroidUploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cgm
uploader
600SeriesAndroidUploader
Commits
af2cbc72
Commit
af2cbc72
authored
8 years ago
by
Lennart Goedhart
Browse files
Options
Downloads
Patches
Plain Diff
Fix #55.
Code cleanup (remove unneeded brackets). Added support for Temp Basal Rates.
parent
c5f91833
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/info/nightscout/android/medtronic/message/PumpStatusResponseMessage.java
+27
-24
27 additions, 24 deletions
.../android/medtronic/message/PumpStatusResponseMessage.java
with
27 additions
and
24 deletions
app/src/main/java/info/nightscout/android/medtronic/message/PumpStatusResponseMessage.java
+
27
−
24
View file @
af2cbc72
...
@@ -68,48 +68,47 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
...
@@ -68,48 +68,47 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
Log
.
d
(
TAG
,
"PAYLOAD: "
+
outputString
);
Log
.
d
(
TAG
,
"PAYLOAD: "
+
outputString
);
}
}
// Status Flags
// Status Flags
suspended
=
(
(
statusBuffer
.
get
(
0x03
)
&
0x01
)
!=
0x00
)
;
suspended
=
(
statusBuffer
.
get
(
0x03
)
&
0x01
)
!=
0x00
;
bolusing
=
(
(
statusBuffer
.
get
(
0x03
)
&
0x02
)
!=
0x00
)
;
bolusing
=
(
statusBuffer
.
get
(
0x03
)
&
0x02
)
!=
0x00
;
deliveringInsulin
=
(
(
statusBuffer
.
get
(
0x03
)
&
0x10
)
!=
0x00
)
;
deliveringInsulin
=
(
statusBuffer
.
get
(
0x03
)
&
0x10
)
!=
0x00
;
tempBasalActive
=
(
(
statusBuffer
.
get
(
0x03
)
&
0x20
)
!=
0x00
)
;
tempBasalActive
=
(
statusBuffer
.
get
(
0x03
)
&
0x20
)
!=
0x00
;
cgmActive
=
(
(
statusBuffer
.
get
(
0x03
)
&
0x40
)
!=
0x00
)
;
cgmActive
=
(
statusBuffer
.
get
(
0x03
)
&
0x40
)
!=
0x00
;
// Active basal pattern
// Active basal pattern
activeBasalPattern
=
(
statusBuffer
.
get
(
0x1a
)
)
;
activeBasalPattern
=
statusBuffer
.
get
(
0x1a
);
// Normal basal rate
// Normal basal rate
long
rawNormalBasal
=
statusBuffer
.
getInt
(
0x1b
);
long
rawNormalBasal
=
statusBuffer
.
getInt
(
0x1b
);
basalRate
=
(
new
BigDecimal
(
rawNormalBasal
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
()
)
;
basalRate
=
new
BigDecimal
(
rawNormalBasal
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
// Temp basal rate
// Temp basal rate
// TODO - need to figure this one out
long
rawTempBasal
=
statusBuffer
.
getShort
(
0x21
)
&
0x0000ffff
;
//long rawTempBasal = statusBuffer.getShort(0x21) & 0x0000ffff;
tempBasalRate
=
new
BigDecimal
(
rawTempBasal
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
//pumpRecord.setTempBasalRate(new BigDecimal(rawTempBasal / 10000f).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue());
// Temp basal percentage
// Temp basal percentage
tempBasalPercentage
=
(
statusBuffer
.
get
(
0x23
)
)
;
tempBasalPercentage
=
statusBuffer
.
get
(
0x23
);
// Temp basal minutes remaining
// Temp basal minutes remaining
tempBasalMinutesRemaining
=
(
(
short
)
(
statusBuffer
.
getShort
(
0x24
)
&
0x0000ffff
)
)
;
tempBasalMinutesRemaining
=
(
short
)
(
statusBuffer
.
getShort
(
0x24
)
&
0x0000ffff
);
// Units of insulin delivered as basal today
// Units of insulin delivered as basal today
// TODO - is this basal? Do we have a total Units delivered elsewhere?
// TODO - is this basal? Do we have a total Units delivered elsewhere?
basalUnitsDeliveredToday
=
(
statusBuffer
.
getInt
(
0x26
)
)
;
basalUnitsDeliveredToday
=
statusBuffer
.
getInt
(
0x26
);
// Pump battery percentage
// Pump battery percentage
batteryPercentage
=
((
statusBuffer
.
get
(
0x2a
)
))
;
batteryPercentage
=
statusBuffer
.
get
(
0x2a
);
// Reservoir amount
// Reservoir amount
long
rawReservoirAmount
=
statusBuffer
.
getInt
(
0x2b
);
long
rawReservoirAmount
=
statusBuffer
.
getInt
(
0x2b
);
reservoirAmount
=
(
new
BigDecimal
(
rawReservoirAmount
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
()
)
;
reservoirAmount
=
new
BigDecimal
(
rawReservoirAmount
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
// Amount of insulin left in pump (in minutes)
// Amount of insulin left in pump (in minutes)
byte
insulinHours
=
statusBuffer
.
get
(
0x2f
);
byte
insulinHours
=
statusBuffer
.
get
(
0x2f
);
byte
insulinMinutes
=
statusBuffer
.
get
(
0x30
);
byte
insulinMinutes
=
statusBuffer
.
get
(
0x30
);
minutesOfInsulinRemaining
=
(
(
short
)
((
insulinHours
*
60
)
+
insulinMinutes
)
)
;
minutesOfInsulinRemaining
=
(
short
)
((
insulinHours
*
60
)
+
insulinMinutes
);
// Active insulin
// Active insulin
long
rawActiveInsulin
=
statusBuffer
.
get
Shor
t
(
0x3
3
)
&
0x0000ffff
;
long
rawActiveInsulin
=
statusBuffer
.
get
In
t
(
0x3
1
)
;
activeInsulin
=
new
BigDecimal
(
rawActiveInsulin
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
activeInsulin
=
new
BigDecimal
(
rawActiveInsulin
/
10000
f
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
// CGM SGV
// CGM SGV
...
@@ -119,11 +118,11 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
...
@@ -119,11 +118,11 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
sgv
=
0
;
sgv
=
0
;
rtc
=
0
;
rtc
=
0
;
offset
=
0
;
offset
=
0
;
cgmTrend
=
(
PumpStatusEvent
.
CGM_TREND
.
NOT_SET
)
;
cgmTrend
=
PumpStatusEvent
.
CGM_TREND
.
NOT_SET
;
}
else
{
}
else
{
rtc
=
statusBuffer
.
getInt
(
0x37
)
&
0x00000000ffffffff
L
;
rtc
=
statusBuffer
.
getInt
(
0x37
)
&
0x00000000ffffffff
L
;
offset
=
statusBuffer
.
getInt
(
0x3b
);
offset
=
statusBuffer
.
getInt
(
0x3b
);
cgmTrend
=
(
PumpStatusEvent
.
CGM_TREND
.
fromMessageByte
(
statusBuffer
.
get
(
0x40
))
)
;
cgmTrend
=
PumpStatusEvent
.
CGM_TREND
.
fromMessageByte
(
statusBuffer
.
get
(
0x40
));
}
}
// SGV Date
// SGV Date
...
@@ -133,19 +132,20 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
...
@@ -133,19 +132,20 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
// Predictive low suspend
// Predictive low suspend
// TODO - there is more status info in this byte other than just a boolean yes/no
// TODO - there is more status info in this byte other than just a boolean yes/no
lowSuspendActive
=
(
statusBuffer
.
get
(
0x3f
)
!=
0
)
;
lowSuspendActive
=
statusBuffer
.
get
(
0x3f
)
!=
0
;
// Recent Bolus Wizard BGL
// Recent Bolus Wizard BGL
recentBolusWizard
=
(
statusBuffer
.
get
(
0x48
)
!=
0
)
;
recentBolusWizard
=
statusBuffer
.
get
(
0x48
)
!=
0
;
bolusWizardBGL
=
(
statusBuffer
.
getShort
(
0x49
)
&
0x0000ffff
)
;
// In mg/DL
bolusWizardBGL
=
statusBuffer
.
getShort
(
0x49
)
&
0x0000ffff
;
// In mg/DL
}
}
/**
/**
* update pumpRecord with data read from pump
* update pumpRecord with data read from pump
*
*
* @param pumpRecord
* @param pumpRecord
* @param pumpOffset
*/
*/
public
void
updatePumpRecord
(
PumpStatusEvent
pumpRecord
)
{
public
void
updatePumpRecord
(
PumpStatusEvent
pumpRecord
,
long
pumpOffset
)
{
// Status Flags
// Status Flags
pumpRecord
.
setSuspended
(
suspended
);
pumpRecord
.
setSuspended
(
suspended
);
pumpRecord
.
setBolusing
(
bolusing
);
pumpRecord
.
setBolusing
(
bolusing
);
...
@@ -159,6 +159,9 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
...
@@ -159,6 +159,9 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
// Normal basal rate
// Normal basal rate
pumpRecord
.
setBasalRate
(
basalRate
);
pumpRecord
.
setBasalRate
(
basalRate
);
// Temp basal rate
pumpRecord
.
setTempBasalRate
(
tempBasalRate
);
// Temp basal percentage
// Temp basal percentage
pumpRecord
.
setTempBasalPercentage
(
tempBasalPercentage
);
pumpRecord
.
setTempBasalPercentage
(
tempBasalPercentage
);
...
@@ -185,7 +188,7 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
...
@@ -185,7 +188,7 @@ public class PumpStatusResponseMessage extends MedtronicSendMessageResponseMessa
// SGV Date
// SGV Date
pumpRecord
.
setCgmTrend
(
cgmTrend
);
pumpRecord
.
setCgmTrend
(
cgmTrend
);
pumpRecord
.
setEventDate
(
new
Date
(
sgvDate
.
getTime
()
-
pump
Record
.
getPumpTime
Offset
()
));
pumpRecord
.
setEventDate
(
new
Date
(
sgvDate
.
getTime
()
-
pumpOffset
));
// Predictive low suspend
// Predictive low suspend
// TODO - there is more status info in this byte other than just a boolean yes/no
// TODO - there is more status info in this byte other than just a boolean yes/no
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment