fix tests
This commit is contained in:
parent
120c526b80
commit
70e9d3e88a
183 changed files with 814 additions and 617 deletions
|
@ -16,13 +16,12 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var tirCalculator: TirCalculator
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_stats)
|
||||
|
||||
stats_tdds.text = tddCalculator.stats(dateUtil)
|
||||
stats_tdds.text = tddCalculator.stats()
|
||||
stats_tir.text = tirCalculator.stats()
|
||||
stats_activity.text = activityMonitor.stats()
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ class SurveyActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var defaultProfile: DefaultProfile
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -43,7 +42,7 @@ class SurveyActivity : NoSplashAppCompatActivity() {
|
|||
val profileList = profileStore?.getProfileList() ?: return
|
||||
survey_spinner.adapter = ArrayAdapter(this, R.layout.spinner_centered, profileList)
|
||||
|
||||
survey_tdds.text = tddCalculator.stats(dateUtil)
|
||||
survey_tdds.text = tddCalculator.stats()
|
||||
survey_tir.text = tirCalculator.stats()
|
||||
survey_activity.text = activityMonitor.stats()
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
eventTime -= eventTime % 1000
|
||||
val time = eventTime + timeOffset * 1000 * 60
|
||||
if (timeOffset != 0)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(time))
|
||||
val duration = overview_carbs_duration.value.toInt()
|
||||
if (duration > 0)
|
||||
actions.add(resourceHelper.gs(R.string.duration) + ": " + duration + resourceHelper.gs(R.string.shorthour))
|
||||
|
@ -184,7 +184,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
|||
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
|
||||
|
||||
if (eventTimeChanged)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(eventTime))
|
||||
|
||||
if (carbsAfterConstraints > 0 || activitySelected || eatingSoonSelected || hypoSelected) {
|
||||
activity?.let { activity ->
|
||||
|
|
|
@ -167,7 +167,7 @@ class CareDialog : DialogFragmentWithDate() {
|
|||
eventTime -= eventTime % 1000
|
||||
|
||||
if (eventTimeChanged)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(eventTime))
|
||||
|
||||
json.put("created_at", DateUtil.toISOString(eventTime))
|
||||
json.put("mills", eventTime)
|
||||
|
|
|
@ -112,7 +112,7 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
eventTime -= eventTime % 1000
|
||||
|
||||
if (eventTimeChanged)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(eventTime))
|
||||
|
||||
if (insulinAfterConstraints > 0 || fill_catheter_change.isChecked || fill_cartridge_change.isChecked) {
|
||||
activity?.let { activity ->
|
||||
|
|
|
@ -145,7 +145,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
val timeOffset = overview_insulin_time.value.toInt()
|
||||
val time = DateUtil.now() + T.mins(timeOffset.toLong()).msecs()
|
||||
if (timeOffset != 0)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(time))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(time))
|
||||
|
||||
val notes = notes.text.toString()
|
||||
if (notes.isNotEmpty())
|
||||
|
|
|
@ -98,7 +98,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
|||
if (notes.isNotEmpty())
|
||||
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
|
||||
if (eventTimeChanged)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(eventTime))
|
||||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
||||
|
|
|
@ -23,6 +23,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
@Inject lateinit var injector: HasAndroidInjector
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private var time: Long = 0
|
||||
|
||||
|
@ -67,7 +68,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
Mode.RUNNING_PROFILE -> {
|
||||
profile = treatmentsPlugin.getProfileSwitchFromHistory(time)?.profileObject
|
||||
profileName = treatmentsPlugin.getProfileSwitchFromHistory(time)?.customizedName
|
||||
date = DateUtil.dateAndTimeString(treatmentsPlugin.getProfileSwitchFromHistory(time)?.date
|
||||
date = dateUtil.dateAndTimeString(treatmentsPlugin.getProfileSwitchFromHistory(time)?.date
|
||||
?: 0)
|
||||
profileview_datelayout.visibility = View.VISIBLE
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
|||
actions.add(resourceHelper.gs(R.string.stoptemptarget))
|
||||
}
|
||||
if (eventTimeChanged)
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
|
||||
actions.add(resourceHelper.gs(R.string.time) + ": " + dateUtil.dateAndTimeString(eventTime))
|
||||
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
||||
|
|
|
@ -54,6 +54,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var overviewMenus: OverviewMenus
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
|
@ -117,7 +118,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
cal.set(Calendar.MONTH, monthOfYear)
|
||||
cal.set(Calendar.DAY_OF_MONTH, dayOfMonth)
|
||||
start = cal.timeInMillis
|
||||
historybrowse_date?.text = DateUtil.dateAndTimeString(start)
|
||||
historybrowse_date?.text = dateUtil.dateAndTimeString(start)
|
||||
updateGUI("onClickDate")
|
||||
runCalculation("onClickDate")
|
||||
}
|
||||
|
@ -236,7 +237,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
val lowLine = defaultValueHelper.determineLowLine()
|
||||
val highLine = defaultValueHelper.determineHighLine()
|
||||
historybrowse_date?.text = DateUtil.dateAndTimeString(start)
|
||||
historybrowse_date?.text = dateUtil.dateAndTimeString(start)
|
||||
historybrowse_zoom?.text = rangeToDisplay.toString()
|
||||
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
|
@ -248,7 +249,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
withContext(Dispatchers.Default) {
|
||||
val fromTime: Long = start + T.secs(100).msecs()
|
||||
val toTime: Long = start + T.hours(rangeToDisplay.toLong()).msecs()
|
||||
aapsLogger.debug(LTag.UI, "Period: " + DateUtil.dateAndTimeString(fromTime) + " - " + DateUtil.dateAndTimeString(toTime))
|
||||
aapsLogger.debug(LTag.UI, "Period: " + dateUtil.dateAndTimeString(fromTime) + " - " + dateUtil.dateAndTimeString(toTime))
|
||||
val pointer = System.currentTimeMillis()
|
||||
|
||||
// **** In range Area ****
|
||||
|
|
|
@ -10,6 +10,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
|||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
|
@ -27,9 +28,10 @@ class IobCobStaticCalculatorPlugin @Inject constructor(
|
|||
sensitivityOref1Plugin: SensitivityOref1Plugin,
|
||||
sensitivityAAPSPlugin: SensitivityAAPSPlugin,
|
||||
sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin,
|
||||
fabricPrivacy: FabricPrivacy
|
||||
fabricPrivacy: FabricPrivacy,
|
||||
dateUtil: DateUtil
|
||||
) : IobCobCalculatorPlugin(injector, aapsLogger, rxBus, sp, resourceHelper, profileFunction,
|
||||
activePlugin, treatmentsPlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy) {
|
||||
activePlugin, treatmentsPlugin, sensitivityOref1Plugin, sensitivityAAPSPlugin, sensitivityWeightedAveragePlugin, fabricPrivacy, dateUtil) {
|
||||
|
||||
override fun onStart() { // do not attach to rxbus
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class LoopFragment : DaggerFragment() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -81,12 +82,12 @@ class LoopFragment : DaggerFragment() {
|
|||
loop_request?.text = it.request?.toSpanned() ?: ""
|
||||
loop_constraintsprocessed?.text = it.constraintsProcessed?.toSpanned() ?: ""
|
||||
loop_source?.text = it.source ?: ""
|
||||
loop_lastrun?.text = DateUtil.dateAndTimeString(it.lastAPSRun)
|
||||
loop_lastrun?.text = dateUtil.dateAndTimeString(it.lastAPSRun)
|
||||
?: ""
|
||||
loop_smbrequest_time?.text = DateUtil.dateAndTimeAndSecondsString(it.lastSMBRequest)
|
||||
loop_smbexecution_time?.text = DateUtil.dateAndTimeAndSecondsString(it.lastSMBEnact)
|
||||
loop_tbrrequest_time?.text = DateUtil.dateAndTimeAndSecondsString(it.lastTBRRequest)
|
||||
loop_tbrexecution_time?.text = DateUtil.dateAndTimeAndSecondsString(it.lastTBREnact)
|
||||
loop_smbrequest_time?.text = dateUtil.dateAndTimeAndSecondsString(it.lastSMBRequest)
|
||||
loop_smbexecution_time?.text = dateUtil.dateAndTimeAndSecondsString(it.lastSMBEnact)
|
||||
loop_tbrrequest_time?.text = dateUtil.dateAndTimeAndSecondsString(it.lastTBRRequest)
|
||||
loop_tbrexecution_time?.text = dateUtil.dateAndTimeAndSecondsString(it.lastTBREnact)
|
||||
|
||||
loop_tbrsetbypump?.text = it.tbrSetByPump?.let { tbrSetByPump -> HtmlHelper.fromHtml(tbrSetByPump.toHtml()) }
|
||||
?: ""
|
||||
|
|
|
@ -32,6 +32,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
@ -96,7 +97,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
|||
openapsma_scriptdebugdata.text = determineBasalAdapterAMAJS.scriptDebug
|
||||
}
|
||||
if (openAPSAMAPlugin.lastAPSRun != 0L) {
|
||||
openapsma_lastrun.text = DateUtil.dateAndTimeString(openAPSAMAPlugin.lastAPSRun)
|
||||
openapsma_lastrun.text = dateUtil.dateAndTimeString(openAPSAMAPlugin.lastAPSRun)
|
||||
}
|
||||
openAPSAMAPlugin.lastAutosensResult?.let {
|
||||
openapsma_autosensdata.text = JSONFormatter.format(it.json())
|
||||
|
|
|
@ -33,6 +33,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
@ -99,7 +100,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
if (openAPSSMBPlugin.lastAPSRun != 0L) {
|
||||
openapsma_lastrun.text = DateUtil.dateAndTimeString(openAPSSMBPlugin.lastAPSRun)
|
||||
openapsma_lastrun.text = dateUtil.dateAndTimeString(openAPSSMBPlugin.lastAPSRun)
|
||||
}
|
||||
openAPSSMBPlugin.lastAutosensResult?.let {
|
||||
openapsma_autosensdata.text = JSONFormatter.format(it.json())
|
||||
|
|
|
@ -49,6 +49,8 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var objectivesPlugin: ObjectivesPlugin
|
||||
@Inject lateinit var receiverStatusStore: ReceiverStatusStore
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var sntpClient: SntpClient
|
||||
|
||||
private val objectivesAdapter = ObjectivesAdapter()
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
@ -221,7 +223,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.progress.addView(separator, LinearLayout.LayoutParams.MATCH_PARENT, 2)
|
||||
}
|
||||
}
|
||||
holder.accomplished.text = resourceHelper.gs(R.string.accomplished, DateUtil.dateAndTimeString(objective.accomplishedOn))
|
||||
holder.accomplished.text = resourceHelper.gs(R.string.accomplished, dateUtil.dateAndTimeString(objective.accomplishedOn))
|
||||
holder.accomplished.setTextColor(-0x3e3e3f)
|
||||
holder.verify.setOnClickListener {
|
||||
receiverStatusStore.updateNetworkStatus()
|
||||
|
@ -236,7 +238,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
Thread {
|
||||
NtpProgressDialog().show((context as AppCompatActivity).supportFragmentManager, "NtpCheck")
|
||||
rxBus.send(EventNtpStatus(resourceHelper.gs(R.string.timedetection), 0))
|
||||
SntpClient.ntpTime(object : SntpClient.Callback() {
|
||||
sntpClient.ntpTime(object : SntpClient.Callback() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("NTP time: $time System time: ${DateUtil.now()}")
|
||||
SystemClock.sleep(300)
|
||||
|
@ -275,7 +277,7 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
Thread {
|
||||
NtpProgressDialog().show((context as AppCompatActivity).supportFragmentManager, "NtpCheck")
|
||||
rxBus.send(EventNtpStatus(resourceHelper.gs(R.string.timedetection), 0))
|
||||
SntpClient.ntpTime(object : SntpClient.Callback() {
|
||||
sntpClient.ntpTime(object : SntpClient.Callback() {
|
||||
override fun run() {
|
||||
aapsLogger.debug("NTP time: $time System time: ${DateUtil.now()}")
|
||||
SystemClock.sleep(300)
|
||||
|
|
|
@ -248,7 +248,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
|
||||
private fun checkPumpCustomActions() {
|
||||
val activePump = activePlugin.activePump
|
||||
val customActions = activePump.customActions
|
||||
val customActions = activePump.customActions ?: return
|
||||
removePumpCustomActions()
|
||||
|
||||
for (customAction in customActions) {
|
||||
|
|
|
@ -12,8 +12,11 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.JsonHelper
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import org.json.JSONObject
|
||||
import javax.inject.Inject
|
||||
|
||||
class TriggerTime(injector: HasAndroidInjector) : Trigger(injector) {
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
var time = InputDateTime(injector)
|
||||
|
||||
constructor(injector: HasAndroidInjector, runAt: Long) : this(injector) {
|
||||
|
@ -57,7 +60,7 @@ class TriggerTime(injector: HasAndroidInjector) : Trigger(injector) {
|
|||
override fun friendlyName(): Int = R.string.time
|
||||
|
||||
override fun friendlyDescription(): String =
|
||||
resourceHelper.gs(R.string.atspecifiedtime, DateUtil.dateAndTimeString(time.value))
|
||||
resourceHelper.gs(R.string.atspecifiedtime, dateUtil.dateAndTimeString(time.value))
|
||||
|
||||
override fun icon(): Optional<Int?> = Optional.of(R.drawable.ic_access_alarm_24dp)
|
||||
|
||||
|
|
|
@ -699,7 +699,7 @@ public class NewNSTreatmentDialog extends DaggerDialogFragment implements View.O
|
|||
if (data.has("created_at")) {
|
||||
ret += resourceHelper.gs(R.string.event_time_label);
|
||||
ret += ": ";
|
||||
ret += DateUtil.dateAndTimeString(eventTime);
|
||||
ret += dateUtil.dateAndTimeString(eventTime);
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("enteredBy")) {
|
||||
|
|
|
@ -90,6 +90,7 @@ public class NSClientService extends DaggerService {
|
|||
@Inject NSClientPlugin nsClientPlugin;
|
||||
@Inject BuildHelper buildHelper;
|
||||
@Inject Config config;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.NSCLIENT);
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
@ -721,7 +722,7 @@ public class NSClientService extends DaggerService {
|
|||
}
|
||||
handleNewSgv(sgvs, isDelta);
|
||||
}
|
||||
rxBus.send(new EventNSClientNewLog("LAST", DateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||
rxBus.send(new EventNSClientNewLog("LAST", dateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ class TidepoolUploader @Inject constructor(
|
|||
private val resourceHelper: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val uploadChunk: UploadChunk,
|
||||
private val activePlugin: ActivePluginProvider
|
||||
private val activePlugin: ActivePluginProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) {
|
||||
|
||||
private var wl: PowerManager.WakeLock? = null
|
||||
|
@ -233,7 +234,7 @@ class TidepoolUploader @Inject constructor(
|
|||
private fun uploadNext() {
|
||||
if (uploadChunk.getLastEnd() < DateUtil.now() - T.mins(1).msecs()) {
|
||||
SystemClock.sleep(3000)
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Restarting doUpload. Last: " + DateUtil.dateAndTimeString(uploadChunk.getLastEnd()))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Restarting doUpload. Last: " + dateUtil.dateAndTimeString(uploadChunk.getLastEnd()))
|
||||
doUpload()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ class UploadChunk @Inject constructor(
|
|||
private val aapsLogger: AAPSLogger,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val treatmentsPlugin: TreatmentsPlugin,
|
||||
private val activePlugin: ActivePluginProvider
|
||||
private val activePlugin: ActivePluginProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) {
|
||||
|
||||
private val MAX_UPLOAD_SIZE = T.days(7).msecs() // don't change this
|
||||
|
@ -51,9 +52,9 @@ class UploadChunk @Inject constructor(
|
|||
|
||||
operator fun get(start: Long, end: Long): String {
|
||||
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Syncing data between: " + DateUtil.dateAndTimeString(start) + " -> " + DateUtil.dateAndTimeString(end))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Syncing data between: " + dateUtil.dateAndTimeString(start) + " -> " + dateUtil.dateAndTimeString(end))
|
||||
if (end <= start) {
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "End is <= start: " + DateUtil.dateAndTimeString(start) + " " + DateUtil.dateAndTimeString(end))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "End is <= start: " + dateUtil.dateAndTimeString(start) + " " + dateUtil.dateAndTimeString(end))
|
||||
return ""
|
||||
}
|
||||
if (end - start > MAX_UPLOAD_SIZE) {
|
||||
|
@ -85,11 +86,11 @@ class UploadChunk @Inject constructor(
|
|||
fun setLastEnd(time: Long) {
|
||||
if (time > getLastEnd()) {
|
||||
sp.putLong(R.string.key_tidepool_last_end, time)
|
||||
val friendlyEnd = DateUtil.dateAndTimeString(time)
|
||||
val friendlyEnd = dateUtil.dateAndTimeString(time)
|
||||
rxBus.send(EventTidepoolStatus(("Marking uploaded data up to $friendlyEnd")))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Updating last end to: " + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Updating last end to: " + dateUtil.dateAndTimeString(time))
|
||||
} else {
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Cannot set last end to: " + DateUtil.dateAndTimeString(time) + " vs " + DateUtil.dateAndTimeString(getLastEnd()))
|
||||
aapsLogger.debug(LTag.TIDEPOOL, "Cannot set last end to: " + dateUtil.dateAndTimeString(time) + " vs " + dateUtil.dateAndTimeString(getLastEnd()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ class UploadChunk @Inject constructor(
|
|||
|
||||
}
|
||||
|
||||
internal fun getBgReadings(start: Long, end: Long): List<SensorGlucoseElement> {
|
||||
private fun getBgReadings(start: Long, end: Long): List<SensorGlucoseElement> {
|
||||
val readings = MainApp.getDbHelper().getBgreadingsDataFromTime(start, end, true)
|
||||
val selection = SensorGlucoseElement.fromBgReadings(readings)
|
||||
if (selection.isNotEmpty())
|
||||
|
|
|
@ -69,6 +69,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
private final SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
private final SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
private final FabricPrivacy fabricPrivacy;
|
||||
private final DateUtil dateUtil;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -98,7 +99,8 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
SensitivityOref1Plugin sensitivityOref1Plugin,
|
||||
SensitivityAAPSPlugin sensitivityAAPSPlugin,
|
||||
SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin,
|
||||
FabricPrivacy fabricPrivacy
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
|
@ -119,6 +121,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
this.sensitivityAAPSPlugin = sensitivityAAPSPlugin;
|
||||
this.sensitivityWeightedAveragePlugin = sensitivityWeightedAveragePlugin;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -247,10 +250,10 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
// if close to now expect there can be some readings with time in close future (caused by wrong time setting)
|
||||
// so read all records
|
||||
bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime(start, false);
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size() + " Start date: " + DateUtil.dateAndTimeString(start));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size() + " Start date: " + dateUtil.dateAndTimeString(start));
|
||||
} else {
|
||||
bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime(start, to, false);
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size() + " Start date: " + DateUtil.dateAndTimeString(start) + " End date: " + DateUtil.dateAndTimeString(to));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size() + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +443,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
if (limitDataToOldestAvailable) {
|
||||
getBGDataFrom = Math.max(oldestDataAvailable, (long) (from - T.hours(1).msecs() * (24 + dia)));
|
||||
if (getBGDataFrom == oldestDataAvailable)
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Limiting data to oldest available temps: " + DateUtil.dateAndTimeString(oldestDataAvailable));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Limiting data to oldest available temps: " + dateUtil.dateAndTimeString(oldestDataAvailable));
|
||||
} else
|
||||
getBGDataFrom = (long) (from - T.hours(1).msecs() * (24 + dia));
|
||||
return getBGDataFrom;
|
||||
|
@ -675,7 +678,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
return null;
|
||||
}
|
||||
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + DateUtil.dateAndTimeString(data.time));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastdata=" + dateUtil.dateAndTimeString(data.time));
|
||||
return null;
|
||||
} else {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "AUTOSENSDATA (" + reason + ") " + data.toString());
|
||||
|
@ -686,7 +689,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
@Override
|
||||
public String lastDataTime() {
|
||||
if (autosensDataTable.size() > 0)
|
||||
return DateUtil.dateAndTimeString(autosensDataTable.valueAt(autosensDataTable.size() - 1).time);
|
||||
return dateUtil.dateAndTimeString(autosensDataTable.valueAt(autosensDataTable.size() - 1).time);
|
||||
else
|
||||
return "autosensDataTable empty";
|
||||
}
|
||||
|
@ -808,7 +811,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
}
|
||||
|
||||
public void runCalculation(String from, long end, boolean bgDataReload, boolean limitDataToOldestAvailable, Event cause) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Starting calculation thread: " + from + " to " + DateUtil.dateAndTimeString(end));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Starting calculation thread: " + from + " to " + dateUtil.dateAndTimeString(end));
|
||||
if (thread == null || thread.getState() == Thread.State.TERMINATED) {
|
||||
if (sensitivityOref1Plugin.isEnabled())
|
||||
thread = new IobCobOref1Thread(injector, from, end, bgDataReload, limitDataToOldestAvailable, cause);
|
||||
|
@ -825,10 +828,10 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
synchronized (dataLock) {
|
||||
// clear up 5 min back for proper COB calculation
|
||||
long time = ev.getTime() - 5 * 60 * 1000L;
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Invalidating cached data to: " + DateUtil.dateAndTimeString(time));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Invalidating cached data to: " + dateUtil.dateAndTimeString(time));
|
||||
for (int index = iobTable.size() - 1; index >= 0; index--) {
|
||||
if (iobTable.keyAt(index) > time) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from iobTable: " + DateUtil.dateAndTimeString(iobTable.keyAt(index)));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from iobTable: " + dateUtil.dateAndTimeString(iobTable.keyAt(index)));
|
||||
iobTable.removeAt(index);
|
||||
} else {
|
||||
break;
|
||||
|
@ -836,7 +839,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
}
|
||||
for (int index = absIobTable.size() - 1; index >= 0; index--) {
|
||||
if (absIobTable.keyAt(index) > time) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from absIobTable: " + DateUtil.dateAndTimeString(absIobTable.keyAt(index)));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from absIobTable: " + dateUtil.dateAndTimeString(absIobTable.keyAt(index)));
|
||||
absIobTable.removeAt(index);
|
||||
} else {
|
||||
break;
|
||||
|
@ -844,7 +847,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
}
|
||||
for (int index = autosensDataTable.size() - 1; index >= 0; index--) {
|
||||
if (autosensDataTable.keyAt(index) > time) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from autosensDataTable: " + DateUtil.dateAndTimeString(autosensDataTable.keyAt(index)));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from autosensDataTable: " + dateUtil.dateAndTimeString(autosensDataTable.keyAt(index)));
|
||||
autosensDataTable.removeAt(index);
|
||||
} else {
|
||||
break;
|
||||
|
@ -852,7 +855,7 @@ public class IobCobCalculatorPlugin extends PluginBase implements IobCobCalculat
|
|||
}
|
||||
for (int index = basalDataTable.size() - 1; index >= 0; index--) {
|
||||
if (basalDataTable.keyAt(index) > time) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from basalDataTable: " + DateUtil.dateAndTimeString(basalDataTable.keyAt(index)));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Removing from basalDataTable: " + dateUtil.dateAndTimeString(basalDataTable.keyAt(index)));
|
||||
basalDataTable.removeAt(index);
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -68,6 +68,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
@Inject BuildHelper buildHelper;
|
||||
@Inject Profiler profiler;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
private final HasAndroidInjector injector;
|
||||
private boolean bgDataReload;
|
||||
|
@ -122,7 +123,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
}
|
||||
|
||||
long prevDataTime = IobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + DateUtil.dateAndTimeString(prevDataTime));
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + dateUtil.dateAndTimeString(prevDataTime));
|
||||
AutosensData previous = autosensDataTable.get(prevDataTime);
|
||||
// start from oldest to be able sub cob
|
||||
for (int i = bucketed_data.size() - 4; i >= 0; i--) {
|
||||
|
@ -378,7 +379,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
previous = autosensData;
|
||||
if (bgTime < now())
|
||||
autosensDataTable.put(bgTime, autosensData);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
AutosensResult sensitivity = iobCobCalculatorPlugin.detectSensitivityWithLock(oldestTimeWithData, bgTime);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: " + sensitivity.toString());
|
||||
autosensData.autosensResult = sensitivity;
|
||||
|
|
|
@ -65,6 +65,7 @@ public class IobCobThread extends Thread {
|
|||
@Inject BuildHelper buildHelper;
|
||||
@Inject Profiler profiler;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
private final HasAndroidInjector injector;
|
||||
private boolean bgDataReload;
|
||||
|
@ -119,7 +120,7 @@ public class IobCobThread extends Thread {
|
|||
}
|
||||
|
||||
long prevDataTime = IobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + DateUtil.dateAndTimeString(prevDataTime));
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + dateUtil.dateAndTimeString(prevDataTime));
|
||||
AutosensData previous = autosensDataTable.get(prevDataTime);
|
||||
// start from oldest to be able sub cob
|
||||
for (int i = bucketed_data.size() - 4; i >= 0; i--) {
|
||||
|
@ -302,7 +303,7 @@ public class IobCobThread extends Thread {
|
|||
previous = autosensData;
|
||||
if (bgTime < now())
|
||||
autosensDataTable.put(bgTime, autosensData);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Running detectSensitivity from: " + DateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + DateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + iobCobCalculatorPlugin.lastDataTime());
|
||||
AutosensResult sensitivity = iobCobCalculatorPlugin.detectSensitivityWithLock(oldestTimeWithData, bgTime);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: " + sensitivity.toString());
|
||||
autosensData.autosensResult = sensitivity;
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA
|
||||
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
|
||||
|
@ -28,12 +29,14 @@ import java.text.DecimalFormat
|
|||
import javax.inject.Inject
|
||||
|
||||
class LocalProfileFragment : DaggerFragment() {
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
||||
@Inject lateinit var hardLimits: HardLimits
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -103,14 +106,14 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
localprofile_name.addTextChangedListener(textWatch)
|
||||
localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
|
||||
localprofile_dia.tag = "LP_DIA"
|
||||
TimeListEdit(context, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
|
||||
basalView = TimeListEdit(context, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label), localProfilePlugin.currentProfile().ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
|
||||
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
|
||||
if (units == Constants.MGDL) {
|
||||
TimeListEdit(context, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
|
||||
TimeListEdit(context, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), 1.0, DecimalFormat("0"), save)
|
||||
} else {
|
||||
TimeListEdit(context, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label), localProfilePlugin.currentProfile().isf, null, Profile.fromMgdlToUnits(hardLimits.MINISF, Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.MAXISF, Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label), localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[0].toDouble(), Constants.MMOL), Profile.fromMgdlToUnits(hardLimits.VERY_HARD_LIMIT_TARGET_BG[1].toDouble(), Constants.MMOL), 0.1, DecimalFormat("0.0"), save)
|
||||
}
|
||||
|
||||
// Spinner
|
||||
|
@ -187,10 +190,10 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
localprofile_units.text = resourceHelper.gs(R.string.units_colon) + " " + (if (localProfilePlugin.currentProfile().mgdl) resourceHelper.gs(R.string.mgdl) else resourceHelper.gs(R.string.mmol))
|
||||
localprofile_dia.setParams(localProfilePlugin.currentProfile().dia, MIN_DIA, 12.0, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
|
||||
localprofile_dia.tag = "LP_DIA"
|
||||
TimeListEdit(context, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save)
|
||||
basalView = TimeListEdit(context, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
|
||||
TimeListEdit(context, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.nsprofileview_ic_label) + ":", localProfilePlugin.currentProfile().ic, null, 0.5, 50.0, 0.1, DecimalFormat("0.0"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.nsprofileview_isf_label) + ":", localProfilePlugin.currentProfile().isf, null, 0.5, 500.0, 0.1, DecimalFormat("0.0"), save)
|
||||
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.nsprofileview_basal_label) + ": " + sumLabel(), localProfilePlugin.currentProfile().basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
|
||||
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_target, "TARGET", resourceHelper.gs(R.string.nsprofileview_target_label) + ":", localProfilePlugin.currentProfile().targetLow, localProfilePlugin.currentProfile().targetHigh, 3.0, 200.0, 0.1, DecimalFormat("0.0"), save)
|
||||
updateGUI()
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
protected ResourceHelper resourceHelper;
|
||||
protected CommandQueueProvider commandQueue;
|
||||
protected SP sp;
|
||||
protected DateUtil dateUtil;
|
||||
|
||||
/*
|
||||
protected static final PumpEnactResult OPERATION_NOT_SUPPORTED = new PumpEnactResult().success(false)
|
||||
|
@ -92,7 +93,8 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
ActivePluginProvider activePlugin,
|
||||
SP sp,
|
||||
Context context,
|
||||
FabricPrivacy fabricPrivacy
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
|
||||
super(pluginDescription, injector, aapsLogger, resourceHelper, commandQueue);
|
||||
|
@ -107,7 +109,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
|
||||
pumpDescription.setPumpDescription(pumpType);
|
||||
this.pumpType = pumpType;
|
||||
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -345,14 +347,14 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
|
|||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate",
|
||||
tb.tempBasalConvertedToAbsolute(System.currentTimeMillis(), profile));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
|
||||
ExtendedBolus eb = activePlugin.getActiveTreatments().getExtendedBolusFromHistory(System.currentTimeMillis());
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
|||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +46,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
@Inject MedtronicUtil medtronicUtil;
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject RileyLinkServiceData rileyLinkServiceData;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
TextView connectionStatus;
|
||||
TextView configuredAddress;
|
||||
|
@ -148,7 +150,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
rileyLinkServiceData.lastGoodFrequency));
|
||||
|
||||
if (medtronicPumpStatus.lastConnection != 0)
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
|
||||
medtronicPumpStatus.lastDataTime)));
|
||||
else
|
||||
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
|
||||
|
@ -182,7 +184,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
rileyLinkServiceData.lastGoodFrequency));
|
||||
|
||||
if (omnipodPumpStatus.lastConnection != 0)
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(new LocalDateTime(
|
||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(
|
||||
omnipodPumpStatus.lastDataTime)));
|
||||
else
|
||||
this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never));
|
||||
|
|
|
@ -34,6 +34,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
|
|||
|
||||
@Inject RileyLinkUtil rileyLinkUtil;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
RecyclerView recyclerView;
|
||||
RecyclerViewAdapter recyclerViewAdapter;
|
||||
|
@ -136,7 +137,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
|
|||
RLHistoryItem item = historyList.get(position);
|
||||
|
||||
if (item != null) {
|
||||
holder.timeView.setText(DateUtil.dateAndTimeAndSecondsString(item.getDateTime().toDateTime().getMillis()));
|
||||
holder.timeView.setText(dateUtil.dateAndTimeAndSecondsString(item.getDateTime().toDateTime().getMillis()));
|
||||
holder.typeView.setText(item.getSource().getDesc());
|
||||
holder.valueView.setText(item.getDescription(resourceHelper));
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ public class StringUtil {
|
|||
}
|
||||
|
||||
|
||||
public static String toDateTimeString(LocalDateTime localDateTime) {
|
||||
return DateUtil.dateAndTimeAndSecondsString(localDateTime.toDateTime().getMillis());
|
||||
public static String toDateTimeString(DateUtil dateUtil, LocalDateTime localDateTime) {
|
||||
return dateUtil.dateAndTimeAndSecondsString(localDateTime.toDateTime().getMillis());
|
||||
//return localDateTime.toString("dd.MM.yyyy HH:mm:ss");
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
protected RxBusWrapper rxBus;
|
||||
protected TreatmentsPlugin treatmentsPlugin;
|
||||
protected SP sp;
|
||||
protected DateUtil dateUtil;
|
||||
|
||||
protected AbstractDanaRPlugin(
|
||||
HasAndroidInjector injector,
|
||||
|
@ -69,7 +70,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
CommandQueueProvider commandQueue,
|
||||
RxBusWrapper rxBus,
|
||||
TreatmentsPlugin treatmentsPlugin,
|
||||
SP sp
|
||||
SP sp,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -85,6 +87,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
this.rxBus = rxBus;
|
||||
this.treatmentsPlugin = treatmentsPlugin;
|
||||
this.sp = sp;
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -349,19 +352,19 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
status.put("timestamp", DateUtil.toISOString(pump.getLastConnection()));
|
||||
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
||||
if (pump.getLastBolusTime() != 0) {
|
||||
extended.put("LastBolus", DateUtil.dateAndTimeString(pump.getLastBolusTime()));
|
||||
extended.put("LastBolus", dateUtil.dateAndTimeString(pump.getLastBolusTime()));
|
||||
extended.put("LastBolusAmount", pump.getLastBolusAmount());
|
||||
}
|
||||
TemporaryBasal tb = treatmentsPlugin.getRealTempBasalFromHistory(now);
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = treatmentsPlugin.getExtendedBolusFromHistory(now);
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
|
||||
}
|
||||
extended.put("BaseBasalRate", getBaseBasalRate());
|
||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
|||
import info.nightscout.androidaps.plugins.pump.danaR.services.DanaRExecutionService;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.Round;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
@ -58,9 +59,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
TreatmentsPlugin treatmentsPlugin,
|
||||
SP sp,
|
||||
CommandQueueProvider commandQueue,
|
||||
DanaRPump danaRPump
|
||||
DanaRPump danaRPump,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp);
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.resourceHelper = resourceHelper;
|
||||
|
|
|
@ -47,6 +47,7 @@ class DanaRHistoryActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
|
||||
@Inject lateinit var danaRSPlugin: DanaRSPlugin
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
|
@ -143,7 +144,7 @@ class DanaRHistoryActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) {
|
||||
val record = historyList[position]
|
||||
holder.time.text = DateUtil.dateAndTimeString(record.recordDate)
|
||||
holder.time.text = dateUtil.dateAndTimeString(record.recordDate)
|
||||
holder.value.text = DecimalFormatter.to2Decimal(record.recordValue)
|
||||
holder.stringValue.text = record.stringRecordValue
|
||||
holder.bolusType.text = record.bolusType
|
||||
|
|
|
@ -10,6 +10,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
@ -27,7 +28,8 @@ class MessageHashTableR @Inject constructor(
|
|||
configBuilderPlugin: ConfigBuilderPlugin,
|
||||
commandQueue: CommandQueueProvider,
|
||||
activePlugin: ActivePluginProvider,
|
||||
injector: HasAndroidInjector
|
||||
injector: HasAndroidInjector,
|
||||
dateUtil: DateUtil
|
||||
) : MessageHashTableBase {
|
||||
|
||||
var messages: HashMap<Int, MessageBase> = HashMap()
|
||||
|
@ -39,11 +41,11 @@ class MessageHashTableR @Inject constructor(
|
|||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
|
||||
// 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue))
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil))
|
||||
put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(aapsLogger, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
|
@ -55,15 +57,15 @@ class MessageHashTableR @Inject constructor(
|
|||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
// 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin))
|
||||
|
@ -74,7 +76,7 @@ class MessageHashTableR @Inject constructor(
|
|||
put(MsgSettingBasalProfileAll(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(aapsLogger, danaRPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(aapsLogger, danaRPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(aapsLogger, danaRPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
|
@ -83,9 +85,9 @@ class MessageHashTableR @Inject constructor(
|
|||
put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(aapsLogger, rxBus)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
|
||||
// 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgCheckValue(aapsLogger, danaRPump, danaRPlugin))
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryAlarm(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3105)
|
||||
|
|
|
@ -10,7 +10,8 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
|
||||
open class MsgHistoryAll(
|
||||
val aapsLogger: AAPSLogger,
|
||||
val rxBus: RxBusWrapper
|
||||
val rxBus: RxBusWrapper,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -138,6 +139,6 @@ open class MsgHistoryAll(
|
|||
17.toByte() -> failed = true
|
||||
}
|
||||
MainApp.getDbHelper().createOrUpdate(danaRHistoryRecord)
|
||||
rxBus.send(EventDanaRSyncStatus(DateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
|
||||
rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
|
||||
}
|
||||
}
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryBasalHour(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x310A)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryBolus(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3101)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryCarbo(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3107)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryDailyInsulin(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3102)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryError(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3106)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryGlucose(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3104)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryNew(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x42F2)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistoryRefill(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3108)
|
||||
|
|
|
@ -3,11 +3,13 @@ package info.nightscout.androidaps.plugins.pump.danaR.comm
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class MsgHistorySuspend(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper
|
||||
) : MsgHistoryAll(aapsLogger, rxBus) {
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil
|
||||
) : MsgHistoryAll(aapsLogger, rxBus, dateUtil) {
|
||||
|
||||
init {
|
||||
SetCommand(0x3109)
|
||||
|
|
|
@ -24,7 +24,8 @@ class MsgInitConnStatusTime(
|
|||
private val danaRPlugin: DanaRPlugin,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
private val configBuilderPlugin: ConfigBuilderPlugin,
|
||||
private val commandQueue: CommandQueueProvider
|
||||
private val commandQueue: CommandQueueProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -54,7 +55,7 @@ class MsgInitConnStatusTime(
|
|||
}
|
||||
val time = dateTimeSecFromBuff(bytes, 0)
|
||||
val versionCode = intFromBuff(bytes, 6, 1)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + dateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Version code: $versionCode")
|
||||
}
|
||||
}
|
|
@ -7,13 +7,14 @@ import java.util.*
|
|||
|
||||
class MsgSetTime(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val dateUtil: DateUtil,
|
||||
time: Date
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
SetCommand(0x330a)
|
||||
AddParamDateTime(time)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "New message: time:" + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "New message: time:" + dateUtil.dateAndTimeString(time))
|
||||
}
|
||||
|
||||
override fun handleMessage(bytes: ByteArray) {
|
||||
|
|
|
@ -8,7 +8,8 @@ import java.util.*
|
|||
|
||||
class MsgSettingPumpTime(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -25,7 +26,7 @@ class MsgSettingPumpTime(
|
|||
intFromBuff(bytes, 1, 1),
|
||||
intFromBuff(bytes, 0, 1)
|
||||
).time
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + DateUtil.dateAndTimeString(time) + " Phone time: " + Date())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + dateUtil.dateAndTimeString(time) + " Phone time: " + Date())
|
||||
danaRPump.pumpTime = time
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ class MsgStatusBolusExtended(
|
|||
private val injector: HasAndroidInjector,
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump,
|
||||
private val activePlugin: ActivePluginProvider
|
||||
private val activePlugin: ActivePluginProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -48,7 +49,7 @@ class MsgStatusBolusExtended(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus amount: $extendedBolusAmount")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus so far in minutes: $extendedBolusSoFarInMinutes")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus absolute rate: $extendedBolusAbsoluteRate")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus start: " + DateUtil.dateAndTimeString(extendedBolusStart))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus start: " + dateUtil.dateAndTimeString(extendedBolusStart))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus remaining minutes: $extendedBolusRemainingMinutes")
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject DanaRPump danaRPump;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -228,31 +229,31 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
|
|||
MessageBase msg = null;
|
||||
switch (type) {
|
||||
case RecordTypes.RECORD_TYPE_ALARM:
|
||||
msg = new MsgHistoryAlarm(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryAlarm(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_BASALHOUR:
|
||||
msg = new MsgHistoryBasalHour(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_BOLUS:
|
||||
msg = new MsgHistoryBolus(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryBolus(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_CARBO:
|
||||
msg = new MsgHistoryCarbo(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryCarbo(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_DAILY:
|
||||
msg = new MsgHistoryDailyInsulin(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_ERROR:
|
||||
msg = new MsgHistoryError(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryError(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_GLUCOSE:
|
||||
msg = new MsgHistoryGlucose(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryGlucose(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_REFILL:
|
||||
msg = new MsgHistoryRefill(aapsLogger, rxBus);
|
||||
msg = new MsgHistoryRefill(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_SUSPEND:
|
||||
msg = new MsgHistorySuspend(aapsLogger, rxBus);
|
||||
msg = new MsgHistorySuspend(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
}
|
||||
danaRPump.setHistoryDoneReceived(false);
|
||||
|
|
|
@ -14,18 +14,19 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||
|
@ -63,10 +64,8 @@ import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusBolusExtended
|
|||
import info.nightscout.androidaps.plugins.pump.danaR.comm.MsgStatusTempBasal;
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRNewStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.androidaps.queue.commands.Command;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
MsgStatus statusMsg = new MsgStatus(aapsLogger, danaRPump);
|
||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic(aapsLogger, danaRPump);
|
||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil);
|
||||
MsgCheckValue checkValue = new MsgCheckValue(aapsLogger, danaRPump, danaRPlugin);
|
||||
|
||||
if (danaRPump.isNewPump()) {
|
||||
|
@ -187,7 +186,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingUserOptions(aapsLogger, danaRPump));
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
if (danaRPump.getPumpTime() == 0) {
|
||||
// initial handshake was not successfull
|
||||
// deinitialize pump
|
||||
|
@ -200,8 +199,8 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
long timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
if (Math.abs(timeDiff) > 10) {
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, dateUtil, new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -252,7 +251,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(aapsLogger, constraintChecker, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -261,7 +260,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -350,7 +349,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
t.insulin = danaRPump.getLastBolusAmount();
|
||||
aapsLogger.debug(LTag.PUMP, "Used bolus amount from history: " + danaRPump.getLastBolusAmount());
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMP, "Bolus amount in history too old: " + DateUtil.dateAndTimeString(danaRPump.getLastBolusTime()));
|
||||
aapsLogger.debug(LTag.PUMP, "Bolus amount in history too old: " + dateUtil.dateAndTimeString(danaRPump.getLastBolusTime()));
|
||||
}
|
||||
synchronized (o) {
|
||||
o.notify();
|
||||
|
|
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump;
|
|||
import info.nightscout.androidaps.plugins.pump.danaRKorean.services.DanaRKoreanExecutionService;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.Round;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
@ -60,10 +61,10 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
|
|||
ConstraintChecker constraintChecker,
|
||||
TreatmentsPlugin treatmentsPlugin,
|
||||
SP sp,
|
||||
CommandQueueProvider commandQueue
|
||||
|
||||
CommandQueueProvider commandQueue,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp);
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.resourceHelper = resourceHelper;
|
||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
|
|||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPump
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.comm.*
|
||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
@ -28,6 +29,7 @@ class MessageHashTableRKorean @Inject constructor(
|
|||
configBuilderPlugin: ConfigBuilderPlugin,
|
||||
commandQueue: CommandQueueProvider,
|
||||
activePlugin: ActivePluginProvider,
|
||||
dateUtil: DateUtil,
|
||||
injector: HasAndroidInjector
|
||||
) : MessageHashTableBase {
|
||||
|
||||
|
@ -39,10 +41,10 @@ class MessageHashTableRKorean @Inject constructor(
|
|||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic_k(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus_k(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime_k(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusTime_k(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus_k(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic_k(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgSetTempBasalStart(aapsLogger, 0, 0)) // 0x0401 CMD_PUMPSET_EXERCISE_S
|
||||
|
@ -53,11 +55,11 @@ class MessageHashTableRKorean @Inject constructor(
|
|||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgSettingBasal_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
put(MsgSettingProfileRatios(aapsLogger, danaRPump)) // 0x3204 CMD_SETTING_V_CCC_I
|
||||
|
@ -65,11 +67,11 @@ class MessageHashTableRKorean @Inject constructor(
|
|||
put(MsgSettingBasalProfileAll_k(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSetSingleBasalProfile(aapsLogger, rxBus, resourceHelper, Array(24) { 0.0 })) // 0x3302 CMD_SETTING_BASAL_INS_S
|
||||
put(MsgHistoryAll(aapsLogger, rxBus)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ class MsgInitConnStatusTime_k(
|
|||
private val danaRPlugin: DanaRPlugin,
|
||||
private val danaRKoreanPlugin: DanaRKoreanPlugin,
|
||||
private val configBuilderPlugin: ConfigBuilderPlugin,
|
||||
private val commandQueue: CommandQueueProvider
|
||||
private val commandQueue: CommandQueueProvider,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -55,7 +56,7 @@ class MsgInitConnStatusTime_k(
|
|||
val versionCode2 = intFromBuff(bytes, 7, 1)
|
||||
val versionCode3 = intFromBuff(bytes, 8, 1)
|
||||
val versionCode4 = intFromBuff(bytes, 9, 1)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time: " + dateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Version code1: $versionCode1")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Version code2: $versionCode2")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Version code3: $versionCode3")
|
||||
|
|
|
@ -75,6 +75,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
@Inject MessageHashTableRKorean messageHashTableRKorean;
|
||||
@Inject ActivePluginProvider activePlugin;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
public DanaRKoreanExecutionService() {
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
//MsgStatus_k statusMsg = new MsgStatus_k();
|
||||
MsgStatusBasic_k statusBasicMsg = new MsgStatusBasic_k(aapsLogger, danaRPump);
|
||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal(aapsLogger, danaRPump, activePlugin, injector);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin);
|
||||
MsgStatusBolusExtended exStatusMsg = new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil);
|
||||
MsgCheckValue_k checkValue = new MsgCheckValue_k(aapsLogger, danaRPump, danaRKoreanPlugin);
|
||||
|
||||
if (danaRPump.isNewPump()) {
|
||||
|
@ -172,7 +173,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
mSerialIOThread.sendMessage(new MsgSettingGlucose(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios(aapsLogger, danaRPump));
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
if (danaRPump.getPumpTime() == 0) {
|
||||
// initial handshake was not successfull
|
||||
// deinitialize pump
|
||||
|
@ -187,8 +188,8 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (Math.abs(timeDiff) > 10) {
|
||||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, dateUtil, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -239,7 +240,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(aapsLogger, constraintChecker, insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
@ -248,7 +249,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)));
|
||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin));
|
||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended(injector, aapsLogger, danaRPump, activePlugin, dateUtil));
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ public class DanaRSPlugin extends PumpPluginBase implements PumpInterface, DanaR
|
|||
private final CommandQueueProvider commandQueue;
|
||||
private final DanaRPump danaRPump;
|
||||
private final DetailedBolusInfoStorage detailedBolusInfoStorage;
|
||||
private final DateUtil dateUtil;
|
||||
|
||||
private static DanaRSService danaRSService;
|
||||
|
||||
|
@ -113,7 +114,8 @@ public class DanaRSPlugin extends PumpPluginBase implements PumpInterface, DanaR
|
|||
SP sp,
|
||||
CommandQueueProvider commandQueue,
|
||||
DanaRPump danaRPump,
|
||||
DetailedBolusInfoStorage detailedBolusInfoStorage
|
||||
DetailedBolusInfoStorage detailedBolusInfoStorage,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -134,6 +136,7 @@ public class DanaRSPlugin extends PumpPluginBase implements PumpInterface, DanaR
|
|||
this.commandQueue = commandQueue;
|
||||
this.danaRPump = danaRPump;
|
||||
this.detailedBolusInfoStorage = detailedBolusInfoStorage;
|
||||
this.dateUtil = dateUtil;
|
||||
|
||||
pumpDescription.setPumpDescription(PumpType.DanaRS);
|
||||
}
|
||||
|
@ -720,19 +723,19 @@ public class DanaRSPlugin extends PumpPluginBase implements PumpInterface, DanaR
|
|||
status.put("timestamp", DateUtil.toISOString(pump.getLastConnection()));
|
||||
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
|
||||
if (pump.getLastBolusTime() != 0) {
|
||||
extended.put("LastBolus", DateUtil.dateAndTimeString(pump.getLastBolusTime()));
|
||||
extended.put("LastBolus", dateUtil.dateAndTimeString(pump.getLastBolusTime()));
|
||||
extended.put("LastBolusAmount", pump.getLastBolusAmount());
|
||||
}
|
||||
TemporaryBasal tb = treatmentsPlugin.getTempBasalFromHistory(now);
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = treatmentsPlugin.getExtendedBolusFromHistory(now);
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
|
||||
}
|
||||
extended.put("BaseBasalRate", getBaseBasalRate());
|
||||
|
|
|
@ -49,7 +49,7 @@ class DanaRSMessageHashTable @Inject constructor(
|
|||
put(DanaRS_Packet_Basal_Set_Suspend_Off(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Set_Suspend_On(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger))
|
||||
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil))
|
||||
put(DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump))
|
||||
|
@ -59,7 +59,7 @@ class DanaRSMessageHashTable @Inject constructor(
|
|||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil))
|
||||
put(DanaRS_Packet_Bolus_Set_Bolus_Option(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_Initial_Bolus(aapsLogger))
|
||||
put(DanaRS_Packet_Bolus_Set_CIR_CF_Array(aapsLogger))
|
||||
|
@ -77,33 +77,33 @@ class DanaRSMessageHashTable @Inject constructor(
|
|||
put(DanaRS_Packet_Notify_Delivery_Complete(aapsLogger, rxBus, resourceHelper, danaRSPlugin))
|
||||
put(DanaRS_Packet_Notify_Delivery_Rate_Display(aapsLogger, rxBus, resourceHelper, danaRSPlugin))
|
||||
put(DanaRS_Packet_Notify_Missed_Bolus_Alarm(aapsLogger))
|
||||
put(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil))
|
||||
put(DanaRS_Packet_Option_Get_User_Option(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger))
|
||||
put(DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil))
|
||||
put(DanaRS_Packet_Option_Set_User_Option(aapsLogger, danaRPump))
|
||||
//put(new DanaRS_Packet_History_());
|
||||
put(DanaRS_Packet_History_Alarm(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_All_History(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Basal(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Bolus(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Alarm(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_All_History(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Basal(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Bolus(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_Review_Bolus_Avg(aapsLogger))
|
||||
put(DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Daily(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Daily(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump, dateUtil))
|
||||
put(DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper))
|
||||
put(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil))
|
||||
put(DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump))
|
||||
put(DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger))
|
||||
put(DanaRS_Packet_History_Prime(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Refill(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Prime(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Refill(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_General_Set_History_Upload_Mode(aapsLogger))
|
||||
put(DanaRS_Packet_General_Set_User_Time_Change_Flag_Clear(aapsLogger))
|
||||
put(DanaRS_Packet_History_Suspend(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Temporary(aapsLogger, rxBus))
|
||||
put(DanaRS_Packet_History_Suspend(aapsLogger, rxBus, dateUtil))
|
||||
put(DanaRS_Packet_History_Temporary(aapsLogger, rxBus, dateUtil))
|
||||
// APS
|
||||
put(DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, 0))
|
||||
put(DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRSPlugin, detailedBolusInfoStorage, injector, dateUtil, 0))
|
||||
put(DanaRS_Packet_APS_Set_Event_History(aapsLogger, 0, 0, 0, 0))
|
||||
put(DanaRS_Packet_APS_Set_Event_History(aapsLogger, dateUtil, 0, 0, 0, 0))
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
hour = cal[Calendar.HOUR_OF_DAY]
|
||||
min = cal[Calendar.MINUTE]
|
||||
sec = cal[Calendar.SECOND]
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + DateUtil.dateAndTimeString(cal.timeInMillis))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(cal.timeInMillis))
|
||||
danaRSPlugin.apsHistoryDone = false
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
val status: String
|
||||
when (recordCode.toInt()) {
|
||||
DanaRPump.TEMPSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT TEMPSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
temporaryBasal.percentRate = param1
|
||||
temporaryBasal.durationInMinutes = param2
|
||||
activePlugin.activeTreatments.addToHistoryTempBasal(temporaryBasal)
|
||||
|
@ -91,13 +91,13 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
}
|
||||
|
||||
DanaRPump.TEMPSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime))
|
||||
activePlugin.activeTreatments.addToHistoryTempBasal(temporaryBasal)
|
||||
status = "TEMPSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.EXTENDEDSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT EXTENDEDSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT EXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
extendedBolus.insulin = param1 / 100.0
|
||||
extendedBolus.durationInMinutes = param2
|
||||
activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus)
|
||||
|
@ -105,7 +105,7 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
}
|
||||
|
||||
DanaRPump.EXTENDEDSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT EXTENDEDSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT EXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus)
|
||||
status = "EXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
detailedBolusInfo.pumpId = datetime
|
||||
detailedBolusInfo.insulin = param1 / 100.0
|
||||
val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "BOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -130,12 +130,12 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
detailedBolusInfo.pumpId = datetime
|
||||
detailedBolusInfo.insulin = param1 / 100.0
|
||||
val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "DUALBOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.DUALEXTENDEDSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
extendedBolus.insulin = param1 / 100.0
|
||||
extendedBolus.durationInMinutes = param2
|
||||
activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus)
|
||||
|
@ -143,33 +143,33 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
}
|
||||
|
||||
DanaRPump.DUALEXTENDEDSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
activePlugin.activeTreatments.addToHistoryExtendedBolus(extendedBolus)
|
||||
status = "DUALEXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.SUSPENDON -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT SUSPENDON (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT SUSPENDON (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDON " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.SUSPENDOFF -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT SUSPENDOFF (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT SUSPENDOFF (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDOFF " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.REFILL -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT REFILL (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT REFILL (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "REFILL " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.PRIME -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PRIME (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PRIME (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "PRIME " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.PROFILECHANGE -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PROFILECHANGE (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PROFILECHANGE (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
status = "PROFILECHANGE " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -180,17 +180,17 @@ open class DanaRS_Packet_APS_History_Events(
|
|||
emptyCarbsInfo.source = Source.PUMP
|
||||
emptyCarbsInfo.pumpId = datetime
|
||||
val newRecord = activePlugin.activeTreatments.addToHistoryTreatment(emptyCarbsInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
status = "CARBS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.PRIMECANNULA -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PRIMECANNULA(" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "EVENT PRIMECANNULA(" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "PRIMECANNULA " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
else -> {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Event: " + recordCode + " " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
status = "UNKNOWN " + dateUtil.timeString(datetime)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.*
|
|||
|
||||
class DanaRS_Packet_APS_Set_Event_History(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val dateUtil: DateUtil,
|
||||
private var packetType: Int,
|
||||
private var time: Long,
|
||||
private var param1: Int,
|
||||
|
@ -18,7 +19,7 @@ class DanaRS_Packet_APS_Set_Event_History(
|
|||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
|
||||
if ((packetType == DanaRPump.CARBS || packetType == DanaRPump.BOLUS) && param1 <= 0) this.param1 = 0
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + DateUtil.dateAndTimeString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + dateUtil.dateAndTimeString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
|
||||
}
|
||||
|
||||
override fun getRequestParams(): ByteArray {
|
||||
|
|
|
@ -9,7 +9,8 @@ import kotlin.math.ceil
|
|||
|
||||
class DanaRS_Packet_Basal_Get_Temporary_Basal_State(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
init {
|
||||
|
@ -35,7 +36,7 @@ class DanaRS_Packet_Basal_Get_Temporary_Basal_State(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal percent: " + danaRPump.tempBasalPercent)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal remaining min: $tempBasalRemainingMin")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal total sec: " + danaRPump.tempBasalTotalSec)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal start: " + DateUtil.dateAndTimeString(tempBasalStart))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal start: " + dateUtil.dateAndTimeString(tempBasalStart))
|
||||
}
|
||||
|
||||
override fun getFriendlyName(): String {
|
||||
|
|
|
@ -9,7 +9,8 @@ import java.util.*
|
|||
|
||||
class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
init {
|
||||
|
@ -48,7 +49,7 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_Information(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $error")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "BolusType: $bolusType")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Initial bolus amount: " + danaRPump.initialBolusAmount + " U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + DateUtil.dateAndTimeString(danaRPump.lastBolusTime))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + dateUtil.dateAndTimeString(danaRPump.lastBolusTime))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaRPump.lastBolusAmount)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Max bolus: " + danaRPump.maxBolus + " U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Bolus step: " + danaRPump.bolusStep + " U")
|
||||
|
|
|
@ -9,7 +9,8 @@ import java.util.*
|
|||
|
||||
class DanaRS_Packet_General_Get_More_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
init {
|
||||
|
@ -52,7 +53,7 @@ class DanaRS_Packet_General_Get_More_Information(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Daily total units: " + danaRPump.dailyTotalUnits.toString() + " U")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Is extended in progress: " + danaRPump.isExtendedInProgress)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus remaining minutes: " + danaRPump.extendedBolusRemainingMinutes)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + DateUtil.dateAndTimeAndSecondsString(lastBolusTime.time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus time: " + dateUtil.dateAndTimeAndSecondsString(lastBolusTime.time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Last bolus amount: " + danaRPump.lastBolusAmount)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
|
||||
class DanaRS_Packet_General_Get_Shipping_Information(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
init {
|
||||
|
@ -31,7 +32,7 @@ class DanaRS_Packet_General_Get_Shipping_Information(
|
|||
dataSize = 3
|
||||
danaRPump.shippingCountry = asciiStringFromBuff(data, dataIndex, dataSize)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Serial number: " + danaRPump.serialNumber)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Shipping date: " + DateUtil.dateAndTimeString(danaRPump.shippingDate))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Shipping date: " + dateUtil.dateAndTimeString(danaRPump.shippingDate))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Shipping country: " + danaRPump.shippingCountry)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.*
|
|||
abstract class DanaRS_Packet_History_(
|
||||
protected val aapsLogger: AAPSLogger,
|
||||
protected val rxBus: RxBusWrapper,
|
||||
protected val dateUtil: DateUtil,
|
||||
protected val from: Long
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
|
@ -36,7 +37,7 @@ abstract class DanaRS_Packet_History_(
|
|||
hour = cal[Calendar.HOUR_OF_DAY]
|
||||
min = cal[Calendar.MINUTE]
|
||||
sec = cal[Calendar.SECOND]
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + DateUtil.dateAndTimeString(cal.timeInMillis))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(cal.timeInMillis))
|
||||
}
|
||||
|
||||
override fun getRequestParams(): ByteArray {
|
||||
|
@ -85,7 +86,7 @@ abstract class DanaRS_Packet_History_(
|
|||
val historyCode = byteArrayToInt(getBytes(data, DATA_START + 7, 1))
|
||||
val paramByte8 = historyCode.toByte()
|
||||
val value: Int = (data[DATA_START + 8].toInt() and 0xFF shl 8) + (data[DATA_START + 9].toInt() and 0xFF)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + DateUtil.dateAndTimeString(datetimewihtsec) + " Code: " + historyCode + " Value: " + value)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "History packet: " + recordCode + " Date: " + dateUtil.dateAndTimeString(datetimewihtsec) + " Code: " + historyCode + " Value: " + value)
|
||||
val danaRHistoryRecord = DanaRHistoryRecord()
|
||||
danaRHistoryRecord.setBytes(data)
|
||||
// danaRHistoryRecord.recordCode is different from DanaR codes
|
||||
|
@ -197,7 +198,7 @@ abstract class DanaRS_Packet_History_(
|
|||
}
|
||||
}
|
||||
MainApp.getDbHelper().createOrUpdate(danaRHistoryRecord)
|
||||
rxBus.send(EventDanaRSyncStatus(DateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
|
||||
rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaRHistoryRecord.recordDate) + " " + messageType))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Alarm @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__ALARM
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_All_History(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__ALL_HISTORY
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Basal @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BASAL
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Blood_Glucose @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BLOOD_GLUCOSE
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Bolus @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__BOLUS
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Carbohydrate @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__CARBOHYDRATE
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Daily @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__DAILY
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Prime @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__PRIME
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Refill @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__REFILL
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Suspend @JvmOverloads constructor(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__SUSPEND
|
||||
|
|
|
@ -4,12 +4,14 @@ import com.cozmo.danar.util.BleCommandUtil
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
|
||||
class DanaRS_Packet_History_Temporary(
|
||||
aapsLogger: AAPSLogger,
|
||||
rxBus: RxBusWrapper,
|
||||
dateUtil: DateUtil,
|
||||
from: Long = 0
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, from) {
|
||||
) : DanaRS_Packet_History_(aapsLogger, rxBus, dateUtil, from) {
|
||||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_REVIEW__TEMPORARY
|
||||
|
|
|
@ -9,7 +9,8 @@ import java.util.*
|
|||
|
||||
class DanaRS_Packet_Option_Get_Pump_Time(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
init {
|
||||
|
@ -39,7 +40,7 @@ class DanaRS_Packet_Option_Get_Pump_Time(
|
|||
val time = Date(100 + year, month - 1, day, hour, min, sec)
|
||||
danaRPump.pumpTime = time.time
|
||||
failed = year == month && month == day && day == hour && hour == min && min == sec && sec == 1
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeString(time))
|
||||
}
|
||||
|
||||
override fun handleMessageNotReceived() {
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.*
|
|||
|
||||
class DanaRS_Packet_Option_Set_Pump_Time(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val dateUtil: DateUtil,
|
||||
private var time: Long = 0
|
||||
) : DanaRS_Packet() {
|
||||
|
||||
|
@ -15,7 +16,7 @@ class DanaRS_Packet_Option_Set_Pump_Time(
|
|||
|
||||
init {
|
||||
opCode = BleCommandUtil.DANAR_PACKET__OPCODE_OPTION__SET_PUMP_TIME
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Setting pump time " + DateUtil.dateAndTimeString(time))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Setting pump time " + dateUtil.dateAndTimeString(time))
|
||||
}
|
||||
|
||||
override fun getRequestParams(): ByteArray {
|
||||
|
|
|
@ -167,9 +167,9 @@ public class DanaRSService extends DaggerService {
|
|||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingextendedbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State(aapsLogger, danaRPump));
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump)); // last bolus, bolusStep, maxBolus
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil)); // last bolus, bolusStep, maxBolus
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingtempbasalstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
|
||||
|
||||
danaRPump.setLastConnection(System.currentTimeMillis());
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class DanaRSService extends DaggerService {
|
|||
}
|
||||
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil));
|
||||
|
||||
long timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
if (danaRPump.getPumpTime() == 0) {
|
||||
|
@ -198,7 +198,7 @@ public class DanaRSService extends DaggerService {
|
|||
long now = System.currentTimeMillis();
|
||||
if (danaRPump.getLastSettingsRead() + 60 * 60 * 1000L < now || !pump.isInitialized()) {
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpsettings)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump)); // serial no
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump, dateUtil)); // serial no
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper)); // firmware
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option(aapsLogger, rxBus, resourceHelper, danaRPump)); // isExtendedEnabled
|
||||
|
@ -228,13 +228,13 @@ public class DanaRSService extends DaggerService {
|
|||
return;
|
||||
} else {
|
||||
if (danaRPump.getProtocol() >= 6) {
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, DateUtil.now()));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil, DateUtil.now()));
|
||||
} else {
|
||||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, DateUtil.now() + T.secs(10).msecs()));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(aapsLogger, dateUtil, DateUtil.now() + T.secs(10).msecs()));
|
||||
}
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time(aapsLogger, danaRPump, dateUtil));
|
||||
timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class DanaRSService extends DaggerService {
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Loading complete event history");
|
||||
} else {
|
||||
msg = new DanaRS_Packet_APS_History_Events(aapsLogger, rxBus, resourceHelper, activePlugin, danaRSPlugin, detailedBolusInfoStorage, injector, dateUtil, lastHistoryFetched);
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + DateUtil.dateAndTimeString(lastHistoryFetched));
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(lastHistoryFetched));
|
||||
}
|
||||
bleComm.sendMessage(msg);
|
||||
while (!danaRSPlugin.apsHistoryDone && bleComm.isConnected()) {
|
||||
|
@ -315,7 +315,7 @@ public class DanaRSService extends DaggerService {
|
|||
if (carbs > 0) {
|
||||
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbtime, carbs); ####
|
||||
// bleComm.sendMessage(msg);
|
||||
DanaRS_Packet_APS_Set_Event_History msgSetHistoryEntry_v2 = new DanaRS_Packet_APS_Set_Event_History(aapsLogger, DanaRPump.CARBS, carbtime, carbs, 0);
|
||||
DanaRS_Packet_APS_Set_Event_History msgSetHistoryEntry_v2 = new DanaRS_Packet_APS_Set_Event_History(aapsLogger, dateUtil, DanaRPump.CARBS, carbtime, carbs, 0);
|
||||
bleComm.sendMessage(msgSetHistoryEntry_v2);
|
||||
lastHistoryFetched = Math.min(lastHistoryFetched, carbtime - T.mins(1).msecs());
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ public class DanaRSService extends DaggerService {
|
|||
public void run() {
|
||||
// reread bolus status
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump)); // last bolus
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump, dateUtil)); // last bolus
|
||||
bolusingEvent.setPercent(100);
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.disconnecting)));
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ public class DanaRSService extends DaggerService {
|
|||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(aapsLogger, percent, durationInHours));
|
||||
SystemClock.sleep(200);
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -417,7 +417,7 @@ public class DanaRSService extends DaggerService {
|
|||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -436,7 +436,7 @@ public class DanaRSService extends DaggerService {
|
|||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_APS_Basal_Set_Temporary_Basal(aapsLogger, percent));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -446,7 +446,7 @@ public class DanaRSService extends DaggerService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal(aapsLogger));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -493,31 +493,31 @@ public class DanaRSService extends DaggerService {
|
|||
DanaRS_Packet_History_ msg = null;
|
||||
switch (type) {
|
||||
case RecordTypes.RECORD_TYPE_ALARM:
|
||||
msg = new DanaRS_Packet_History_Alarm(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Alarm(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_PRIME:
|
||||
msg = new DanaRS_Packet_History_Prime(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Prime(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_BASALHOUR:
|
||||
msg = new DanaRS_Packet_History_Basal(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Basal(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_BOLUS:
|
||||
msg = new DanaRS_Packet_History_Bolus(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Bolus(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_CARBO:
|
||||
msg = new DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Carbohydrate(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_DAILY:
|
||||
msg = new DanaRS_Packet_History_Daily(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Daily(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_GLUCOSE:
|
||||
msg = new DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Blood_Glucose(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_REFILL:
|
||||
msg = new DanaRS_Packet_History_Refill(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Refill(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
case RecordTypes.RECORD_TYPE_SUSPEND:
|
||||
msg = new DanaRS_Packet_History_Suspend(aapsLogger, rxBus);
|
||||
msg = new DanaRS_Packet_History_Suspend(aapsLogger, rxBus, dateUtil);
|
||||
break;
|
||||
}
|
||||
if (msg != null) {
|
||||
|
|
|
@ -66,9 +66,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
TreatmentsPlugin treatmentsPlugin,
|
||||
SP sp,
|
||||
CommandQueueProvider commandQueue,
|
||||
DetailedBolusInfoStorage detailedBolusInfoStorage
|
||||
DetailedBolusInfoStorage detailedBolusInfoStorage,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp);
|
||||
super(injector, danaRPump, resourceHelper, constraintChecker, aapsLogger, commandQueue, rxBus, treatmentsPlugin, sp, dateUtil);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.resourceHelper = resourceHelper;
|
||||
|
|
|
@ -47,11 +47,11 @@ class MessageHashTableRv2 @Inject constructor(
|
|||
put(MsgBolusStartWithSpeed(aapsLogger, constraintChecker, danaRPump, 0.0, 0)) // 0x0104 CMD_MEALINS_START_DATA_SPEED
|
||||
put(MsgBolusProgress(aapsLogger, resourceHelper, rxBus, danaRPump)) // 0x0202 CMD_PUMP_THIS_REMAINDER_MEAL_INS
|
||||
put(MsgStatusProfile(aapsLogger, danaRPump)) // 0x0204 CMD_PUMP_CALCULATION_SETTING
|
||||
put(MsgStatusTempBasal_v2(aapsLogger, danaRPump)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil)) // 0x0205 CMD_PUMP_EXERCISE_MODE
|
||||
put(MsgStatusBolusExtended_v2(aapsLogger, danaRPump)) // 0x0207 CMD_PUMP_EXPANS_INS_I
|
||||
put(MsgStatusBasic(aapsLogger, danaRPump)) // 0x020A CMD_PUMP_INITVIEW_I
|
||||
put(MsgStatus(aapsLogger, danaRPump)) // 0x020B CMD_PUMP_STATUS
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusTime(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, configBuilderPlugin, commandQueue, dateUtil)) // 0x0301 CMD_PUMPINIT_TIME_INFO
|
||||
put(MsgInitConnStatusBolus(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0302 CMD_PUMPINIT_BOLUS_INFO
|
||||
put(MsgInitConnStatusBasic(aapsLogger, danaRPump)) // 0x0303 CMD_PUMPINIT_INIT_INFO
|
||||
put(MsgInitConnStatusOption(aapsLogger, rxBus, resourceHelper, danaRPump, activePlugin)) // 0x0304 CMD_PUMPINIT_OPTION
|
||||
|
@ -63,15 +63,15 @@ class MessageHashTableRv2 @Inject constructor(
|
|||
put(MsgError(aapsLogger, rxBus, resourceHelper, danaRPump)) // 0x0601 CMD_PUMPOWAY_SYSTEM_STATUS
|
||||
put(MsgPCCommStart(aapsLogger)) // 0x3001 CMD_CONNECT
|
||||
put(MsgPCCommStop(aapsLogger)) // 0x3002 CMD_DISCONNECT
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryBolus(aapsLogger, rxBus, dateUtil)) // 0x3101 CMD_HISTORY_MEAL_INS
|
||||
put(MsgHistoryDailyInsulin(aapsLogger, rxBus, dateUtil)) // 0x3102 CMD_HISTORY_DAY_INS
|
||||
put(MsgHistoryGlucose(aapsLogger, rxBus, dateUtil)) // 0x3104 CMD_HISTORY_GLUCOSE
|
||||
put(MsgHistoryAlarm(aapsLogger, rxBus, dateUtil)) // 0x3105 CMD_HISTORY_ALARM
|
||||
put(MsgHistoryError(aapsLogger, rxBus, dateUtil)) // 0x3106 CMD_HISTORY_ERROR
|
||||
put(MsgHistoryCarbo(aapsLogger, rxBus, dateUtil)) // 0x3107 CMD_HISTORY_CARBOHY
|
||||
put(MsgHistoryRefill(aapsLogger, rxBus, dateUtil)) // 0x3108 CMD_HISTORY_REFILL
|
||||
put(MsgHistorySuspend(aapsLogger, rxBus, dateUtil)) // 0x3109 CMD_HISTORY_SUSPEND
|
||||
put(MsgHistoryBasalHour(aapsLogger, rxBus, dateUtil)) // 0x310A CMD_HISTORY_BASAL_HOUR
|
||||
put(MsgHistoryDone(aapsLogger, danaRPump)) // 0x31F1 CMD_HISTORY_DONT_USED
|
||||
put(MsgSettingBasal(aapsLogger, danaRPump, danaRPlugin)) // 0x3202 CMD_SETTING_V_BASAL_INS_I
|
||||
put(MsgSettingMeal(aapsLogger, rxBus, resourceHelper, danaRPump, danaRKoreanPlugin)) // 0x3203 CMD_SETTING_V_MEAL_SETTING_I
|
||||
|
@ -80,7 +80,7 @@ class MessageHashTableRv2 @Inject constructor(
|
|||
put(MsgSettingBasalProfileAll(aapsLogger, danaRPump)) // 0x3206 CMD_SETTING_V_BASAL_PROFILE_ALL
|
||||
put(MsgSettingShippingInfo(aapsLogger, danaRPump)) // 0x3207 CMD_SETTING_V_SHIPPING_I
|
||||
put(MsgSettingGlucose(aapsLogger, danaRPump)) // 0x3209 CMD_SETTING_V_GLUCOSEandEASY
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil)) // 0x320A CMD_SETTING_V_TIME_I
|
||||
put(MsgSettingUserOptions(aapsLogger, danaRPump)) // 0x320B CMD_SETTING_V_USER_OPTIONS
|
||||
put(MsgSettingActiveProfile(aapsLogger, danaRPump)) // 0x320C CMD_SETTING_V_PROFILE_NUMBER
|
||||
put(MsgSettingProfileRatiosAll(aapsLogger, danaRPump)) // 0x320D CMD_SETTING_V_CIR_CF_VALUE
|
||||
|
@ -89,9 +89,9 @@ class MessageHashTableRv2 @Inject constructor(
|
|||
put(MsgSetUserOptions(aapsLogger, danaRPump)) // 0x330B CMD_SETTING_USER_OPTIONS_S
|
||||
put(MsgSetActivateBasalProfile(aapsLogger, 0.toByte())) // 0x330C CMD_SETTING_PROFILE_NUMBER_S
|
||||
put(MsgHistoryAllDone(aapsLogger, danaRPump)) // 0x41F1 CMD_HISTORY_ALL_DONE
|
||||
put(MsgHistoryAll(aapsLogger, rxBus)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryAll(aapsLogger, rxBus, dateUtil)) // 0x41F2 CMD_HISTORY_ALL
|
||||
put(MsgHistoryNewDone(aapsLogger, danaRPump)) // 0x42F1 CMD_HISTORY_NEW_DONE
|
||||
put(MsgHistoryNew(aapsLogger, rxBus)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgHistoryNew(aapsLogger, rxBus, dateUtil)) // 0x42F2 CMD_HISTORY_NEW
|
||||
put(MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue)) // 0xF0F1 CMD_PUMP_CHECK_VALUE
|
||||
put(MsgStatusAPS_v2(aapsLogger, danaRPump)) // 0xE001 CMD_PUMPSTATUS_APS
|
||||
put(MsgSetAPSTempBasalStart_v2(aapsLogger, 0, false, false)) // 0xE002 CMD_PUMPSET_APSTEMP
|
||||
|
|
|
@ -75,7 +75,7 @@ class MsgHistoryEvents_v2 constructor(
|
|||
val status: String
|
||||
when (recordCode.toInt()) {
|
||||
DanaRPump.TEMPSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Ratio: " + param1 + "% Duration: " + param2 + "min")
|
||||
temporaryBasal.percentRate = param1
|
||||
temporaryBasal.durationInMinutes = param2
|
||||
treatmentsPlugin.addToHistoryTempBasal(temporaryBasal)
|
||||
|
@ -83,13 +83,13 @@ class MsgHistoryEvents_v2 constructor(
|
|||
}
|
||||
|
||||
DanaRPump.TEMPSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime))
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT TEMPSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime))
|
||||
treatmentsPlugin.addToHistoryTempBasal(temporaryBasal)
|
||||
status = "TEMPSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.EXTENDEDSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
extendedBolus.insulin = param1 / 100.0
|
||||
extendedBolus.durationInMinutes = param2
|
||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus)
|
||||
|
@ -97,7 +97,7 @@ class MsgHistoryEvents_v2 constructor(
|
|||
}
|
||||
|
||||
DanaRPump.EXTENDEDSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT EXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus)
|
||||
status = "EXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class MsgHistoryEvents_v2 constructor(
|
|||
detailedBolusInfo.pumpId = datetime
|
||||
detailedBolusInfo.insulin = param1 / 100.0
|
||||
val newRecord = treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "BOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -122,12 +122,12 @@ class MsgHistoryEvents_v2 constructor(
|
|||
detailedBolusInfo.pumpId = datetime
|
||||
detailedBolusInfo.insulin = param1 / 100.0
|
||||
val newRecord = treatmentsPlugin.addToHistoryTreatment(detailedBolusInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT DUALBOLUS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Bolus: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
status = "DUALBOLUS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.DUALEXTENDEDSTART -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTART (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U Duration: " + param2 + "min")
|
||||
extendedBolus.insulin = param1 / 100.0
|
||||
extendedBolus.durationInMinutes = param2
|
||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus)
|
||||
|
@ -135,33 +135,33 @@ class MsgHistoryEvents_v2 constructor(
|
|||
}
|
||||
|
||||
DanaRPump.DUALEXTENDEDSTOP -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT DUALEXTENDEDSTOP (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Delivered: " + param1 / 100.0 + "U RealDuration: " + param2 + "min")
|
||||
treatmentsPlugin.addToHistoryExtendedBolus(extendedBolus)
|
||||
status = "DUALEXTENDEDSTOP " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.SUSPENDON -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDON (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDON (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDON " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.SUSPENDOFF -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDOFF (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT SUSPENDOFF (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")")
|
||||
status = "SUSPENDOFF " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.REFILL -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT REFILL (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT REFILL (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "REFILL " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.PRIME -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PRIME (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PRIME (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Amount: " + param1 / 100.0 + "U")
|
||||
status = "PRIME " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
DanaRPump.PROFILECHANGE -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PROFILECHANGE (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EVENT PROFILECHANGE (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " No: " + param1 + " CurrentRate: " + param2 / 100.0 + "U/h")
|
||||
status = "PROFILECHANGE " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
|
@ -172,12 +172,12 @@ class MsgHistoryEvents_v2 constructor(
|
|||
emptyCarbsInfo.source = Source.PUMP
|
||||
emptyCarbsInfo.pumpId = datetime
|
||||
val newRecord = treatmentsPlugin.addToHistoryTreatment(emptyCarbsInfo, false)
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, (if (newRecord) "**NEW** " else "") + "EVENT CARBS (" + recordCode + ") " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Carbs: " + param1 + "g")
|
||||
status = "CARBS " + dateUtil.timeString(datetime)
|
||||
}
|
||||
|
||||
else -> {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Event: " + recordCode + " " + DateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Event: " + recordCode + " " + dateUtil.dateAndTimeString(datetime) + " (" + datetime + ")" + " Param1: " + param1 + " Param2: " + param2)
|
||||
status = "UNKNOWN " + dateUtil.timeString(datetime)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import kotlin.math.ceil
|
|||
|
||||
class MsgStatusTempBasal_v2(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
private val danaRPump: DanaRPump
|
||||
|
||||
private val danaRPump: DanaRPump,
|
||||
private val dateUtil: DateUtil
|
||||
) : MessageBase() {
|
||||
|
||||
init {
|
||||
|
@ -37,7 +37,7 @@ class MsgStatusTempBasal_v2(
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal percent: $tempBasalPercent")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal remaining min: $tempBasalRemainingMin")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal total sec: $tempBasalTotalSec")
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal start: " + DateUtil.dateAndTimeString(tempBasalStart))
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Current temp basal start: " + dateUtil.dateAndTimeString(tempBasalStart))
|
||||
}
|
||||
|
||||
private fun getDateFromTempBasalSecAgo(tempBasalAgoSecs: Int): Long {
|
||||
|
|
|
@ -16,19 +16,20 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||
|
@ -72,7 +73,6 @@ import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgSetAPSTempBasalSt
|
|||
import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgSetHistoryEntry_v2;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgStatusBolusExtended_v2;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRv2.comm.MsgStatusTempBasal_v2;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.androidaps.queue.commands.Command;
|
||||
|
@ -159,7 +159,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumpstatus)));
|
||||
MsgStatus statusMsg = new MsgStatus(aapsLogger, danaRPump);
|
||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic(aapsLogger, danaRPump);
|
||||
MsgStatusTempBasal_v2 tempStatusMsg = new MsgStatusTempBasal_v2(aapsLogger, danaRPump);
|
||||
MsgStatusTempBasal_v2 tempStatusMsg = new MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil);
|
||||
MsgStatusBolusExtended_v2 exStatusMsg = new MsgStatusBolusExtended_v2(aapsLogger, danaRPump);
|
||||
MsgCheckValue_v2 checkValue = new MsgCheckValue_v2(aapsLogger, rxBus, resourceHelper, danaRPump, danaRPlugin, danaRKoreanPlugin, danaRv2Plugin, configBuilderPlugin, commandQueue);
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
}
|
||||
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.gettingpumptime)));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
if (danaRPump.getPumpTime() == 0) {
|
||||
// initial handshake was not successfull
|
||||
// deinitialize pump
|
||||
|
@ -222,8 +222,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
} else {
|
||||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(aapsLogger, dateUtil, new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime(aapsLogger, danaRPump, dateUtil));
|
||||
timeDiff = (danaRPump.getPumpTime() - System.currentTimeMillis()) / 1000L;
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(aapsLogger, percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -289,7 +289,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(aapsLogger, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -309,7 +309,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
}
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetAPSTempBasalStart_v2(aapsLogger, percent, durationInMinutes == 15, durationInMinutes == 30));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -319,7 +319,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (!isConnected()) return false;
|
||||
rxBus.send(new EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop(aapsLogger));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2(aapsLogger, danaRPump, dateUtil));
|
||||
loadEvents();
|
||||
rxBus.send(new EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING));
|
||||
return true;
|
||||
|
@ -450,7 +450,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
return new PumpEnactResult(injector).success(false);
|
||||
SystemClock.sleep(300);
|
||||
MsgHistoryEvents_v2 msg = new MsgHistoryEvents_v2(aapsLogger, resourceHelper, detailedBolusInfoStorage, danaRv2Plugin, rxBus, treatmentsPlugin, injector, dateUtil, lastHistoryFetched);
|
||||
aapsLogger.debug(LTag.PUMP, "Loading event history from: " + DateUtil.dateAndTimeString(lastHistoryFetched));
|
||||
aapsLogger.debug(LTag.PUMP, "Loading event history from: " + dateUtil.dateAndTimeString(lastHistoryFetched));
|
||||
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
while (!danaRv2Plugin.eventsLoadingDone && mRfcommSocket.isConnected()) {
|
||||
|
|
|
@ -150,6 +150,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private final CommandQueueProvider commandQueue;
|
||||
private final ProfileFunction profileFunction;
|
||||
private final Context context;
|
||||
private final DateUtil dateUtil;
|
||||
|
||||
public static final String ALERT_CHANNEL_ID = "AndroidAPS-InsightAlert";
|
||||
|
||||
|
@ -209,7 +210,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
CommandQueueProvider commandQueue,
|
||||
ProfileFunction profileFunction,
|
||||
Context context,
|
||||
Config config
|
||||
Config config,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.pluginName(R.string.insight_local)
|
||||
|
@ -229,6 +231,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
this.commandQueue = commandQueue;
|
||||
this.profileFunction = profileFunction;
|
||||
this.context = context;
|
||||
this.dateUtil = dateUtil;
|
||||
|
||||
pumpDescription = new PumpDescription();
|
||||
pumpDescription.setPumpDescription(PumpType.AccuChekInsightBluetooth);
|
||||
|
@ -996,13 +999,13 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
|
|||
TemporaryBasal tb = treatmentsPlugin.getTempBasalFromHistory(now);
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile));
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date));
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
}
|
||||
ExtendedBolus eb = treatmentsPlugin.getExtendedBolusFromHistory(now);
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate());
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date));
|
||||
extended.put("ExtendedBolusRemaining", eb.getPlannedRemainingMinutes());
|
||||
}
|
||||
extended.put("BaseBasalRate", getBaseBasalRate());
|
||||
|
|
|
@ -84,6 +84,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButt
|
|||
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
@ -136,7 +137,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
MedtronicPumpStatus medtronicPumpStatus,
|
||||
MedtronicHistoryData medtronicHistoryData,
|
||||
RileyLinkServiceData rileyLinkServiceData,
|
||||
ServiceTaskExecutor serviceTaskExecutor
|
||||
ServiceTaskExecutor serviceTaskExecutor,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
|
||||
super(new PluginDescription() //
|
||||
|
@ -147,7 +149,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
.preferencesId(R.xml.pref_medtronic)
|
||||
.description(R.string.description_pump_medtronic), //
|
||||
PumpType.Medtronic_522_722, // we default to most basic model, correct model from config is loaded later
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil
|
||||
);
|
||||
|
||||
this.rileyLinkUtil = rileyLinkUtil;
|
||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
|
||||
/**
|
||||
|
@ -32,6 +33,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
|||
public class RileyLinkStatusDeviceMedtronic extends DaggerFragment implements RefreshableInterface {
|
||||
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
// @BindView(R.id.rileylink_history_list)
|
||||
ListView listView;
|
||||
|
@ -153,7 +155,7 @@ public class RileyLinkStatusDeviceMedtronic extends DaggerFragment implements Re
|
|||
}
|
||||
|
||||
RLHistoryItem item = historyItemList.get(i);
|
||||
viewHolder.itemTime.setText(StringUtil.toDateTimeString(item.getDateTime()));
|
||||
viewHolder.itemTime.setText(StringUtil.toDateTimeString(dateUtil, item.getDateTime()));
|
||||
viewHolder.itemSource.setText("Riley Link"); // for now
|
||||
viewHolder.itemDescription.setText(item.getDescription(resourceHelper));
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefres
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.Round;
|
||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
||||
|
@ -136,7 +137,9 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
CommandQueueProvider commandQueue,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
RileyLinkServiceData rileyLinkServiceData,
|
||||
ServiceTaskExecutor serviceTaskExecutor) {
|
||||
ServiceTaskExecutor serviceTaskExecutor,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
|
||||
super(new PluginDescription() //
|
||||
.mainType(PluginType.PUMP) //
|
||||
|
@ -146,7 +149,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
.preferencesId(R.xml.pref_omnipod) //
|
||||
.description(R.string.description_pump_omnipod), //
|
||||
PumpType.Insulet_Omnipod,
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy
|
||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil
|
||||
);
|
||||
this.rileyLinkServiceData = rileyLinkServiceData;
|
||||
this.serviceTaskExecutor = serviceTaskExecutor;
|
||||
|
@ -232,8 +235,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
ActivePluginProvider activePlugin,
|
||||
info.nightscout.androidaps.utils.sharedPreferences.SP sp,
|
||||
CommandQueueProvider commandQueue,
|
||||
FabricPrivacy fabricPrivacy) {
|
||||
super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy);
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy, dateUtil);
|
||||
|
||||
// this.rileyLinkUtil = rileyLinkUtil;
|
||||
// this.medtronicUtil = medtronicUtil;
|
||||
|
|
|
@ -36,6 +36,7 @@ public class PodSessionState extends PodState {
|
|||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject SP sp;
|
||||
@Inject OmnipodUtil omnipodUtil;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
||||
private final Map<AlertSlot, AlertType> configuredAlerts;
|
||||
private transient PodStateChangedHandler stateChangedHandler;
|
||||
|
@ -112,7 +113,7 @@ public class PodSessionState extends PodState {
|
|||
}
|
||||
|
||||
public String getExpiryDateAsString() {
|
||||
return expiresAt == null ? "???" : DateUtil.dateAndTimeString(expiresAt.toDate());
|
||||
return expiresAt == null ? "???" : dateUtil.dateAndTimeString(expiresAt.toDate());
|
||||
}
|
||||
|
||||
public FirmwareVersion getPiVersion() {
|
||||
|
|
|
@ -52,7 +52,8 @@ class VirtualPumpPlugin @Inject constructor(
|
|||
private val profileFunction: ProfileFunction,
|
||||
private val treatmentsPlugin: TreatmentsPlugin,
|
||||
commandQueue: CommandQueueProvider,
|
||||
private val config: Config
|
||||
private val config: Config,
|
||||
private val dateUtil: DateUtil
|
||||
) : PumpPluginBase(PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
.fragmentClass(VirtualPumpFragment::class.java.name)
|
||||
|
@ -356,13 +357,13 @@ class VirtualPumpPlugin @Inject constructor(
|
|||
val tb = treatmentsPlugin.getTempBasalFromHistory(now)
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(now, profile))
|
||||
extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date))
|
||||
extended.put("TempBasalStart", dateUtil.dateAndTimeString(tb.date))
|
||||
extended.put("TempBasalRemaining", tb.plannedRemainingMinutes)
|
||||
}
|
||||
val eb = treatmentsPlugin.getExtendedBolusFromHistory(now)
|
||||
if (eb != null) {
|
||||
extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate())
|
||||
extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date))
|
||||
extended.put("ExtendedBolusStart", dateUtil.dateAndTimeString(eb.date))
|
||||
extended.put("ExtendedBolusRemaining", eb.plannedRemainingMinutes)
|
||||
}
|
||||
status.put("timestamp", DateUtil.toISOString(now))
|
||||
|
|
|
@ -38,7 +38,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
|
||||
private SP sp;
|
||||
private ProfileFunction profileFunction;
|
||||
private ResourceHelper resourceHelper;
|
||||
private DateUtil dateUtil;
|
||||
|
||||
@Inject
|
||||
public SensitivityAAPSPlugin(
|
||||
|
@ -46,7 +46,8 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
AAPSLogger aapsLogger,
|
||||
ResourceHelper resourceHelper,
|
||||
SP sp,
|
||||
ProfileFunction profileFunction
|
||||
ProfileFunction profileFunction,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.SENSITIVITY)
|
||||
|
@ -58,6 +59,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
);
|
||||
this.sp = sp;
|
||||
this.profileFunction = profileFunction;
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
@NonNull @Override
|
||||
|
@ -66,9 +68,9 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
|
||||
String age = sp.getString(R.string.key_age, "");
|
||||
int defaultHours = 24;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_adult))) defaultHours = 24;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_teenage))) defaultHours = 4;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_child))) defaultHours = 4;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_adult))) defaultHours = 24;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_teenage))) defaultHours = 4;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_child))) defaultHours = 4;
|
||||
int hoursForDetection = sp.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
||||
|
||||
Profile profile = profileFunction.getProfile();
|
||||
|
@ -85,7 +87,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
|
||||
AutosensData current = iobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
|
||||
if (current == null) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + DateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + dateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
|
@ -116,7 +118,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
}
|
||||
|
||||
// reset deviations after profile switch
|
||||
if (ProfileSwitch.isEvent5minBack(getAapsLogger(), profileSwitches, autosensData.time, true)) {
|
||||
if (new ProfileSwitch(getInjector()).isEvent5minBack(profileSwitches, autosensData.time, true)) {
|
||||
deviationsArray.clear();
|
||||
pastSensitivity += "(PROFILESWITCH)";
|
||||
}
|
||||
|
@ -172,7 +174,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin {
|
|||
sensResult, deviationsArray.size());
|
||||
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Sensitivity to: "
|
||||
+ DateUtil.dateAndTimeString(toTime) +
|
||||
+ dateUtil.dateAndTimeString(toTime) +
|
||||
" ratio: " + output.ratio
|
||||
+ " mealCOB: " + current.cob);
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Sensitivity to: deviations " + Arrays.toString(deviations));
|
||||
|
|
|
@ -35,7 +35,8 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
|||
@Singleton
|
||||
public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
||||
|
||||
private ProfileFunction profileFunction;
|
||||
private final ProfileFunction profileFunction;
|
||||
private final DateUtil dateUtil;
|
||||
|
||||
@Inject
|
||||
public SensitivityOref1Plugin(
|
||||
|
@ -43,7 +44,8 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
|||
AAPSLogger aapsLogger,
|
||||
ResourceHelper resourceHelper,
|
||||
SP sp,
|
||||
ProfileFunction profileFunction
|
||||
ProfileFunction profileFunction,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.SENSITIVITY)
|
||||
|
@ -56,6 +58,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
|||
injector, aapsLogger, resourceHelper, sp
|
||||
);
|
||||
this.profileFunction = profileFunction;
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +82,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
|||
// the current
|
||||
AutosensData current = iobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
|
||||
if (current == null) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + DateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + dateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
|
@ -125,7 +128,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
|||
}
|
||||
|
||||
// reset deviations after profile switch
|
||||
if (ProfileSwitch.isEvent5minBack(getAapsLogger(), profileSwitches, autosensData.time, true)) {
|
||||
if (new ProfileSwitch(getInjector()).isEvent5minBack(profileSwitches, autosensData.time, true)) {
|
||||
deviationsArray.clear();
|
||||
pastSensitivity += "(PROFILESWITCH)";
|
||||
}
|
||||
|
@ -241,7 +244,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
|||
sensResultArray.get(key) + comparison, deviationsHour.get(key).size());
|
||||
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Sensitivity to: "
|
||||
+ DateUtil.dateAndTimeString(toTime) +
|
||||
+ dateUtil.dateAndTimeString(toTime) +
|
||||
" ratio: " + output.ratio
|
||||
+ " mealCOB: " + current.cob);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
|||
public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin {
|
||||
|
||||
private SP sp;
|
||||
private ResourceHelper resourceHelper;
|
||||
private DateUtil dateUtil;
|
||||
private ProfileFunction profileFunction;
|
||||
|
||||
@Inject
|
||||
|
@ -41,7 +41,8 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
AAPSLogger aapsLogger,
|
||||
ResourceHelper resourceHelper,
|
||||
SP sp,
|
||||
ProfileFunction profileFunction
|
||||
ProfileFunction profileFunction,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.SENSITIVITY)
|
||||
|
@ -52,7 +53,7 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
injector, aapsLogger, resourceHelper, sp
|
||||
);
|
||||
this.sp = sp;
|
||||
this.resourceHelper = resourceHelper;
|
||||
this.dateUtil = dateUtil;
|
||||
this.profileFunction = profileFunction;
|
||||
}
|
||||
|
||||
|
@ -62,9 +63,9 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
|
||||
String age = sp.getString(R.string.key_age, "");
|
||||
int defaultHours = 24;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_adult))) defaultHours = 24;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_teenage))) defaultHours = 4;
|
||||
if (age.equals(resourceHelper.gs(R.string.key_child))) defaultHours = 4;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_adult))) defaultHours = 24;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_teenage))) defaultHours = 4;
|
||||
if (age.equals(getResourceHelper().gs(R.string.key_child))) defaultHours = 4;
|
||||
int hoursForDetection = sp.getInt(R.string.key_openapsama_autosens_period, defaultHours);
|
||||
|
||||
if (autosensDataTable == null || autosensDataTable.size() < 4) {
|
||||
|
@ -74,7 +75,7 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
|
||||
AutosensData current = iobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
|
||||
if (current == null) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + DateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "No autosens data available. toTime: " + dateUtil.dateAndTimeString(toTime) + " lastDataTime: " + iobCobCalculatorPlugin.lastDataTime());
|
||||
return new AutosensResult();
|
||||
}
|
||||
|
||||
|
@ -117,7 +118,7 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
}
|
||||
|
||||
// reset deviations after profile switch
|
||||
if (ProfileSwitch.isEvent5minBack(getAapsLogger(), profileSwitches, autosensData.time, true)) {
|
||||
if (new ProfileSwitch(getInjector()).isEvent5minBack(profileSwitches, autosensData.time, true)) {
|
||||
data.clear();
|
||||
pastSensitivity += "(PROFILESWITCH)";
|
||||
}
|
||||
|
@ -145,10 +146,10 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
}
|
||||
|
||||
if (data.size() == 0) {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Data size: " + data.size() + " fromTime: " + DateUtil.dateAndTimeString(fromTime) + " toTime: " + DateUtil.dateAndTimeString(toTime));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Data size: " + data.size() + " fromTime: " + dateUtil.dateAndTimeString(fromTime) + " toTime: " + dateUtil.dateAndTimeString(toTime));
|
||||
return new AutosensResult();
|
||||
} else {
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Data size: " + data.size() + " fromTime: " + DateUtil.dateAndTimeString(fromTime) + " toTime: " + DateUtil.dateAndTimeString(toTime));
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Data size: " + data.size() + " fromTime: " + dateUtil.dateAndTimeString(fromTime) + " toTime: " + dateUtil.dateAndTimeString(toTime));
|
||||
}
|
||||
|
||||
double weightedsum = 0;
|
||||
|
@ -192,7 +193,7 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin
|
|||
sensResult, data.size());
|
||||
|
||||
getAapsLogger().debug(LTag.AUTOSENS, "Sensitivity to: "
|
||||
+ DateUtil.dateAndTimeString(toTime) +
|
||||
+ dateUtil.dateAndTimeString(toTime) +
|
||||
" ratio: " + output.ratio
|
||||
+ " mealCOB: " + current.cob);
|
||||
|
||||
|
|
|
@ -12,17 +12,16 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.db.BgReading
|
||||
import info.nightscout.androidaps.db.DatabaseHelper
|
||||
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.androidaps.plugins.source.BGSourceFragment.RecyclerViewAdapter.BgReadingsViewHolder
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
@ -34,6 +33,7 @@ class BGSourceFragment : DaggerFragment() {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var databaseHelper: DatabaseHelperInterface
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
@ -84,7 +84,7 @@ class BGSourceFragment : DaggerFragment() {
|
|||
val bgReading = bgReadings[position]
|
||||
holder.ns.visibility = if (NSUpload.isIdValid(bgReading._id)) View.VISIBLE else View.GONE
|
||||
holder.invalid.visibility = if (!bgReading.isValid) View.VISIBLE else View.GONE
|
||||
holder.date.text = DateUtil.dateAndTimeString(bgReading.date)
|
||||
holder.date.text = dateUtil.dateAndTimeString(bgReading.date)
|
||||
holder.value.text = bgReading.valueToUnitsToString(profileFunction.getUnits())
|
||||
holder.direction.text = bgReading.directionToSymbol(databaseHelper)
|
||||
holder.remove.tag = bgReading
|
||||
|
@ -106,7 +106,7 @@ class BGSourceFragment : DaggerFragment() {
|
|||
remove.setOnClickListener { v: View ->
|
||||
val bgReading = v.tag as BgReading
|
||||
activity?.let { activity ->
|
||||
val text = DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profileFunction.getUnits())
|
||||
val text = dateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profileFunction.getUnits())
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
bgReading.isValid = false
|
||||
MainApp.getDbHelper().update(bgReading)
|
||||
|
|
|
@ -28,7 +28,8 @@ class EversensePlugin @Inject constructor(
|
|||
injector: HasAndroidInjector,
|
||||
private val sp: SP,
|
||||
resourceHelper: ResourceHelper,
|
||||
aapsLogger: AAPSLogger
|
||||
aapsLogger: AAPSLogger,
|
||||
private val dateUtil: DateUtil
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment::class.java.name)
|
||||
|
@ -50,7 +51,7 @@ class EversensePlugin @Inject constructor(
|
|||
if (bundle.containsKey("placementModeInProgress")) aapsLogger.debug(LTag.BGSOURCE, "placementModeInProgress: " + bundle.getBoolean("placementModeInProgress"))
|
||||
if (bundle.containsKey("glucoseLevel")) aapsLogger.debug(LTag.BGSOURCE, "glucoseLevel: " + bundle.getInt("glucoseLevel"))
|
||||
if (bundle.containsKey("glucoseTrendDirection")) aapsLogger.debug(LTag.BGSOURCE, "glucoseTrendDirection: " + bundle.getString("glucoseTrendDirection"))
|
||||
if (bundle.containsKey("glucoseTimestamp")) aapsLogger.debug(LTag.BGSOURCE, "glucoseTimestamp: " + DateUtil.dateAndTimeString(bundle.getLong("glucoseTimestamp")))
|
||||
if (bundle.containsKey("glucoseTimestamp")) aapsLogger.debug(LTag.BGSOURCE, "glucoseTimestamp: " + dateUtil.dateAndTimeString(bundle.getLong("glucoseTimestamp")))
|
||||
if (bundle.containsKey("batteryLevel")) aapsLogger.debug(LTag.BGSOURCE, "batteryLevel: " + bundle.getString("batteryLevel"))
|
||||
if (bundle.containsKey("signalStrength")) aapsLogger.debug(LTag.BGSOURCE, "signalStrength: " + bundle.getString("signalStrength"))
|
||||
if (bundle.containsKey("transmitterVersionNumber")) aapsLogger.debug(LTag.BGSOURCE, "transmitterVersionNumber: " + bundle.getString("transmitterVersionNumber"))
|
||||
|
@ -58,7 +59,7 @@ class EversensePlugin @Inject constructor(
|
|||
if (bundle.containsKey("transmitterModelNumber")) aapsLogger.debug(LTag.BGSOURCE, "transmitterModelNumber: " + bundle.getString("transmitterModelNumber"))
|
||||
if (bundle.containsKey("transmitterSerialNumber")) aapsLogger.debug(LTag.BGSOURCE, "transmitterSerialNumber: " + bundle.getString("transmitterSerialNumber"))
|
||||
if (bundle.containsKey("transmitterAddress")) aapsLogger.debug(LTag.BGSOURCE, "transmitterAddress: " + bundle.getString("transmitterAddress"))
|
||||
if (bundle.containsKey("sensorInsertionTimestamp")) aapsLogger.debug(LTag.BGSOURCE, "sensorInsertionTimestamp: " + DateUtil.dateAndTimeString(bundle.getLong("sensorInsertionTimestamp")))
|
||||
if (bundle.containsKey("sensorInsertionTimestamp")) aapsLogger.debug(LTag.BGSOURCE, "sensorInsertionTimestamp: " + dateUtil.dateAndTimeString(bundle.getLong("sensorInsertionTimestamp")))
|
||||
if (bundle.containsKey("transmitterVersionNumber")) aapsLogger.debug(LTag.BGSOURCE, "transmitterVersionNumber: " + bundle.getString("transmitterVersionNumber"))
|
||||
if (bundle.containsKey("transmitterConnectionState")) aapsLogger.debug(LTag.BGSOURCE, "transmitterConnectionState: " + bundle.getString("transmitterConnectionState"))
|
||||
if (bundle.containsKey("glucoseLevels")) {
|
||||
|
|
|
@ -70,7 +70,7 @@ class NSClientSourcePlugin @Inject constructor(
|
|||
|
||||
private fun storeSgv(sgvJson: JSONObject) {
|
||||
val nsSgv = NSSgv(sgvJson)
|
||||
val bgReading = BgReading(nsSgv)
|
||||
val bgReading = BgReading(injector, nsSgv)
|
||||
MainApp.getDbHelper().createIfNotExists(bgReading, "NS")
|
||||
detectSource(safeGetString(sgvJson, "device", "none"), safeGetLong(sgvJson, "mills"))
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
private final ProfileFunction profileFunction;
|
||||
private final ActivePluginProvider activePlugin;
|
||||
private final FabricPrivacy fabricPrivacy;
|
||||
private final DateUtil dateUtil;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -100,7 +101,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
SP sp,
|
||||
ProfileFunction profileFunction,
|
||||
ActivePluginProvider activePlugin,
|
||||
FabricPrivacy fabricPrivacy
|
||||
FabricPrivacy fabricPrivacy,
|
||||
DateUtil dateUtil
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.TREATMENT)
|
||||
|
@ -119,6 +121,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
this.profileFunction = profileFunction;
|
||||
this.activePlugin = activePlugin;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
this.dateUtil = dateUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -339,7 +342,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
last = t.date;
|
||||
}
|
||||
}
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: " + DateUtil.dateAndTimeString(last));
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last bolus time: " + dateUtil.dateAndTimeString(last));
|
||||
return last;
|
||||
}
|
||||
|
||||
|
@ -354,7 +357,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
last = t.date;
|
||||
}
|
||||
}
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: " + DateUtil.dateAndTimeString(last));
|
||||
getAapsLogger().debug(LTag.DATATREATMENTS, "Last manual bolus time: " + dateUtil.dateAndTimeString(last));
|
||||
return last;
|
||||
}
|
||||
|
||||
|
@ -643,7 +646,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
if (!allowUpdate && !creatOrUpdateResult.success) {
|
||||
getAapsLogger().error("Treatment could not be added to DB", new Exception());
|
||||
|
||||
String status = String.format(resourceHelper.gs(R.string.error_adding_treatment_message), treatment.insulin, (int) treatment.carbs, DateUtil.dateAndTimeString(treatment.date));
|
||||
String status = String.format(resourceHelper.gs(R.string.error_adding_treatment_message), treatment.insulin, (int) treatment.carbs, dateUtil.dateAndTimeString(treatment.date));
|
||||
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.error);
|
||||
|
|
|
@ -42,6 +42,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var treatmentsPlugin: TreatmentsPlugin
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
@ -109,7 +110,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
override fun onBindViewHolder(holder: TreatmentsViewHolder, position: Int) {
|
||||
val profile = profileFunction.getProfile() ?: return
|
||||
val t = treatments[position]
|
||||
holder.date.text = DateUtil.dateAndTimeString(t.date)
|
||||
holder.date.text = dateUtil.dateAndTimeString(t.date)
|
||||
holder.insulin.text = resourceHelper.gs(R.string.formatinsulinunits, t.insulin)
|
||||
holder.carbs.text = resourceHelper.gs(R.string.format_carbs, t.carbs.toInt())
|
||||
val iob = t.iobCalc(System.currentTimeMillis(), profile.dia)
|
||||
|
@ -158,7 +159,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
|||
val text = resourceHelper.gs(R.string.configbuilder_insulin) + ": " +
|
||||
resourceHelper.gs(R.string.formatinsulinunits, treatment.insulin) + "\n" +
|
||||
resourceHelper.gs(R.string.carbs) + ": " + resourceHelper.gs(R.string.format_carbs, treatment.carbs.toInt()) + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(treatment.date)
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(treatment.date)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
if (treatment.source == Source.PUMP) {
|
||||
treatment.isValid = false
|
||||
|
|
|
@ -38,6 +38,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var translator: Translator
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
@ -106,7 +107,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
override fun onBindViewHolder(holder: CareportalEventsViewHolder, position: Int) {
|
||||
val careportalEvent = careportalEventList[position]
|
||||
holder.ns.visibility = if (NSUpload.isIdValid(careportalEvent._id)) View.VISIBLE else View.GONE
|
||||
holder.date.text = DateUtil.dateAndTimeString(careportalEvent.date)
|
||||
holder.date.text = dateUtil.dateAndTimeString(careportalEvent.date)
|
||||
holder.duration.text = if (careportalEvent.durationInMsec() == 0L) "" else DateUtil.niceTimeScalar(careportalEvent.durationInMsec(), resourceHelper)
|
||||
holder.note.text = careportalEvent.notes
|
||||
holder.type.text = translator.translate(careportalEvent.eventType)
|
||||
|
@ -132,7 +133,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
val text = resourceHelper.gs(R.string.careportal_newnstreatment_eventtype) + ": " + translator.translate(careportalEvent.eventType) + "\n" +
|
||||
resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + careportalEvent.notes + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(careportalEvent.date)
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(careportalEvent.date)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
if (NSUpload.isIdValid(careportalEvent._id))
|
||||
NSUpload.removeCareportalEntryFromNS(careportalEvent._id)
|
||||
|
|
|
@ -64,7 +64,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
holder.ph.visibility = if (extendedBolus.source == Source.PUMP) View.VISIBLE else View.GONE
|
||||
holder.ns.visibility = if (NSUpload.isIdValid(extendedBolus._id)) View.VISIBLE else View.GONE
|
||||
if (extendedBolus.isEndingEvent) {
|
||||
holder.date.text = DateUtil.dateAndTimeString(extendedBolus.date)
|
||||
holder.date.text = dateUtil.dateAndTimeString(extendedBolus.date)
|
||||
holder.duration.text = resourceHelper.gs(R.string.cancel)
|
||||
holder.insulin.text = ""
|
||||
holder.realDuration.text = ""
|
||||
|
@ -73,8 +73,8 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
holder.ratio.text = ""
|
||||
} else {
|
||||
@SuppressLint("SetTextI18n")
|
||||
if (extendedBolus.isInProgress) holder.date.text = DateUtil.dateAndTimeString(extendedBolus.date)
|
||||
else holder.date.text = DateUtil.dateAndTimeString(extendedBolus.date) + " - " + dateUtil.timeString(extendedBolus.end())
|
||||
if (extendedBolus.isInProgress) holder.date.text = dateUtil.dateAndTimeString(extendedBolus.date)
|
||||
else holder.date.text = dateUtil.dateAndTimeString(extendedBolus.date) + " - " + dateUtil.timeString(extendedBolus.end())
|
||||
|
||||
holder.duration.text = resourceHelper.gs(R.string.format_mins, extendedBolus.durationInMinutes)
|
||||
holder.insulin.text = resourceHelper.gs(R.string.formatinsulinunits, extendedBolus.insulin)
|
||||
|
@ -113,7 +113,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
showConfirmation(it, resourceHelper.gs(R.string.removerecord),
|
||||
"""
|
||||
${resourceHelper.gs(R.string.extended_bolus)}
|
||||
${resourceHelper.gs(R.string.date)}: ${DateUtil.dateAndTimeString(extendedBolus.date)}
|
||||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
|
||||
""".trimIndent(), DialogInterface.OnClickListener { _: DialogInterface, _: Int ->
|
||||
val id = extendedBolus._id
|
||||
if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
|
||||
|
|
|
@ -43,6 +43,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
|
@ -95,7 +96,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
val profileSwitch = profileSwitchList[position]
|
||||
holder.ph.visibility = (profileSwitch.source == Source.PUMP).toVisibility()
|
||||
holder.ns.visibility = NSUpload.isIdValid(profileSwitch._id).toVisibility()
|
||||
holder.date.text = DateUtil.dateAndTimeString(profileSwitch.date)
|
||||
holder.date.text = dateUtil.dateAndTimeString(profileSwitch.date)
|
||||
if (!profileSwitch.isEndingEvent) {
|
||||
holder.duration.text = resourceHelper.gs(R.string.format_mins, profileSwitch.durationInMinutes)
|
||||
} else {
|
||||
|
@ -132,7 +133,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord),
|
||||
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
|
||||
"\n" + resourceHelper.gs(R.string.date) + ": " + DateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
val id = profileSwitch._id
|
||||
if (NSUpload.isIdValid(id)) NSUpload.removeCareportalEntryFromNS(id)
|
||||
else UploadQueue.removeID("dbAdd", id)
|
||||
|
@ -141,10 +142,10 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
}
|
||||
R.id.profileswitch_clone ->
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + DateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
profileSwitch.profileObject?.let {
|
||||
val nonCustomized = it.convertToNonCustomizedProfile()
|
||||
localProfilePlugin.addProfile(LocalProfilePlugin.SingleProfile().copyFrom(localProfilePlugin.rawProfile, nonCustomized, profileSwitch.customizedName + " " + DateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
|
||||
localProfilePlugin.addProfile(LocalProfilePlugin.SingleProfile().copyFrom(localProfilePlugin.rawProfile, nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
|
||||
rxBus.send(EventLocalProfileChanged())
|
||||
}
|
||||
})
|
||||
|
|
|
@ -78,13 +78,13 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
|
|||
holder.ph.setVisibility(tempTarget.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(tempTarget._id) ? View.VISIBLE : View.GONE);
|
||||
if (!tempTarget.isEndingEvent()) {
|
||||
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.date) + " - " + dateUtil.timeString(tempTarget.originalEnd()));
|
||||
holder.date.setText(dateUtil.dateAndTimeString(tempTarget.date) + " - " + dateUtil.timeString(tempTarget.originalEnd()));
|
||||
holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.durationInMinutes) + " min");
|
||||
holder.low.setText(tempTarget.lowValueToUnitsToString(units));
|
||||
holder.high.setText(tempTarget.highValueToUnitsToString(units));
|
||||
holder.reason.setText(tempTarget.reason);
|
||||
} else {
|
||||
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.date));
|
||||
holder.date.setText(dateUtil.dateAndTimeString(tempTarget.date));
|
||||
holder.duration.setText(R.string.cancel);
|
||||
holder.low.setText("");
|
||||
holder.high.setText("");
|
||||
|
@ -142,7 +142,7 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
|
|||
final TempTarget tempTarget = (TempTarget) v.getTag();
|
||||
OKDialog.showConfirmation(getContext(), resourceHelper.gs(R.string.removerecord),
|
||||
resourceHelper.gs(R.string.careportal_temporarytarget) + ": " + tempTarget.friendlyDescription(profileFunction.getUnits(), resourceHelper) +
|
||||
"\n" + DateUtil.dateAndTimeString(tempTarget.date),
|
||||
"\n" + dateUtil.dateAndTimeString(tempTarget.date),
|
||||
(dialog, id) -> {
|
||||
final String _id = tempTarget._id;
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue