reverting some formater changes

This commit is contained in:
Andy Rozman 2018-08-30 20:54:15 +01:00
parent 679b4b2668
commit bbffa703df

View file

@ -42,48 +42,16 @@ import info.nightscout.utils.SP;
* Created by mike on 05.08.2016. * Created by mike on 05.08.2016.
*/ */
public class VirtualPumpPlugin extends PluginBase implements PumpInterface { public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
private static Logger log = LoggerFactory.getLogger(VirtualPumpPlugin.class);
private static VirtualPumpPlugin plugin = null;
public static VirtualPumpPlugin getPlugin() {
loadFakingStatus();
if (plugin == null)
plugin = new VirtualPumpPlugin();
return plugin;
}
static Integer batteryPercent = 50; static Integer batteryPercent = 50;
static Integer reservoirInUnits = 50; static Integer reservoirInUnits = 50;
private static Logger log = LoggerFactory.getLogger(VirtualPumpPlugin.class);
private long lastDataTime = 0; private static VirtualPumpPlugin plugin = null;
private static boolean fromNSAreCommingFakedExtendedBoluses = false; private static boolean fromNSAreCommingFakedExtendedBoluses = false;
PumpType pumpType = null;
private long lastDataTime = 0;
private PumpDescription pumpDescription = new PumpDescription(); private PumpDescription pumpDescription = new PumpDescription();
PumpType pumpType = null;
private static void loadFakingStatus() {
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, false);
}
public static void setFakingStatus(boolean newStatus) {
fromNSAreCommingFakedExtendedBoluses = newStatus;
SP.putBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, fromNSAreCommingFakedExtendedBoluses);
}
public static boolean getFakingStatus() {
return fromNSAreCommingFakedExtendedBoluses;
}
public VirtualPumpPlugin() { public VirtualPumpPlugin() {
super(new PluginDescription() super(new PluginDescription()
.mainType(PluginType.PUMP) .mainType(PluginType.PUMP)
.fragmentClass(VirtualPumpFragment.class.getName()) .fragmentClass(VirtualPumpFragment.class.getName())
@ -123,9 +91,28 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
pumpDescription.is30minBasalRatesCapable = true; pumpDescription.is30minBasalRatesCapable = true;
} }
public static VirtualPumpPlugin getPlugin() {
loadFakingStatus();
if (plugin == null)
plugin = new VirtualPumpPlugin();
return plugin;
}
private static void loadFakingStatus() {
fromNSAreCommingFakedExtendedBoluses = SP.getBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, false);
}
public static boolean getFakingStatus() {
return fromNSAreCommingFakedExtendedBoluses;
}
public static void setFakingStatus(boolean newStatus) {
fromNSAreCommingFakedExtendedBoluses = newStatus;
SP.putBoolean(R.string.key_fromNSAreCommingFakedExtendedBoluses, fromNSAreCommingFakedExtendedBoluses);
}
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
MainApp.bus().register(this); MainApp.bus().register(this);
refreshConfiguration(); refreshConfiguration();
@ -133,20 +120,17 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
protected void onStop() { protected void onStop() {
MainApp.bus().unregister(this); MainApp.bus().unregister(this);
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventPreferenceChange s) { public void onStatusEvent(final EventPreferenceChange s) {
if (s.isChanged(R.string.key_virtualpump_type)) if (s.isChanged(R.string.key_virtualpump_type))
refreshConfiguration(); refreshConfiguration();
} }
@Override @Override
public boolean isFakingTempsByExtendedBoluses() { public boolean isFakingTempsByExtendedBoluses() {
return (Config.NSCLIENT) && fromNSAreCommingFakedExtendedBoluses; return (Config.NSCLIENT) && fromNSAreCommingFakedExtendedBoluses;
} }
@ -159,48 +143,40 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
return true; return true;
} }
@Override @Override
public boolean isSuspended() { public boolean isSuspended() {
return false; return false;
} }
@Override @Override
public boolean isBusy() { public boolean isBusy() {
return false; return false;
} }
@Override @Override
public boolean isConnected() { public boolean isConnected() {
return true; return true;
} }
@Override @Override
public boolean isConnecting() { public boolean isConnecting() {
return false; return false;
} }
@Override @Override
public boolean isHandshakeInProgress() { public boolean isHandshakeInProgress() {
return false; return false;
} }
@Override @Override
public void finishHandshaking() { public void finishHandshaking() {
} }
@Override @Override
public void connect(String reason) { public void connect(String reason) {
if (!Config.NSCLIENT) if (!Config.NSCLIENT)
NSUpload.uploadDeviceStatus(); NSUpload.uploadDeviceStatus();
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
@ -208,23 +184,19 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public void disconnect(String reason) { public void disconnect(String reason) {
} }
@Override @Override
public void stopConnecting() { public void stopConnecting() {
} }
@Override @Override
public void getPumpStatus() { public void getPumpStatus() {
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
} }
@Override @Override
public PumpEnactResult setNewBasalProfile(Profile profile) { public PumpEnactResult setNewBasalProfile(Profile profile) {
lastDataTime = System.currentTimeMillis(); lastDataTime = System.currentTimeMillis();
// Do nothing here. we are using MainApp.getConfigBuilder().getActiveProfile().getProfile(); // Do nothing here. we are using MainApp.getConfigBuilder().getActiveProfile().getProfile();
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
@ -236,19 +208,16 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public boolean isThisProfileSet(Profile profile) { public boolean isThisProfileSet(Profile profile) {
return true; return true;
} }
@Override @Override
public long lastDataTime() { public long lastDataTime() {
return lastDataTime; return lastDataTime;
} }
@Override @Override
public double getBaseBasalRate() { public double getBaseBasalRate() {
Profile profile = ProfileFunctions.getInstance().getProfile(); Profile profile = ProfileFunctions.getInstance().getProfile();
if (profile != null) if (profile != null)
return profile.getBasal(); return profile.getBasal();
@ -257,9 +226,6 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
} }
@Override @Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) { public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
@ -298,7 +264,6 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
@Override @Override
public void stopBolusDelivering() { public void stopBolusDelivering() {
} }
@Override @Override