RileyLinkServiceData resolve nullability
This commit is contained in:
parent
77e112471f
commit
23bdb57ed3
4 changed files with 15 additions and 20 deletions
|
@ -340,19 +340,15 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
medtronicPumpPlugin.rileyLinkService?.verifyConfiguration()
|
medtronicPumpPlugin.rileyLinkService?.verifyConfiguration()
|
||||||
binding.errors.text = medtronicPumpStatus.errorInfo
|
binding.errors.text = medtronicPumpStatus.errorInfo
|
||||||
|
|
||||||
val showRileyLinkBatteryLevel: Boolean = rileyLinkServiceData.showBatteryLevel
|
if (rileyLinkServiceData.showBatteryLevel) {
|
||||||
|
|
||||||
if (showRileyLinkBatteryLevel) {
|
|
||||||
binding.rlBatteryView.visibility = View.VISIBLE
|
binding.rlBatteryView.visibility = View.VISIBLE
|
||||||
binding.rlBatteryLabel.visibility = View.VISIBLE
|
binding.rlBatteryLabel.visibility = View.VISIBLE
|
||||||
binding.rlBatteryState.visibility = View.VISIBLE
|
binding.rlBatteryState.visibility = View.VISIBLE
|
||||||
binding.rlBatteryLayout.visibility = View.VISIBLE
|
binding.rlBatteryLayout.visibility = View.VISIBLE
|
||||||
binding.rlBatterySemicolon.visibility = View.VISIBLE
|
binding.rlBatterySemicolon.visibility = View.VISIBLE
|
||||||
if (rileyLinkServiceData.batteryLevel == null) {
|
binding.rlBatteryState.text =
|
||||||
binding.rlBatteryState.text = " ?"
|
if (rileyLinkServiceData.batteryLevel == null) " ?"
|
||||||
} else {
|
else "{fa-battery-${rileyLinkServiceData.batteryLevel!! / 25}} ${rileyLinkServiceData.batteryLevel}%"
|
||||||
binding.rlBatteryState.text = "{fa-battery-" + rileyLinkServiceData.batteryLevel / 25 + "} " + rileyLinkServiceData.batteryLevel + "%"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
binding.rlBatteryView.visibility = View.GONE
|
binding.rlBatteryView.visibility = View.GONE
|
||||||
binding.rlBatteryLabel.visibility = View.GONE
|
binding.rlBatteryLabel.visibility = View.GONE
|
||||||
|
|
|
@ -110,7 +110,7 @@ class RileyLinkBroadcastReceiver : DaggerBroadcastReceiver() {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): $bleVersion")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): $bleVersion")
|
||||||
rileyLinkService?.rileyLinkServiceData?.versionBLE113 = bleVersion
|
rileyLinkService?.rileyLinkServiceData?.versionBLE113 = bleVersion
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name)
|
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): ${rlVersion?.name}")
|
||||||
rileyLinkServiceData.firmwareVersion = rlVersion
|
rileyLinkServiceData.firmwareVersion = rlVersion
|
||||||
val task: ServiceTask = InitializePumpManagerTask(injector, context)
|
val task: ServiceTask = InitializePumpManagerTask(injector, context)
|
||||||
serviceTaskExecutor.startTask(task)
|
serviceTaskExecutor.startTask(task)
|
||||||
|
|
|
@ -31,27 +31,27 @@ public class RileyLinkServiceData {
|
||||||
@Inject RxBus rxBus;
|
@Inject RxBus rxBus;
|
||||||
|
|
||||||
boolean tuneUpDone = false;
|
boolean tuneUpDone = false;
|
||||||
public RileyLinkError rileyLinkError;
|
@Nullable public RileyLinkError rileyLinkError;
|
||||||
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
|
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
|
||||||
private long lastServiceStateChange = 0L;
|
private long lastServiceStateChange = 0L;
|
||||||
public RileyLinkFirmwareVersion firmwareVersion; // here we have "compatibility level" version
|
@Nullable public RileyLinkFirmwareVersion firmwareVersion; // here we have "compatibility level" version
|
||||||
@Nullable public RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
@Nullable public RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
||||||
@Nullable public String rileyLinkAddress;
|
@Nullable public String rileyLinkAddress;
|
||||||
@Nullable public String rileyLinkName;
|
@Nullable public String rileyLinkName;
|
||||||
public Integer batteryLevel;
|
@Nullable public Integer batteryLevel;
|
||||||
public boolean showBatteryLevel = false;
|
public boolean showBatteryLevel = false;
|
||||||
long lastTuneUpTime = 0L;
|
long lastTuneUpTime = 0L;
|
||||||
public Double lastGoodFrequency;
|
@Nullable public Double lastGoodFrequency;
|
||||||
|
|
||||||
// bt version
|
// bt version
|
||||||
public String versionBLE113;
|
@Nullable public String versionBLE113;
|
||||||
// radio version
|
// radio version
|
||||||
public String versionCC110;
|
@Nullable public String versionCC110;
|
||||||
|
|
||||||
// orangeLink
|
// orangeLink
|
||||||
public boolean isOrange;
|
public boolean isOrange = false;
|
||||||
public String versionOrangeFirmware;
|
@Nullable public String versionOrangeFirmware;
|
||||||
public String versionOrangeHardware;
|
@Nullable public String versionOrangeHardware;
|
||||||
|
|
||||||
public RileyLinkTargetDevice targetDevice;
|
public RileyLinkTargetDevice targetDevice;
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@ class InitializePumpManagerTask(injector: HasAndroidInjector, private val contex
|
||||||
lastGoodFrequency = sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0)
|
lastGoodFrequency = sp.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0)
|
||||||
lastGoodFrequency = (lastGoodFrequency * 1000.0).roundToLong() / 1000.0
|
lastGoodFrequency = (lastGoodFrequency * 1000.0).roundToLong() / 1000.0
|
||||||
rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency
|
rileyLinkServiceData.lastGoodFrequency = lastGoodFrequency
|
||||||
|
} else lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency ?: 0.0
|
||||||
} else lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency
|
|
||||||
|
|
||||||
val rileyLinkCommunicationManager = pumpDevice?.rileyLinkService?.deviceCommunicationManager
|
val rileyLinkCommunicationManager = pumpDevice?.rileyLinkService?.deviceCommunicationManager
|
||||||
if (activePlugin.activePump.manufacturer() === ManufacturerType.Medtronic) {
|
if (activePlugin.activePump.manufacturer() === ManufacturerType.Medtronic) {
|
||||||
|
|
Loading…
Reference in a new issue