Integrate Source for SMS, NS and Bolus Record (Simplify list of actions)

This commit is contained in:
Philoul 2021-03-23 15:42:55 +01:00
parent ac3baab3f3
commit d3a9947cb4
10 changed files with 65 additions and 106 deletions

View file

@ -211,7 +211,7 @@ class InsulinDialog : DialogFragmentWithDate() {
detailedBolusInfo.source = Source.USER
detailedBolusInfo.notes = notes
if (recordOnlyChecked) {
uel.log(Action.BOLUS_RECORD, notes, ValueWithUnit(insulinAfterConstraints, Units.U), ValueWithUnit(timeOffset, Units.M, timeOffset!= 0))
uel.log(Action.BOLUS, notes, ValueWithUnit(Sources.Record), ValueWithUnit(insulinAfterConstraints, Units.U), ValueWithUnit(timeOffset, Units.M, timeOffset!= 0))
detailedBolusInfo.date = time
activePlugin.activeTreatments.addToHistoryTreatment(detailedBolusInfo, false)
} else {

View file

@ -16,6 +16,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.Food
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.transactions.InvalidateFoodTransaction
import info.nightscout.androidaps.databinding.FoodFragmentBinding
@ -76,7 +77,7 @@ class FoodFragment : DaggerFragment() {
binding.refreshFromNightscout.setOnClickListener {
context?.let { context ->
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
uel.log(Action.FOOD_FROM_NS)
uel.log(Action.FOOD, UserEntry.ValueWithUnit(UserEntry.Sources.NS))
disposable += Completable.fromAction { repository.deleteAllFoods() }
.subscribeOn(aapsSchedulers.io)
.observeOn(aapsSchedulers.main)

View file

@ -86,7 +86,7 @@ class NSClientAddUpdateWorker(
.blockingGet()
.also { result ->
result.inserted.forEach {
uel.log(UserEntry.Action.TT_FROM_NS,
uel.log(UserEntry.Action.TT, ValueWithUnit(UserEntry.Sources.NS),
ValueWithUnit(it.reason.text, UserEntry.Units.TherapyEvent),
ValueWithUnit(it.lowTarget, UserEntry.Units.Mg_Dl, true),
ValueWithUnit(it.highTarget, UserEntry.Units.Mg_Dl, it.lowTarget != it.highTarget),
@ -94,7 +94,7 @@ class NSClientAddUpdateWorker(
)
}
result.invalidated.forEach {
uel.log(UserEntry.Action.TT_DELETED_FROM_NS,
uel.log(UserEntry.Action.TT_REMOVED, ValueWithUnit(UserEntry.Sources.NS),
ValueWithUnit(it.reason.text, UserEntry.Units.TherapyEvent),
ValueWithUnit(it.lowTarget, UserEntry.Units.Mg_Dl, true),
ValueWithUnit(it.highTarget, UserEntry.Units.Mg_Dl, it.lowTarget != it.highTarget),
@ -102,7 +102,7 @@ class NSClientAddUpdateWorker(
)
}
result.ended.forEach {
uel.log(UserEntry.Action.TT_CANCELED_FROM_NS,
uel.log(UserEntry.Action.CANCEL_TT, ValueWithUnit(UserEntry.Sources.NS),
ValueWithUnit(it.reason.text, UserEntry.Units.TherapyEvent),
ValueWithUnit(it.lowTarget, UserEntry.Units.Mg_Dl, true),
ValueWithUnit(it.highTarget, UserEntry.Units.Mg_Dl, it.lowTarget != it.highTarget),
@ -131,15 +131,15 @@ class NSClientAddUpdateWorker(
.blockingGet()
.also { result ->
result.inserted.forEach {
uel.log(UserEntry.Action.CAREPORTAL_FROM_NS,
it.note ?: "",
uel.log(UserEntry.Action.CAREPORTAL,
it.note ?: "", ValueWithUnit(UserEntry.Sources.NS),
ValueWithUnit(it.timestamp, UserEntry.Units.Timestamp, true),
ValueWithUnit(it.type.text, UserEntry.Units.TherapyEvent)
)
}
result.invalidated.forEach {
uel.log(UserEntry.Action.CAREPORTAL_DELETED_FROM_NS,
it.note ?: "",
uel.log(UserEntry.Action.CAREPORTAL_REMOVED,
it.note ?: "", ValueWithUnit(UserEntry.Sources.NS),
ValueWithUnit(it.timestamp, UserEntry.Units.Timestamp, true),
ValueWithUnit(it.type.text, UserEntry.Units.TherapyEvent)
)

View file

@ -7,7 +7,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.*
import info.nightscout.androidaps.database.transactions.SyncTemporaryTargetTransaction
import info.nightscout.androidaps.database.transactions.SyncTherapyEventTransaction
import info.nightscout.androidaps.events.EventNsTreatment
@ -68,10 +68,10 @@ class NSClientRemoveWorker(
.also { result ->
result.invalidated.forEach {
uel.log(
UserEntry.Action.TT_DELETED_FROM_NS,
ValueWithUnit(it.reason.text, UserEntry.Units.TherapyEvent),
ValueWithUnit(it.lowTarget, UserEntry.Units.Mg_Dl, true),
ValueWithUnit(it.highTarget, UserEntry.Units.Mg_Dl, it.lowTarget != it.highTarget),
Action.TT_REMOVED, ValueWithUnit(Sources.NS),
ValueWithUnit(it.reason.text, Units.TherapyEvent),
ValueWithUnit(it.lowTarget, Units.Mg_Dl, true),
ValueWithUnit(it.highTarget, Units.Mg_Dl, it.lowTarget != it.highTarget),
ValueWithUnit(it.duration.toInt() / 60000, UserEntry.Units.M, it.duration != 0L)
)
}
@ -88,9 +88,9 @@ class NSClientRemoveWorker(
.also { result ->
result.invalidated.forEach {
uel.log(
UserEntry.Action.CAREPORTAL_DELETED_FROM_NS, (it.note ?: ""),
ValueWithUnit(it.timestamp, UserEntry.Units.Timestamp, true),
ValueWithUnit(it.type.text, UserEntry.Units.TherapyEvent))
Action.CAREPORTAL_REMOVED, (it.note ?: ""), ValueWithUnit(Sources.NS),
ValueWithUnit(it.timestamp, Units.Timestamp, true),
ValueWithUnit(it.type.text, Units.TherapyEvent))
}
}

View file

@ -348,7 +348,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
uel.log(Action.SMS_LOOP_DISABLED)
uel.log(Action.LOOP_DISABLED, ValueWithUnit(Sources.SMS))
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
@ -372,7 +372,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
uel.log(Action.SMS_LOOP_ENABLED)
uel.log(Action.LOOP_ENABLED, ValueWithUnit(Sources.SMS))
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
@ -399,7 +399,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
uel.log(Action.SMS_LOOP_RESUME)
uel.log(Action.RESUME, ValueWithUnit(Sources.SMS))
loopPlugin.suspendTo(0L)
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
commandQueue.cancelTempBasal(true, object : Callback() {
@ -432,7 +432,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
override fun run() {
uel.log(Action.SMS_LOOP_SUSPEND)
uel.log(Action.SUSPEND, ValueWithUnit(Sources.SMS))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (result.success) {
@ -516,7 +516,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
uel.log(Action.SMS_PUMP_CONNECT)
uel.log(Action.RECONNECT, ValueWithUnit(Sources.SMS))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (!result.success) {
@ -545,7 +545,7 @@ class SmsCommunicatorPlugin @Inject constructor(
receivedSms.processed = true
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
override fun run() {
uel.log(Action.SMS_PUMP_DISCONNECT)
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.SMS))
val profile = profileFunction.getProfile()
loopPlugin.disconnectPump(duration, profile)
rxBus.send(EventRefreshOverview("SMS_PUMP_DISCONNECT"))
@ -602,7 +602,7 @@ class SmsCommunicatorPlugin @Inject constructor(
activePlugin.activeTreatments.doProfileSwitch(store, list[pIndex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_PROFILE, ValueWithUnit(R.string.profileswitchcreated, Units.R_String))
uel.log(Action.PROFILE_SWITCH, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.profileswitchcreated, Units.R_String))
}
})
}
@ -624,12 +624,12 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcanceled)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalcanceled, Units.R_String))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalcanceled, Units.R_String))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcancelfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalcancelfailed, Units.R_String))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalcancelfailed, Units.R_String))
}
}
})
@ -658,14 +658,14 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result.isPercent)
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
else
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
}
}
})
@ -696,14 +696,14 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result.isPercent)
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
else
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
}
}
})
@ -730,7 +730,7 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedcancelfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedcanceled, Units.R_String))
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedcanceled, Units.R_String))
}
}
})
@ -757,16 +757,16 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (config.APS)
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
?: 0.0, Units.U), ValueWithUnit(duration, Units.M), ValueWithUnit(R.string.loopsuspended, Units.R_String))
else
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
?: 0.0, Units.U), ValueWithUnit(duration, Units.M))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_extendedfailed, Units.R_String))
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedfailed, Units.R_String))
}
}
})
@ -839,12 +839,12 @@ class SmsCommunicatorPlugin @Inject constructor(
}
}
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BOLUS, replyText)
uel.log(Action.BOLUS, replyText, ValueWithUnit(Sources.SMS))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_bolusfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_bolusfailed, Units.R_String))
uel.log(Action.BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_bolusfailed, Units.R_String))
}
}
})
@ -884,13 +884,13 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = String.format(resourceHelper.gs(R.string.smscommunicator_carbsset), anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsset, 1), ValueWithUnit(anInteger
uel.log(Action.CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_carbsset, 1), ValueWithUnit(anInteger
?: 0, Units.G))
} else {
var replyText = resourceHelper.gs(R.string.smscommunicator_carbsfailed, anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsfailed, 1), ValueWithUnit(anInteger
uel.log(Action.CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_carbsfailed, 1), ValueWithUnit(anInteger
?: 0, Units.G))
}
}
@ -900,7 +900,7 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = String.format(resourceHelper.gs(R.string.smscommunicator_carbsset), anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(R.string.smscommunicator_carbsset, 1), ValueWithUnit(anInteger
uel.log(Action.CARBS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_carbsset, 1), ValueWithUnit(anInteger
?: 0, Units.G))
}
}
@ -971,7 +971,7 @@ class SmsCommunicatorPlugin @Inject constructor(
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_set), ttString, ttDuration)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
//uel.log(Action.SMS_TT, ValueWithUnit(R.string.smscommunicator_tt_set, 2), ValueWithUnit(tt, units), ValueWithUnit(ttDuration, Units.M))
uel.log(Action.SMS_TT, ValueWithUnit(tt, units), ValueWithUnit(ttDuration, Units.M))
uel.log(Action.TT, ValueWithUnit(Sources.SMS), ValueWithUnit(tt, units), ValueWithUnit(ttDuration, Units.M))
}
})
} else if (isStop) {
@ -988,7 +988,7 @@ class SmsCommunicatorPlugin @Inject constructor(
})
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_canceled))
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_TT, ValueWithUnit(R.string.smscommunicator_tt_canceled, Units.R_String))
uel.log(Action.CANCEL_TT, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tt_canceled, Units.R_String))
}
})
} else
@ -1007,7 +1007,7 @@ class SmsCommunicatorPlugin @Inject constructor(
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
uel.log(Action.SMS_SMS, ValueWithUnit(R.string.smscommunicator_stoppedsms, Units.R_String))
uel.log(Action.SMS_SMS, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_stoppedsms, Units.R_String))
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
@ -1026,9 +1026,9 @@ class SmsCommunicatorPlugin @Inject constructor(
if (result) resourceHelper.gs(R.string.smscommunicator_calibrationsent) else resourceHelper.gs(R.string.smscommunicator_calibrationfailed)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result)
uel.log(Action.SMS_CAL, ValueWithUnit(R.string.smscommunicator_calibrationsent, Units.R_String))
uel.log(Action.CALIBRATION, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_calibrationsent, Units.R_String))
else
uel.log(Action.SMS_CAL, ValueWithUnit(R.string.smscommunicator_calibrationfailed, Units.R_String))
uel.log(Action.CALIBRATION, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_calibrationfailed, Units.R_String))
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))

View file

@ -131,7 +131,6 @@
<string name="configbuilder_constraints_description">Which constraints are applied?</string>
<string name="constraints">Constraints</string>
<string name="loop">Loop</string>
<string name="configbuilder_loop">Loop</string>
<string name="configbuilder_loop_description">Use this to activate AndroidAPS\' loop integration.</string>
<string name="loop_aps_label">APS</string>
@ -511,7 +510,6 @@
<string name="openapsama_autosens_period_summary">Amount of hours in the past for sensitivity detection (carbs absorption time is excluded)</string>
<string name="key_openapsama_autosens_period" translatable="false">openapsama_autosens_period</string>
<string name="key_nsclient_localbroadcasts" translatable="false">nsclient_localbroadcasts</string>
<string name="pump">Pump</string>
<string name="openaps">OpenAPS</string>
<string name="uploader">Uploader</string>
<string name="configbuilder_sensitivity">Sensitivity detection</string>

View file

@ -124,6 +124,7 @@ class ClassicPrefsFormat @Inject constructor(
when (v.unit) {
Units.Timestamp -> timestamp = dateUtil.dateAndTimeAndSecondsString(v.lValue)
Units.TherapyEvent -> therapyEvent = if (therapyEvent == "") translator.translate(v.sValue) else therapyEvent + " / " + translator.translate(v.sValue)
Units.Source -> source = csvString(translator.translate(v.sValue))
Units.R_String -> if (v.iValue != 0) { //Formated string lValue is the number of parameters, up to 3
var rStringParam = v.lValue.toInt()
var tempString = ""

View file

@ -53,7 +53,6 @@ class Translator @Inject internal constructor(
Action.BOLUS.name -> resourceHelper.gs(R.string.uel_bolus)
Action.BOLUS_ADVISOR.name -> resourceHelper.gs(R.string.uel_bolus_advisor)
Action.BOLUS_RECORD.name -> resourceHelper.gs(R.string.uel_bolus_record)
Action.EXTENDED_BOLUS.name -> resourceHelper.gs(R.string.uel_extended_bolus)
Action.SUPERBOLUS_TBR.name -> resourceHelper.gs(R.string.uel_superbolus_tbr)
Action.CARBS.name -> resourceHelper.gs(R.string.uel_carbs)
@ -118,25 +117,7 @@ class Translator @Inject internal constructor(
Action.IMPORT_DATABASES.name -> resourceHelper.gs(R.string.uel_import_databases)
Action.OTP_EXPORT.name -> resourceHelper.gs(R.string.uel_otp_export)
Action.OTP_RESET.name -> resourceHelper.gs(R.string.uel_otp_reset)
Action.SMS_BASAL.name -> resourceHelper.gs(R.string.uel_sms_basal)
Action.SMS_BOLUS.name -> resourceHelper.gs(R.string.uel_sms_bolus)
Action.SMS_CAL.name -> resourceHelper.gs(R.string.uel_sms_cal)
Action.SMS_CARBS.name -> resourceHelper.gs(R.string.uel_sms_carbs)
Action.SMS_EXTENDED_BOLUS.name -> resourceHelper.gs(R.string.uel_sms_extended_bolus)
Action.SMS_LOOP_DISABLED.name -> resourceHelper.gs(R.string.uel_sms_loop_disabled)
Action.SMS_LOOP_ENABLED.name -> resourceHelper.gs(R.string.uel_sms_loop_enabled)
Action.SMS_LOOP_RESUME.name -> resourceHelper.gs(R.string.uel_sms_loop_resume)
Action.SMS_LOOP_SUSPEND.name -> resourceHelper.gs(R.string.uel_sms_loop_suspend)
Action.SMS_PROFILE.name -> resourceHelper.gs(R.string.uel_sms_profile)
Action.SMS_PUMP_CONNECT.name -> resourceHelper.gs(R.string.uel_sms_pump_connect)
Action.SMS_PUMP_DISCONNECT.name -> resourceHelper.gs(R.string.uel_sms_pump_disconnect)
Action.SMS_SMS.name -> resourceHelper.gs(R.string.uel_sms_sms)
Action.SMS_TT.name -> resourceHelper.gs(R.string.uel_sms_tt)
Action.TT_DELETED_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_deleted_from_ns)
Action.TT_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_from_ns)
Action.TT_CANCELED_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_canceleted_from_ns)
Action.CAREPORTAL_DELETED_FROM_NS.name -> resourceHelper.gs(R.string.uel_careportal_deleted_from_ns)
Action.CAREPORTAL_FROM_NS.name -> resourceHelper.gs(R.string.uel_careportal_from_ns)
Action.EXPORT_CSV.name -> resourceHelper.gs(R.string.uel_export_csv)
Units.Mg_Dl.name -> resourceHelper.gs(R.string.mgdl)
@ -149,6 +130,16 @@ class Translator @Inject internal constructor(
Units.Percent.name -> resourceHelper.gs(R.string.shortpercent)
Units.None.name -> ""
Sources.Manual.text -> resourceHelper.gs(R.string.manual)
Sources.Record.text -> resourceHelper.gs(R.string.record)
Sources.Automation.text -> resourceHelper.gs(R.string.automation)
Sources.Loop.text -> resourceHelper.gs(R.string.loop)
Sources.NS.text -> resourceHelper.gs(R.string.ns)
Sources.Pump.text -> resourceHelper.gs(R.string.pump)
Sources.SMS.text -> resourceHelper.gs(R.string.smb_shortname)
Sources.Wear.text -> resourceHelper.gs(R.string.wear)
Sources.Unknown.text -> resourceHelper.gs(R.string.unknown)
else -> resourceHelper.gs(R.string.unknown)
}
}

View file

@ -276,6 +276,10 @@
<string name="wear">Wear</string>
<string name="automation">Automation</string>
<string name="custom">Custom</string>
<string name="pump">Pump</string>
<string name="loop">Loop</string>
<string name="ns">NS</string>
<string name="record">Record</string>
<!-- Command-->
<string name="connectiontimedout">Connection timed out</string>
@ -401,7 +405,6 @@
<!-- User Entry -->
<string name="uel_bolus">BOLUS</string>
<string name="uel_bolus_advisor">BOLUS ADVISOR</string>
<string name="uel_bolus_record">BOLUS RECORD</string>
<string name="uel_extended_bolus">EXTENDED BOLUS</string>
<string name="uel_superbolus_tbr">SUPERBOLUS TBR</string>
<string name="uel_carbs">CARBS</string>
@ -466,25 +469,7 @@
<string name="uel_import_databases">IMPORT DATABASES</string>
<string name="uel_otp_export">OTP EXPORT</string>
<string name="uel_otp_reset">OTP RESET</string>
<string name="uel_sms_basal">SMS BASAL</string>
<string name="uel_sms_bolus">SMS BOLUS</string>
<string name="uel_sms_cal">SMS CAL</string>
<string name="uel_sms_carbs">SMS CARBS</string>
<string name="uel_sms_extended_bolus">SMS EXTENDED BOLUS</string>
<string name="uel_sms_loop_disabled">SMS LOOP DISABLED</string>
<string name="uel_sms_loop_enabled">SMS LOOP ENABLED</string>
<string name="uel_sms_loop_resume">SMS LOOP RESUME</string>
<string name="uel_sms_loop_suspend">SMS LOOP SUSPEND</string>
<string name="uel_sms_profile">SMS PROFILE</string>
<string name="uel_sms_pump_connect">SMS PUMP CONNECT</string>
<string name="uel_sms_pump_disconnect">SMS PUMP DISCONNECT</string>
<string name="uel_sms_sms">SMS SMS</string>
<string name="uel_sms_tt">SMS TT</string>
<string name="uel_tt_deleted_from_ns">TT DELETED FROM NS</string>
<string name="uel_careportal_deleted_from_ns">CAREPORTAL DELETED FROM NS</string>
<string name="uel_careportal_from_ns">CAREPORTAL FROM NS</string>
<string name="uel_tt_from_ns">TT FROM NS</string>
<string name="uel_tt_canceleted_from_ns">TT CANCELED FROM NS</string>
<string name="uel_export_csv">EXPORT USER ENTRIES</string>
<string name="uel_unknown">UNKNOWN</string>
<string name="formated_string">Formated string</string>

View file

@ -86,26 +86,8 @@ data class UserEntry(
@SerializedName("IMPORT_DATABASES") IMPORT_DATABASES (ColorGroup.Aaps),
@SerializedName("OTP_EXPORT") OTP_EXPORT (ColorGroup.Aaps),
@SerializedName("OTP_RESET") OTP_RESET (ColorGroup.Aaps),
@SerializedName("SMS_BASAL") SMS_BASAL (ColorGroup.InsulinTreatment),
@SerializedName("SMS_BOLUS") SMS_BOLUS (ColorGroup.InsulinTreatment),
@SerializedName("SMS_CAL") SMS_CAL (ColorGroup.Careportal),
@SerializedName("SMS_CARBS") SMS_CARBS (ColorGroup.CarbTreatment),
@SerializedName("SMS_EXTENDED_BOLUS") SMS_EXTENDED_BOLUS (ColorGroup.InsulinTreatment),
@SerializedName("SMS_LOOP_DISABLED") SMS_LOOP_DISABLED (ColorGroup.Loop),
@SerializedName("SMS_LOOP_ENABLED") SMS_LOOP_ENABLED (ColorGroup.Loop),
@SerializedName("SMS_LOOP_RESUME") SMS_LOOP_RESUME (ColorGroup.Loop),
@SerializedName("SMS_LOOP_SUSPEND") SMS_LOOP_SUSPEND (ColorGroup.Loop),
@SerializedName("SMS_PROFILE") SMS_PROFILE (ColorGroup.Profile),
@SerializedName("SMS_PUMP_CONNECT") SMS_PUMP_CONNECT (ColorGroup.Pump),
@SerializedName("SMS_PUMP_DISCONNECT") SMS_PUMP_DISCONNECT (ColorGroup.Pump),
@SerializedName("SMS_SMS") SMS_SMS (ColorGroup.Aaps),
@SerializedName("SMS_TT") SMS_TT (ColorGroup.TT),
@SerializedName("TT_DELETED_FROM_NS") TT_DELETED_FROM_NS (ColorGroup.TT),
@SerializedName("CAREPORTAL_DELETED_FROM_NS") CAREPORTAL_DELETED_FROM_NS (ColorGroup.Careportal),
@SerializedName("CAREPORTAL_FROM_NS") CAREPORTAL_FROM_NS (ColorGroup.Careportal),
@SerializedName("FOOD_FROM_NS") FOOD_FROM_NS (ColorGroup.Careportal),
@SerializedName("TT_FROM_NS") TT_FROM_NS (ColorGroup.TT),
@SerializedName("TT_CANCELED_FROM_NS") TT_CANCELED_FROM_NS (ColorGroup.TT),
@SerializedName("FOOD") FOOD (ColorGroup.Careportal),
@SerializedName("EXPORT_CSV") EXPORT_CSV (ColorGroup.Aaps),
@SerializedName("UNKNOWN") UNKNOWN (ColorGroup.Aaps)
;
@ -119,6 +101,7 @@ data class UserEntry(
constructor(ivalue: Int, unit: Units, condition:Boolean = true) : this(0.0, ivalue, 0, "", unit, condition)
constructor(lvalue: Long, unit: Units, condition:Boolean = true) : this(0.0,0, lvalue, "", unit, condition)
constructor(svalue: String, unit:Units) : this(0.0,0, 0, svalue, unit, svalue != "")
constructor(source: Sources) : this(0.0,0, 0, source.text, Units.Source, true)
constructor(dvalue: Double, unit:String) : this(dvalue,0, 0, "", Units.fromText(unit))
constructor(rStringRef: Int, nbParam: Long) : this(0.0, rStringRef, nbParam, "", Units.R_String, !rStringRef.equals(0)) // additionnal constructors for formated strings with additional values as parameters (define number of parameters as long
@ -152,7 +135,7 @@ data class UserEntry(
}
enum class Sources(val text: String) {
@SerializedName("Manual") Manual ("Manual"), //Manual entry by user, given through AAPS (default)
@SerializedName("External") External ("External"), //Manual entry by user, treatment given outside AAPS (for example Bolus with Serynge)
@SerializedName("Record") Record ("Record"), //Manual entry by user, treatment given outside AAPS (for example Bolus with Serynge)
@SerializedName("Automation") Automation ("Automation"), //From Automation plugin
@SerializedName("Loop") Loop ("Loop"), //From Loop plugin
@SerializedName("NS") NS ("NS"), //From NSClient plugin