RL: enum -> kt
This commit is contained in:
parent
9e29cbc2fe
commit
c9a039a8a6
8 changed files with 35 additions and 58 deletions
|
@ -177,7 +177,7 @@ class RileyLinkMedtronicService : RileyLinkService() {
|
||||||
medtronicPumpStatus.pumpFrequency = pumpFrequency
|
medtronicPumpStatus.pumpFrequency = pumpFrequency
|
||||||
val isFrequencyUS = pumpFrequency == frequencies[0]
|
val isFrequencyUS = pumpFrequency == frequencies[0]
|
||||||
val newTargetFrequency = if (isFrequencyUS) //
|
val newTargetFrequency = if (isFrequencyUS) //
|
||||||
RileyLinkTargetFrequency.Medtronic_US else RileyLinkTargetFrequency.Medtronic_WorldWide
|
RileyLinkTargetFrequency.MedtronicUS else RileyLinkTargetFrequency.MedtronicWorldWide
|
||||||
if (rileyLinkServiceData.rileyLinkTargetFrequency != newTargetFrequency) {
|
if (rileyLinkServiceData.rileyLinkTargetFrequency != newTargetFrequency) {
|
||||||
rileyLinkServiceData.rileyLinkTargetFrequency = newTargetFrequency
|
rileyLinkServiceData.rileyLinkTargetFrequency = newTargetFrequency
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class RFSpy {
|
||||||
aapsLogger.error(LTag.PUMPBTCOMM, "RileyLinkTargetFrequency: " + frequency);
|
aapsLogger.error(LTag.PUMPBTCOMM, "RileyLinkTargetFrequency: " + frequency);
|
||||||
|
|
||||||
switch (frequency) {
|
switch (frequency) {
|
||||||
case Medtronic_WorldWide:
|
case MedtronicWorldWide:
|
||||||
setRXFilterMode(RXFilterMode.Wide);
|
setRXFilterMode(RXFilterMode.Wide);
|
||||||
updateRegister(CC111XRegister.mdmcfg1, 0x62);
|
updateRegister(CC111XRegister.mdmcfg1, 0x62);
|
||||||
updateRegister(CC111XRegister.mdmcfg0, 0x1A);
|
updateRegister(CC111XRegister.mdmcfg0, 0x1A);
|
||||||
|
@ -317,7 +317,7 @@ public class RFSpy {
|
||||||
setMedtronicEncoding();
|
setMedtronicEncoding();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Medtronic_US:
|
case MedtronicUS:
|
||||||
setRXFilterMode(RXFilterMode.Narrow);
|
setRXFilterMode(RXFilterMode.Narrow);
|
||||||
updateRegister(CC111XRegister.mdmcfg1, 0x61);
|
updateRegister(CC111XRegister.mdmcfg1, 0x61);
|
||||||
updateRegister(CC111XRegister.mdmcfg0, 0x7E);
|
updateRegister(CC111XRegister.mdmcfg0, 0x7E);
|
||||||
|
@ -400,7 +400,7 @@ public class RFSpy {
|
||||||
|
|
||||||
private void setRXFilterMode(RXFilterMode mode) {
|
private void setRXFilterMode(RXFilterMode mode) {
|
||||||
byte drate_e = (byte) 0x9; // exponent of symbol rate (16kbps)
|
byte drate_e = (byte) 0x9; // exponent of symbol rate (16kbps)
|
||||||
byte chanbw = mode.value;
|
byte chanbw = mode.getValue();
|
||||||
|
|
||||||
updateRegister(CC111XRegister.mdmcfg4, (byte) (chanbw | drate_e));
|
updateRegister(CC111XRegister.mdmcfg4, (byte) (chanbw | drate_e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 5/6/18.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public enum RLMessageType {
|
|
||||||
PowerOn, // for powering on the pump (wakeup)
|
|
||||||
ReadSimpleData, // for checking if pump is readable (for Medtronic we can use GetModel)
|
|
||||||
}
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 5/6/18.
|
||||||
|
*/
|
||||||
|
enum class RLMessageType {
|
||||||
|
|
||||||
|
PowerOn, // for powering on the pump (wakeup)
|
||||||
|
ReadSimpleData // for checking if pump is readable (for Medtronic we can use GetModel)
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 21/05/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public enum RXFilterMode {
|
|
||||||
|
|
||||||
Wide(0x50), //
|
|
||||||
Narrow(0x90) //
|
|
||||||
;
|
|
||||||
|
|
||||||
public byte value;
|
|
||||||
|
|
||||||
|
|
||||||
RXFilterMode(int value) {
|
|
||||||
this.value = (byte)value;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 21/05/2018.
|
||||||
|
*/
|
||||||
|
enum class RXFilterMode(val value: Byte) {
|
||||||
|
|
||||||
|
Wide(0x50),
|
||||||
|
Narrow(0x90.toByte());
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by andy on 6/7/18.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public enum RileyLinkTargetFrequency {
|
|
||||||
|
|
||||||
Medtronic_WorldWide(868.25, 868.3, 868.35, 868.4, 868.45, 868.5, 868.55, 868.6, 868.65), //
|
|
||||||
Medtronic_US(916.45, 916.5, 916.55, 916.6, 916.65, 916.7, 916.75, 916.8), //
|
|
||||||
Omnipod(433.91), //
|
|
||||||
;
|
|
||||||
|
|
||||||
double[] frequencies;
|
|
||||||
|
|
||||||
|
|
||||||
RileyLinkTargetFrequency(double... frequencies) {
|
|
||||||
this.frequencies = frequencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public double[] getScanFrequencies() {
|
|
||||||
return frequencies;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 6/7/18.
|
||||||
|
*/
|
||||||
|
enum class RileyLinkTargetFrequency(vararg var scanFrequencies: Double) {
|
||||||
|
|
||||||
|
MedtronicWorldWide(868.25, 868.3, 868.35, 868.4, 868.45, 868.5, 868.55, 868.6, 868.65),
|
||||||
|
MedtronicUS(916.45, 916.5, 916.55, 916.6, 916.65, 916.7, 916.75, 916.8),
|
||||||
|
Omnipod(433.91);
|
||||||
|
}
|
Loading…
Reference in a new issue