Refresh buttons in Pod Management fragment on EventRileyLinkDeviceStatusChange and indicate when we're still waiting for a RL connection
This commit is contained in:
parent
4a10e0b06b
commit
4a0e8aa518
12 changed files with 96 additions and 154 deletions
|
@ -80,7 +80,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
|
||||
medtronic_pumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder))
|
||||
|
||||
medtronic_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.MedtronicPump))
|
||||
medtronic_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId())
|
||||
|
||||
medtronic_pump_status.setTextColor(Color.WHITE)
|
||||
medtronic_pump_status.text = "{fa-bed}"
|
||||
|
@ -172,7 +172,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
|
||||
@Synchronized
|
||||
private fun setDeviceStatus() {
|
||||
val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump)
|
||||
val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId()
|
||||
val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error
|
||||
medtronic_rl_status.text =
|
||||
when {
|
||||
|
|
|
@ -35,13 +35,13 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.WarnColors
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.omnipod_fragment.*
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
@ -69,15 +69,11 @@ class OmnipodFragment : DaggerFragment() {
|
|||
// @Inject lateinit var localAlertUtils: LocalAlertUtils
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
private val loopHandler = Handler()
|
||||
private lateinit var refreshLoop: Runnable
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
init {
|
||||
refreshLoop = Runnable {
|
||||
activity?.runOnUiThread { updateUi() }
|
||||
|
@ -157,23 +153,23 @@ class OmnipodFragment : DaggerFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
loopHandler.postDelayed(refreshLoop, T.mins(1).msecs())
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodRefreshButtonState::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ omnipod_refresh.isEnabled = it.newState }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventRileyLinkDeviceStatusChange::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateRileyLinkUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodPumpValuesChanged::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateOmipodUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventOmnipodAcknowledgeAlertsChanged::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ updateAcknowledgeAlertsUiElements() }, { fabricPrivacy.logException(it) })
|
||||
disposable += rxBus
|
||||
disposables += rxBus
|
||||
.toObservable(EventPreferenceChange::class.java)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe({
|
||||
|
@ -200,7 +196,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
disposable.clear()
|
||||
disposables.clear()
|
||||
loopHandler.removeCallbacks(refreshLoop)
|
||||
}
|
||||
|
||||
|
@ -215,7 +211,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
val rileyLinkServiceState = rileyLinkServiceData.rileyLinkServiceState
|
||||
|
||||
val resourceId = rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.Omnipod)
|
||||
val resourceId = rileyLinkServiceState.getResourceId()
|
||||
val rileyLinkError = rileyLinkServiceData.rileyLinkError
|
||||
|
||||
omnipod_rl_status.text =
|
||||
|
|
|
@ -169,30 +169,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (OmnipodPumpPlugin.this.omnipodPumpStatus != null) {
|
||||
//
|
||||
// aapsLogger.debug(LTag.PUMP, "Starting OmniPod-RileyLink service");
|
||||
// if (omnipodService.setNotInPreInit()) {
|
||||
// if (omnipodCommunicationManager == null) {
|
||||
// omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
// omnipodCommunicationManager.setPumpStatus(OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// omnipodServiceRunning = true;
|
||||
// } else {
|
||||
// omnipodCommunicationManager.setPumpStatus(OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// }
|
||||
//
|
||||
// omnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||
// //omnipodUtil.setPlugin(OmnipodPumpPlugin.this);
|
||||
//
|
||||
// omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, plugin, OmnipodPumpPlugin.this.omnipodPumpStatus);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// SystemClock.sleep(5000);
|
||||
//}
|
||||
}).start();
|
||||
}
|
||||
};
|
||||
|
@ -225,24 +201,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
);
|
||||
|
||||
super.onStart();
|
||||
|
||||
|
||||
//rileyLinkOmnipodService.verifyConfiguration();
|
||||
//initPumpStatusData();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void onResume() {
|
||||
//
|
||||
// }
|
||||
|
||||
// private void refreshConfiguration() {
|
||||
// if (pumpStatusLocal != null) {
|
||||
// pumpStatusLocal.refreshConfiguration();
|
||||
// }
|
||||
// verifyConfiguration()
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
disposable.clear();
|
||||
|
@ -253,7 +213,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
return "OmnipodPlugin::";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initPumpStatusData() {
|
||||
|
||||
|
@ -269,16 +228,12 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
if (!sp.contains(OmnipodConst.Statistics.FirstPumpStart)) {
|
||||
sp.putLong(OmnipodConst.Statistics.FirstPumpStart, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStartCustomActions() {
|
||||
|
||||
// check status every minute (if any status needs refresh we send readStatus command)
|
||||
new Thread(() -> {
|
||||
|
||||
do {
|
||||
SystemClock.sleep(60000);
|
||||
|
||||
|
@ -726,29 +681,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
}
|
||||
|
||||
// if TBR is running we will cancel it.
|
||||
// if (tbrCurrent != null) {
|
||||
//
|
||||
// aapsLogger.info(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - TBR running - so canceling it.");
|
||||
//
|
||||
// // CANCEL
|
||||
// OmnipodUITask responseTask2 = omnipodUIComm.executeCommand(OmnipodCommandType.CancelTemporaryBasal);
|
||||
//
|
||||
// PumpEnactResult result = responseTask2.getResult();
|
||||
//
|
||||
// if (result.success) {
|
||||
//
|
||||
// aapsLogger.info(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - Current TBR cancelled.");
|
||||
// } else {
|
||||
//
|
||||
// aapsLogger.error(LTag.PUMP,getLogPrefix() + "setTempBasalAbsolute - Cancel TBR failed.");
|
||||
//
|
||||
// finishAction("TBR");
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
|
||||
// now start new TBR
|
||||
OmnipodUITask responseTask = getDeviceCommandExecutor().executeCommand(OmnipodCommandType.SetTemporaryBasal,
|
||||
absoluteRate, durationInMinutes);
|
||||
|
|
|
@ -78,6 +78,13 @@ public abstract class PodStateManager {
|
|||
&& podState.getPodProgressStatus() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if we have a Pod state and the Pod activation has been completed. The pod could also be dead at this point
|
||||
*/
|
||||
public final boolean isPodActivationCompleted() {
|
||||
return isPodInitialized() && podState.getPodProgressStatus().isAtLeast(PodProgressStatus.ABOVE_FIFTY_UNITS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if we have a Pod state and the Pod is running, meaning the activation process has completed and the Pod is not deactivated or in a fault state
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
|
|||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||
import com.atech.android.library.wizardpager.WizardPagerActivity
|
||||
import com.atech.android.library.wizardpager.WizardPagerContext
|
||||
|
@ -11,9 +13,8 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus
|
||||
|
@ -24,11 +25,12 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.Remo
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.ShortInitPodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.extensions.plusAssign
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -38,18 +40,15 @@ import javax.inject.Inject
|
|||
class PodManagementActivity : NoSplashAppCompatActivity() {
|
||||
|
||||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var omnipodUtil: OmnipodUtil
|
||||
@Inject lateinit var podStateManager: PodStateManager
|
||||
@Inject lateinit var injector: HasAndroidInjector
|
||||
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
|
||||
@Inject lateinit var aapsOmnipodManager: AapsOmnipodManager
|
||||
|
||||
private var initPodChanged = false
|
||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -57,33 +56,39 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
initpod_init_pod.setOnClickListener {
|
||||
initPodAction()
|
||||
initPodChanged = true
|
||||
}
|
||||
|
||||
initpod_remove_pod.setOnClickListener {
|
||||
removePodAction()
|
||||
initPodChanged = true
|
||||
}
|
||||
|
||||
initpod_reset_pod.setOnClickListener {
|
||||
resetPodAction()
|
||||
initPodChanged = true
|
||||
}
|
||||
|
||||
initpod_pod_history.setOnClickListener {
|
||||
showPodHistory()
|
||||
}
|
||||
}
|
||||
|
||||
refreshButtons();
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
disposables += rxBus
|
||||
.toObservable(EventRileyLinkDeviceStatusChange::class.java)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ refreshButtons() }, { fabricPrivacy.logException(it) })
|
||||
|
||||
refreshButtons()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
disposables.clear()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
|
||||
if (initPodChanged) {
|
||||
rxBus.send(EventOmnipodPumpValuesChanged())
|
||||
rxBus.send(EventRefreshOverview("Omnipod Pod Management"))
|
||||
}
|
||||
rxBus.send(EventRefreshOverview("Omnipod Pod Management"))
|
||||
}
|
||||
|
||||
fun initPodAction() {
|
||||
|
@ -148,20 +153,21 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
}
|
||||
|
||||
fun showPodHistory() {
|
||||
// OKDialog.showConfirmation(this,
|
||||
// MainApp.gs(R.string.omnipod_cmd_pod_history_na), null)
|
||||
|
||||
startActivity(Intent(applicationContext, PodHistoryActivity::class.java))
|
||||
}
|
||||
|
||||
fun refreshButtons() {
|
||||
initpod_init_pod.isEnabled = !podStateManager.isPodRunning()
|
||||
|
||||
initpod_init_pod.isEnabled = !podStateManager.isPodActivationCompleted
|
||||
initpod_remove_pod.isEnabled = podStateManager.isPodInitialized
|
||||
initpod_reset_pod.isEnabled = podStateManager.hasPodState()
|
||||
|
||||
if (!rileyLinkServiceData.rileyLinkServiceState.isReady) {
|
||||
val waitingForRlView = findViewById<LinearLayout>(R.id.initpod_waiting_for_rl_layout)
|
||||
|
||||
if (rileyLinkServiceData.rileyLinkServiceState.isReady) {
|
||||
waitingForRlView.visibility = View.GONE
|
||||
} else {
|
||||
// if rileylink is not running we disable all operations that require a RL connection
|
||||
waitingForRlView.visibility = View.VISIBLE
|
||||
initpod_init_pod.isEnabled = false
|
||||
initpod_remove_pod.isEnabled = false
|
||||
initpod_reset_pod.isEnabled = false
|
||||
|
|
|
@ -51,8 +51,6 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
|
|||
if (this.cancelActionText.equals("Cancel")) {
|
||||
//AapsOmnipodManager.getInstance().resetPodStatus();
|
||||
}
|
||||
|
||||
podManagementActivity.refreshButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,9 +60,6 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
|
|||
uploadCareportalEvent(System.currentTimeMillis(), CareportalEvent.SITECHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO do this in PodManagerMentActivity itself by listening to OmnipodPumpValuesChanged events
|
||||
podManagementActivity.refreshButtons();
|
||||
}
|
||||
|
||||
private void uploadCareportalEvent(long date, String event) {
|
||||
|
|
|
@ -23,25 +23,54 @@
|
|||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="@string/omnipod_pod_mgmt_title"
|
||||
android:textAlignment="center"
|
||||
android:textSize="12pt"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/initpod_waiting_for_rl_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/initpod_waiting_for_rl_progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginRight="25dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_waiting_for_rl_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="@string/omnipod_waiting_for_rileylink_connection"
|
||||
android:textAlignment="center"
|
||||
android:textSize="8pt"/>
|
||||
</LinearLayout>
|
||||
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/initpod_init_pod"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_cp_pump_canula"
|
||||
android:text="@string/omnipod_cmd_init_pod" />
|
||||
android:text="@string/omnipod_cmd_init_pod"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space1"
|
||||
|
@ -55,14 +84,14 @@
|
|||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_actions_temptarget"
|
||||
android:text="@string/omnipod_cmd_deactivate_pod" />
|
||||
android:text="@string/omnipod_cmd_deactivate_pod"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space2"
|
||||
|
@ -80,10 +109,10 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_cp_pump_canula"
|
||||
android:text="@string/omnipod_cmd_reset_pod" />
|
||||
android:text="@string/omnipod_cmd_reset_pod"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initpod_space3"
|
||||
|
@ -92,7 +121,6 @@
|
|||
android:layout_weight="0.5"
|
||||
android:text="" />
|
||||
|
||||
|
||||
<info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
android:id="@+id/initpod_pod_history"
|
||||
style="?android:attr/buttonStyle"
|
||||
|
@ -102,11 +130,10 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableTop="@drawable/ic_danarhistory"
|
||||
android:text="@string/omnipod_cmd_pod_history" />
|
||||
|
||||
android:text="@string/omnipod_cmd_pod_history"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
<string name="omnipod_time_or_timezone_change">Time and/or Timezone change on pump</string>
|
||||
<string name="omnipod_composite_time">%1$s and %2$s</string>
|
||||
<string name="omnipod_time_ago">%1$s ago</string>
|
||||
<string name="omnipod_waiting_for_rileylink_connection">Waiting for RileyLink connection...</string>
|
||||
|
||||
<plurals name="omnipod_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
|
|
|
@ -60,7 +60,7 @@ public class RLHistoryItem {
|
|||
public String getDescription(ResourceHelper resourceHelper) {
|
||||
switch (this.source) {
|
||||
case RileyLink:
|
||||
return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
|
||||
return "State: " + resourceHelper.gs(serviceState.getResourceId())
|
||||
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode);
|
||||
case MedtronicPump:
|
||||
return resourceHelper.gs(pumpDeviceState.getResourceId());
|
||||
|
|
|
@ -22,7 +22,7 @@ public enum RileyLinkServiceState {
|
|||
RileyLinkInitializing(R.string.rileylink_state_rl_init), // (S) start Gatt discovery (OK -> RileyLinkReady, Error ->
|
||||
// BluetoothEnabled) ??
|
||||
RileyLinkError(R.string.rileylink_state_rl_error), // (E)
|
||||
RileyLinkReady(R.string.rileylink_state_connected), // (OK) if tunning was already done we go to PumpConnectorReady
|
||||
RileyLinkReady(R.string.rileylink_state_rl_ready), // (OK) if tunning was already done we go to PumpConnectorReady
|
||||
|
||||
// Tunning
|
||||
TuneUpDevice(R.string.rileylink_state_pc_tune_up), // (S)
|
||||
|
@ -40,43 +40,23 @@ public enum RileyLinkServiceState {
|
|||
// RileyLinkConnected, // -> TuneUpPump (on 1st), else PumpConnectorReady
|
||||
|
||||
// PumpConnected, //
|
||||
|
||||
;
|
||||
|
||||
int resourceId;
|
||||
Integer resourceIdPod;
|
||||
|
||||
|
||||
RileyLinkServiceState(int resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
|
||||
RileyLinkServiceState(int resourceId, int resourceIdPod) {
|
||||
this.resourceId = resourceId;
|
||||
this.resourceIdPod = resourceIdPod;
|
||||
}
|
||||
|
||||
|
||||
public boolean isReady() {
|
||||
return (this == PumpConnectorReady);
|
||||
}
|
||||
|
||||
|
||||
public int getResourceId(RileyLinkTargetDevice targetDevice) {
|
||||
if (this.resourceIdPod != null) {
|
||||
|
||||
return (targetDevice == null || targetDevice == RileyLinkTargetDevice.MedtronicPump) ? //
|
||||
this.resourceId
|
||||
: this.resourceIdPod;
|
||||
} else {
|
||||
return this.resourceId;
|
||||
}
|
||||
public int getResourceId() {
|
||||
return this.resourceId;
|
||||
}
|
||||
|
||||
|
||||
public boolean isConnecting() {
|
||||
|
||||
return (this == RileyLinkServiceState.BluetoothInitializing || //
|
||||
// this == RileyLinkServiceState.BluetoothError || //
|
||||
this == RileyLinkServiceState.BluetoothReady || //
|
||||
|
@ -86,9 +66,7 @@ public enum RileyLinkServiceState {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public boolean isError() {
|
||||
|
||||
return (this == RileyLinkServiceState.BluetoothError || //
|
||||
// this == RileyLinkServiceState.PumpConnectorError || //
|
||||
this == RileyLinkServiceState.RileyLinkError);
|
||||
|
|
|
@ -36,7 +36,6 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
|
||||
@Inject ActivePluginProvider activePlugin;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
//@Inject MedtronicUtil medtronicUtil;
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject RileyLinkServiceData rileyLinkServiceData;
|
||||
@Inject DateUtil dateUtil;
|
||||
|
@ -103,7 +102,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
|
||||
RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice;
|
||||
|
||||
this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId(targetDevice)));
|
||||
this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId()));
|
||||
|
||||
if (rileyLinkServiceData != null) {
|
||||
this.configuredAddress.setText(rileyLinkServiceData.rileylinkAddress);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<string name="rileylink_state_pc_tune_up">Tuning up RileyLink and Pump</string>
|
||||
<string name="rileylink_state_pc_error">Problem connecting to Pump</string>
|
||||
<string name="rileylink_state_connected">Connected</string>
|
||||
<string name="rileylink_state_rl_ready">RileyLink ready</string>
|
||||
|
||||
<!-- RL Errors -->
|
||||
<string name="rileylink_error_not_rl">Device is not RileyLink</string>
|
||||
|
|
Loading…
Reference in a new issue