- added Expose attribute to all varaiables in PodSessionState

- OmnipodUtil: Gson now uses only Expose fields
This commit is contained in:
Andy Rozman 2020-05-05 13:49:55 +01:00
parent 2de1761555
commit e51e3daeb1
4 changed files with 30 additions and 4 deletions

View file

@ -55,9 +55,9 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
@Inject public AAPSLogger aapsLogger; @Inject public AAPSLogger aapsLogger;
@Inject OmnipodPumpStatus omnipodPumpStatus; @Inject OmnipodPumpStatus omnipodPumpStatus;
@Inject OmnipodPumpPlugin omnipodPumpPlugin; //@Inject OmnipodPumpPlugin omnipodPumpPlugin;
@Inject RileyLinkServiceData rileyLinkServiceData; //@Inject RileyLinkServiceData rileyLinkServiceData;
@Inject ServiceTaskExecutor serviceTaskExecutor; //@Inject ServiceTaskExecutor serviceTaskExecutor;
public OmnipodCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { public OmnipodCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) {
super(injector, rfspy); super(injector, rfspy);

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.plugins.pump.omnipod.defs.state; package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
@ -37,22 +38,38 @@ public class PodSessionState extends PodState {
@Inject SP sp; @Inject SP sp;
@Inject OmnipodUtil omnipodUtil; @Inject OmnipodUtil omnipodUtil;
@Expose
private final Map<AlertSlot, AlertType> configuredAlerts; private final Map<AlertSlot, AlertType> configuredAlerts;
@Expose
private transient PodStateChangedHandler stateChangedHandler; private transient PodStateChangedHandler stateChangedHandler;
@Expose
private DateTime activatedAt; private DateTime activatedAt;
@Expose
private DateTime expiresAt; private DateTime expiresAt;
@Expose
private final FirmwareVersion piVersion; private final FirmwareVersion piVersion;
@Expose
private final FirmwareVersion pmVersion; private final FirmwareVersion pmVersion;
@Expose
private final int lot; private final int lot;
@Expose
private final int tid; private final int tid;
@Expose
private Double reservoirLevel; private Double reservoirLevel;
@Expose
private boolean suspended; private boolean suspended;
@Expose
private DateTimeZone timeZone; private DateTimeZone timeZone;
@Expose
private NonceState nonceState; private NonceState nonceState;
@Expose
private SetupProgress setupProgress; private SetupProgress setupProgress;
@Expose
private AlertSet activeAlerts; private AlertSet activeAlerts;
@Expose
private BasalSchedule basalSchedule; private BasalSchedule basalSchedule;
@Expose
private DeliveryStatus lastDeliveryStatus; private DeliveryStatus lastDeliveryStatus;
public PodSessionState(DateTimeZone timeZone, int address, FirmwareVersion piVersion, public PodSessionState(DateTimeZone timeZone, int address, FirmwareVersion piVersion,

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.defs.state;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
public abstract class PodState { public abstract class PodState {
protected final int address; protected final int address;

View file

@ -136,7 +136,7 @@ public class OmnipodUtil {
.registerTypeAdapter(DateTimeZone.class, (JsonDeserializer<DateTimeZone>) (json, typeOfT, context) -> .registerTypeAdapter(DateTimeZone.class, (JsonDeserializer<DateTimeZone>) (json, typeOfT, context) ->
DateTimeZone.forID(json.getAsString())); DateTimeZone.forID(json.getAsString()));
return gsonBuilder.create(); return gsonBuilder.excludeFieldsWithoutExposeAnnotation().create();
} }
@ -215,4 +215,12 @@ public class OmnipodUtil {
public void removeNextPodAddress() { public void removeNextPodAddress() {
sp.remove(OmnipodConst.Prefs.NextPodAddress); sp.remove(OmnipodConst.Prefs.NextPodAddress);
} }
public AAPSLogger getAapsLogger() {
return this.aapsLogger;
}
public SP getSp() {
return this.sp;
}
} }