NSC: allow TBR sync for testing in eng mode

This commit is contained in:
Milos Kozak 2022-02-26 13:48:52 +01:00
parent d0ba2328c2
commit fcd4b736d7
4 changed files with 12 additions and 2 deletions

View file

@ -310,7 +310,7 @@ class NSClientAddUpdateWorker(
} ?: aapsLogger.error("Error parsing TherapyEvent json $json")
}
eventType == TherapyEvent.Type.COMBO_BOLUS.text ->
if (config.NSCLIENT) {
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
extendedBolusFromJson(json)?.let { extendedBolus ->
repository.runTransactionForResult(SyncNsExtendedBolusTransaction(extendedBolus))
.doOnError {
@ -356,7 +356,7 @@ class NSClientAddUpdateWorker(
} ?: aapsLogger.error("Error parsing ExtendedBolus json $json")
}
eventType == TherapyEvent.Type.TEMPORARY_BASAL.text ->
if (config.NSCLIENT) {
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
temporaryBasalFromJson(json)?.let { temporaryBasal ->
repository.runTransactionForResult(SyncNsTemporaryBasalTransaction(temporaryBasal))
.doOnError {

View file

@ -151,6 +151,7 @@ class NSClientPlugin @Inject constructor(
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_errors))?.isVisible = false
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = buildHelper.isEngineeringMode()
// preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_sync_use_absolute))?.isVisible = false
} else {
// APS or pumpControl mode

View file

@ -1110,6 +1110,8 @@
<string name="ns_receive_profile_switch_summary">Accept profile switches entered through NS or NSClient</string>
<string name="ns_receive_offline_event">Receive APS offline events</string>
<string name="ns_receive_offline_event_summary">Accept APS Offline events entered through NS or NSClient</string>
<string name="ns_receive_tbr_eb">Receive TBR and EB</string>
<string name="ns_receive_tbr_eb_summary">Accept TBR and EB entered through another instance</string>
<string name="key_ns_receive_insulin" translatable="false">ns_receive_insulin</string>
<string name="ns_receive_insulin">Receive insulin</string>
<string name="ns_receive_insulin_summary">Accept insulin entered through NS or NSClient (it\'s not delivered, only calculated towards IOB)</string>
@ -1117,6 +1119,7 @@
<string name="ns_receive_carbs">Receive carbs</string>
<string name="ns_receive_carbs_summary">Accept carbs entered through NS or NSClient</string>
<string name="key_ns_receive_therapy_events" translatable="false">ns_receive_therapy_events</string>
<string name="key_ns_receive_tbr_eb" translatable="false">ns_receive_tbr_eb</string>
<string name="ns_receive_therapy_events">Receive therapy events</string>
<string name="ns_receive_therapy_events_summary">Accept therapy events (cannula, insulin, battery change etc) entered through NS or NSClient</string>
<string name="key_ns_receive_cgm" translatable="false">ns_receive_cgm</string>

View file

@ -84,6 +84,12 @@
android:summary="@string/ns_receive_offline_event_summary"
android:title="@string/ns_receive_offline_event" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_ns_receive_tbr_eb"
android:summary="@string/ns_receive_tbr_eb_summary"
android:title="@string/ns_receive_tbr_eb" />
</androidx.preference.PreferenceScreen>>
<androidx.preference.PreferenceScreen