This commit is contained in:
Milos Kozak 2021-01-08 14:20:31 +01:00
commit dac720e919
29 changed files with 246 additions and 239 deletions

View file

@ -25,6 +25,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.FabricPrivacy
@ -254,7 +255,7 @@ class ActionsFragment : DaggerFragment() {
val activeBgSource = activePlugin.activeBgSource
actions_historybrowser.visibility = (profile != null).toVisibility()
actions_fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized && !pump.isSuspended).toVisibility()
actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility()
actions_pumpbatterychange?.visibility = (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
actions_temptarget?.visibility = (profile != null && config.APS).toVisibility()
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()

View file

@ -37,7 +37,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

View file

@ -48,7 +48,6 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
import info.nightscout.androidaps.queue.commands.CustomCommand;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
@ -86,6 +85,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPu
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
import info.nightscout.androidaps.queue.commands.CustomCommand;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.TimeChangeType;
@ -327,11 +327,10 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
}
@Override public RileyLinkPumpInfo getPumpInfo() {
String pumpDescription = pumpType.getDescription();
String frequency = resourceHelper.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide);
String model = medtronicPumpStatus.medtronicDeviceType == null ? "???" : "Medtronic " + medtronicPumpStatus.medtronicDeviceType.getPumpModel();
String serialNumber = medtronicPumpStatus.serialNumber;
return new RileyLinkPumpInfo(pumpDescription, frequency, model, serialNumber);
return new RileyLinkPumpInfo(frequency, model, serialNumber);
}
@Override public long getLastConnectionTimeMillis() {

View file

@ -15,7 +15,6 @@
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
<string name="key_medtronic_battery_type" translatable="false">pref_medtronic_battery_type</string>
<string name="key_medtronic_bolus_debug" translatable="false">pref_medtronic_bolus_debug</string>
<string name="key_rileylink_mac_address" translatable="false">pref_rileylink_mac_address</string>
<string name="key_medtronic_pump_frequency_us_ca" translatable="false">medtronic_pump_frequency_us_ca</string>
<string name="key_medtronic_pump_frequency_worldwide" translatable="false">medtronic_pump_frequency_worldwide</string>
<string name="key_medtronic_pump_encoding_4b6b_local" translatable="false">medtronic_pump_encoding_4b6b_local</string>

View file

@ -98,6 +98,12 @@
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_riley_link_show_battery_level"
android:summary="@string/riley_link_show_battery_level_summary"
android:title="@string/riley_link_show_battery_level" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_set_neutral_temps"

View file

@ -318,7 +318,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.USE_RILEY_LINK_BATTERY_LEVEL) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.SHOW_RILEY_LINK_BATTERY_LEVEL) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.BATTERY_CHANGE_LOGGING_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED) ||
event.isChanged(getResourceHelper(), OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED) ||
@ -520,11 +521,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
}
@Override public RileyLinkPumpInfo getPumpInfo() {
String pumpDescription = "Eros";
String frequency = resourceHelper.gs(R.string.omnipod_frequency);
String connectedModel = podStateManager.isPodInitialized() ? "Eros Pod" : "-";
String connectedModel = "Eros";
String serialNumber = podStateManager.isPodInitialized() ? String.valueOf(podStateManager.getAddress()) : "-";
return new RileyLinkPumpInfo(pumpDescription, frequency, connectedModel, serialNumber);
return new RileyLinkPumpInfo(frequency, connectedModel, serialNumber);
}
// Required by RileyLinkPumpDevice interface.
@ -625,9 +625,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
@Override
public int getBatteryLevel() {
if (aapsOmnipodManager.isUseRileyLinkBatteryLevel()) {
Integer batteryLevel = omnipodRileyLinkCommunicationManager.getBatteryLevel();
return batteryLevel == null ? 0 : batteryLevel;
if (aapsOmnipodManager.isShowRileyLinkBatteryLevel()) {
return Optional.ofNullable(rileyLinkServiceData.batteryLevel).orElse(0);
}
return 0;
@ -1060,7 +1059,11 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
}
public boolean isUseRileyLinkBatteryLevel() {
return aapsOmnipodManager.isUseRileyLinkBatteryLevel();
return aapsOmnipodManager.isShowRileyLinkBatteryLevel();
}
public boolean isBatteryChangeLoggingEnabled() {
return aapsOmnipodManager.isBatteryChangeLoggingEnabled();
}
private void initializeAfterRileyLinkConnection() {

View file

@ -22,7 +22,8 @@ public class OmnipodStorageKeys {
public static final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled;
public static final int AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED = R.string.key_omnipod_automatically_acknowledge_alerts_enabled;
public static final int RILEY_LINK_STATS_BUTTON_ENABLED = R.string.key_omnipod_riley_link_stats_button_enabled;
public static final int USE_RILEY_LINK_BATTERY_LEVEL = R.string.key_omnipod_use_riley_link_battery_level;
public static final int SHOW_RILEY_LINK_BATTERY_LEVEL = R.string.key_riley_link_show_battery_level;
public static final int BATTERY_CHANGE_LOGGING_ENABLED = R.string.key_omnipod_battery_change_logging_enabled;
}
public static class Statistics {

View file

@ -121,7 +121,8 @@ public class AapsOmnipodManager {
private boolean notificationUncertainBolusSoundEnabled;
private boolean automaticallyAcknowledgeAlertsEnabled;
private boolean rileylinkStatsButtonEnabled;
private boolean useRileyLinkBatteryLevel;
private boolean showRileyLinkBatteryLevel;
private boolean batteryChangeLoggingEnabled;
@Inject
public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService,
@ -166,7 +167,8 @@ public class AapsOmnipodManager {
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false);
rileylinkStatsButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED, false);
useRileyLinkBatteryLevel = sp.getBoolean(OmnipodStorageKeys.Preferences.USE_RILEY_LINK_BATTERY_LEVEL, false);
showRileyLinkBatteryLevel = sp.getBoolean(OmnipodStorageKeys.Preferences.SHOW_RILEY_LINK_BATTERY_LEVEL, false);
batteryChangeLoggingEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.BATTERY_CHANGE_LOGGING_ENABLED, false);
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, false);
notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED, true);
@ -669,8 +671,12 @@ public class AapsOmnipodManager {
return rileylinkStatsButtonEnabled;
}
public boolean isUseRileyLinkBatteryLevel() {
return useRileyLinkBatteryLevel;
public boolean isShowRileyLinkBatteryLevel() {
return showRileyLinkBatteryLevel;
}
public boolean isBatteryChangeLoggingEnabled() {
return batteryChangeLoggingEnabled;
}
public boolean isTimeChangeEventEnabled() {

View file

@ -8,7 +8,6 @@ import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
@ -16,7 +15,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLink
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.OmnipodAction;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.MessageBlock;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.OmnipodMessage;
@ -52,7 +50,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateMa
*/
@Singleton
public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunicationManager<OmnipodPacket> {
private Integer batteryLevel;
// This empty constructor must be kept, otherwise dagger injection might break!
@Inject
@ -86,18 +83,7 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
}
@Override protected OmnipodPacket sendAndListen(OmnipodPacket msg, int timeout_ms, int repeatCount, int retryCount, Integer extendPreamble_ms) throws RileyLinkCommunicationException {
OmnipodPacket response = super.sendAndListen(msg, timeout_ms, repeatCount, retryCount, extendPreamble_ms);
PumpInterface activePump = activePluginProvider.getActivePump();
if (activePump instanceof OmnipodPumpPlugin && ((OmnipodPumpPlugin) activePump).isUseRileyLinkBatteryLevel()) {
updateBatteryLevel();
}
return response;
}
public Integer getBatteryLevel() {
return batteryLevel;
return super.sendAndListen(msg, timeout_ms, repeatCount, retryCount, extendPreamble_ms);
}
public <T extends MessageBlock> T sendCommand(Class<T> responseClass, PodStateManager podStateManager, MessageBlock command) {
@ -402,8 +388,4 @@ public class OmnipodRileyLinkCommunicationManager extends RileyLinkCommunication
throw new RileyLinkUnreachableException();
}
private void updateBatteryLevel() {
batteryLevel = rfspy.getBatteryLevel();
}
}

View file

@ -11,7 +11,7 @@
<string name="key_omnipod_suspend_delivery_button_enabled" translatable="false">AAPS.Omnipod.suspend_delivery_button_enabled</string>
<string name="key_omnipod_pulse_log_button_enabled" translatable="false">AAPS.Omnipod.pulse_log_button_enabled</string>
<string name="key_omnipod_riley_link_stats_button_enabled" translatable="false">AAPS.Omnipod.rileylink_stats_button_enabled</string>
<string name="key_omnipod_use_riley_link_battery_level" translatable="false">AAPS.Omnipod.use_riley_link_battery_level</string>
<string name="key_omnipod_battery_change_logging_enabled" translatable="false">AAPS.Omnipod.enable_battery_change_logging</string>
<string name="key_omnipod_time_change_event_enabled" translatable="false">AAPS.Omnipod.time_change_enabled</string>
<string name="key_omnipod_expiration_reminder_enabled" translatable="false">AAPS.Omnipod.expiration_reminder_enabled</string>
<string name="key_omnipod_expiration_reminder_hours_before_shutdown" translatable="false">AAPS.Omnipod.expiration_reminder_hours_before_shutdown</string>
@ -45,8 +45,7 @@
<string name="omnipod_config_suspend_delivery_button_enabled">Show Suspend Delivery button in Omnipod tab</string>
<string name="omnipod_config_pulse_log_button_enabled">Show Pulse Log button in Pod Management menu</string>
<string name="omnipod_config_rileylink_stats_button_enabled">Show RileyLink Stats button in Pod Management menu</string>
<string name="omnipod_config_use_riley_link_battery_level">Use battery level reported by OrangeLink/EmaLink</string>
<string name="omnipod_config_use_riley_link_battery_level_summary">DOES NOT work with the original RileyLink. May not work with other RileyLink alternatives.</string>
<string name="omnipod_config_battery_change_logging_enabled">Enable battery change logging in Actions</string>
<string name="omnipod_config_time_change_enabled">DST/Time zone detection enabled</string>
<string name="omnipod_config_expiration_reminder_enabled">Expiration reminder enabled</string>
<string name="omnipod_config_expiration_reminder_hours_before_shutdown">Hours before shutdown</string>

View file

@ -11,6 +11,18 @@
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_riley_link_show_battery_level"
android:summary="@string/riley_link_show_battery_level_summary"
android:title="@string/riley_link_show_battery_level" />
<SwitchPreference
android:defaultValue="false"
android:dependency="@string/key_riley_link_show_battery_level"
android:key="@string/key_omnipod_battery_change_logging_enabled"
android:title="@string/omnipod_config_battery_change_logging_enabled" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/omnipod_preference_category_confirmation_beeps">
@ -114,12 +126,6 @@
android:key="@string/key_omnipod_riley_link_stats_button_enabled"
android:title="@string/omnipod_config_rileylink_stats_button_enabled" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_omnipod_use_riley_link_battery_level"
android:summary="@string/omnipod_config_use_riley_link_battery_level_summary"
android:title="@string/omnipod_config_use_riley_link_battery_level" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_time_change_event_enabled"

View file

@ -18,7 +18,6 @@ import javax.inject.Singleton;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.encoding.Encoding4b6b;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.encoding.Encoding4b6bGeoff;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.BleAdvertisedData;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceResult;

View file

@ -2,14 +2,17 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble;
import android.os.SystemClock;
import java.util.Optional;
import java.util.UUID;
import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
@ -40,12 +43,16 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
*/
@Singleton
public class RFSpy {
private static final long DEFAULT_BATTERY_CHECK_INTERVAL_MILLIS = 30 * 60 * 1_000; // 30 minutes;
private static final long LOW_BATTERY_BATTERY_CHECK_INTERVAL_MILLIS = 10 * 60 * 1_000; // 10 minutes;
private static final int LOW_BATTERY_PERCENTAGE_THRESHOLD = 20;
@Inject AAPSLogger aapsLogger;
@Inject ResourceHelper resourceHelper;
@Inject SP sp;
@Inject RileyLinkServiceData rileyLinkServiceData;
@Inject RileyLinkUtil rileyLinkUtil;
@Inject RxBusWrapper rxBus;
private final HasAndroidInjector injector;
@ -59,11 +66,9 @@ public class RFSpy {
private final UUID radioVersionUUID = UUID.fromString(GattAttributes.CHARA_RADIO_VERSION);
private final UUID batteryServiceUUID = UUID.fromString(GattAttributes.SERVICE_BATTERY);
private final UUID batteryLevelUUID = UUID.fromString(GattAttributes.CHARA_BATTERY_UNK);
//private UUID responseCountUUID = UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT);
private RileyLinkFirmwareVersion firmwareVersion;
private String bleVersion; // We don't use it so no need of sofisticated logic
private Double currentFrequencyMHz;
private long nextBatteryCheck = 0;
@Inject
public RFSpy(HasAndroidInjector injector, RileyLinkBLE rileyLinkBle) {
@ -77,17 +82,10 @@ public class RFSpy {
reader = new RFSpyReader(aapsLogger, rileyLinkBle);
}
public RileyLinkFirmwareVersion getRLVersionCached() {
return firmwareVersion;
}
public String getBLEVersionCached() {
return bleVersion;
}
// Call this after the RL services are discovered.
// Starts an async task to read when data is available
public void startReader() {
@ -95,7 +93,6 @@ public class RFSpy {
reader.start();
}
// Here should go generic RL initialisation + protocol adjustments depending on
// firmware version
public void initializeRileyLink() {
@ -105,14 +102,13 @@ public class RFSpy {
rileyLinkServiceData.firmwareVersion = getFirmwareVersion(aapsLogger, bleVersion, cc1110Version);
}
// Call this from the "response count" notification handler.
private void newDataIsAvailable() {
// pass the message to the reader (which should be internal to RFSpy)
reader.newDataIsAvailable();
}
public Integer getBatteryLevel() {
public Integer retrieveBatteryLevel() {
BLECommOperationResult result = rileyLinkBle.readCharacteristic_blocking(batteryServiceUUID, batteryLevelUUID);
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
int value = result.value[0];
@ -124,7 +120,6 @@ public class RFSpy {
}
}
// This gets the version from the BLE113, not from the CC1110.
// I.e., this gets the version from the BLE interface, not from the radio.
public String getVersion() {
@ -208,14 +203,12 @@ public class RFSpy {
aapsLogger.error(LTag.PUMPBTCOMM, "BLE Write operation failed, code=" + writeCheck.resultCode);
return null; // will be a null (invalid) response
}
SystemClock.sleep(100);
// Log.i(TAG,ThreadUtil.sig()+String.format(" writeToData:(timeout %d) %s",(responseTimeout_ms),ByteUtil.shortHexString(prepended)));
byte[] rawResponse = reader.poll(responseTimeout_ms);
return rawResponse;
return reader.poll(responseTimeout_ms);
}
// The caller has to know how long the RFSpy will be busy with what was sent to it.
private RFSpyResponse writeToData(RileyLinkCommand command, int responseTimeout_ms) {
@ -236,55 +229,26 @@ public class RFSpy {
resetNotConnectedCount();
} else {
if (resp.looksLikeRadioPacket()) {
// RadioResponse radioResp = resp.getRadioResponse();
// byte[] responsePayload = radioResp.getPayload();
aapsLogger.debug(LTag.PUMPBTCOMM, "writeToData: received radio response. Will decode at upper level");
resetNotConnectedCount();
}
// Log.i(TAG, "writeToData: raw response is " + ByteUtil.shortHexString(rawResponse));
}
return resp;
}
private void resetNotConnectedCount() {
this.notConnectedCount = 0;
}
private byte[] getByteArray(byte... input) {
return input;
}
private byte[] getCommandArray(RileyLinkCommandType command, byte[] body) {
int bodyLength = body == null ? 0 : body.length;
byte[] output = new byte[bodyLength + 1];
output[0] = command.code;
if (body != null) {
for (int i = 0; i < body.length; i++) {
output[i + 1] = body[i];
}
}
return output;
}
public RFSpyResponse transmitThenReceive(RadioPacket pkt, byte sendChannel, byte repeatCount, byte delay_ms,
byte listenChannel, int timeout_ms, byte retryCount) {
return transmitThenReceive(pkt, sendChannel, repeatCount, delay_ms, listenChannel, timeout_ms, retryCount, null);
}
public RFSpyResponse transmitThenReceive(RadioPacket pkt, int timeout_ms) {
return transmitThenReceive(pkt, (byte) 0, (byte) 0, (byte) 0, (byte) 0, timeout_ms, (byte) 0);
}
public RFSpyResponse transmitThenReceive(RadioPacket pkt, byte sendChannel, byte repeatCount, byte delay_ms,
byte listenChannel, int timeout_ms, byte retryCount, Integer extendPreamble_ms) {
@ -294,16 +258,29 @@ public class RFSpy {
SendAndListen command = new SendAndListen(injector, sendChannel, repeatCount, delay_ms, listenChannel, timeout_ms,
retryCount, extendPreamble_ms, pkt);
return writeToData(command, sendDelay + receiveDelay + EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
RFSpyResponse rfSpyResponse = writeToData(command, sendDelay + receiveDelay + EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
if (System.currentTimeMillis() >= nextBatteryCheck) {
updateBatteryLevel();
}
return rfSpyResponse;
}
private void updateBatteryLevel() {
rileyLinkServiceData.batteryLevel = retrieveBatteryLevel();
nextBatteryCheck = System.currentTimeMillis() +
(Optional.ofNullable(rileyLinkServiceData.batteryLevel).orElse(0) <= LOW_BATTERY_PERCENTAGE_THRESHOLD ? LOW_BATTERY_BATTERY_CHECK_INTERVAL_MILLIS : DEFAULT_BATTERY_CHECK_INTERVAL_MILLIS);
// The Omnipod plugin reports the RL battery as the pump battery (as the Omnipod battery level is unknown)
// So update overview when the battery level has been updated
rxBus.send(new EventRefreshOverview("RL battery level updated", false));
}
private RFSpyResponse updateRegister(CC111XRegister reg, int val) {
RFSpyResponse resp = writeToData(new UpdateRegister(reg, (byte) val), EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
return resp;
return writeToData(new UpdateRegister(reg, (byte) val), EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
}
public void setBaseFrequency(double freqMHz) {
int value = (int) (freqMHz * 1000000 / ((double) (RILEYLINK_FREQ_XTAL) / Math.pow(2.0, 16.0)));
updateRegister(CC111XRegister.freq0, (byte) (value & 0xff));
@ -316,69 +293,56 @@ public class RFSpy {
configureRadioForRegion(rileyLinkServiceData.rileyLinkTargetFrequency);
}
private void configureRadioForRegion(RileyLinkTargetFrequency frequency) {
// we update registers only on first run, or if region changed
aapsLogger.error(LTag.PUMPBTCOMM, "RileyLinkTargetFrequency: " + frequency);
switch (frequency) {
case Medtronic_WorldWide: {
// updateRegister(CC111X_MDMCFG4, (byte) 0x59);
case Medtronic_WorldWide:
setRXFilterMode(RXFilterMode.Wide);
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
updateRegister(CC111XRegister.mdmcfg1, 0x62);
updateRegister(CC111XRegister.mdmcfg0, 0x1A);
updateRegister(CC111XRegister.deviatn, 0x13);
setMedtronicEncoding();
}
break;
break;
case Medtronic_US: {
// updateRegister(CC111X_MDMCFG4, (byte) 0x99);
case Medtronic_US:
setRXFilterMode(RXFilterMode.Narrow);
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
updateRegister(CC111XRegister.mdmcfg1, 0x61);
updateRegister(CC111XRegister.mdmcfg0, 0x7E);
updateRegister(CC111XRegister.deviatn, 0x15);
setMedtronicEncoding();
}
break;
break;
case Omnipod: {
RFSpyResponse r = null;
case Omnipod:
// RL initialization for Omnipod is a copy/paste from OmniKit implementation.
// Last commit from original repository: 5c3beb4144
// so if something is terribly wrong, please check git diff PodCommsSession.swift since that commit
r = updateRegister(CC111XRegister.pktctrl1, 0x20);
r = updateRegister(CC111XRegister.agcctrl0, 0x00);
r = updateRegister(CC111XRegister.fsctrl1, 0x06);
r = updateRegister(CC111XRegister.mdmcfg4, 0xCA);
r = updateRegister(CC111XRegister.mdmcfg3, 0xBC);
r = updateRegister(CC111XRegister.mdmcfg2, 0x06);
r = updateRegister(CC111XRegister.mdmcfg1, 0x70);
r = updateRegister(CC111XRegister.mdmcfg0, 0x11);
r = updateRegister(CC111XRegister.deviatn, 0x44);
r = updateRegister(CC111XRegister.mcsm0, 0x18);
r = updateRegister(CC111XRegister.foccfg, 0x17);
r = updateRegister(CC111XRegister.fscal3, 0xE9);
r = updateRegister(CC111XRegister.fscal2, 0x2A);
r = updateRegister(CC111XRegister.fscal1, 0x00);
r = updateRegister(CC111XRegister.fscal0, 0x1F);
updateRegister(CC111XRegister.pktctrl1, 0x20);
updateRegister(CC111XRegister.agcctrl0, 0x00);
updateRegister(CC111XRegister.fsctrl1, 0x06);
updateRegister(CC111XRegister.mdmcfg4, 0xCA);
updateRegister(CC111XRegister.mdmcfg3, 0xBC);
updateRegister(CC111XRegister.mdmcfg2, 0x06);
updateRegister(CC111XRegister.mdmcfg1, 0x70);
updateRegister(CC111XRegister.mdmcfg0, 0x11);
updateRegister(CC111XRegister.deviatn, 0x44);
updateRegister(CC111XRegister.mcsm0, 0x18);
updateRegister(CC111XRegister.foccfg, 0x17);
updateRegister(CC111XRegister.fscal3, 0xE9);
updateRegister(CC111XRegister.fscal2, 0x2A);
updateRegister(CC111XRegister.fscal1, 0x00);
updateRegister(CC111XRegister.fscal0, 0x1F);
r = updateRegister(CC111XRegister.test1, 0x31);
r = updateRegister(CC111XRegister.test0, 0x09);
r = updateRegister(CC111XRegister.paTable0, 0x84);
r = updateRegister(CC111XRegister.sync1, 0xA5);
r = updateRegister(CC111XRegister.sync0, 0x5A);
updateRegister(CC111XRegister.test1, 0x31);
updateRegister(CC111XRegister.test0, 0x09);
updateRegister(CC111XRegister.paTable0, 0x84);
updateRegister(CC111XRegister.sync1, 0xA5);
updateRegister(CC111XRegister.sync0, 0x5A);
r = setRileyLinkEncoding(RileyLinkEncodingType.Manchester);
r = setPreamble(0x6665);
}
break;
setRileyLinkEncoding(RileyLinkEncodingType.Manchester);
setPreamble(0x6665);
break;
default:
aapsLogger.warn(LTag.PUMPBTCOMM, "No region configuration for RfSpy and {}", frequency.name());
break;
@ -386,7 +350,6 @@ public class RFSpy {
}
}
private void setMedtronicEncoding() {
RileyLinkEncodingType encoding = RileyLinkEncodingType.FourByteSixByteLocal;
@ -403,7 +366,6 @@ public class RFSpy {
aapsLogger.debug(LTag.PUMPBTCOMM, "Set Encoding for Medtronic: " + encoding.name());
}
private RFSpyResponse setPreamble(int preamble) {
RFSpyResponse resp = null;
try {
@ -414,7 +376,6 @@ public class RFSpy {
return resp;
}
public RFSpyResponse setRileyLinkEncoding(RileyLinkEncodingType encoding) {
RFSpyResponse resp = writeToData(new SetHardwareEncoding(encoding), EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
@ -426,9 +387,7 @@ public class RFSpy {
return resp;
}
private void setRXFilterMode(RXFilterMode mode) {
byte drate_e = (byte) 0x9; // exponent of symbol rate (16kbps)
byte chanbw = mode.value;
@ -442,9 +401,4 @@ public class RFSpy {
if (this.currentFrequencyMHz != null)
this.setBaseFrequency(this.currentFrequencyMHz);
}
public void stopReader() {
reader.stop();
}
}

View file

@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command;
import java.nio.ByteBuffer;
import org.apache.commons.lang3.NotImplementedException;
import java.nio.ByteBuffer;
import javax.inject.Inject;
import dagger.android.HasAndroidInjector;

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.encoding;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError;

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.encoding;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
import java.util.HashMap;
import java.util.Map;
import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.utils.resources.ResourceHelper;

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations;
import android.bluetooth.BluetoothGatt;
import java.util.UUID;
import java.util.concurrent.Semaphore;
import android.bluetooth.BluetoothGatt;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
/**

View file

@ -1,13 +1,11 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs;
public class RileyLinkPumpInfo {
private final String connectedDeviceModel;
private final String pumpDescription;
private final String connectedDeviceSerialNumber;
private final String pumpFrequency;
private final String connectedDeviceModel;
private final String connectedDeviceSerialNumber;
public RileyLinkPumpInfo(String pumpDescription, String pumpFrequency, String connectedDeviceModel, String connectedDeviceSerialNumber) {
this.pumpDescription = pumpDescription;
public RileyLinkPumpInfo(String pumpFrequency, String connectedDeviceModel, String connectedDeviceSerialNumber) {
this.pumpFrequency = pumpFrequency;
this.connectedDeviceModel = connectedDeviceModel;
this.connectedDeviceSerialNumber = connectedDeviceSerialNumber;
@ -17,10 +15,6 @@ public class RileyLinkPumpInfo {
return connectedDeviceModel;
}
public String getPumpDescription() {
return pumpDescription;
}
public String getConnectedDeviceSerialNumber() {
return connectedDeviceSerialNumber;
}

View file

@ -9,8 +9,7 @@ import info.nightscout.androidaps.plugins.pump.common.R;
public enum RileyLinkTargetDevice {
MedtronicPump(R.string.rileylink_target_device_medtronic, true), //
Omnipod(R.string.rileylink_target_device_omnipod, false), //
;
Omnipod(R.string.rileylink_target_device_omnipod, false);
private final int resourceId;
private final boolean tuneUpEnabled;

View file

@ -1,11 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -14,6 +9,11 @@ import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;

View file

@ -6,10 +6,9 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.LocalDateTime;
import java.util.Locale;
import java.util.Optional;
import javax.inject.Inject;
@ -18,6 +17,7 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/**
* Created by andy on 5/19/18.
@ -39,14 +40,18 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
@Inject AAPSLogger aapsLogger;
@Inject RileyLinkServiceData rileyLinkServiceData;
@Inject DateUtil dateUtil;
@Inject SP sp;
private TextView connectionStatus;
private TextView configuredRileyLinkAddress;
private TextView configuredRileyLinkName;
private TextView connectedDevice;
private View batteryLevelRow;
private TextView batteryLevel;
private TextView connectionError;
private View connectedDeviceDetails;
private TextView deviceType;
private TextView deviceModel;
private TextView configuredDeviceModel;
private TextView connectedDeviceModel;
private TextView serialNumber;
private TextView pumpFrequency;
private TextView lastUsedFrequency;
@ -59,16 +64,19 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
}
@Override
public void onStart() {
super.onStart();
public void onResume() {
super.onResume();
this.connectionStatus = getActivity().findViewById(R.id.rls_t1_connection_status);
this.configuredRileyLinkAddress = getActivity().findViewById(R.id.rls_t1_configured_riley_link_address);
this.configuredRileyLinkName = getActivity().findViewById(R.id.rls_t1_configured_riley_link_name);
this.connectedDevice = getActivity().findViewById(R.id.rls_t1_connected_device);
this.batteryLevelRow = getActivity().findViewById(R.id.rls_t1_battery_level_row);
this.batteryLevel = getActivity().findViewById(R.id.rls_t1_battery_level);
this.connectionError = getActivity().findViewById(R.id.rls_t1_connection_error);
this.connectedDeviceDetails = getActivity().findViewById(R.id.rls_t1_connected_device_details);
this.deviceType = getActivity().findViewById(R.id.rls_t1_device_type);
this.deviceModel = getActivity().findViewById(R.id.rls_t1_device_model);
this.configuredDeviceModel = getActivity().findViewById(R.id.rls_t1_configured_device_model);
this.connectedDeviceModel = getActivity().findViewById(R.id.rls_t1_connected_device_model);
this.serialNumber = getActivity().findViewById(R.id.rls_t1_serial_number);
this.pumpFrequency = getActivity().findViewById(R.id.rls_t1_pump_frequency);
this.lastUsedFrequency = getActivity().findViewById(R.id.rls_t1_last_used_frequency);
@ -85,34 +93,42 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
// BS FIXME rileyLinkServiceData is injected so I suppose it cannot be null?
if (rileyLinkServiceData != null) {
this.configuredRileyLinkAddress.setText(StringUtils.isEmpty(rileyLinkServiceData.rileyLinkAddress) ? PLACEHOLDER : rileyLinkServiceData.rileyLinkAddress);
this.configuredRileyLinkName.setText(StringUtils.isEmpty(rileyLinkServiceData.rileyLinkName) ? PLACEHOLDER : rileyLinkServiceData.rileyLinkName);
this.connectionError.setText(rileyLinkServiceData.rileyLinkError == null ? //
PLACEHOLDER
: resourceHelper.gs(rileyLinkServiceData.rileyLinkError.getResourceId(targetDevice)));
this.configuredRileyLinkAddress.setText(Optional.ofNullable(rileyLinkServiceData.rileyLinkAddress).orElse(PLACEHOLDER));
this.configuredRileyLinkName.setText(Optional.ofNullable(rileyLinkServiceData.rileyLinkName).orElse(PLACEHOLDER));
if (firmwareVersion == null) {
this.firmwareVersion.setText("BLE113: " + PLACEHOLDER + "\nCC110: " + PLACEHOLDER);
if (sp.getBoolean(resourceHelper.gs(R.string.key_riley_link_show_battery_level), false)) {
batteryLevelRow.setVisibility(View.VISIBLE);
Integer batteryLevel = rileyLinkServiceData.batteryLevel;
this.batteryLevel.setText(batteryLevel == null ? PLACEHOLDER : resourceHelper.gs(R.string.rileylink_battery_level_value, batteryLevel));
} else {
this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 +
"\nCC110: " + rileyLinkServiceData.versionCC110);
batteryLevelRow.setVisibility(View.GONE);
}
RileyLinkError rileyLinkError = rileyLinkServiceData.rileyLinkError;
this.connectionError.setText(rileyLinkError == null ? PLACEHOLDER : resourceHelper.gs(rileyLinkError.getResourceId(targetDevice)));
this.firmwareVersion.setText(resourceHelper.gs(R.string.rileylink_firmware_version_value,
Optional.ofNullable(rileyLinkServiceData.versionBLE113).orElse(PLACEHOLDER), Optional.ofNullable(rileyLinkServiceData.versionCC110).orElse(PLACEHOLDER)));
}
RileyLinkPumpDevice pumpPlugin = (RileyLinkPumpDevice) activePlugin.getActivePump();
RileyLinkPumpInfo pumpInfo = pumpPlugin.getPumpInfo();
this.deviceType.setText(rileyLinkServiceData.targetDevice.getResourceId());
this.deviceModel.setText(pumpInfo.getPumpDescription());
this.serialNumber.setText(pumpInfo.getConnectedDeviceSerialNumber());
this.pumpFrequency.setText(pumpInfo.getPumpFrequency());
this.connectedDevice.setText(pumpInfo.getConnectedDeviceModel());
RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
RileyLinkPumpInfo rileyLinkPumpInfo = rileyLinkPumpDevice.getPumpInfo();
this.deviceType.setText(targetDevice.getResourceId());
if (targetDevice == RileyLinkTargetDevice.MedtronicPump) {
this.connectedDeviceDetails.setVisibility(View.VISIBLE);
this.configuredDeviceModel.setText(activePlugin.getActivePump().getPumpDescription().pumpType.getDescription());
this.connectedDeviceModel.setText(rileyLinkPumpInfo.getConnectedDeviceModel());
} else {
this.connectedDeviceDetails.setVisibility(View.GONE);
}
this.serialNumber.setText(rileyLinkPumpInfo.getConnectedDeviceSerialNumber());
this.pumpFrequency.setText(rileyLinkPumpInfo.getPumpFrequency());
if (rileyLinkServiceData.lastGoodFrequency != null) {
this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz",
rileyLinkServiceData.lastGoodFrequency));
this.lastUsedFrequency.setText(resourceHelper.gs(R.string.rileylink_pump_frequency_value, rileyLinkServiceData.lastGoodFrequency));
}
long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis();
long lastConnectionTimeMillis = rileyLinkPumpDevice.getLastConnectionTimeMillis();
if (lastConnectionTimeMillis == 0) {
this.lastDeviceContact.setText(resourceHelper.gs(R.string.riley_link_ble_config_connected_never));
} else {

View file

@ -18,13 +18,11 @@ import java.util.List;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.plugins.pump.common.R;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;

View file

@ -20,6 +20,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
* Created by andy on 16/05/2018.
*/
// FIXME encapsulation
@Singleton
public class RileyLinkServiceData {
@ -36,6 +37,7 @@ public class RileyLinkServiceData {
public RileyLinkTargetFrequency rileyLinkTargetFrequency;
public String rileyLinkAddress;
public String rileyLinkName;
public Integer batteryLevel;
long lastTuneUpTime = 0L;
public Double lastGoodFrequency;
@ -76,7 +78,6 @@ public class RileyLinkServiceData {
}
private synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState, RileyLinkError errorCode, boolean set) {
if (set) {
rileyLinkServiceState = newState;
lastServiceStateChange = System.currentTimeMillis();
@ -90,7 +91,6 @@ public class RileyLinkServiceData {
} else {
return rileyLinkServiceState;
}
}
}

View file

@ -42,7 +42,7 @@
android:layout_marginLeft="30dp"
android:layout_weight="35"
android:gravity="center_vertical"
android:text="@string/rileylink_configured_riley_link_address" />
android:text="@string/rileylink_address" />
<TextView
android:id="@+id/rls_t1_configured_riley_link_address"
@ -69,7 +69,7 @@
android:layout_marginLeft="30dp"
android:layout_weight="35"
android:gravity="center_vertical"
android:text="@string/rileylink_configured_riley_link_name" />
android:text="@string/rileylink_name" />
<TextView
android:id="@+id/rls_t1_configured_riley_link_name"
@ -83,12 +83,14 @@
</LinearLayout>
<LinearLayout
android:id="@+id/rls_t1_battery_level_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="58dp"
@ -96,10 +98,10 @@
android:layout_marginLeft="30dp"
android:layout_weight="35"
android:gravity="center_vertical"
android:text="@string/rileylink_connected_device" />
android:text="@string/rileylink_battery_level" />
<TextView
android:id="@+id/rls_t1_connected_device"
android:id="@+id/rls_t1_battery_level"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
@ -234,35 +236,69 @@
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:id="@+id/rls_t1_connected_device_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="58dp"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_weight="35"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:text="@string/rileylink_device_model" />
android:orientation="horizontal">
<TextView
android:id="@+id/rls_t1_device_model"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="65"
<TextView
android:layout_width="58dp"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_weight="35"
android:gravity="center_vertical"
android:text="@string/rileylink_configured_device_model" />
<TextView
android:id="@+id/rls_t1_configured_device_model"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="65"
android:gravity="center_vertical"
android:text=" "
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:text=" "
android:textAlignment="center" />
android:orientation="horizontal">
<TextView
android:layout_width="58dp"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_weight="35"
android:gravity="center_vertical"
android:text="@string/rileylink_connected_device_model" />
<TextView
android:id="@+id/rls_t1_connected_device_model"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="65"
android:gravity="center_vertical"
android:text=" "
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -6,6 +6,7 @@
<string name="key_medtronic_pump_encoding_4b6b_rileylink" translatable="false">medtronic_pump_encoding_4b6b_rileylink</string>
<string name="key_rileylink_mac_address" translatable="false">pref_rileylink_mac_address</string>
<string name="key_rileylink_name" translatable="false">pref_rileylink_name</string>
<string name="key_riley_link_show_battery_level" translatable="false">pref_riley_link_show_reported_battery_level</string>
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
<!-- RL BLE Config -->
@ -30,19 +31,23 @@
<string name="medtronic_pump_status">Pump Status</string>
<string name="title_activity_rileylink_settings">RileyLink Settings</string>
<string name="rileylink_title">RileyLink</string>
<string name="rileylink_configured_riley_link_address">Configured RileyLink Address:</string>
<string name="rileylink_configured_riley_link_name">Configured RileyLink Name:</string>
<string name="rileylink_connected_device">Connected Device:</string>
<string name="rileylink_address">Address:</string>
<string name="rileylink_name">Name:</string>
<string name="rileylink_battery_level">Battery Level:</string>
<string name="rileylink_battery_level_value">%1$d%%</string>
<string name="rileylink_connection_status">Connection Status:</string>
<string name="rileylink_connection_error">Connection Error:</string>
<string name="rileylink_device">Device</string>
<string name="rileylink_device_type">Device Type:</string>
<string name="rileylink_device_model">Device Model:</string>
<string name="rileylink_configured_device_model">Configured Device Model:</string>
<string name="rileylink_connected_device_model">Connected Device Model:</string>
<string name="rileylink_last_used_frequency">Last Used Frequency:</string>
<string name="rileylink_last_device_contact">Last Device Contact:</string>
<string name="rileylink_firmware_version">Firmware Version:</string>
<string name="rileylink_firmware_version_value">BLE113: %1$s\nCC110: %2$s</string>
<string name="rileylink_pump_serial_number">Pump Serial Number:</string>
<string name="rileylink_pump_frequency">Pump Frequency:</string>
<string name="rileylink_pump_frequency_value">%1$.2f MHz</string>
<!-- RL State -->
<string name="rileylink_state_bt_init">Bluetooth Initializing…</string>
@ -67,10 +72,14 @@
<!-- RileyLink - Common -->
<string name="rileylink_target_device_medtronic">Medtronic Pump</string>
<string name="rileylink_target_device_omnipod">Omnipod</string>
<string name="rileylink_target_device_omnipod">Omnipod (Eros)</string>
<string name="riley_link_common_yes">Yes</string>
<string name="riley_link_common_no">No</string>
<!-- RileyLink - Preferences -->
<string name="riley_link_show_battery_level">Show battery level reported by OrangeLink/EmaLink</string>
<string name="riley_link_show_battery_level_summary">DOES NOT work with the original RileyLink. May not work with other RileyLink alternatives.</string>
<plurals name="duration_days">
<item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item>

View file

@ -39,8 +39,8 @@ public class MainMenuActivity extends MenuListActivity {
if(!sharedPreferences.getBoolean("wearcontrol", false)){
return new String[] {
"Settings",
"Re-Sync"};
aaps.gs(R.string.menu_settings),
aaps.gs(R.string.menu_resync)};
}

View file

@ -77,6 +77,7 @@
<string name="menu_ecarb">eCarb</string>
<string name="menu_settings">Settings</string>
<string name="menu_status">Status</string>
<string name="menu_resync">Re-Sync</string>
<string name="menu_prime_fill">Prime/Fill</string>
<string name="menu_none">None</string>
<string name="menu_default">Default</string>