- fixed endless loop
- status works correctly when RL is not present
This commit is contained in:
parent
bc6e4be3ad
commit
ec28f92223
|
@ -217,6 +217,8 @@ class OmnipodFragment : Fragment() {
|
||||||
|
|
||||||
val driverState = OmnipodUtil.getDriverState();
|
val driverState = OmnipodUtil.getDriverState();
|
||||||
|
|
||||||
|
LOG.info("getDriverState: [driverState={}]", driverState)
|
||||||
|
|
||||||
if (driverState == OmnipodDriverState.NotInitalized) {
|
if (driverState == OmnipodDriverState.NotInitalized) {
|
||||||
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
omnipod_pod_address.text = MainApp.gs(R.string.omnipod_pod_name_no_info)
|
||||||
omnipod_pod_expiry.text = "-"
|
omnipod_pod_expiry.text = "-"
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
boolean omnipodServiceRunning = false;
|
boolean omnipodServiceRunning = false;
|
||||||
|
|
||||||
private long nextPodCheck = 0L;
|
private long nextPodCheck = 0L;
|
||||||
OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
//OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
||||||
|
|
||||||
private OmnipodPumpPlugin() {
|
private OmnipodPumpPlugin() {
|
||||||
|
|
||||||
|
@ -124,11 +124,16 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
displayConnectionMessages = false;
|
displayConnectionMessages = false;
|
||||||
|
|
||||||
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
|
||||||
|
|
||||||
if (OmnipodUtil.isOmnipodEros()) {
|
|
||||||
OmnipodUtil.setPlugin(this);
|
// if (OmnipodUtil.isOmnipodEros()) {
|
||||||
}
|
// OmnipodUtil.setPlugin(this);
|
||||||
|
// OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TODO ccc
|
||||||
|
OmnipodUtil.setOmnipodPodType(OmnipodPodType.Eros);
|
||||||
|
OmnipodUtil.setPlugin(this);
|
||||||
|
|
||||||
serviceConnection = new ServiceConnection() {
|
serviceConnection = new ServiceConnection() {
|
||||||
|
|
||||||
|
@ -284,7 +289,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
private void doPodCheck() {
|
private void doPodCheck() {
|
||||||
|
|
||||||
if (System.currentTimeMillis() > this.nextPodCheck) {
|
if (System.currentTimeMillis() > this.nextPodCheck) {
|
||||||
if (!getPodPumpStatusObject().podAvailable && omnipodServiceRunning) {
|
if (OmnipodUtil.getDriverState()==OmnipodDriverState.Initalized_NoPod) {
|
||||||
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
|
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
|
||||||
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
|
@ -376,7 +381,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
if (isLoggingEnabled() && displayConnectionMessages)
|
if (isLoggingEnabled() && displayConnectionMessages)
|
||||||
LOG.debug(getLogPrefix() + "isConnected");
|
LOG.debug(getLogPrefix() + "isConnected");
|
||||||
return isServiceSet() && this.omnipodService.isInitialized() && isInitialized;
|
return isServiceSet() && omnipodService.isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,14 +389,22 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
public boolean isConnecting() {
|
public boolean isConnecting() {
|
||||||
if (isLoggingEnabled() && displayConnectionMessages)
|
if (isLoggingEnabled() && displayConnectionMessages)
|
||||||
LOG.debug(getLogPrefix() + "isConnecting");
|
LOG.debug(getLogPrefix() + "isConnecting");
|
||||||
return !isServiceSet() || (!omnipodService.isInitialized() || (!isInitialized));
|
return !isServiceSet() || !omnipodService.isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuspended() {
|
public boolean isSuspended() {
|
||||||
return (driverState == OmnipodDriverState.Initalized_NoPod) ||
|
|
||||||
|
return (OmnipodUtil.getDriverState() == OmnipodDriverState.Initalized_NoPod) ||
|
||||||
(OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
(OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
||||||
|
|
||||||
|
// return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable) ||
|
||||||
|
// (OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
||||||
|
//
|
||||||
|
// TODO ddd
|
||||||
|
// return (OmnipodUtil.getDriverState() == OmnipodDriverState.Initalized_NoPod) ||
|
||||||
|
// (OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
||||||
//
|
//
|
||||||
// return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable) ||
|
// return (pumpStatusLocal != null && !pumpStatusLocal.podAvailable) ||
|
||||||
// (OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
// (OmnipodUtil.getPodSessionState() != null && OmnipodUtil.getPodSessionState().isSuspended());
|
||||||
|
@ -491,7 +504,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDriverState(OmnipodDriverState state) {
|
public void setDriverState(OmnipodDriverState state) {
|
||||||
this.driverState = state;
|
//this.driverState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,7 +524,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
if (isLoggingEnabled())
|
if (isLoggingEnabled())
|
||||||
LOG.info(getLogPrefix() + "initializePump - start");
|
LOG.info(getLogPrefix() + "initializePump - start");
|
||||||
|
|
||||||
OmnipodPumpStatus podPumpStatus = getPodPumpStatusObject();
|
// TODO ccc
|
||||||
|
//OmnipodPumpStatus podPumpStatus = getPodPumpStatusObject();
|
||||||
|
|
||||||
setRefreshButtonEnabled(false);
|
setRefreshButtonEnabled(false);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
//private static PodDeviceState podDeviceState;
|
//private static PodDeviceState podDeviceState;
|
||||||
private static OmnipodPumpPluginInterface omnipodPumpPlugin;
|
private static OmnipodPumpPluginInterface omnipodPumpPlugin;
|
||||||
private static OmnipodPodType omnipodPodType;
|
private static OmnipodPodType omnipodPodType;
|
||||||
private static OmnipodDriverState driverState;
|
private static OmnipodDriverState driverState = OmnipodDriverState.NotInitalized;
|
||||||
|
|
||||||
public static Gson getGsonInstance() {
|
public static Gson getGsonInstance() {
|
||||||
return gsonInstance;
|
return gsonInstance;
|
||||||
|
@ -162,13 +162,13 @@ public class OmnipodUtil extends RileyLinkUtil {
|
||||||
OmnipodUtil.driverState = state;
|
OmnipodUtil.driverState = state;
|
||||||
|
|
||||||
// TODO maybe remove
|
// TODO maybe remove
|
||||||
if (OmnipodUtil.omnipodPumpStatus != null) {
|
// if (OmnipodUtil.omnipodPumpStatus != null) {
|
||||||
OmnipodUtil.omnipodPumpStatus.driverState = state;
|
// OmnipodUtil.omnipodPumpStatus.driverState = state;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (OmnipodUtil.omnipodPumpPlugin != null) {
|
// if (OmnipodUtil.omnipodPumpPlugin != null) {
|
||||||
OmnipodUtil.omnipodPumpPlugin.setDriverState(state);
|
// OmnipodUtil.omnipodPumpPlugin.setDriverState(state);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPumpStatus(OmnipodPumpStatus omnipodPumpStatus) {
|
public static void setPumpStatus(OmnipodPumpStatus omnipodPumpStatus) {
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
android:id="@+id/omnipod_queue"
|
android:id="@+id/omnipod_queue"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="content"
|
android:text=""
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|
Loading…
Reference in a new issue