lints
This commit is contained in:
parent
02c1bd1e52
commit
d7a8323bc8
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.utils.extensions
|
package info.nightscout.core.ui.extensions
|
||||||
|
|
||||||
import android.widget.RadioGroup
|
import android.widget.RadioGroup
|
||||||
import androidx.appcompat.widget.AppCompatRadioButton
|
import androidx.appcompat.widget.AppCompatRadioButton
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.core.extensions
|
package info.nightscout.core.utils.extensions
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
|
|
|
@ -165,7 +165,7 @@ class AutotuneCore @Inject constructor(
|
||||||
for (i in 0..23) {
|
for (i in 0..23) {
|
||||||
newHourlyBasalProfile[i] = hourlyBasalProfile[i]
|
newHourlyBasalProfile[i] = hourlyBasalProfile[i]
|
||||||
}
|
}
|
||||||
val basalUnTuned = previousAutotune.basalUntuned
|
val basalUnTuned = previousAutotune.basalUnTuned
|
||||||
|
|
||||||
//autotune-core (lib/autotune/index.js) #210-#266
|
//autotune-core (lib/autotune/index.js) #210-#266
|
||||||
// look at net deviations for each hour
|
// look at net deviations for each hour
|
||||||
|
@ -484,7 +484,7 @@ class AutotuneCore @Inject constructor(
|
||||||
previousAutotune.basal = basalProfile
|
previousAutotune.basal = basalProfile
|
||||||
previousAutotune.isf = isf
|
previousAutotune.isf = isf
|
||||||
previousAutotune.ic = Round.roundTo(carbRatio, 0.001)
|
previousAutotune.ic = Round.roundTo(carbRatio, 0.001)
|
||||||
previousAutotune.basalUntuned = basalUnTuned
|
previousAutotune.basalUnTuned = basalUnTuned
|
||||||
previousAutotune.dia = newDia
|
previousAutotune.dia = newDia
|
||||||
previousAutotune.peak = newPeak
|
previousAutotune.peak = newPeak
|
||||||
val localInsulin = LocalInsulin("Ins_$newPeak-$newDia", newPeak, newDia)
|
val localInsulin = LocalInsulin("Ins_$newPeak-$newDia", newPeak, newDia)
|
||||||
|
|
|
@ -89,14 +89,14 @@ class AutotuneFS @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exportPumpProfile(profile: ATProfile) {
|
fun exportPumpProfile(profile: ATProfile) {
|
||||||
createAutotunefile(PUMPPROFILE, profile.profiletoOrefJSON(), true)
|
createAutotunefile(PUMPPROFILE, profile.profileToOrefJSON(), true)
|
||||||
createAutotunefile(PUMPPROFILE, profile.profiletoOrefJSON())
|
createAutotunefile(PUMPPROFILE, profile.profileToOrefJSON())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun exportTunedProfile(tunedProfile: ATProfile) {
|
fun exportTunedProfile(tunedProfile: ATProfile) {
|
||||||
createAutotunefile(TUNEDPROFILE + formatDate(tunedProfile.from) + ".json", tunedProfile.profiletoOrefJSON())
|
createAutotunefile(TUNEDPROFILE + formatDate(tunedProfile.from) + ".json", tunedProfile.profileToOrefJSON())
|
||||||
try {
|
try {
|
||||||
createAutotunefile(rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name) + ".json", tunedProfile.profiletoOrefJSON(), true)
|
createAutotunefile(rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name) + ".json", tunedProfile.profileToOrefJSON(), true)
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ import info.nightscout.interfaces.Constants
|
||||||
import info.nightscout.interfaces.GlucoseUnit
|
import info.nightscout.interfaces.GlucoseUnit
|
||||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
|
import info.nightscout.interfaces.profile.Instantiator
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.profile.Instantiator
|
|
||||||
import info.nightscout.interfaces.profile.ProfileStore
|
import info.nightscout.interfaces.profile.ProfileStore
|
||||||
import info.nightscout.interfaces.ui.UiInteraction
|
import info.nightscout.interfaces.ui.UiInteraction
|
||||||
import info.nightscout.interfaces.utils.MidnightTime
|
import info.nightscout.interfaces.utils.MidnightTime
|
||||||
|
@ -149,12 +149,12 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.autotuneUpdateProfile.setOnClickListener {
|
binding.autotuneUpdateProfile.setOnClickListener {
|
||||||
val localName = autotunePlugin.pumpProfile.profilename
|
val localName = autotunePlugin.pumpProfile.profileName
|
||||||
OKDialog.showConfirmation(requireContext(),
|
OKDialog.showConfirmation(requireContext(),
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune_update_input_profile_button),
|
rh.gs(info.nightscout.core.ui.R.string.autotune_update_input_profile_button),
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune_update_local_profile_message, localName),
|
rh.gs(info.nightscout.core.ui.R.string.autotune_update_local_profile_message, localName),
|
||||||
Runnable {
|
Runnable {
|
||||||
autotunePlugin.tunedProfile?.profilename = localName
|
autotunePlugin.tunedProfile?.profileName = localName
|
||||||
autotunePlugin.updateProfile(autotunePlugin.tunedProfile)
|
autotunePlugin.updateProfile(autotunePlugin.tunedProfile)
|
||||||
autotunePlugin.updateButtonVisibility = View.GONE
|
autotunePlugin.updateButtonVisibility = View.GONE
|
||||||
autotunePlugin.saveLastRun()
|
autotunePlugin.saveLastRun()
|
||||||
|
@ -169,12 +169,12 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.autotuneRevertProfile.setOnClickListener {
|
binding.autotuneRevertProfile.setOnClickListener {
|
||||||
val localName = autotunePlugin.pumpProfile.profilename
|
val localName = autotunePlugin.pumpProfile.profileName
|
||||||
OKDialog.showConfirmation(requireContext(),
|
OKDialog.showConfirmation(requireContext(),
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune_revert_input_profile_button),
|
rh.gs(info.nightscout.core.ui.R.string.autotune_revert_input_profile_button),
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune_revert_local_profile_message, localName),
|
rh.gs(info.nightscout.core.ui.R.string.autotune_revert_local_profile_message, localName),
|
||||||
Runnable {
|
Runnable {
|
||||||
autotunePlugin.tunedProfile?.profilename = ""
|
autotunePlugin.tunedProfile?.profileName = ""
|
||||||
autotunePlugin.updateProfile(autotunePlugin.pumpProfile)
|
autotunePlugin.updateProfile(autotunePlugin.pumpProfile)
|
||||||
autotunePlugin.updateButtonVisibility = View.VISIBLE
|
autotunePlugin.updateButtonVisibility = View.VISIBLE
|
||||||
autotunePlugin.saveLastRun()
|
autotunePlugin.saveLastRun()
|
||||||
|
@ -192,11 +192,11 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
val pumpProfile = profileFunction.getProfile()?.let { currentProfile ->
|
val pumpProfile = profileFunction.getProfile()?.let { currentProfile ->
|
||||||
profileStore.getSpecificProfile(profileName)?.let { specificProfile ->
|
profileStore.getSpecificProfile(profileName)?.let { specificProfile ->
|
||||||
ATProfile(ProfileSealed.Pure(specificProfile), LocalInsulin(""), injector).also {
|
ATProfile(ProfileSealed.Pure(specificProfile), LocalInsulin(""), injector).also {
|
||||||
it.profilename = profileName
|
it.profileName = profileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?: ATProfile(currentProfile, LocalInsulin(""), injector).also {
|
?: ATProfile(currentProfile, LocalInsulin(""), injector).also {
|
||||||
it.profilename = profileFunction.getProfileName()
|
it.profileName = profileFunction.getProfileName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pumpProfile?.let {
|
pumpProfile?.let {
|
||||||
|
@ -205,7 +205,7 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
time = dateUtil.now(),
|
time = dateUtil.now(),
|
||||||
mode = UiInteraction.Mode.CUSTOM_PROFILE,
|
mode = UiInteraction.Mode.CUSTOM_PROFILE,
|
||||||
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
||||||
customProfileName = pumpProfile.profilename
|
customProfileName = pumpProfile.profileName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
time = dateUtil.now(),
|
time = dateUtil.now(),
|
||||||
mode = UiInteraction.Mode.PROFILE_COMPARE,
|
mode = UiInteraction.Mode.PROFILE_COMPARE,
|
||||||
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
customProfile = pumpProfile.profile.toPureNsJson(dateUtil).toString(),
|
||||||
customProfileName = pumpProfile.profilename + "\n" + rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name),
|
customProfileName = pumpProfile.profileName + "\n" + rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name),
|
||||||
customProfile2 = tunedProfile?.toPureNsJson(dateUtil).toString()
|
customProfile2 = tunedProfile?.toPureNsJson(dateUtil).toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -231,17 +231,17 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
tunedProfile?.let { tunedP ->
|
tunedProfile?.let { tunedP ->
|
||||||
tunedP.profileStore(circadian)?.let {
|
tunedP.profileStore(circadian)?.let {
|
||||||
OKDialog.showConfirmation(requireContext(),
|
OKDialog.showConfirmation(requireContext(),
|
||||||
rh.gs(info.nightscout.core.ui.R.string.activate_profile) + ": " + tunedP.profilename + " ?",
|
rh.gs(info.nightscout.core.ui.R.string.activate_profile) + ": " + tunedP.profileName + " ?",
|
||||||
{
|
{
|
||||||
uel.log(
|
uel.log(
|
||||||
UserEntry.Action.STORE_PROFILE,
|
UserEntry.Action.STORE_PROFILE,
|
||||||
UserEntry.Sources.Autotune,
|
UserEntry.Sources.Autotune,
|
||||||
ValueWithUnit.SimpleString(tunedP.profilename)
|
ValueWithUnit.SimpleString(tunedP.profileName)
|
||||||
)
|
)
|
||||||
val now = dateUtil.now()
|
val now = dateUtil.now()
|
||||||
if (profileFunction.createProfileSwitch(
|
if (profileFunction.createProfileSwitch(
|
||||||
it,
|
it,
|
||||||
profileName = tunedP.profilename,
|
profileName = tunedP.profileName,
|
||||||
durationInMinutes = 0,
|
durationInMinutes = 0,
|
||||||
percentage = 100,
|
percentage = 100,
|
||||||
timeShiftInHours = 0,
|
timeShiftInHours = 0,
|
||||||
|
@ -252,7 +252,7 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
UserEntry.Action.PROFILE_SWITCH,
|
UserEntry.Action.PROFILE_SWITCH,
|
||||||
UserEntry.Sources.Autotune,
|
UserEntry.Sources.Autotune,
|
||||||
"Autotune AutoSwitch",
|
"Autotune AutoSwitch",
|
||||||
ValueWithUnit.SimpleString(autotunePlugin.tunedProfile!!.profilename)
|
ValueWithUnit.SimpleString(autotunePlugin.tunedProfile!!.profileName)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
rxBus.send(EventLocalProfileChanged())
|
rxBus.send(EventLocalProfileChanged())
|
||||||
|
@ -472,7 +472,7 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
val time = df.format(h.toLong()) + ":00"
|
val time = df.format(h.toLong()) + ":00"
|
||||||
totalPump += autotunePlugin.pumpProfile.basal[h]
|
totalPump += autotunePlugin.pumpProfile.basal[h]
|
||||||
totalTuned += tuned.basal[h]
|
totalTuned += tuned.basal[h]
|
||||||
layout.addView(toTableRowValue(context, time, autotunePlugin.pumpProfile.basal[h], tuned.basal[h], "%.3f", tuned.basalUntuned[h].toString()))
|
layout.addView(toTableRowValue(context, time, autotunePlugin.pumpProfile.basal[h], tuned.basal[h], "%.3f", tuned.basalUnTuned[h].toString()))
|
||||||
}
|
}
|
||||||
layout.addView(toTableRowValue(context, "∑", totalPump, totalTuned, "%.3f", " "))
|
layout.addView(toTableRowValue(context, "∑", totalPump, totalTuned, "%.3f", " "))
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
import info.nightscout.interfaces.plugin.PluginBase
|
||||||
import info.nightscout.interfaces.plugin.PluginDescription
|
import info.nightscout.interfaces.plugin.PluginDescription
|
||||||
import info.nightscout.interfaces.plugin.PluginType
|
import info.nightscout.interfaces.plugin.PluginType
|
||||||
|
import info.nightscout.interfaces.profile.Instantiator
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.profile.Instantiator
|
|
||||||
import info.nightscout.interfaces.utils.JsonHelper
|
import info.nightscout.interfaces.utils.JsonHelper
|
||||||
import info.nightscout.interfaces.utils.MidnightTime
|
import info.nightscout.interfaces.utils.MidnightTime
|
||||||
import info.nightscout.plugins.aps.R
|
import info.nightscout.plugins.aps.R
|
||||||
|
@ -131,10 +131,10 @@ class AutotunePlugin @Inject constructor(
|
||||||
val starttime = endTime - daysBack * 24 * 60 * 60 * 1000L
|
val starttime = endTime - daysBack * 24 * 60 * 60 * 1000L
|
||||||
autotuneFS.exportSettings(settings(lastRun, daysBack, starttime, endTime))
|
autotuneFS.exportSettings(settings(lastRun, daysBack, starttime, endTime))
|
||||||
tunedProfile = ATProfile(profile, localInsulin, injector).also {
|
tunedProfile = ATProfile(profile, localInsulin, injector).also {
|
||||||
it.profilename = rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name)
|
it.profileName = rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name)
|
||||||
}
|
}
|
||||||
pumpProfile = ATProfile(profile, localInsulin, injector).also {
|
pumpProfile = ATProfile(profile, localInsulin, injector).also {
|
||||||
it.profilename = selectedProfile
|
it.profileName = selectedProfile
|
||||||
}
|
}
|
||||||
autotuneFS.exportPumpProfile(pumpProfile)
|
autotuneFS.exportPumpProfile(pumpProfile)
|
||||||
|
|
||||||
|
@ -195,31 +195,31 @@ class AutotunePlugin @Inject constructor(
|
||||||
if (autoSwitch) {
|
if (autoSwitch) {
|
||||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||||
tunedProfile?.let { tunedP ->
|
tunedProfile?.let { tunedP ->
|
||||||
tunedP.profilename = pumpProfile.profilename
|
tunedP.profileName = pumpProfile.profileName
|
||||||
updateProfile(tunedP)
|
updateProfile(tunedP)
|
||||||
uel.log(
|
uel.log(
|
||||||
UserEntry.Action.STORE_PROFILE,
|
UserEntry.Action.STORE_PROFILE,
|
||||||
UserEntry.Sources.Automation,
|
UserEntry.Sources.Automation,
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune),
|
rh.gs(info.nightscout.core.ui.R.string.autotune),
|
||||||
ValueWithUnit.SimpleString(tunedP.profilename)
|
ValueWithUnit.SimpleString(tunedP.profileName)
|
||||||
)
|
)
|
||||||
updateButtonVisibility = View.GONE
|
updateButtonVisibility = View.GONE
|
||||||
tunedP.profileStore(circadian)?.let { profilestore ->
|
tunedP.profileStore(circadian)?.let { profilestore ->
|
||||||
if (profileFunction.createProfileSwitch(
|
if (profileFunction.createProfileSwitch(
|
||||||
profilestore,
|
profilestore,
|
||||||
profileName = tunedP.profilename,
|
profileName = tunedP.profileName,
|
||||||
durationInMinutes = 0,
|
durationInMinutes = 0,
|
||||||
percentage = 100,
|
percentage = 100,
|
||||||
timeShiftInHours = 0,
|
timeShiftInHours = 0,
|
||||||
timestamp = dateUtil.now()
|
timestamp = dateUtil.now()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
log("Profile Switch succeed ${tunedP.profilename}")
|
log("Profile Switch succeed ${tunedP.profileName}")
|
||||||
uel.log(
|
uel.log(
|
||||||
UserEntry.Action.PROFILE_SWITCH,
|
UserEntry.Action.PROFILE_SWITCH,
|
||||||
UserEntry.Sources.Automation,
|
UserEntry.Sources.Automation,
|
||||||
rh.gs(info.nightscout.core.ui.R.string.autotune),
|
rh.gs(info.nightscout.core.ui.R.string.autotune),
|
||||||
ValueWithUnit.SimpleString(tunedP.profilename)
|
ValueWithUnit.SimpleString(tunedP.profileName)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
rxBus.send(EventLocalProfileChanged())
|
rxBus.send(EventLocalProfileChanged())
|
||||||
|
@ -262,7 +262,7 @@ class AutotunePlugin @Inject constructor(
|
||||||
totalBasal += pumpProfile.basal[i]
|
totalBasal += pumpProfile.basal[i]
|
||||||
totalTuned += tunedProfile.basal[i]
|
totalTuned += tunedProfile.basal[i]
|
||||||
val percentageChangeValue = tunedProfile.basal[i] / pumpProfile.basal[i] * 100 - 100
|
val percentageChangeValue = tunedProfile.basal[i] / pumpProfile.basal[i] * 100 - 100
|
||||||
strResult += rh.gs(info.nightscout.core.ui.R.string.autotune_log_basal, i.toDouble(), pumpProfile.basal[i], tunedProfile.basal[i], tunedProfile.basalUntuned[i], percentageChangeValue)
|
strResult += rh.gs(info.nightscout.core.ui.R.string.autotune_log_basal, i.toDouble(), pumpProfile.basal[i], tunedProfile.basal[i], tunedProfile.basalUnTuned[i], percentageChangeValue)
|
||||||
}
|
}
|
||||||
strResult += line
|
strResult += line
|
||||||
strResult += rh.gs(info.nightscout.core.ui.R.string.autotune_log_sum_basal, totalBasal, totalTuned)
|
strResult += rh.gs(info.nightscout.core.ui.R.string.autotune_log_sum_basal, totalBasal, totalTuned)
|
||||||
|
@ -329,10 +329,10 @@ class AutotunePlugin @Inject constructor(
|
||||||
val profileList: ArrayList<CharSequence> = profileStore.getProfileList()
|
val profileList: ArrayList<CharSequence> = profileStore.getProfileList()
|
||||||
var indexLocalProfile = -1
|
var indexLocalProfile = -1
|
||||||
for (p in profileList.indices)
|
for (p in profileList.indices)
|
||||||
if (profileList[p] == newProfile.profilename)
|
if (profileList[p] == newProfile.profileName)
|
||||||
indexLocalProfile = p
|
indexLocalProfile = p
|
||||||
if (indexLocalProfile == -1) {
|
if (indexLocalProfile == -1) {
|
||||||
profilePlugin.addProfile(profilePlugin.copyFrom(newProfile.getProfile(circadian), newProfile.profilename))
|
profilePlugin.addProfile(profilePlugin.copyFrom(newProfile.getProfile(circadian), newProfile.profileName))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
profilePlugin.currentProfileIndex = indexLocalProfile
|
profilePlugin.currentProfileIndex = indexLocalProfile
|
||||||
|
@ -348,17 +348,17 @@ class AutotunePlugin @Inject constructor(
|
||||||
json.put("lastNbDays", lastNbDays)
|
json.put("lastNbDays", lastNbDays)
|
||||||
json.put("lastRun", lastRun)
|
json.put("lastRun", lastRun)
|
||||||
json.put("pumpProfile", pumpProfile.profile.toPureNsJson(dateUtil))
|
json.put("pumpProfile", pumpProfile.profile.toPureNsJson(dateUtil))
|
||||||
json.put("pumpProfileName", pumpProfile.profilename)
|
json.put("pumpProfileName", pumpProfile.profileName)
|
||||||
json.put("pumpPeak", pumpProfile.peak)
|
json.put("pumpPeak", pumpProfile.peak)
|
||||||
json.put("pumpDia", pumpProfile.dia)
|
json.put("pumpDia", pumpProfile.dia)
|
||||||
tunedProfile?.let { atProfile ->
|
tunedProfile?.let { atProfile ->
|
||||||
json.put("tunedProfile", atProfile.profile.toPureNsJson(dateUtil))
|
json.put("tunedProfile", atProfile.profile.toPureNsJson(dateUtil))
|
||||||
json.put("tunedCircadianProfile", atProfile.circadianProfile.toPureNsJson(dateUtil))
|
json.put("tunedCircadianProfile", atProfile.circadianProfile.toPureNsJson(dateUtil))
|
||||||
json.put("tunedProfileName", atProfile.profilename)
|
json.put("tunedProfileName", atProfile.profileName)
|
||||||
json.put("tunedPeak", atProfile.peak)
|
json.put("tunedPeak", atProfile.peak)
|
||||||
json.put("tunedDia", atProfile.dia)
|
json.put("tunedDia", atProfile.dia)
|
||||||
for (i in 0..23) {
|
for (i in 0..23) {
|
||||||
json.put("missingDays_$i", atProfile.basalUntuned[i])
|
json.put("missingDays_$i", atProfile.basalUnTuned[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json.put("result", result)
|
json.put("result", result)
|
||||||
|
@ -379,7 +379,7 @@ class AutotunePlugin @Inject constructor(
|
||||||
selectedProfile = JsonHelper.safeGetString(json, "pumpProfileName", "")
|
selectedProfile = JsonHelper.safeGetString(json, "pumpProfileName", "")
|
||||||
val profile = JsonHelper.safeGetJSONObject(json, "pumpProfile", null)?.let { pureProfileFromJson(it, dateUtil) }
|
val profile = JsonHelper.safeGetJSONObject(json, "pumpProfile", null)?.let { pureProfileFromJson(it, dateUtil) }
|
||||||
?: return
|
?: return
|
||||||
pumpProfile = ATProfile(ProfileSealed.Pure(profile), localInsulin, injector).also { it.profilename = selectedProfile }
|
pumpProfile = ATProfile(ProfileSealed.Pure(profile), localInsulin, injector).also { it.profileName = selectedProfile }
|
||||||
val tunedPeak = JsonHelper.safeGetInt(json, "tunedPeak")
|
val tunedPeak = JsonHelper.safeGetInt(json, "tunedPeak")
|
||||||
val tunedDia = JsonHelper.safeGetDouble(json, "tunedDia")
|
val tunedDia = JsonHelper.safeGetDouble(json, "tunedDia")
|
||||||
localInsulin = LocalInsulin("PumpInsulin", tunedPeak, tunedDia)
|
localInsulin = LocalInsulin("PumpInsulin", tunedPeak, tunedDia)
|
||||||
|
@ -389,10 +389,10 @@ class AutotunePlugin @Inject constructor(
|
||||||
val circadianTuned = JsonHelper.safeGetJSONObject(json, "tunedCircadianProfile", null)?.let { pureProfileFromJson(it, dateUtil) }
|
val circadianTuned = JsonHelper.safeGetJSONObject(json, "tunedCircadianProfile", null)?.let { pureProfileFromJson(it, dateUtil) }
|
||||||
?: return
|
?: return
|
||||||
tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile ->
|
tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile ->
|
||||||
atProfile.profilename = tunedProfileName
|
atProfile.profileName = tunedProfileName
|
||||||
atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned)
|
atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned)
|
||||||
for (i in 0..23) {
|
for (i in 0..23) {
|
||||||
atProfile.basalUntuned[i] = JsonHelper.safeGetInt(json, "missingDays_$i")
|
atProfile.basalUnTuned[i] = JsonHelper.safeGetInt(json, "missingDays_$i")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = JsonHelper.safeGetString(json, "result", "")
|
result = JsonHelper.safeGetString(json, "result", "")
|
||||||
|
|
|
@ -10,13 +10,15 @@ import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.GlucoseUnit
|
import info.nightscout.interfaces.GlucoseUnit
|
||||||
import info.nightscout.interfaces.insulin.Insulin
|
import info.nightscout.interfaces.insulin.Insulin
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
|
import info.nightscout.interfaces.profile.Instantiator
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.profile.Instantiator
|
|
||||||
import info.nightscout.interfaces.profile.ProfileStore
|
import info.nightscout.interfaces.profile.ProfileStore
|
||||||
import info.nightscout.interfaces.profile.PureProfile
|
import info.nightscout.interfaces.profile.PureProfile
|
||||||
import info.nightscout.interfaces.utils.Round
|
import info.nightscout.interfaces.utils.Round
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -28,6 +30,7 @@ import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.TimeZone
|
import java.util.TimeZone
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector: HasAndroidInjector) {
|
class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector: HasAndroidInjector) {
|
||||||
|
|
||||||
|
@ -39,30 +42,31 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
@Inject lateinit var rxBus: RxBus
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var instantiator: Instantiator
|
@Inject lateinit var instantiator: Instantiator
|
||||||
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
|
|
||||||
var profile: ProfileSealed
|
var profile: ProfileSealed
|
||||||
var circadianProfile: ProfileSealed
|
var circadianProfile: ProfileSealed
|
||||||
lateinit var pumpProfile: ProfileSealed
|
private lateinit var pumpProfile: ProfileSealed
|
||||||
var profilename: String = ""
|
var profileName: String = ""
|
||||||
var basal = DoubleArray(24)
|
var basal = DoubleArray(24)
|
||||||
var basalUntuned = IntArray(24)
|
var basalUnTuned = IntArray(24)
|
||||||
var ic = 0.0
|
var ic = 0.0
|
||||||
var isf = 0.0
|
var isf = 0.0
|
||||||
var dia = 0.0
|
var dia = 0.0
|
||||||
var peak = 0
|
var peak = 0
|
||||||
var isValid: Boolean = false
|
var isValid: Boolean = false
|
||||||
var from: Long = 0
|
var from: Long = 0
|
||||||
var pumpProfileAvgISF = 0.0
|
private var pumpProfileAvgISF = 0.0
|
||||||
var pumpProfileAvgIC = 0.0
|
private var pumpProfileAvgIC = 0.0
|
||||||
|
|
||||||
val icSize: Int
|
val icSize: Int
|
||||||
get() = profile.getIcsValues().size
|
get() = profile.getIcsValues().size
|
||||||
val isfSize: Int
|
val isfSize: Int
|
||||||
get() = profile.getIsfsMgdlValues().size
|
get() = profile.getIsfsMgdlValues().size
|
||||||
val avgISF: Double
|
private val avgISF: Double
|
||||||
get() = if (profile.getIsfsMgdlValues().size == 1) profile.getIsfsMgdlValues().get(0).value else Round.roundTo(averageProfileValue(profile.getIsfsMgdlValues()), 0.01)
|
get() = if (profile.getIsfsMgdlValues().size == 1) profile.getIsfsMgdlValues()[0].value else Round.roundTo(averageProfileValue(profile.getIsfsMgdlValues()), 0.01)
|
||||||
val avgIC: Double
|
private val avgIC: Double
|
||||||
get() = if (profile.getIcsValues().size == 1) profile.getIcsValues().get(0).value else Round.roundTo(averageProfileValue(profile.getIcsValues()), 0.01)
|
get() = if (profile.getIcsValues().size == 1) profile.getIcsValues()[0].value else Round.roundTo(averageProfileValue(profile.getIcsValues()), 0.01)
|
||||||
|
|
||||||
fun getBasal(timestamp: Long): Double = basal[MidnightUtils.secondsFromMidnight(timestamp) / 3600]
|
fun getBasal(timestamp: Long): Double = basal[MidnightUtils.secondsFromMidnight(timestamp) / 3600]
|
||||||
|
|
||||||
|
@ -94,12 +98,12 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
|
|
||||||
//Export json string with oref0 format used for autotune
|
//Export json string with oref0 format used for autotune
|
||||||
// Include min_5m_carbimpact, insulin type, single value for carb_ratio and isf
|
// Include min_5m_carbimpact, insulin type, single value for carb_ratio and isf
|
||||||
fun profiletoOrefJSON(): String {
|
fun profileToOrefJSON(): String {
|
||||||
var jsonString = ""
|
var jsonString = ""
|
||||||
val json = JSONObject()
|
val json = JSONObject()
|
||||||
val insulinInterface: Insulin = activePlugin.activeInsulin
|
val insulinInterface: Insulin = activePlugin.activeInsulin
|
||||||
try {
|
try {
|
||||||
json.put("name", profilename)
|
json.put("name", profileName)
|
||||||
json.put("min_5m_carbimpact", sp.getDouble("openapsama_min_5m_carbimpact", 3.0))
|
json.put("min_5m_carbimpact", sp.getDouble("openapsama_min_5m_carbimpact", 3.0))
|
||||||
json.put("dia", dia)
|
json.put("dia", dia)
|
||||||
if (insulinInterface.id === Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING) json.put(
|
if (insulinInterface.id === Insulin.InsulinType.OREF_ULTRA_RAPID_ACTING) json.put(
|
||||||
|
@ -110,32 +114,31 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
json.put("useCustomPeakTime", true)
|
json.put("useCustomPeakTime", true)
|
||||||
json.put("insulinPeakTime", 45)
|
json.put("insulinPeakTime", 45)
|
||||||
} else if (insulinInterface.id === Insulin.InsulinType.OREF_FREE_PEAK) {
|
} else if (insulinInterface.id === Insulin.InsulinType.OREF_FREE_PEAK) {
|
||||||
val peaktime: Int = sp.getInt(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak), 75)
|
val peakTime: Int = sp.getInt(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak), 75)
|
||||||
json.put("curve", if (peaktime > 50) "rapid-acting" else "ultra-rapid")
|
json.put("curve", if (peakTime > 50) "rapid-acting" else "ultra-rapid")
|
||||||
json.put("useCustomPeakTime", true)
|
json.put("useCustomPeakTime", true)
|
||||||
json.put("insulinPeakTime", peaktime)
|
json.put("insulinPeakTime", peakTime)
|
||||||
}
|
}
|
||||||
val basals = JSONArray()
|
val basals = JSONArray()
|
||||||
for (h in 0..23) {
|
for (h in 0..23) {
|
||||||
val secondfrommidnight = h * 60 * 60
|
val secondFromMidnight = h * 60 * 60
|
||||||
var time: String
|
val time: String = DecimalFormat("00").format(h) + ":00:00"
|
||||||
time = DecimalFormat("00").format(h) + ":00:00"
|
|
||||||
basals.put(
|
basals.put(
|
||||||
JSONObject()
|
JSONObject()
|
||||||
.put("start", time)
|
.put("start", time)
|
||||||
.put("minutes", h * 60)
|
.put("minutes", h * 60)
|
||||||
.put(
|
.put(
|
||||||
"rate", profile.getBasalTimeFromMidnight(secondfrommidnight)
|
"rate", profile.getBasalTimeFromMidnight(secondFromMidnight)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
json.put("basalprofile", basals)
|
json.put("basalprofile", basals)
|
||||||
val isfvalue = Round.roundTo(avgISF, 0.001)
|
val isfValue = Round.roundTo(avgISF, 0.001)
|
||||||
json.put(
|
json.put(
|
||||||
"isfProfile",
|
"isfProfile",
|
||||||
JSONObject().put(
|
JSONObject().put(
|
||||||
"sensitivities",
|
"sensitivities",
|
||||||
JSONArray().put(JSONObject().put("i", 0).put("start", "00:00:00").put("sensitivity", isfvalue).put("offset", 0).put("x", 0).put("endoffset", 1440))
|
JSONArray().put(JSONObject().put("i", 0).put("start", "00:00:00").put("sensitivity", isfValue).put("offset", 0).put("x", 0).put("endoffset", 1440))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
json.put("carb_ratio", avgIC)
|
json.put("carb_ratio", avgIC)
|
||||||
|
@ -145,6 +148,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
json.put("timezone", TimeZone.getDefault().id)
|
json.put("timezone", TimeZone.getDefault().id)
|
||||||
jsonString = json.toString(2).replace("\\/", "/")
|
jsonString = json.toString(2).replace("\\/", "/")
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
|
aapsLogger.error(LTag.CORE, e.stackTraceToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonString
|
return jsonString
|
||||||
|
@ -163,6 +167,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
}
|
}
|
||||||
json.put("basal", jsonArray(basal))
|
json.put("basal", jsonArray(basal))
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
|
aapsLogger.error(LTag.CORE, e.stackTraceToString())
|
||||||
}
|
}
|
||||||
return pureProfileFromJson(json, dateUtil, profile.units.asText)
|
return pureProfileFromJson(json, dateUtil, profile.units.asText)
|
||||||
}
|
}
|
||||||
|
@ -172,36 +177,37 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
val json = JSONObject()
|
val json = JSONObject()
|
||||||
val store = JSONObject()
|
val store = JSONObject()
|
||||||
val tunedProfile = if (circadian) circadianProfile else profile
|
val tunedProfile = if (circadian) circadianProfile else profile
|
||||||
if (profilename.isEmpty())
|
if (profileName.isEmpty())
|
||||||
profilename = rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name)
|
profileName = rh.gs(info.nightscout.core.ui.R.string.autotune_tunedprofile_name)
|
||||||
try {
|
try {
|
||||||
store.put(profilename, tunedProfile.toPureNsJson(dateUtil))
|
store.put(profileName, tunedProfile.toPureNsJson(dateUtil))
|
||||||
json.put("defaultProfile", profilename)
|
json.put("defaultProfile", profileName)
|
||||||
json.put("store", store)
|
json.put("store", store)
|
||||||
json.put("startDate", dateUtil.toISOAsUTC(dateUtil.now()))
|
json.put("startDate", dateUtil.toISOAsUTC(dateUtil.now()))
|
||||||
profileStore = instantiator.provideProfileStore(json)
|
profileStore = instantiator.provideProfileStore(json)
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
|
aapsLogger.error(LTag.CORE, e.stackTraceToString())
|
||||||
}
|
}
|
||||||
return profileStore
|
return profileStore
|
||||||
}
|
}
|
||||||
|
|
||||||
fun jsonArray(values: DoubleArray): JSONArray {
|
private fun jsonArray(values: DoubleArray): JSONArray {
|
||||||
val json = JSONArray()
|
val json = JSONArray()
|
||||||
for (h in 0..23) {
|
for (h in 0..23) {
|
||||||
val secondfrommidnight = h * 60 * 60
|
val secondFromMidnight = h * 60 * 60
|
||||||
val df = DecimalFormat("00")
|
val df = DecimalFormat("00")
|
||||||
val time = df.format(h.toLong()) + ":00"
|
val time = df.format(h.toLong()) + ":00"
|
||||||
json.put(
|
json.put(
|
||||||
JSONObject()
|
JSONObject()
|
||||||
.put("time", time)
|
.put("time", time)
|
||||||
.put("timeAsSeconds", secondfrommidnight)
|
.put("timeAsSeconds", secondFromMidnight)
|
||||||
.put("value", values[h])
|
.put("value", values[h])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
fun jsonArray(value: Double) =
|
private fun jsonArray(value: Double): JSONArray =
|
||||||
JSONArray().put(
|
JSONArray().put(
|
||||||
JSONObject()
|
JSONObject()
|
||||||
.put("time", "00:00")
|
.put("time", "00:00")
|
||||||
|
@ -209,7 +215,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
.put("value", value)
|
.put("value", value)
|
||||||
)
|
)
|
||||||
|
|
||||||
fun jsonArray(values: List<Block>, multiplier: Double = 1.0): JSONArray {
|
private fun jsonArray(values: List<Block>, multiplier: Double = 1.0): JSONArray {
|
||||||
val json = JSONArray()
|
val json = JSONArray()
|
||||||
var elapsedHours = 0L
|
var elapsedHours = 0L
|
||||||
values.forEach {
|
values.forEach {
|
||||||
|
@ -249,7 +255,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
||||||
var minBasal = 1.0
|
var minBasal = 1.0
|
||||||
for (h in 0..23) {
|
for (h in 0..23) {
|
||||||
basal[h] = Round.roundTo(profile.basalBlocks.blockValueBySeconds(T.hours(h.toLong()).secs().toInt(), 1.0, 0), 0.001)
|
basal[h] = Round.roundTo(profile.basalBlocks.blockValueBySeconds(T.hours(h.toLong()).secs().toInt(), 1.0, 0), 0.001)
|
||||||
minBasal = Math.min(minBasal, basal[h])
|
minBasal = min(minBasal, basal[h])
|
||||||
}
|
}
|
||||||
ic = avgIC
|
ic = avgIC
|
||||||
isf = avgISF
|
isf = avgISF
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.plugins.constraints.safety
|
package info.nightscout.plugins.constraints.safety
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.extensions.putDouble
|
import info.nightscout.core.utils.extensions.putDouble
|
||||||
import info.nightscout.core.extensions.putInt
|
import info.nightscout.core.utils.extensions.putInt
|
||||||
import info.nightscout.core.extensions.putString
|
import info.nightscout.core.utils.extensions.putString
|
||||||
import info.nightscout.core.extensions.storeDouble
|
import info.nightscout.core.utils.extensions.storeDouble
|
||||||
import info.nightscout.core.extensions.storeInt
|
import info.nightscout.core.utils.extensions.storeInt
|
||||||
import info.nightscout.core.extensions.storeString
|
import info.nightscout.core.utils.extensions.storeString
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.constraints.Constraint
|
import info.nightscout.interfaces.constraints.Constraint
|
||||||
import info.nightscout.interfaces.constraints.Constraints
|
import info.nightscout.interfaces.constraints.Constraints
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.insulin
|
package info.nightscout.insulin
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.extensions.putInt
|
import info.nightscout.core.utils.extensions.putInt
|
||||||
import info.nightscout.core.extensions.storeInt
|
import info.nightscout.core.utils.extensions.storeInt
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.insulin.Insulin
|
import info.nightscout.interfaces.insulin.Insulin
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
|
|
|
@ -7,14 +7,14 @@ import androidx.preference.SwitchPreference
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.events.EventIobCalculationProgress
|
import info.nightscout.core.events.EventIobCalculationProgress
|
||||||
import info.nightscout.core.events.EventNewNotification
|
import info.nightscout.core.events.EventNewNotification
|
||||||
import info.nightscout.core.extensions.putDouble
|
|
||||||
import info.nightscout.core.extensions.putInt
|
|
||||||
import info.nightscout.core.extensions.putString
|
|
||||||
import info.nightscout.core.extensions.storeDouble
|
|
||||||
import info.nightscout.core.extensions.storeInt
|
|
||||||
import info.nightscout.core.extensions.storeString
|
|
||||||
import info.nightscout.core.graph.OverviewData
|
import info.nightscout.core.graph.OverviewData
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
|
import info.nightscout.core.utils.extensions.putDouble
|
||||||
|
import info.nightscout.core.utils.extensions.putInt
|
||||||
|
import info.nightscout.core.utils.extensions.putString
|
||||||
|
import info.nightscout.core.utils.extensions.storeDouble
|
||||||
|
import info.nightscout.core.utils.extensions.storeInt
|
||||||
|
import info.nightscout.core.utils.extensions.storeString
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.Overview
|
import info.nightscout.interfaces.Overview
|
||||||
|
|
|
@ -10,9 +10,9 @@ import android.view.WindowManager
|
||||||
import com.google.android.material.timepicker.MaterialTimePicker
|
import com.google.android.material.timepicker.MaterialTimePicker
|
||||||
import com.google.android.material.timepicker.TimeFormat
|
import com.google.android.material.timepicker.TimeFormat
|
||||||
import dagger.android.support.DaggerDialogFragment
|
import dagger.android.support.DaggerDialogFragment
|
||||||
import info.nightscout.androidaps.utils.extensions.selectedItemPosition
|
import info.nightscout.core.ui.extensions.selectedItemPosition
|
||||||
import info.nightscout.androidaps.utils.extensions.setEnableForChildren
|
import info.nightscout.core.ui.extensions.setEnableForChildren
|
||||||
import info.nightscout.androidaps.utils.extensions.setSelection
|
import info.nightscout.core.ui.extensions.setSelection
|
||||||
import info.nightscout.core.wizard.QuickWizard
|
import info.nightscout.core.wizard.QuickWizard
|
||||||
import info.nightscout.core.wizard.QuickWizardEntry
|
import info.nightscout.core.wizard.QuickWizardEntry
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.plugins.R
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.plugins.general.wear.events.EventWearUpdateGui
|
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.plugins.databinding.WearFragmentBinding
|
import info.nightscout.plugins.databinding.WearFragmentBinding
|
||||||
|
import info.nightscout.plugins.general.wear.events.EventWearUpdateGui
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventMobileToWear
|
import info.nightscout.rx.events.EventMobileToWear
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.wear.events
|
package info.nightscout.plugins.general.wear.events
|
||||||
|
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import com.google.android.gms.wearable.PutDataMapRequest
|
||||||
import com.google.android.gms.wearable.Wearable
|
import com.google.android.gms.wearable.Wearable
|
||||||
import com.google.android.gms.wearable.WearableListenerService
|
import com.google.android.gms.wearable.WearableListenerService
|
||||||
import dagger.android.AndroidInjection
|
import dagger.android.AndroidInjection
|
||||||
import info.nightscout.androidaps.plugins.general.wear.events.EventWearUpdateGui
|
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
|
@ -27,6 +26,7 @@ import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.receivers.ReceiverStatusStore
|
import info.nightscout.interfaces.receivers.ReceiverStatusStore
|
||||||
import info.nightscout.plugins.R
|
import info.nightscout.plugins.R
|
||||||
import info.nightscout.plugins.general.wear.WearPlugin
|
import info.nightscout.plugins.general.wear.WearPlugin
|
||||||
|
import info.nightscout.plugins.general.wear.events.EventWearUpdateGui
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventMobileToWear
|
import info.nightscout.rx.events.EventMobileToWear
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.danars.di
|
package info.nightscout.pump.combo.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.pump.combo.di
|
package info.nightscout.pump.combo.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import info.nightscout.androidaps.danars.di.ComboActivitiesModule
|
|
||||||
|
|
||||||
@Module(includes = [
|
@Module(includes = [
|
||||||
ComboActivitiesModule::class
|
ComboActivitiesModule::class
|
||||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.pump.diaconn.packet
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
||||||
import info.nightscout.pump.diaconn.R
|
import info.nightscout.pump.diaconn.R
|
||||||
import info.nightscout.pump.diaconn.pumplog.PumplogUtil
|
import info.nightscout.pump.diaconn.pumplog.PumpLogUtil
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -39,7 +39,7 @@ class BasalLimitInquireResponsePacket(injector: HasAndroidInjector) : DiaconnG8P
|
||||||
}
|
}
|
||||||
diaconnG8Pump.maxBasalPerHours = getShortToInt(bufferData).toDouble() / 100.0 // not include tempbasal limit
|
diaconnG8Pump.maxBasalPerHours = getShortToInt(bufferData).toDouble() / 100.0 // not include tempbasal limit
|
||||||
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
||||||
if(pumpFirmwareVersion.isNotEmpty() && PumplogUtil.isPumpVersionGe(pumpFirmwareVersion, 3, 0)) {
|
if(pumpFirmwareVersion.isNotEmpty() && PumpLogUtil.isPumpVersionGe(pumpFirmwareVersion, 3, 0)) {
|
||||||
diaconnG8Pump.maxBasal = diaconnG8Pump.maxBasalPerHours * 2.5 // include tempbasal
|
diaconnG8Pump.maxBasal = diaconnG8Pump.maxBasalPerHours * 2.5 // include tempbasal
|
||||||
} else {
|
} else {
|
||||||
diaconnG8Pump.maxBasal = diaconnG8Pump.maxBasalPerHours * 2.0 // include tempbasal
|
diaconnG8Pump.maxBasal = diaconnG8Pump.maxBasalPerHours * 2.0 // include tempbasal
|
||||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.pump.diaconn.packet
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
||||||
import info.nightscout.pump.diaconn.R
|
import info.nightscout.pump.diaconn.R
|
||||||
import info.nightscout.pump.diaconn.pumplog.PumplogUtil
|
import info.nightscout.pump.diaconn.pumplog.PumpLogUtil
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -214,7 +214,7 @@ class BigAPSMainInfoInquireResponsePacket(
|
||||||
diaconnG8Pump.pumpProfiles!![diaconnG8Pump.activeProfile][23] = diaconnG8Pump.baseAmount24
|
diaconnG8Pump.pumpProfiles!![diaconnG8Pump.activeProfile][23] = diaconnG8Pump.baseAmount24
|
||||||
|
|
||||||
//incarnation no 처리
|
//incarnation no 처리
|
||||||
diaconnG8Pump.isPumpVersionGe2_63 = PumplogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
||||||
|
|
|
@ -19,32 +19,32 @@ import info.nightscout.pump.diaconn.api.PumpLogDto
|
||||||
import info.nightscout.pump.diaconn.common.RecordTypes
|
import info.nightscout.pump.diaconn.common.RecordTypes
|
||||||
import info.nightscout.pump.diaconn.database.DiaconnHistoryRecord
|
import info.nightscout.pump.diaconn.database.DiaconnHistoryRecord
|
||||||
import info.nightscout.pump.diaconn.database.DiaconnHistoryRecordDao
|
import info.nightscout.pump.diaconn.database.DiaconnHistoryRecordDao
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_ALARM_BATTERY
|
import info.nightscout.pump.diaconn.pumplog.LogAlarmBattery
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_ALARM_BLOCK
|
import info.nightscout.pump.diaconn.pumplog.LogAlarmBlock
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_ALARM_SHORTAGE
|
import info.nightscout.pump.diaconn.pumplog.LogAlarmShortAge
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_CHANGE_INJECTOR_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogChangeInjectorSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_CHANGE_NEEDLE_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogChangeNeedleSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_CHANGE_TUBE_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogChangeTubeSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECTION_1DAY
|
import info.nightscout.pump.diaconn.pumplog.LogInjectDualFail
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECTION_1DAY_BASAL
|
import info.nightscout.pump.diaconn.pumplog.LogInjectDualSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECTION_1HOUR_BASAL
|
import info.nightscout.pump.diaconn.pumplog.LogInjectMealFail
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECTION_DUAL_NORMAL
|
import info.nightscout.pump.diaconn.pumplog.LogInjectMealSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_DUAL_FAIL
|
import info.nightscout.pump.diaconn.pumplog.LogInjectNormalFail
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_DUAL_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogInjectNormalSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_MEAL_FAIL
|
import info.nightscout.pump.diaconn.pumplog.LogInjectSquareFail
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_MEAL_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogInjectSquareSuccess
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_NORMAL_FAIL
|
import info.nightscout.pump.diaconn.pumplog.LogInjection1Day
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_NORMAL_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogInjection1DayBasal
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_SQUARE_FAIL
|
import info.nightscout.pump.diaconn.pumplog.LogInjection1HourBasal
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_INJECT_SQUARE_SUCCESS
|
import info.nightscout.pump.diaconn.pumplog.LogInjectionDualNormal
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_RESET_SYS_V3
|
import info.nightscout.pump.diaconn.pumplog.LogResetSysV3
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_SET_DUAL_INJECTION
|
import info.nightscout.pump.diaconn.pumplog.LogSetDualInjection
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_SET_SQUARE_INJECTION
|
import info.nightscout.pump.diaconn.pumplog.LogSetSquareInjection
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_SUSPEND_RELEASE_V2
|
import info.nightscout.pump.diaconn.pumplog.LogSuspendReleaseV2
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_SUSPEND_V2
|
import info.nightscout.pump.diaconn.pumplog.LogSuspendV2
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_TB_START_V3
|
import info.nightscout.pump.diaconn.pumplog.LogTbStartV3
|
||||||
import info.nightscout.pump.diaconn.pumplog.LOG_TB_STOP_V3
|
import info.nightscout.pump.diaconn.pumplog.LogTbStopV3
|
||||||
import info.nightscout.pump.diaconn.pumplog.PumplogUtil
|
import info.nightscout.pump.diaconn.pumplog.PumpLogUtil
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventPumpStatusChanged
|
import info.nightscout.rx.events.EventPumpStatusChanged
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
@ -113,22 +113,22 @@ class BigLogInquireResponsePacket(
|
||||||
val logNum = getShortToInt(bufferData) // 2byte
|
val logNum = getShortToInt(bufferData) // 2byte
|
||||||
// log Data Parsing
|
// log Data Parsing
|
||||||
val logData = byteArrayOf(
|
val logData = byteArrayOf(
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData),
|
PumpLogUtil.getByte(bufferData),
|
||||||
PumplogUtil.getByte(bufferData)
|
PumpLogUtil.getByte(bufferData)
|
||||||
)
|
)
|
||||||
// process Log to DB
|
// process Log to DB
|
||||||
val logDataToHexString = toNarrowHex(logData)
|
val logDataToHexString = toNarrowHex(logData)
|
||||||
val pumpLogKind: Byte = PumplogUtil.getKind(logDataToHexString)
|
val pumpLogKind: Byte = PumpLogUtil.getKind(logDataToHexString)
|
||||||
var status: String
|
var status: String
|
||||||
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
|
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ class BigLogInquireResponsePacket(
|
||||||
|
|
||||||
when (pumpLogKind) {
|
when (pumpLogKind) {
|
||||||
|
|
||||||
LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> {
|
LogInjectMealSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_MEAL_SUCCESS.parse(logDataToHexString)
|
val logItem = LogInjectMealSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -186,8 +186,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "MEAL_BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
status = "MEAL_BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_MEAL_FAIL.LOG_KIND -> {
|
LogInjectMealFail.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_MEAL_FAIL.parse(logDataToHexString)
|
val logItem = LogInjectMealFail.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -221,8 +221,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "MEAL_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
status = "MEAL_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_NORMAL_SUCCESS.LOG_KIND -> {
|
LogInjectNormalSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_NORMAL_SUCCESS.parse(logDataToHexString)
|
val logItem = LogInjectNormalSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ -257,8 +257,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
status = "BOLUS_SUCCESS" + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_NORMAL_FAIL.LOG_KIND -> {
|
LogInjectNormalFail.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_NORMAL_FAIL.parse(logDataToHexString)
|
val logItem = LogInjectNormalFail.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -295,8 +295,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
status = "BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_SET_SQUARE_INJECTION.LOG_KIND -> {
|
LogSetSquareInjection.LOG_KIND -> {
|
||||||
val logItem = LOG_SET_SQUARE_INJECTION.parse(logDataToHexString)
|
val logItem = LogSetSquareInjection.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -326,8 +326,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "EXTENDED_BOLUS_START " + dateUtil.timeString(logDateTime)
|
status = "EXTENDED_BOLUS_START " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
|
LogInjectSquareSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_SQUARE_SUCCESS.parse(logDataToHexString)
|
val logItem = LogInjectSquareSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -343,8 +343,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "EXTENDED_BOLUS_END " + dateUtil.timeString(logDateTime)
|
status = "EXTENDED_BOLUS_END " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_SQUARE_FAIL.LOG_KIND -> {
|
LogInjectSquareFail.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_SQUARE_FAIL.parse(logDataToHexString)
|
val logItem = LogInjectSquareFail.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -371,8 +371,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "EXTENDED_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
status = "EXTENDED_BOLUS_FAIL " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_SET_DUAL_INJECTION.LOG_KIND -> {
|
LogSetDualInjection.LOG_KIND -> {
|
||||||
val logItem = LOG_SET_DUAL_INJECTION.parse(logDataToHexString)
|
val logItem = LogSetDualInjection.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -405,8 +405,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DUAL_EXTENDED_START " + dateUtil.timeString(logDateTime)
|
status = "DUAL_EXTENDED_START " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECTION_DUAL_NORMAL.LOG_KIND -> {
|
LogInjectionDualNormal.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECTION_DUAL_NORMAL.parse(logDataToHexString)
|
val logItem = LogInjectionDualNormal.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -445,8 +445,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DUAL_BOLUS" + dateUtil.timeString(logDateTime)
|
status = "DUAL_BOLUS" + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_DUAL_SUCCESS.LOG_KIND -> {
|
LogInjectDualSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_DUAL_SUCCESS.parse(logDataToHexString)
|
val logItem = LogInjectDualSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -464,8 +464,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DUAL_BOLUS_SQUARE_SUCCESS " + dateUtil.timeString(logDateTime)
|
status = "DUAL_BOLUS_SQUARE_SUCCESS " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECT_DUAL_FAIL.LOG_KIND -> {
|
LogInjectDualFail.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_DUAL_FAIL.parse(logDataToHexString)
|
val logItem = LogInjectDualFail.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -493,8 +493,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DUAL_BOLUS FAIL " + dateUtil.timeString(logDateTime)
|
status = "DUAL_BOLUS FAIL " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECTION_1HOUR_BASAL.LOG_KIND -> {
|
LogInjection1HourBasal.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECTION_1HOUR_BASAL.parse(logDataToHexString)
|
val logItem = LogInjection1HourBasal.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -509,8 +509,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "1HOUR BASAL " + dateUtil.dateAndTimeString(logDateTime)
|
status = "1HOUR BASAL " + dateUtil.dateAndTimeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_SUSPEND_V2.LOG_KIND -> {
|
LogSuspendV2.LOG_KIND -> {
|
||||||
val logItem = LOG_SUSPEND_V2.parse(logDataToHexString)
|
val logItem = LogSuspendV2.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -524,8 +524,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "SUSPEND " + dateUtil.timeString(logDateTime)
|
status = "SUSPEND " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_SUSPEND_RELEASE_V2.LOG_KIND -> {
|
LogSuspendReleaseV2.LOG_KIND -> {
|
||||||
val logItem = LOG_SUSPEND_RELEASE_V2.parse(logDataToHexString)
|
val logItem = LogSuspendReleaseV2.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -539,8 +539,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "SUSPEND_RELEASE " + dateUtil.timeString(logDateTime)
|
status = "SUSPEND_RELEASE " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CHANGE_INJECTOR_SUCCESS.LOG_KIND -> {
|
LogChangeInjectorSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_CHANGE_INJECTOR_SUCCESS.parse(logDataToHexString)
|
val logItem = LogChangeInjectorSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -568,8 +568,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "INSULIN_CHANGE " + dateUtil.timeString(logDateTime)
|
status = "INSULIN_CHANGE " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CHANGE_TUBE_SUCCESS.LOG_KIND -> {
|
LogChangeTubeSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_CHANGE_TUBE_SUCCESS.parse(logDataToHexString)
|
val logItem = LogChangeTubeSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -600,8 +600,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "TUBE_CHANGE " + dateUtil.timeString(logDateTime)
|
status = "TUBE_CHANGE " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECTION_1DAY.LOG_KIND -> { // Daily Bolus Log
|
LogInjection1Day.LOG_KIND -> { // Daily Bolus Log
|
||||||
val logItem = LOG_INJECTION_1DAY.parse(logDataToHexString)
|
val logItem = LogInjection1Day.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -649,8 +649,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DAILY_BOLUS " + dateUtil.timeString(logDateTime)
|
status = "DAILY_BOLUS " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INJECTION_1DAY_BASAL.LOG_KIND -> { // Daily Basal Log
|
LogInjection1DayBasal.LOG_KIND -> { // Daily Basal Log
|
||||||
val logItem = LOG_INJECTION_1DAY_BASAL.parse(logDataToHexString)
|
val logItem = LogInjection1DayBasal.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -698,8 +698,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "DAILY_BASAL " + dateUtil.timeString(logDateTime)
|
status = "DAILY_BASAL " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CHANGE_NEEDLE_SUCCESS.LOG_KIND -> {
|
LogChangeNeedleSuccess.LOG_KIND -> {
|
||||||
val logItem = LOG_CHANGE_NEEDLE_SUCCESS.parse(logDataToHexString)
|
val logItem = LogChangeNeedleSuccess.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -728,8 +728,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "NEEDLE_CHANGE " + dateUtil.timeString(logDateTime)
|
status = "NEEDLE_CHANGE " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TB_START_V3.LOG_KIND -> {
|
LogTbStartV3.LOG_KIND -> {
|
||||||
val logItem = LOG_TB_START_V3.parse(logDataToHexString)
|
val logItem = LogTbStartV3.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ -772,8 +772,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "TEMP_START " + dateUtil.timeString(logDateTime)
|
status = "TEMP_START " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TB_STOP_V3.LOG_KIND -> {
|
LogTbStopV3.LOG_KIND -> {
|
||||||
val logItem = LOG_TB_STOP_V3.parse(logDataToHexString)
|
val logItem = LogTbStopV3.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -806,8 +806,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "TEMP_STOP " + dateUtil.timeString(logDateTime)
|
status = "TEMP_STOP " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ALARM_BATTERY.LOG_KIND -> { // BATTERY SHORTAGE ALARM
|
LogAlarmBattery.LOG_KIND -> { // BATTERY SHORTAGE ALARM
|
||||||
val logItem = LOG_ALARM_BATTERY.parse(logDataToHexString)
|
val logItem = LogAlarmBattery.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
@ -822,8 +822,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "BATTERY_ALARM " + dateUtil.timeString(logDateTime)
|
status = "BATTERY_ALARM " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ALARM_BLOCK.LOG_KIND -> { // INJECTION BLOCKED ALARM
|
LogAlarmBlock.LOG_KIND -> { // INJECTION BLOCKED ALARM
|
||||||
val logItem = LOG_ALARM_BLOCK.parse(logDataToHexString)
|
val logItem = LogAlarmBlock.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ -840,8 +840,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "BLOCK_ALARM " + dateUtil.timeString(logDateTime)
|
status = "BLOCK_ALARM " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ALARM_SHORTAGE.LOG_KIND -> { // INSULIN SHORTAGE ALARM
|
LogAlarmShortAge.LOG_KIND -> { // INSULIN SHORTAGE ALARM
|
||||||
val logItem = LOG_ALARM_SHORTAGE.parse(logDataToHexString)
|
val logItem = LogAlarmShortAge.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ -858,8 +858,8 @@ class BigLogInquireResponsePacket(
|
||||||
status = "SHORT_AGE_ALARM " + dateUtil.timeString(logDateTime)
|
status = "SHORT_AGE_ALARM " + dateUtil.timeString(logDateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_RESET_SYS_V3.LOG_KIND -> {
|
LogResetSysV3.LOG_KIND -> {
|
||||||
val logItem = LOG_RESET_SYS_V3.parse(logDataToHexString)
|
val logItem = LogResetSysV3.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
@ -5,7 +5,7 @@ import info.nightscout.interfaces.pump.defs.PumpDescription
|
||||||
import info.nightscout.interfaces.pump.defs.PumpType
|
import info.nightscout.interfaces.pump.defs.PumpType
|
||||||
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
import info.nightscout.pump.diaconn.DiaconnG8Pump
|
||||||
import info.nightscout.pump.diaconn.R
|
import info.nightscout.pump.diaconn.R
|
||||||
import info.nightscout.pump.diaconn.pumplog.PumplogUtil
|
import info.nightscout.pump.diaconn.pumplog.PumpLogUtil
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -213,7 +213,7 @@ class BigMainInfoInquireResponsePacket(
|
||||||
diaconnG8Pump.pumpProfiles!![diaconnG8Pump.activeProfile][23] = diaconnG8Pump.baseAmount24
|
diaconnG8Pump.pumpProfiles!![diaconnG8Pump.activeProfile][23] = diaconnG8Pump.baseAmount24
|
||||||
|
|
||||||
//incarnation no 처리
|
//incarnation no 처리
|
||||||
diaconnG8Pump.isPumpVersionGe2_63 = PumplogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* Battery Shortage Alarm Log
|
* Battery Shortage Alarm Log
|
||||||
*/
|
*/
|
||||||
class LOG_ALARM_BATTERY private constructor(
|
class LogAlarmBattery private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
||||||
|
@ -15,8 +15,8 @@ class LOG_ALARM_BATTERY private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_ALARM_BATTERY{")
|
val sb = StringBuilder("LOG_ALARM_BATTERY{")
|
||||||
|
@ -35,17 +35,17 @@ class LOG_ALARM_BATTERY private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x28
|
const val LOG_KIND: Byte = 0x28
|
||||||
fun parse(data: String): LOG_ALARM_BATTERY {
|
fun parse(data: String): LogAlarmBattery {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_ALARM_BATTERY(
|
return LogAlarmBattery(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,19 +6,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* Injection Blocked Alarm Log
|
* Injection Blocked Alarm Log
|
||||||
*/
|
*/
|
||||||
class LOG_ALARM_BLOCK private constructor(
|
class LogAlarmBlock private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
||||||
val alarmLevel: Byte, // 1=OCCUR
|
private val alarmLevel: Byte, // 1=OCCUR
|
||||||
val ack: Byte,
|
private val ack: Byte,
|
||||||
val amount: Short, // 1=BASE, 2=Meal, 3=snack , 4=square, 5=dual, 6=tube change, 7=needle change, 8=insulin change
|
val amount: Short, // 1=BASE, 2=Meal, 3=snack , 4=square, 5=dual, 6=tube change, 7=needle change, 8=insulin change
|
||||||
val reason: Byte,
|
val reason: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_ALARM_BLOCK{")
|
val sb = StringBuilder("LOG_ALARM_BLOCK{")
|
||||||
|
@ -39,19 +39,19 @@ class LOG_ALARM_BLOCK private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x29
|
const val LOG_KIND: Byte = 0x29
|
||||||
fun parse(data: String): LOG_ALARM_BLOCK {
|
fun parse(data: String): LogAlarmBlock {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_ALARM_BLOCK(
|
return LogAlarmBlock(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,18 +6,18 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* Insulin shortage alarm
|
* Insulin shortage alarm
|
||||||
*/
|
*/
|
||||||
class LOG_ALARM_SHORTAGE private constructor(
|
class LogAlarmShortAge private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
typeAndKind: Byte, // 1=INFO, 2=WARNING, 3=MAJOR, 4=CRITICAL
|
||||||
val alarmLevel: Byte, // 1=OCCUR, 2=STOP
|
private val alarmLevel: Byte, // 1=OCCUR, 2=STOP
|
||||||
val ack: Byte, // (1~100U)
|
private val ack: Byte, // (1~100U)
|
||||||
val remain: Byte,
|
val remain: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_ALARM_SHORTAGE{")
|
val sb = StringBuilder("LOG_ALARM_SHORTAGE{")
|
||||||
|
@ -37,18 +37,18 @@ class LOG_ALARM_SHORTAGE private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x2A
|
const val LOG_KIND: Byte = 0x2A
|
||||||
fun parse(data: String): LOG_ALARM_SHORTAGE {
|
fun parse(data: String): LogAlarmShortAge {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_ALARM_SHORTAGE(
|
return LogAlarmShortAge(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 주사기 교체 성공
|
* 주사기 교체 성공
|
||||||
*/
|
*/
|
||||||
class LOG_CHANGE_INJECTOR_SUCCESS private constructor(
|
class LogChangeInjectorSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -15,8 +15,8 @@ class LOG_CHANGE_INJECTOR_SUCCESS private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_CHANGE_INJECTOR_SUCCESS{")
|
val sb = StringBuilder("LOG_CHANGE_INJECTOR_SUCCESS{")
|
||||||
|
@ -35,17 +35,17 @@ class LOG_CHANGE_INJECTOR_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x1A
|
const val LOG_KIND: Byte = 0x1A
|
||||||
fun parse(data: String): LOG_CHANGE_INJECTOR_SUCCESS {
|
fun parse(data: String): LogChangeInjectorSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_CHANGE_INJECTOR_SUCCESS(
|
return LogChangeInjectorSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 바늘 공기빼기 성공
|
* 바늘 공기빼기 성공
|
||||||
*/
|
*/
|
||||||
class LOG_CHANGE_NEEDLE_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogChangeNeedleSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -15,8 +16,8 @@ class LOG_CHANGE_NEEDLE_SUCCESS private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_CHANGE_NEEDLE_SUCCESS{")
|
val sb = StringBuilder("LOG_CHANGE_NEEDLE_SUCCESS{")
|
||||||
|
@ -35,17 +36,17 @@ class LOG_CHANGE_NEEDLE_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x1C
|
const val LOG_KIND: Byte = 0x1C
|
||||||
fun parse(data: String): LOG_CHANGE_NEEDLE_SUCCESS {
|
fun parse(data: String): LogChangeNeedleSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_CHANGE_NEEDLE_SUCCESS(
|
return LogChangeNeedleSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 튜브 공기빼기 성공
|
* 튜브 공기빼기 성공
|
||||||
*/
|
*/
|
||||||
class LOG_CHANGE_TUBE_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogChangeTubeSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -15,8 +16,8 @@ class LOG_CHANGE_TUBE_SUCCESS private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_CHANGE_TUBE_SUCCESS{")
|
val sb = StringBuilder("LOG_CHANGE_TUBE_SUCCESS{")
|
||||||
|
@ -35,17 +36,17 @@ class LOG_CHANGE_TUBE_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x18
|
const val LOG_KIND: Byte = 0x18
|
||||||
fun parse(data: String): LOG_CHANGE_TUBE_SUCCESS {
|
fun parse(data: String): LogChangeTubeSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_CHANGE_TUBE_SUCCESS(
|
return LogChangeTubeSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* Dual Injection Fail Log
|
* Dual Injection Fail Log
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_DUAL_FAIL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectDualFail private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -18,8 +19,8 @@ class LOG_INJECT_DUAL_FAIL private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
|
@ -44,19 +45,19 @@ class LOG_INJECT_DUAL_FAIL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x11
|
const val LOG_KIND: Byte = 0x11
|
||||||
fun parse(data: String): LOG_INJECT_DUAL_FAIL {
|
fun parse(data: String): LogInjectDualFail {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_DUAL_FAIL(
|
return LogInjectDualFail(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,18 +7,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 듀얼주입 성공
|
* 듀얼주입 성공
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_DUAL_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectDualSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
val injectNormAmount: Short, // 47.5=4750
|
private val injectNormAmount: Short, // 47.5=4750
|
||||||
val injectSquareAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
val injectSquareAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
||||||
private val injectTime: Byte,
|
private val injectTime: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -41,18 +42,18 @@ class LOG_INJECT_DUAL_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x10
|
const val LOG_KIND: Byte = 0x10
|
||||||
fun parse(data: String): LOG_INJECT_DUAL_SUCCESS {
|
fun parse(data: String): LogInjectDualSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_DUAL_SUCCESS(
|
return LogInjectDualSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 식사주입 실패
|
* 식사주입 실패
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_MEAL_FAIL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectMealFail private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -18,8 +19,8 @@ class LOG_INJECT_MEAL_FAIL private constructor(
|
||||||
val reason: Byte
|
val reason: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
|
@ -44,19 +45,19 @@ class LOG_INJECT_MEAL_FAIL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x09
|
const val LOG_KIND: Byte = 0x09
|
||||||
fun parse(data: String): LOG_INJECT_MEAL_FAIL {
|
fun parse(data: String): LogInjectMealFail {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_MEAL_FAIL(
|
return LogInjectMealFail(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 식사주입 성공
|
* 식사주입 성공
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_MEAL_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectMealSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -15,12 +16,11 @@ class LOG_INJECT_MEAL_SUCCESS private constructor(
|
||||||
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
||||||
private val injectTime: Byte, // 아침=1, 점심=2, 저녁=3
|
private val injectTime: Byte, // 아침=1, 점심=2, 저녁=3
|
||||||
val time: Byte,
|
val time: Byte,
|
||||||
batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
val batteryRemain: Byte = batteryRemain
|
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -44,19 +44,19 @@ class LOG_INJECT_MEAL_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x08
|
const val LOG_KIND: Byte = 0x08
|
||||||
fun parse(data: String): LOG_INJECT_MEAL_SUCCESS {
|
fun parse(data: String): LogInjectMealSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_MEAL_SUCCESS(
|
return LogInjectMealSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,19 +7,20 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 일반주입 실패
|
* 일반주입 실패
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_NORMAL_FAIL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectNormalFail private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
val setAmount: Short, // 47.5=4750
|
private val setAmount: Short, // 47.5=4750
|
||||||
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
||||||
val injectTime: Byte, // 1=주입막힘, 2=배터리잔량부족, 3=약물부족, 4=사용자중지, 5=시스템리셋, 6=기타, 7=긴급정지
|
val injectTime: Byte, // 1=주입막힘, 2=배터리잔량부족, 3=약물부족, 4=사용자중지, 5=시스템리셋, 6=기타, 7=긴급정지
|
||||||
val reason: Byte,
|
val reason: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
|
@ -44,19 +45,19 @@ class LOG_INJECT_NORMAL_FAIL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0B
|
const val LOG_KIND: Byte = 0x0B
|
||||||
fun parse(data: String): LOG_INJECT_NORMAL_FAIL {
|
fun parse(data: String): LogInjectNormalFail {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_NORMAL_FAIL(
|
return LogInjectNormalFail(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,18 +7,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 일반주입 성공
|
* 일반주입 성공
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_NORMAL_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectNormalSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
val setAmount: Short, // 47.5=4750
|
private val setAmount: Short, // 47.5=4750
|
||||||
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
||||||
val injectTime: Byte,
|
val injectTime: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -41,18 +42,18 @@ class LOG_INJECT_NORMAL_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0A
|
const val LOG_KIND: Byte = 0x0A
|
||||||
fun parse(data: String): LOG_INJECT_NORMAL_SUCCESS {
|
fun parse(data: String): LogInjectNormalSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_NORMAL_SUCCESS(
|
return LogInjectNormalSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 스퀘어주입 실패
|
* 스퀘어주입 실패
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_SQUARE_FAIL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectSquareFail private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -17,8 +18,8 @@ class LOG_INJECT_SQUARE_FAIL private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
|
@ -42,18 +43,18 @@ class LOG_INJECT_SQUARE_FAIL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0E
|
const val LOG_KIND: Byte = 0x0E
|
||||||
fun parse(data: String): LOG_INJECT_SQUARE_FAIL {
|
fun parse(data: String): LogInjectSquareFail {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_SQUARE_FAIL(
|
return LogInjectSquareFail(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,17 +7,18 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 스퀘어주입 성공
|
* 스퀘어주입 성공
|
||||||
*/
|
*/
|
||||||
class LOG_INJECT_SQUARE_SUCCESS private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectSquareSuccess private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
private val injectAmount: Short, // 1분단위 주입시간(124=124분=2시간4분)
|
||||||
private val injectTime: Byte,
|
private val injectTime: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -39,17 +40,17 @@ class LOG_INJECT_SQUARE_SUCCESS private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0D
|
const val LOG_KIND: Byte = 0x0D
|
||||||
fun parse(data: String): LOG_INJECT_SQUARE_SUCCESS {
|
fun parse(data: String): LogInjectSquareSuccess {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECT_SQUARE_SUCCESS(
|
return LogInjectSquareSuccess(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 당일 주입 총량 (식사, 추가)
|
* 당일 주입 총량 (식사, 추가)
|
||||||
*/
|
*/
|
||||||
class LOG_INJECTION_1DAY private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjection1Day private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 당일 식사주입 총량 47.5=4750
|
typeAndKind: Byte, // 당일 식사주입 총량 47.5=4750
|
||||||
|
@ -15,8 +16,8 @@ class LOG_INJECTION_1DAY private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_INJECTION_1DAY{")
|
val sb = StringBuilder("LOG_INJECTION_1DAY{")
|
||||||
|
@ -35,17 +36,17 @@ class LOG_INJECTION_1DAY private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x2F
|
const val LOG_KIND: Byte = 0x2F
|
||||||
fun parse(data: String): LOG_INJECTION_1DAY {
|
fun parse(data: String): LogInjection1Day {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECTION_1DAY(
|
return LogInjection1Day(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 당일 주입 총량 (기저)
|
* 당일 주입 총량 (기저)
|
||||||
*/
|
*/
|
||||||
class LOG_INJECTION_1DAY_BASAL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjection1DayBasal private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
|
@ -15,8 +16,8 @@ class LOG_INJECTION_1DAY_BASAL private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_INJECTION_1DAY_BASAL{")
|
val sb = StringBuilder("LOG_INJECTION_1DAY_BASAL{")
|
||||||
|
@ -33,16 +34,16 @@ class LOG_INJECTION_1DAY_BASAL private constructor(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val LOG_KIND: Byte = 0x2E
|
const val LOG_KIND: Byte = 0x2E
|
||||||
fun parse(data: String): LOG_INJECTION_1DAY_BASAL {
|
fun parse(data: String): LogInjection1DayBasal {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECTION_1DAY_BASAL(
|
return LogInjection1DayBasal(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 1시간 단위 기저 주입량
|
* 1시간 단위 기저 주입량
|
||||||
*/
|
*/
|
||||||
class LOG_INJECTION_1HOUR_BASAL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjection1HourBasal private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
|
@ -17,8 +18,8 @@ class LOG_INJECTION_1HOUR_BASAL private constructor(
|
||||||
private val remainTotalAmount: Short
|
private val remainTotalAmount: Short
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
val beforeAmount // 해당시간의 임시기저 계산 전 기저주입량: 기저주입막힘 발생 시 기저주입 막힘량 제외, 기저정지로 인해 주입되지 않은 량 제외, 리셋으로 인해 주입되지 않은 량 제외(47.5=4750)
|
val beforeAmount // 해당시간의 임시기저 계산 전 기저주입량: 기저주입막힘 발생 시 기저주입 막힘량 제외, 기저정지로 인해 주입되지 않은 량 제외, 리셋으로 인해 주입되지 않은 량 제외(47.5=4750)
|
||||||
: Short = tbBeforeAmount
|
: Short = tbBeforeAmount
|
||||||
val afterAmount // 해당시간의 임시기저 계산 후 기저주입량: 기저주입막힘 발생 시 기저주입 막힘량 제외, 기저정지로 인해 주입되지 않은 량 제외, 리셋으로 인해 주입되지 않은 량 제외(47.5=4750)
|
val afterAmount // 해당시간의 임시기저 계산 후 기저주입량: 기저주입막힘 발생 시 기저주입 막힘량 제외, 기저정지로 인해 주입되지 않은 량 제외, 리셋으로 인해 주입되지 않은 량 제외(47.5=4750)
|
||||||
|
@ -42,18 +43,18 @@ class LOG_INJECTION_1HOUR_BASAL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x2C
|
const val LOG_KIND: Byte = 0x2C
|
||||||
fun parse(data: String): LOG_INJECTION_1HOUR_BASAL {
|
fun parse(data: String): LogInjection1HourBasal {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECTION_1HOUR_BASAL(
|
return LogInjection1HourBasal(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer)
|
PumpLogUtil.getShort(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,18 +7,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 듀얼(일반) 주입량: 듀얼(일반) 주입 완료 시 기록하는 방식
|
* 듀얼(일반) 주입량: 듀얼(일반) 주입 완료 시 기록하는 방식
|
||||||
*/
|
*/
|
||||||
class LOG_INJECTION_DUAL_NORMAL private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogInjectionDualNormal private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 설정량 47.5=4750
|
typeAndKind: Byte, // 설정량 47.5=4750
|
||||||
val setAmount: Short, // 주입량 47.5=4750
|
private val setAmount: Short, // 주입량 47.5=4750
|
||||||
val injectAmount: Short, // 1분 단위 주입 시간 Ex) 124 = 124분 = 2시간 4분
|
val injectAmount: Short, // 1분 단위 주입 시간 Ex) 124 = 124분 = 2시간 4분
|
||||||
private val injectTime: Byte,
|
private val injectTime: Byte,
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -41,18 +42,18 @@ class LOG_INJECTION_DUAL_NORMAL private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x35
|
const val LOG_KIND: Byte = 0x35
|
||||||
fun parse(data: String): LOG_INJECTION_DUAL_NORMAL {
|
fun parse(data: String): LogInjectionDualNormal {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_INJECTION_DUAL_NORMAL(
|
return LogInjectionDualNormal(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,18 +6,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* System Reset Log
|
* System Reset Log
|
||||||
*/
|
*/
|
||||||
class LOG_RESET_SYS_V3 private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogResetSysV3 private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
val batteryRemain: Byte,
|
val batteryRemain: Byte,
|
||||||
val reason: Byte, // 사유(1:공장초기화 후 리셋, 2:긴급정지 해제 후 리셋, 3:사용자 배터리 교체 후 리셋, 4:캘리브레이션 후 리셋, 9:예상치 못한 시스템 리셋)
|
val reason: Byte, // 사유(1:공장초기화 후 리셋, 2:긴급정지 해제 후 리셋, 3:사용자 배터리 교체 후 리셋, 4:캘리브레이션 후 리셋, 9:예상치 못한 시스템 리셋)
|
||||||
val rcon1: Short, // PIC 데이터 시트 내 정의된 2바이트 값
|
private val rcon1: Short, // PIC 데이터 시트 내 정의된 2바이트 값
|
||||||
val rcon2: Short // PIC 데이터 시트 내 정의된 2바이트 값
|
private val rcon2: Short // PIC 데이터 시트 내 정의된 2바이트 값
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_RESET_SYS_V3{")
|
val sb = StringBuilder("LOG_RESET_SYS_V3{")
|
||||||
|
@ -37,18 +38,18 @@ class LOG_RESET_SYS_V3 private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x01
|
const val LOG_KIND: Byte = 0x01
|
||||||
fun parse(data: String): LOG_RESET_SYS_V3 {
|
fun parse(data: String): LogResetSysV3 {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_RESET_SYS_V3(
|
return LogResetSysV3(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer)
|
PumpLogUtil.getShort(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,18 +7,19 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 듀얼주입 설정(시작)
|
* 듀얼주입 설정(시작)
|
||||||
*/
|
*/
|
||||||
class LOG_SET_DUAL_INJECTION private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogSetDualInjection private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
val setNormAmount: Short, // 47.5=4750
|
private val setNormAmount: Short, // 47.5=4750
|
||||||
val setSquareAmount: Short, // 47.5=4750
|
val setSquareAmount: Short, // 47.5=4750
|
||||||
private val injectTime: Byte, // 1~30( 1: 10min )
|
private val injectTime: Byte, // 1~30( 1: 10min )
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -41,18 +42,18 @@ class LOG_SET_DUAL_INJECTION private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0F
|
const val LOG_KIND: Byte = 0x0F
|
||||||
fun parse(data: String): LOG_SET_DUAL_INJECTION {
|
fun parse(data: String): LogSetDualInjection {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_SET_DUAL_INJECTION(
|
return LogSetDualInjection(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 스퀘어주입 설정(시작)
|
* 스퀘어주입 설정(시작)
|
||||||
*/
|
*/
|
||||||
class LOG_SET_SQUARE_INJECTION private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogSetSquareInjection private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 47.5=4750
|
typeAndKind: Byte, // 47.5=4750
|
||||||
|
@ -16,8 +17,8 @@ class LOG_SET_SQUARE_INJECTION private constructor(
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
fun getInjectTime(): Int {
|
fun getInjectTime(): Int {
|
||||||
return injectTime and 0xff
|
return injectTime and 0xff
|
||||||
}
|
}
|
||||||
|
@ -39,17 +40,17 @@ class LOG_SET_SQUARE_INJECTION private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x0C
|
const val LOG_KIND: Byte = 0x0C
|
||||||
fun parse(data: String): LOG_SET_SQUARE_INJECTION {
|
fun parse(data: String): LogSetSquareInjection {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_SET_SQUARE_INJECTION(
|
return LogSetSquareInjection(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 일시정지 중지 (기저정지 해제)
|
* 일시정지 중지 (기저정지 해제)
|
||||||
*/
|
*/
|
||||||
class LOG_SUSPEND_RELEASE_V2 private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogSuspendReleaseV2 private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
|
@ -17,7 +18,7 @@ class LOG_SUSPEND_RELEASE_V2 private constructor(
|
||||||
val type: Byte
|
val type: Byte
|
||||||
val kind: Byte
|
val kind: Byte
|
||||||
val batteryRemain: Byte
|
val batteryRemain: Byte
|
||||||
val patternType // 1=기본, 2=생활1, 3=생활2, 4=생활3, 5=닥터1, 6=닥터2
|
private val patternType // 1=기본, 2=생활1, 3=생활2, 4=생활3, 5=닥터1, 6=닥터2
|
||||||
: Byte
|
: Byte
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
@ -48,23 +49,23 @@ class LOG_SUSPEND_RELEASE_V2 private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x04
|
const val LOG_KIND: Byte = 0x04
|
||||||
fun parse(data: String): LOG_SUSPEND_RELEASE_V2 {
|
fun parse(data: String): LogSuspendReleaseV2 {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_SUSPEND_RELEASE_V2(
|
return LogSuspendReleaseV2(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
type = PumplogUtil.getType(typeAndKind)
|
type = PumpLogUtil.getType(typeAndKind)
|
||||||
kind = PumplogUtil.getKind(typeAndKind)
|
kind = PumpLogUtil.getKind(typeAndKind)
|
||||||
this.batteryRemain = batteryRemain
|
this.batteryRemain = batteryRemain
|
||||||
this.patternType = patternType
|
this.patternType = patternType
|
||||||
}
|
}
|
|
@ -6,16 +6,17 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 일시정지 시작 (기저정지)
|
* 일시정지 시작 (기저정지)
|
||||||
*/
|
*/
|
||||||
class LOG_SUSPEND_V2 private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogSuspendV2 private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
val batteryRemain: Byte, // 1=기본, 2=생활1, 3=생활2, 4=생활3, 5=닥터1, 6=닥터2
|
val batteryRemain: Byte, // 1=기본, 2=생활1, 3=생활2, 4=생활3, 5=닥터1, 6=닥터2
|
||||||
val patternType: Byte
|
private val patternType: Byte
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val sb = StringBuilder("LOG_SUSPEND_V2{")
|
val sb = StringBuilder("LOG_SUSPEND_V2{")
|
||||||
|
@ -46,16 +47,16 @@ class LOG_SUSPEND_V2 private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x03
|
const val LOG_KIND: Byte = 0x03
|
||||||
fun parse(data: String): LOG_SUSPEND_V2 {
|
fun parse(data: String): LogSuspendV2 {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_SUSPEND_V2(
|
return LogSuspendV2(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer)
|
PumpLogUtil.getByte(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 임시기저 설정(시작)
|
* 임시기저 설정(시작)
|
||||||
*/
|
*/
|
||||||
class LOG_TB_START_V3 private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogTbStartV3 private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte, // 임시기저 시간(30분 ~ 24시간, 2 ~ 96, 1당 15분 단위 증감)
|
typeAndKind: Byte, // 임시기저 시간(30분 ~ 24시간, 2 ~ 96, 1당 15분 단위 증감)
|
||||||
|
@ -17,8 +18,8 @@ class LOG_TB_START_V3 private constructor(
|
||||||
private val tbDttm: String // 앱에서 생성 전달한 임시기저 시작(요청) 시간
|
private val tbDttm: String // 앱에서 생성 전달한 임시기저 시작(요청) 시간
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getTbInjectRateRatio(): Int {
|
fun getTbInjectRateRatio(): Int {
|
||||||
return tbInjectRateRatio and 0xffff
|
return tbInjectRateRatio and 0xffff
|
||||||
|
@ -33,7 +34,7 @@ class LOG_TB_START_V3 private constructor(
|
||||||
sb.append(", kind=").append(kind.toInt())
|
sb.append(", kind=").append(kind.toInt())
|
||||||
sb.append(", tbTime=").append(tbTime.toInt())
|
sb.append(", tbTime=").append(tbTime.toInt())
|
||||||
sb.append(", tbInjectRateRatio=").append(tbInjectRateRatio and 0xffff)
|
sb.append(", tbInjectRateRatio=").append(tbInjectRateRatio and 0xffff)
|
||||||
if (!StringUtils.equals(tbDttm, PumplogUtil.getDttm("ffffffff"))) {
|
if (!StringUtils.equals(tbDttm, PumpLogUtil.getDttm("ffffffff"))) {
|
||||||
sb.append(", tbDttm=").append(tbDttm)
|
sb.append(", tbDttm=").append(tbDttm)
|
||||||
}
|
}
|
||||||
sb.append('}')
|
sb.append('}')
|
||||||
|
@ -43,17 +44,17 @@ class LOG_TB_START_V3 private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x12
|
const val LOG_KIND: Byte = 0x12
|
||||||
fun parse(data: String): LOG_TB_START_V3 {
|
fun parse(data: String): LogTbStartV3 {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_TB_START_V3(
|
return LogTbStartV3(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getDttm(buffer)
|
PumpLogUtil.getDttm(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,8 @@ import java.nio.ByteOrder
|
||||||
/*
|
/*
|
||||||
* 임시기저 중지(완료)
|
* 임시기저 중지(완료)
|
||||||
*/
|
*/
|
||||||
class LOG_TB_STOP_V3 private constructor(
|
@Suppress("SpellCheckingInspection")
|
||||||
|
class LogTbStopV3 private constructor(
|
||||||
val data: String,
|
val data: String,
|
||||||
val dttm: String,
|
val dttm: String,
|
||||||
typeAndKind: Byte,
|
typeAndKind: Byte,
|
||||||
|
@ -20,8 +21,8 @@ class LOG_TB_STOP_V3 private constructor(
|
||||||
private val tbDttm: String
|
private val tbDttm: String
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val type: Byte = PumplogUtil.getType(typeAndKind)
|
val type: Byte = PumpLogUtil.getType(typeAndKind)
|
||||||
val kind: Byte = PumplogUtil.getKind(typeAndKind)
|
val kind: Byte = PumpLogUtil.getKind(typeAndKind)
|
||||||
|
|
||||||
fun getTbInjectRateRatio(): Int {
|
fun getTbInjectRateRatio(): Int {
|
||||||
return tbInjectRateRatio and 0xffff
|
return tbInjectRateRatio and 0xffff
|
||||||
|
@ -36,7 +37,7 @@ class LOG_TB_STOP_V3 private constructor(
|
||||||
sb.append(", kind=").append(kind.toInt())
|
sb.append(", kind=").append(kind.toInt())
|
||||||
sb.append(", tbInjectRateRatio=").append(tbInjectRateRatio and 0xffff)
|
sb.append(", tbInjectRateRatio=").append(tbInjectRateRatio and 0xffff)
|
||||||
sb.append(", reason=").append(reason.toInt())
|
sb.append(", reason=").append(reason.toInt())
|
||||||
if (!StringUtils.equals(tbDttm, PumplogUtil.getDttm("ffffffff"))) {
|
if (!StringUtils.equals(tbDttm, PumpLogUtil.getDttm("ffffffff"))) {
|
||||||
sb.append(", tbDttm=").append(tbDttm)
|
sb.append(", tbDttm=").append(tbDttm)
|
||||||
}
|
}
|
||||||
sb.append('}')
|
sb.append('}')
|
||||||
|
@ -46,17 +47,17 @@ class LOG_TB_STOP_V3 private constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val LOG_KIND: Byte = 0x13
|
const val LOG_KIND: Byte = 0x13
|
||||||
fun parse(data: String): LOG_TB_STOP_V3 {
|
fun parse(data: String): LogTbStopV3 {
|
||||||
val bytes = PumplogUtil.hexStringToByteArray(data)
|
val bytes = PumpLogUtil.hexStringToByteArray(data)
|
||||||
val buffer = ByteBuffer.wrap(bytes)
|
val buffer = ByteBuffer.wrap(bytes)
|
||||||
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
buffer.order(ByteOrder.LITTLE_ENDIAN)
|
||||||
return LOG_TB_STOP_V3(
|
return LogTbStopV3(
|
||||||
data,
|
data,
|
||||||
PumplogUtil.getDttm(buffer),
|
PumpLogUtil.getDttm(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getShort(buffer),
|
PumpLogUtil.getShort(buffer),
|
||||||
PumplogUtil.getByte(buffer),
|
PumpLogUtil.getByte(buffer),
|
||||||
PumplogUtil.getDttm(buffer)
|
PumpLogUtil.getDttm(buffer)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,8 @@ import java.util.TimeZone;
|
||||||
/*
|
/*
|
||||||
* 디아콘 G8 펌프 로그 유틸리티 클래스
|
* 디아콘 G8 펌프 로그 유틸리티 클래스
|
||||||
*/
|
*/
|
||||||
public class PumplogUtil {
|
@SuppressWarnings({"CommentedOutCode", "SpellCheckingInspection"})
|
||||||
|
public class PumpLogUtil {
|
||||||
/*
|
/*
|
||||||
* 바이트버퍼에서 4바이트 날짜를 구한다.
|
* 바이트버퍼에서 4바이트 날짜를 구한다.
|
||||||
* @param buffer 바이트버퍼
|
* @param buffer 바이트버퍼
|
||||||
|
@ -39,7 +40,7 @@ public class PumplogUtil {
|
||||||
*/
|
*/
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
public static String getDttm(String data) {
|
public static String getDttm(String data) {
|
||||||
byte[] bytes = PumplogUtil.hexStringToByteArray(data);
|
byte[] bytes = PumpLogUtil.hexStringToByteArray(data);
|
||||||
byte b0 = bytes[0];
|
byte b0 = bytes[0];
|
||||||
byte b1 = bytes[1];
|
byte b1 = bytes[1];
|
||||||
byte b2 = bytes[2];
|
byte b2 = bytes[2];
|
||||||
|
@ -74,9 +75,11 @@ public class PumplogUtil {
|
||||||
* @param buffer 바이트버퍼
|
* @param buffer 바이트버퍼
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public static int getInt(ByteBuffer buffer) {
|
public static int getInt(ByteBuffer buffer) {
|
||||||
return buffer.getInt();
|
return buffer.getInt();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 로그데이터에서 로그 타입 바이트를 구한다.
|
* 로그데이터에서 로그 타입 바이트를 구한다.
|
||||||
|
@ -136,12 +139,14 @@ public class PumplogUtil {
|
||||||
* @param data 1970.1.1이후 경과한 초
|
* @param data 1970.1.1이후 경과한 초
|
||||||
* @return 날짜(GMT기준)
|
* @return 날짜(GMT기준)
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public static Date pumpTimeToGMTDate(Integer data) {
|
public static Date pumpTimeToGMTDate(Integer data) {
|
||||||
long epochTime = new Date(0).getTime(); // 1970-01-01
|
long epochTime = new Date(0).getTime(); // 1970-01-01
|
||||||
long pumpTime = data.longValue() * 1000; // 초를 밀리초 단위로 변환
|
long pumpTime = data.longValue() * 1000; // 초를 밀리초 단위로 변환
|
||||||
int timeZoneOffset = TimeZone.getDefault().getRawOffset(); // GMT와 로컬 타임존 사이의 차이
|
int timeZoneOffset = TimeZone.getDefault().getRawOffset(); // GMT와 로컬 타임존 사이의 차이
|
||||||
return new Date(epochTime + pumpTime - timeZoneOffset);
|
return new Date(epochTime + pumpTime - timeZoneOffset);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 펌프 버전이 해당 버전보다 크거나 같은지 여부 확인(새로운 기능이 추가된 버전을 체크하기 위함)
|
* 펌프 버전이 해당 버전보다 크거나 같은지 여부 확인(새로운 기능이 추가된 버전을 체크하기 위함)
|
|
@ -57,7 +57,7 @@ import info.nightscout.pump.diaconn.packet.TempBasalInquirePacket
|
||||||
import info.nightscout.pump.diaconn.packet.TempBasalSettingPacket
|
import info.nightscout.pump.diaconn.packet.TempBasalSettingPacket
|
||||||
import info.nightscout.pump.diaconn.packet.TimeInquirePacket
|
import info.nightscout.pump.diaconn.packet.TimeInquirePacket
|
||||||
import info.nightscout.pump.diaconn.packet.TimeSettingPacket
|
import info.nightscout.pump.diaconn.packet.TimeSettingPacket
|
||||||
import info.nightscout.pump.diaconn.pumplog.PumplogUtil
|
import info.nightscout.pump.diaconn.pumplog.PumpLogUtil
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventAppExit
|
import info.nightscout.rx.events.EventAppExit
|
||||||
|
@ -168,7 +168,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
val pumpFirmwareVersion = sp.getString(rh.gs(R.string.pumpversion), "")
|
||||||
|
|
||||||
if (pumpFirmwareVersion.isNotEmpty() && PumplogUtil.isPumpVersionGe(pumpFirmwareVersion, 3, 0)) {
|
if (pumpFirmwareVersion.isNotEmpty() && PumpLogUtil.isPumpVersionGe(pumpFirmwareVersion, 3, 0)) {
|
||||||
sendMessage(BigAPSMainInfoInquirePacket(injector)) // APS Pump Main Info
|
sendMessage(BigAPSMainInfoInquirePacket(injector)) // APS Pump Main Info
|
||||||
} else {
|
} else {
|
||||||
sendMessage(BasalLimitInquirePacket(injector)) // basal Limit
|
sendMessage(BasalLimitInquirePacket(injector)) // basal Limit
|
||||||
|
|
|
@ -216,10 +216,6 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hasService(): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStartScheduledPumpActions() {
|
override fun onStartScheduledPumpActions() {
|
||||||
|
|
||||||
// check status every minute (if any status needs refresh we send readStatus command)
|
// check status every minute (if any status needs refresh we send readStatus command)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.util
|
package info.nightscout.androidaps.plugins.pump.medtronic.util
|
||||||
|
|
||||||
|
import com.google.gson.Gson
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
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.RileyLinkUtil
|
||||||
|
@ -18,13 +19,13 @@ import info.nightscout.rx.events.EventDismissNotification
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import org.joda.time.LocalTime
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.nio.ByteOrder
|
import java.nio.ByteOrder
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
import kotlin.experimental.or
|
import kotlin.experimental.or
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 5/9/18.
|
* Created by andy on 5/9/18.
|
||||||
|
@ -38,39 +39,41 @@ class MedtronicUtil @Inject constructor(
|
||||||
private val uiInteraction: UiInteraction
|
private val uiInteraction: UiInteraction
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@Suppress("PrivatePropertyName")
|
||||||
private val ENVELOPE_SIZE = 4 // 0xA7 S1 S2 S3 CMD PARAM_COUNT [PARAMS]
|
private val ENVELOPE_SIZE = 4 // 0xA7 S1 S2 S3 CMD PARAM_COUNT [PARAMS]
|
||||||
|
|
||||||
//private MedtronicDeviceType medtronicPumpModel;
|
//private MedtronicDeviceType medtronicPumpModel;
|
||||||
private var currentCommand: MedtronicCommandType? = null
|
private var currentCommand: MedtronicCommandType? = null
|
||||||
var settings: Map<String, PumpSettingDTO>? = null
|
var settings: Map<String, PumpSettingDTO>? = null
|
||||||
|
@Suppress("PrivatePropertyName")
|
||||||
private val BIG_FRAME_LENGTH = 65
|
private val BIG_FRAME_LENGTH = 65
|
||||||
private val doneBit = 1 shl 7
|
//private val doneBit = 1 shl 7
|
||||||
var pumpTime: ClockDTO? = null
|
var pumpTime: ClockDTO? = null
|
||||||
var gsonInstance = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()
|
var gsonInstance: Gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()
|
||||||
|
|
||||||
fun getTimeFrom30MinInterval(interval: Int): LocalTime {
|
// fun getTimeFrom30MinInterval(interval: Int): LocalTime {
|
||||||
return if (interval % 2 == 0) {
|
// return if (interval % 2 == 0) {
|
||||||
LocalTime(interval / 2, 0)
|
// LocalTime(interval / 2, 0)
|
||||||
} else {
|
// } else {
|
||||||
LocalTime((interval - 1) / 2, 30)
|
// LocalTime((interval - 1) / 2, 30)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun decodeBasalInsulin(i: Int, j: Int): Double {
|
// fun decodeBasalInsulin(i: Int, j: Int): Double {
|
||||||
return decodeBasalInsulin(makeUnsignedShort(i, j))
|
// return decodeBasalInsulin(makeUnsignedShort(i, j))
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun decodeBasalInsulin(i: Int): Double {
|
// fun decodeBasalInsulin(i: Int): Double {
|
||||||
return i.toDouble() / 40.0
|
// return i.toDouble() / 40.0
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getBasalStrokes(amount: Double): ByteArray {
|
// fun getBasalStrokes(amount: Double): ByteArray {
|
||||||
return getBasalStrokes(amount, false)
|
// return getBasalStrokes(amount, false)
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getBasalStrokesInt(amount: Double): Int {
|
// fun getBasalStrokesInt(amount: Double): Int {
|
||||||
return getStrokesInt(amount, 40)
|
// return getStrokesInt(amount, 40)
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getBolusStrokes(amount: Double): ByteArray {
|
fun getBolusStrokes(amount: Double): ByteArray {
|
||||||
val strokesPerUnit = medtronicPumpStatus.medtronicDeviceType.bolusStrokes
|
val strokesPerUnit = medtronicPumpStatus.medtronicDeviceType.bolusStrokes
|
||||||
|
@ -89,17 +92,17 @@ class MedtronicUtil @Inject constructor(
|
||||||
return ByteUtil.fromHexString(String.format("%02x%0" + 2 * length + "x", length, strokes))
|
return ByteUtil.fromHexString(String.format("%02x%0" + 2 * length + "x", length, strokes))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createCommandBody(input: ByteArray): ByteArray {
|
// fun createCommandBody(input: ByteArray): ByteArray {
|
||||||
return ByteUtil.concat(input.size.toByte(), input)
|
// return ByteUtil.concat(input.size.toByte(), input)
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper) {
|
// fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper) {
|
||||||
uiInteraction.addNotification(
|
// uiInteraction.addNotification(
|
||||||
notificationType.notificationType,
|
// notificationType.notificationType,
|
||||||
rh.gs(notificationType.resourceId),
|
// rh.gs(notificationType.resourceId),
|
||||||
notificationType.notificationUrgency
|
// notificationType.notificationUrgency
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, vararg parameters: Any?) {
|
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, vararg parameters: Any?) {
|
||||||
uiInteraction.addNotification(
|
uiInteraction.addNotification(
|
||||||
|
@ -117,7 +120,7 @@ class MedtronicUtil @Inject constructor(
|
||||||
return buildCommandPayload(rileyLinkServiceData, commandType.commandCode, parameters)
|
return buildCommandPayload(rileyLinkServiceData, commandType.commandCode, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildCommandPayload(rileyLinkServiceData: RileyLinkServiceData, commandType: Byte, parameters: ByteArray?): ByteArray {
|
private fun buildCommandPayload(rileyLinkServiceData: RileyLinkServiceData, commandType: Byte, parameters: ByteArray?): ByteArray {
|
||||||
// A7 31 65 51 C0 00 52
|
// A7 31 65 51 C0 00 52
|
||||||
val commandLength = (if (parameters == null) 2 else 2 + parameters.size).toByte()
|
val commandLength = (if (parameters == null) 2 else 2 + parameters.size).toByte()
|
||||||
val sendPayloadBuffer = ByteBuffer.allocate(ENVELOPE_SIZE + commandLength) // + CRC_SIZE
|
val sendPayloadBuffer = ByteBuffer.allocate(ENVELOPE_SIZE + commandLength) // + CRC_SIZE
|
||||||
|
@ -283,12 +286,13 @@ class MedtronicUtil @Inject constructor(
|
||||||
return getStrokes(amount, 40, returnFixedSize)
|
return getStrokes(amount, 40, returnFixedSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStrokes(amount: Double, strokesPerUnit: Int, returnFixedSize: Boolean): ByteArray {
|
@Suppress("SameParameterValue")
|
||||||
|
private fun getStrokes(amount: Double, strokesPerUnit: Int, returnFixedSize: Boolean): ByteArray {
|
||||||
val strokes = getStrokesInt(amount, strokesPerUnit)
|
val strokes = getStrokesInt(amount, strokesPerUnit)
|
||||||
return getByteArrayFromUnsignedShort(strokes, returnFixedSize)
|
return getByteArrayFromUnsignedShort(strokes, returnFixedSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStrokesInt(amount: Double, strokesPerUnit: Int): Int {
|
private fun getStrokesInt(amount: Double, strokesPerUnit: Int): Int {
|
||||||
//var length = 1
|
//var length = 1
|
||||||
var scrollRate = 1
|
var scrollRate = 1
|
||||||
if (strokesPerUnit >= 40) {
|
if (strokesPerUnit >= 40) {
|
||||||
|
@ -304,7 +308,7 @@ class MedtronicUtil @Inject constructor(
|
||||||
|
|
||||||
fun isSame(d1: Double, d2: Double): Boolean {
|
fun isSame(d1: Double, d2: Double): Boolean {
|
||||||
val diff = d1 - d2
|
val diff = d1 - d2
|
||||||
return Math.abs(diff) <= 0.000001
|
return abs(diff) <= 0.000001
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import info.nightscout.core.utils.toHex
|
import info.nightscout.core.utils.toHex
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
@ -10,8 +11,8 @@ import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
class Milenage(
|
class Milenage(
|
||||||
private val aapsLogger: AAPSLogger,
|
aapsLogger: AAPSLogger,
|
||||||
private val config: Config,
|
config: Config,
|
||||||
private val k: ByteArray,
|
private val k: ByteArray,
|
||||||
val sqn: ByteArray,
|
val sqn: ByteArray,
|
||||||
randParam: ByteArray? = null,
|
randParam: ByteArray? = null,
|
||||||
|
@ -30,6 +31,7 @@ class Milenage(
|
||||||
}
|
}
|
||||||
|
|
||||||
private val secretKeySpec = SecretKeySpec(k, "AES")
|
private val secretKeySpec = SecretKeySpec(k, "AES")
|
||||||
|
@SuppressLint("GetInstance")
|
||||||
private val cipher: Cipher = Cipher.getInstance("AES/ECB/NoPadding")
|
private val cipher: Cipher = Cipher.getInstance("AES/ECB/NoPadding")
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -123,9 +125,10 @@ class Milenage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
val RESYNC_AMF = Hex.decode("0000")
|
val RESYNC_AMF: ByteArray = Hex.decode("0000")
|
||||||
private val MILENAGE_OP = Hex.decode("cdc202d5123e20f62b6d676ac72cb318")
|
private val MILENAGE_OP = Hex.decode("cdc202d5123e20f62b6d676ac72cb318")
|
||||||
private val MILENAGE_AMF = Hex.decode("b9b9")
|
private val MILENAGE_AMF = Hex.decode("b9b9")
|
||||||
const val KEY_SIZE = 16
|
const val KEY_SIZE = 16
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.EventOmnipodDashPumpValuesChanged
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.EventOmnipodDashPumpValuesChanged
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id
|
||||||
|
@ -20,6 +19,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.DefaultStatusResponse
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.DefaultStatusResponse
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.SetUniqueIdResponse
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.SetUniqueIdResponse
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.VersionResponse
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.VersionResponse
|
||||||
|
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
||||||
import info.nightscout.interfaces.utils.Round
|
import info.nightscout.interfaces.utils.Round
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
@ -437,7 +437,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
override fun updateActiveCommand() = Maybe.create<CommandConfirmed> { source ->
|
override fun updateActiveCommand(): Maybe<CommandConfirmed> = Maybe.create { source ->
|
||||||
val activeCommand = podState.activeCommand
|
val activeCommand = podState.activeCommand
|
||||||
if (activeCommand == null) {
|
if (activeCommand == null) {
|
||||||
logger.error(LTag.PUMPCOMM, "No active command to update")
|
logger.error(LTag.PUMPCOMM, "No active command to update")
|
||||||
|
@ -515,6 +515,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
||||||
"lastResponse=$lastStatusResponseReceived " +
|
"lastResponse=$lastStatusResponseReceived " +
|
||||||
"$sequenceNumberOfLastProgrammingCommand $historyId"
|
"$sequenceNumberOfLastProgrammingCommand $historyId"
|
||||||
)
|
)
|
||||||
|
@Suppress("KotlinConstantConditions")
|
||||||
when {
|
when {
|
||||||
createdRealtime <= podState.lastStatusResponseReceived &&
|
createdRealtime <= podState.lastStatusResponseReceived &&
|
||||||
sequence == podState.sequenceNumberOfLastProgrammingCommand ->
|
sequence == podState.sequenceNumberOfLastProgrammingCommand ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.core.pump
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions
|
||||||
|
|
||||||
import info.nightscout.interfaces.pump.PumpSync
|
import info.nightscout.interfaces.pump.PumpSync
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
|
@ -56,12 +56,12 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosP
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.OmnipodManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.OmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions.DetailedBolusInfoExtensionKt;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions.DetailedBolusInfoExtensionKt;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.extensions.PumpStateExtensionKt;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryRecordEntity;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
||||||
import info.nightscout.core.pump.PumpStateExtensionKt;
|
|
||||||
import info.nightscout.interfaces.notifications.Notification;
|
import info.nightscout.interfaces.notifications.Notification;
|
||||||
import info.nightscout.interfaces.profile.Profile;
|
import info.nightscout.interfaces.profile.Profile;
|
||||||
import info.nightscout.interfaces.pump.DetailedBolusInfo;
|
import info.nightscout.interfaces.pump.DetailedBolusInfo;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.ServiceConnection
|
import android.content.ServiceConnection
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
|
import com.google.gson.Gson
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
|
@ -26,6 +27,7 @@ import info.nightscout.interfaces.utils.DecimalFormatter.to2Decimal
|
||||||
import info.nightscout.pump.common.data.PumpStatus
|
import info.nightscout.pump.common.data.PumpStatus
|
||||||
import info.nightscout.pump.common.defs.PumpDriverState
|
import info.nightscout.pump.common.defs.PumpDriverState
|
||||||
import info.nightscout.pump.common.sync.PumpDbEntryCarbs
|
import info.nightscout.pump.common.sync.PumpDbEntryCarbs
|
||||||
|
import info.nightscout.pump.common.sync.PumpSyncEntriesCreator
|
||||||
import info.nightscout.pump.common.sync.PumpSyncStorage
|
import info.nightscout.pump.common.sync.PumpSyncStorage
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
@ -61,7 +63,7 @@ abstract class PumpPluginAbstract protected constructor(
|
||||||
var aapsSchedulers: AapsSchedulers,
|
var aapsSchedulers: AapsSchedulers,
|
||||||
var pumpSync: PumpSync,
|
var pumpSync: PumpSync,
|
||||||
var pumpSyncStorage: PumpSyncStorage
|
var pumpSyncStorage: PumpSyncStorage
|
||||||
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, Constraints, info.nightscout.pump.common.sync.PumpSyncEntriesCreator {
|
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, Constraints, PumpSyncEntriesCreator {
|
||||||
|
|
||||||
protected val disposable = CompositeDisposable()
|
protected val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -80,24 +82,21 @@ abstract class PumpPluginAbstract protected constructor(
|
||||||
pumpDescription.fillFor(value)
|
pumpDescription.fillFor(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()
|
protected var gson: Gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()
|
||||||
|
|
||||||
abstract fun initPumpStatusData()
|
abstract fun initPumpStatusData()
|
||||||
|
|
||||||
open fun hasService(): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
initPumpStatusData()
|
initPumpStatusData()
|
||||||
if (hasService()) {
|
serviceConnection?.let { serviceConnection ->
|
||||||
val intent = Intent(context, serviceClass)
|
val intent = Intent(context, serviceClass)
|
||||||
context.bindService(intent, serviceConnection!!, Context.BIND_AUTO_CREATE)
|
context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)
|
||||||
disposable.add(rxBus
|
disposable.add(
|
||||||
.toObservable(EventAppExit::class.java)
|
rxBus
|
||||||
.observeOn(aapsSchedulers.io)
|
.toObservable(EventAppExit::class.java)
|
||||||
.subscribe({ _ -> context.unbindService(serviceConnection!!) }) { throwable: Throwable? -> fabricPrivacy.logException(throwable!!) }
|
.observeOn(aapsSchedulers.io)
|
||||||
|
.subscribe({ context.unbindService(serviceConnection) }, fabricPrivacy::logException)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
serviceRunning = true
|
serviceRunning = true
|
||||||
|
@ -106,8 +105,8 @@ abstract class PumpPluginAbstract protected constructor(
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
aapsLogger.debug(LTag.PUMP, model().model + " onStop()")
|
aapsLogger.debug(LTag.PUMP, model().model + " onStop()")
|
||||||
if (hasService()) {
|
serviceConnection?.let { serviceConnection ->
|
||||||
context.unbindService(serviceConnection!!)
|
context.unbindService(serviceConnection)
|
||||||
}
|
}
|
||||||
serviceRunning = false
|
serviceRunning = false
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
|
@ -334,7 +333,7 @@ abstract class PumpPluginAbstract protected constructor(
|
||||||
rxBus.send(EventCustomActionsChanged())
|
rxBus.send(EventCustomActionsChanged())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun manufacturer(): ManufacturerType = pumpType.manufacturer!!
|
override fun manufacturer(): ManufacturerType = pumpType.manufacturer ?: ManufacturerType.AAPS
|
||||||
override fun model(): PumpType = pumpType
|
override fun model(): PumpType = pumpType
|
||||||
override fun canHandleDST(): Boolean = false
|
override fun canHandleDST(): Boolean = false
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.plugins.iob.iobCobCalculator
|
package info.nightscout.workflow.iob
|
||||||
|
|
||||||
import info.nightscout.database.entities.Carbs
|
import info.nightscout.database.entities.Carbs
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
|
|
|
@ -23,7 +23,6 @@ import info.nightscout.interfaces.profile.Instantiator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.profiling.Profiler
|
import info.nightscout.interfaces.profiling.Profiler
|
||||||
import info.nightscout.interfaces.utils.DecimalFormatter
|
import info.nightscout.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.plugins.iob.iobCobCalculator.fromCarbs
|
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||||
|
|
|
@ -21,7 +21,6 @@ import info.nightscout.interfaces.profile.Instantiator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.profiling.Profiler
|
import info.nightscout.interfaces.profiling.Profiler
|
||||||
import info.nightscout.interfaces.utils.DecimalFormatter
|
import info.nightscout.interfaces.utils.DecimalFormatter
|
||||||
import info.nightscout.plugins.iob.iobCobCalculator.fromCarbs
|
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||||
|
|
Loading…
Reference in a new issue