MDT refactor pass 17

This commit is contained in:
Milos Kozak 2020-04-27 23:02:12 +02:00
parent 52e0e3ec51
commit 1b21b74878
15 changed files with 116 additions and 154 deletions

View file

@ -37,6 +37,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyL
import info.nightscout.androidaps.plugins.pump.danaR.DanaRFragment import info.nightscout.androidaps.plugins.pump.danaR.DanaRFragment
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
import info.nightscout.androidaps.plugins.source.BGSourceFragment import info.nightscout.androidaps.plugins.source.BGSourceFragment
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment
@ -118,4 +119,5 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusGeneral(): RileyLinkStatusGeneralFragment @ContributesAndroidInjector abstract fun contributesRileyLinkStatusGeneral(): RileyLinkStatusGeneralFragment
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusHistoryFragment(): RileyLinkStatusHistoryFragment @ContributesAndroidInjector abstract fun contributesRileyLinkStatusHistoryFragment(): RileyLinkStatusHistoryFragment
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusDeviceMedtronic(): RileyLinkStatusDeviceMedtronic
} }

View file

@ -37,7 +37,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState;
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData; import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
import info.nightscout.androidaps.plugins.treatments.Treatment; import info.nightscout.androidaps.plugins.treatments.Treatment;
@ -109,8 +108,11 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
public abstract void initPumpStatusData(); public abstract void initPumpStatusData();
public abstract void resetRileyLinkConfiguration(); public abstract void resetRileyLinkConfiguration();
public abstract void doTuneUpDevice(); public abstract void doTuneUpDevice();
public abstract RileyLinkService getRileyLinkService(); public abstract RileyLinkService getRileyLinkService();
@Override @Override
@ -446,7 +448,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI
public ManufacturerType manufacturer() { public ManufacturerType manufacturer() {
return pumpType.getManufacturer() ; return pumpType.getManufacturer();
} }
@NotNull @NotNull

View file

@ -32,8 +32,8 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil; import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
/** /**
* Created by geoff on 5/26/16. * Created by geoff on 5/26/16.
@ -65,7 +65,7 @@ public class RFSpy {
injector.androidInjector().inject(this); injector.androidInjector().inject(this);
this.injector = injector; this.injector = injector;
this.rileyLinkBle = rileyLinkBle; this.rileyLinkBle = rileyLinkBle;
reader = new RFSpyReader(rileyLinkBle); reader = new RFSpyReader(aapsLogger, rileyLinkBle);
} }
public String getBLEVersionCached() { public String getBLEVersionCached() {

View file

@ -1,19 +1,15 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble;
import android.os.AsyncTask;
import android.os.SystemClock;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.slf4j.Logger; import info.nightscout.androidaps.logging.AAPSLogger;
import org.slf4j.LoggerFactory; import info.nightscout.androidaps.logging.LTag;
import android.os.AsyncTask;
import android.os.SystemClock;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations.BLECommOperationResult; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations.BLECommOperationResult;
@ -25,7 +21,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil;
*/ */
public class RFSpyReader { public class RFSpyReader {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPBTCOMM); private final AAPSLogger aapsLogger;
private static AsyncTask<Void, Void, Void> readerTask; private static AsyncTask<Void, Void, Void> readerTask;
private RileyLinkBLE rileyLinkBle; private RileyLinkBLE rileyLinkBle;
private Semaphore waitForRadioData = new Semaphore(0, true); private Semaphore waitForRadioData = new Semaphore(0, true);
@ -35,13 +31,9 @@ public class RFSpyReader {
private boolean stopAtNull = true; private boolean stopAtNull = true;
public RFSpyReader(RileyLinkBLE rileyLinkBle) { RFSpyReader(AAPSLogger aapsLogger, RileyLinkBLE rileyLinkBle) {
this.rileyLinkBle = rileyLinkBle; this.rileyLinkBle = rileyLinkBle;
} this.aapsLogger = aapsLogger;
public void init(RileyLinkBLE rileyLinkBLE) {
this.rileyLinkBle = rileyLinkBLE;
} }
@ -52,16 +44,15 @@ public class RFSpyReader {
this.rileyLinkBle = rileyLinkBle; this.rileyLinkBle = rileyLinkBle;
} }
public void setRileyLinkEncodingType(RileyLinkEncodingType encodingType) { void setRileyLinkEncodingType(RileyLinkEncodingType encodingType) {
stopAtNull = !(encodingType == RileyLinkEncodingType.Manchester || // stopAtNull = !(encodingType == RileyLinkEncodingType.Manchester || //
encodingType == RileyLinkEncodingType.FourByteSixByteRileyLink); encodingType == RileyLinkEncodingType.FourByteSixByteRileyLink);
} }
// This timeout must be coordinated with the length of the RFSpy radio operation or Bad Things Happen. // This timeout must be coordinated with the length of the RFSpy radio operation or Bad Things Happen.
public byte[] poll(int timeout_ms) { byte[] poll(int timeout_ms) {
if (isLogEnabled()) aapsLogger.debug(LTag.PUMPBTCOMM, ThreadUtil.sig() + "Entering poll at t==" + SystemClock.uptimeMillis() + ", timeout is " + timeout_ms
LOG.trace(ThreadUtil.sig() + "Entering poll at t==" + SystemClock.uptimeMillis() + ", timeout is " + timeout_ms
+ " mDataQueue size is " + mDataQueue.size()); + " mDataQueue size is " + mDataQueue.size());
if (mDataQueue.isEmpty()) { if (mDataQueue.isEmpty()) {
@ -70,16 +61,14 @@ public class RFSpyReader {
// returns null if timeout. // returns null if timeout.
byte[] dataFromQueue = mDataQueue.poll(timeout_ms, TimeUnit.MILLISECONDS); byte[] dataFromQueue = mDataQueue.poll(timeout_ms, TimeUnit.MILLISECONDS);
if (dataFromQueue != null) { if (dataFromQueue != null) {
if (isLogEnabled()) aapsLogger.debug(LTag.PUMPBTCOMM, "Got data [" + ByteUtil.shortHexString(dataFromQueue) + "] at t=="
LOG.debug("Got data [" + ByteUtil.shortHexString(dataFromQueue) + "] at t==" + SystemClock.uptimeMillis());
+ SystemClock.uptimeMillis());
} else { } else {
if (isLogEnabled()) aapsLogger.debug(LTag.PUMPBTCOMM, "Got data [null] at t==" + SystemClock.uptimeMillis());
LOG.debug("Got data [null] at t==" + SystemClock.uptimeMillis());
} }
return dataFromQueue; return dataFromQueue;
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("poll: Interrupted waiting for data"); aapsLogger.error(LTag.PUMPBTCOMM, "poll: Interrupted waiting for data");
} }
} }
@ -88,11 +77,10 @@ public class RFSpyReader {
// Call this from the "response count" notification handler. // Call this from the "response count" notification handler.
public void newDataIsAvailable() { void newDataIsAvailable() {
releaseCount++; releaseCount++;
if (isLogEnabled()) aapsLogger.debug(LTag.PUMPBTCOMM, ThreadUtil.sig() + "waitForRadioData released(count=" + releaseCount + ") at t="
LOG.trace(ThreadUtil.sig() + "waitForRadioData released(count=" + releaseCount + ") at t="
+ SystemClock.uptimeMillis()); + SystemClock.uptimeMillis());
waitForRadioData.release(); waitForRadioData.release();
} }
@ -110,8 +98,7 @@ public class RFSpyReader {
try { try {
acquireCount++; acquireCount++;
waitForRadioData.acquire(); waitForRadioData.acquire();
if (isLogEnabled()) aapsLogger.debug(LTag.PUMPBTCOMM, ThreadUtil.sig() + "waitForRadioData acquired (count=" + acquireCount + ") at t="
LOG.trace(ThreadUtil.sig() + "waitForRadioData acquired (count=" + acquireCount + ") at t="
+ SystemClock.uptimeMillis()); + SystemClock.uptimeMillis());
SystemClock.sleep(100); SystemClock.sleep(100);
SystemClock.sleep(1); SystemClock.sleep(1);
@ -130,24 +117,19 @@ public class RFSpyReader {
} }
mDataQueue.add(result.value); mDataQueue.add(result.value);
} else if (result.resultCode == BLECommOperationResult.RESULT_INTERRUPTED) { } else if (result.resultCode == BLECommOperationResult.RESULT_INTERRUPTED) {
LOG.error("Read operation was interrupted"); aapsLogger.error(LTag.PUMPBTCOMM, "Read operation was interrupted");
} else if (result.resultCode == BLECommOperationResult.RESULT_TIMEOUT) { } else if (result.resultCode == BLECommOperationResult.RESULT_TIMEOUT) {
LOG.error("Read operation on Radio Data timed out"); aapsLogger.error(LTag.PUMPBTCOMM, "Read operation on Radio Data timed out");
} else if (result.resultCode == BLECommOperationResult.RESULT_BUSY) { } else if (result.resultCode == BLECommOperationResult.RESULT_BUSY) {
LOG.error("FAIL: RileyLinkBLE reports operation already in progress"); aapsLogger.error(LTag.PUMPBTCOMM, "FAIL: RileyLinkBLE reports operation already in progress");
} else if (result.resultCode == BLECommOperationResult.RESULT_NONE) { } else if (result.resultCode == BLECommOperationResult.RESULT_NONE) {
LOG.error("FAIL: got invalid result code: " + result.resultCode); aapsLogger.error(LTag.PUMPBTCOMM, "FAIL: got invalid result code: " + result.resultCode);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("Interrupted while waiting for data"); aapsLogger.error(LTag.PUMPBTCOMM, "Interrupted while waiting for data");
} }
} }
} }
}.execute(); }.execute();
} }
private boolean isLogEnabled() {
return L.isEnabled(L.PUMPBTCOMM);
}
} }

View file

@ -47,8 +47,8 @@ public class RileyLinkBLE {
@Inject RileyLinkUtil rileyLinkUtil; @Inject RileyLinkUtil rileyLinkUtil;
private final Context context; private final Context context;
public boolean gattDebugEnabled = true; private boolean gattDebugEnabled = true;
boolean manualDisconnect = false; private boolean manualDisconnect = false;
private BluetoothAdapter bluetoothAdapter; private BluetoothAdapter bluetoothAdapter;
private BluetoothGattCallback bluetoothGattCallback; private BluetoothGattCallback bluetoothGattCallback;
private BluetoothDevice rileyLinkDevice; private BluetoothDevice rileyLinkDevice;
@ -447,7 +447,7 @@ public class RileyLinkBLE {
} }
BluetoothGattDescriptor descr = list.get(0); BluetoothGattDescriptor descr = list.get(0);
// Tell the remote device to send the notifications // Tell the remote device to send the notifications
mCurrentOperation = new DescriptorWriteOperation(bluetoothConnectionGatt, descr, mCurrentOperation = new DescriptorWriteOperation(aapsLogger, bluetoothConnectionGatt, descr,
BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mCurrentOperation.execute(this); mCurrentOperation.execute(this);
if (mCurrentOperation.timedOut) { if (mCurrentOperation.timedOut) {
@ -496,7 +496,7 @@ public class RileyLinkBLE {
} else { } else {
BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID) BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID)
.getCharacteristic(charaUUID); .getCharacteristic(charaUUID);
mCurrentOperation = new CharacteristicWriteOperation(bluetoothConnectionGatt, chara, value); mCurrentOperation = new CharacteristicWriteOperation(aapsLogger, bluetoothConnectionGatt, chara, value);
mCurrentOperation.execute(this); mCurrentOperation.execute(this);
if (mCurrentOperation.timedOut) { if (mCurrentOperation.timedOut) {
rval.resultCode = BLECommOperationResult.RESULT_TIMEOUT; rval.resultCode = BLECommOperationResult.RESULT_TIMEOUT;
@ -538,7 +538,7 @@ public class RileyLinkBLE {
} else { } else {
BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID).getCharacteristic( BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID).getCharacteristic(
charaUUID); charaUUID);
mCurrentOperation = new CharacteristicReadOperation(bluetoothConnectionGatt, chara); mCurrentOperation = new CharacteristicReadOperation(aapsLogger, bluetoothConnectionGatt, chara);
mCurrentOperation.execute(this); mCurrentOperation.execute(this);
if (mCurrentOperation.timedOut) { if (mCurrentOperation.timedOut) {
rval.resultCode = BLECommOperationResult.RESULT_TIMEOUT; rval.resultCode = BLECommOperationResult.RESULT_TIMEOUT;

View file

@ -1,17 +1,14 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattCharacteristic;
import android.os.SystemClock; import android.os.SystemClock;
import info.nightscout.androidaps.logging.L; import java.util.UUID;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
@ -20,12 +17,13 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Gatt
*/ */
public class CharacteristicReadOperation extends BLECommOperation { public class CharacteristicReadOperation extends BLECommOperation {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPBTCOMM); private final AAPSLogger aapsLogger;
private BluetoothGattCharacteristic characteristic; private BluetoothGattCharacteristic characteristic;
public CharacteristicReadOperation(BluetoothGatt gatt, BluetoothGattCharacteristic chara) { public CharacteristicReadOperation(AAPSLogger aapsLogger, BluetoothGatt gatt, BluetoothGattCharacteristic chara) {
this.aapsLogger = aapsLogger;
this.gatt = gatt; this.gatt = gatt;
this.characteristic = chara; this.characteristic = chara;
} }
@ -39,15 +37,14 @@ public class CharacteristicReadOperation extends BLECommOperation {
boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS); boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS);
if (didAcquire) { if (didAcquire) {
SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier
// understanding of the sequence of events. // understanding of the sequence of events.
// success // success
} else { } else {
LOG.error("Timeout waiting for gatt write operation to complete"); aapsLogger.error(LTag.PUMPBTCOMM, "Timeout waiting for gatt write operation to complete");
timedOut = true; timedOut = true;
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (isLogEnabled()) aapsLogger.error(LTag.PUMPBTCOMM, "Interrupted while waiting for gatt write operation to complete");
LOG.error("Interrupted while waiting for gatt write operation to complete");
interrupted = true; interrupted = true;
} }
value = characteristic.getValue(); value = characteristic.getValue();
@ -58,15 +55,10 @@ public class CharacteristicReadOperation extends BLECommOperation {
public void gattOperationCompletionCallback(UUID uuid, byte[] value) { public void gattOperationCompletionCallback(UUID uuid, byte[] value) {
super.gattOperationCompletionCallback(uuid, value); super.gattOperationCompletionCallback(uuid, value);
if (!characteristic.getUuid().equals(uuid)) { if (!characteristic.getUuid().equals(uuid)) {
LOG.error(String.format( aapsLogger.error(LTag.PUMPCOMM, String.format(
"Completion callback: UUID does not match! out of sequence? Found: %s, should be %s", "Completion callback: UUID does not match! out of sequence? Found: %s, should be %s",
GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid))); GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid)));
} }
operationComplete.release(); operationComplete.release();
} }
private boolean isLogEnabled() {
return L.isEnabled(L.PUMPBTCOMM);
}
} }

View file

@ -1,17 +1,14 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattCharacteristic;
import android.os.SystemClock; import android.os.SystemClock;
import info.nightscout.androidaps.logging.L; import java.util.UUID;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes;
@ -20,12 +17,13 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Gatt
*/ */
public class CharacteristicWriteOperation extends BLECommOperation { public class CharacteristicWriteOperation extends BLECommOperation {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPBTCOMM); private final AAPSLogger aapsLogger;
private BluetoothGattCharacteristic characteristic; private BluetoothGattCharacteristic characteristic;
public CharacteristicWriteOperation(BluetoothGatt gatt, BluetoothGattCharacteristic chara, byte[] value) { public CharacteristicWriteOperation(AAPSLogger aapsLogger, BluetoothGatt gatt, BluetoothGattCharacteristic chara, byte[] value) {
this.aapsLogger = aapsLogger;
this.gatt = gatt; this.gatt = gatt;
this.characteristic = chara; this.characteristic = chara;
this.value = value; this.value = value;
@ -42,14 +40,14 @@ public class CharacteristicWriteOperation extends BLECommOperation {
boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS); boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS);
if (didAcquire) { if (didAcquire) {
SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier
// understanding of the sequence of events. // understanding of the sequence of events.
// success // success
} else { } else {
LOG.error("Timeout waiting for gatt write operation to complete"); aapsLogger.error(LTag.PUMPBTCOMM, "Timeout waiting for gatt write operation to complete");
timedOut = true; timedOut = true;
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("Interrupted while waiting for gatt write operation to complete"); aapsLogger.error(LTag.PUMPBTCOMM, "Interrupted while waiting for gatt write operation to complete");
interrupted = true; interrupted = true;
} }
@ -60,16 +58,10 @@ public class CharacteristicWriteOperation extends BLECommOperation {
@Override @Override
public void gattOperationCompletionCallback(UUID uuid, byte[] value) { public void gattOperationCompletionCallback(UUID uuid, byte[] value) {
if (!characteristic.getUuid().equals(uuid)) { if (!characteristic.getUuid().equals(uuid)) {
LOG.error(String.format( aapsLogger.error(LTag.PUMPCOMM, String.format(
"Completion callback: UUID does not match! out of sequence? Found: %s, should be %s", "Completion callback: UUID does not match! out of sequence? Found: %s, should be %s",
GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid))); GattAttributes.lookup(characteristic.getUuid()), GattAttributes.lookup(uuid)));
} }
operationComplete.release(); operationComplete.release();
} }
private boolean isLogEnabled() {
return L.isEnabled(L.PUMPBTCOMM);
}
} }

View file

@ -1,16 +1,14 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.operations;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattDescriptor;
import android.os.SystemClock; import android.os.SystemClock;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
/** /**
@ -18,12 +16,13 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLink
*/ */
public class DescriptorWriteOperation extends BLECommOperation { public class DescriptorWriteOperation extends BLECommOperation {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(DescriptorWriteOperation.class); private final AAPSLogger aapsLogger;
private BluetoothGattDescriptor descr; private BluetoothGattDescriptor descr;
public DescriptorWriteOperation(BluetoothGatt gatt, BluetoothGattDescriptor descr, byte[] value) { public DescriptorWriteOperation(AAPSLogger aapsLogger, BluetoothGatt gatt, BluetoothGattDescriptor descr, byte[] value) {
this.aapsLogger = aapsLogger;
this.gatt = gatt; this.gatt = gatt;
this.descr = descr; this.descr = descr;
this.value = value; this.value = value;
@ -46,14 +45,14 @@ public class DescriptorWriteOperation extends BLECommOperation {
boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS); boolean didAcquire = operationComplete.tryAcquire(getGattOperationTimeout_ms(), TimeUnit.MILLISECONDS);
if (didAcquire) { if (didAcquire) {
SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier SystemClock.sleep(1); // This is to allow the IBinder thread to exit before we continue, allowing easier
// understanding of the sequence of events. // understanding of the sequence of events.
// success // success
} else { } else {
LOG.error("Timeout waiting for descriptor write operation to complete"); aapsLogger.error(LTag.PUMPBTCOMM, "Timeout waiting for descriptor write operation to complete");
timedOut = true; timedOut = true;
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("Interrupted while waiting for descriptor write operation to complete"); aapsLogger.error(LTag.PUMPBTCOMM, "Interrupted while waiting for descriptor write operation to complete");
interrupted = true; interrupted = true;
} }
} }

View file

@ -2,12 +2,12 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data;
import org.joda.time.LocalDateTime; import org.joda.time.LocalDateTime;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType; import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandType;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/** /**
* Created by andy on 5/19/18. * Created by andy on 5/19/18.
@ -26,7 +26,7 @@ public class RLHistoryItem {
public RLHistoryItem(RileyLinkServiceState serviceState, RileyLinkError errorCode, public RLHistoryItem(RileyLinkServiceState serviceState, RileyLinkError errorCode,
RileyLinkTargetDevice targetDevice) { RileyLinkTargetDevice targetDevice) {
this.targetDevice = targetDevice; this.targetDevice = targetDevice;
this.dateTime = new LocalDateTime(); this.dateTime = new LocalDateTime();
this.serviceState = serviceState; this.serviceState = serviceState;
@ -65,16 +65,16 @@ public class RLHistoryItem {
} }
public String getDescription() { public String getDescription(ResourceHelper resourceHelper) {
// TODO extend when we have Omnipod // TODO extend when we have Omnipod
switch (this.source) { switch (this.source) {
case RileyLink: case RileyLink:
return "State: " + MainApp.gs(serviceState.getResourceId(targetDevice)) return "State: " + resourceHelper.gs(serviceState.getResourceId(targetDevice))
+ (this.errorCode == null ? "" : ", Error Code: " + errorCode); + (this.errorCode == null ? "" : ", Error Code: " + errorCode);
case MedtronicPump: case MedtronicPump:
return MainApp.gs(pumpDeviceState.getResourceId()); return resourceHelper.gs(pumpDeviceState.getResourceId());
case MedtronicCommand: case MedtronicCommand:
return medtronicCommandType.name(); return medtronicCommandType.name();

View file

@ -1,22 +1,20 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.android.support.DaggerFragment; import dagger.android.support.DaggerFragment;
@ -24,9 +22,9 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; 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.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/** /**
* Created by andy on 5/19/18. * Created by andy on 5/19/18.
@ -35,6 +33,7 @@ import info.nightscout.androidaps.utils.DateUtil;
public class RileyLinkStatusHistoryFragment extends DaggerFragment implements RefreshableInterface { public class RileyLinkStatusHistoryFragment extends DaggerFragment implements RefreshableInterface {
@Inject RileyLinkUtil rileyLinkUtil; @Inject RileyLinkUtil rileyLinkUtil;
@Inject ResourceHelper resourceHelper;
RecyclerView recyclerView; RecyclerView recyclerView;
RecyclerViewAdapter recyclerViewAdapter; RecyclerViewAdapter recyclerViewAdapter;
@ -50,7 +49,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
recyclerView = (RecyclerView) rootView.findViewById(R.id.rileylink_history_list); recyclerView = (RecyclerView) rootView.findViewById(R.id.rileylink_history_list);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
llm = new LinearLayoutManager(getActivity().getApplicationContext()); llm = new LinearLayoutManager(rootView.getContext());
recyclerView.setLayoutManager(llm); recyclerView.setLayoutManager(llm);
recyclerViewAdapter = new RecyclerViewAdapter(filteredHistoryList); recyclerViewAdapter = new RecyclerViewAdapter(filteredHistoryList);
@ -76,7 +75,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
} }
public static class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> { public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.HistoryViewHolder> {
List<RLHistoryItem> historyList; List<RLHistoryItem> historyList;
@ -111,11 +110,11 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
PumpDeviceState pumpState = item.getPumpDeviceState(); PumpDeviceState pumpState = item.getPumpDeviceState();
if ((pumpState != null) && // //
(pumpState == PumpDeviceState.Sleeping || // if ((pumpState == PumpDeviceState.Sleeping || //
pumpState == PumpDeviceState.Active || // pumpState == PumpDeviceState.Active || //
pumpState == PumpDeviceState.WakingUp // pumpState == PumpDeviceState.WakingUp //
)) ))
return false; return false;
return true; return true;
@ -139,7 +138,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
if (item != null) { if (item != null) {
holder.timeView.setText(DateUtil.dateAndTimeAndSecondsString(item.getDateTime().toDateTime().getMillis())); holder.timeView.setText(DateUtil.dateAndTimeAndSecondsString(item.getDateTime().toDateTime().getMillis()));
holder.typeView.setText(item.getSource().getDesc()); holder.typeView.setText(item.getSource().getDesc());
holder.valueView.setText(item.getDescription()); holder.valueView.setText(item.getDescription(resourceHelper));
} }
} }
@ -155,7 +154,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re
super.onAttachedToRecyclerView(recyclerView); super.onAttachedToRecyclerView(recyclerView);
} }
static class HistoryViewHolder extends RecyclerView.ViewHolder { class HistoryViewHolder extends RecyclerView.ViewHolder {
TextView timeView; TextView timeView;
TextView typeView; TextView typeView;

View file

@ -11,8 +11,6 @@ import android.content.IntentFilter;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -23,9 +21,7 @@ import javax.inject.Inject;
import dagger.android.DaggerBroadcastReceiver; import dagger.android.DaggerBroadcastReceiver;
import dagger.android.HasAndroidInjector; import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
@ -50,8 +46,6 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
@Inject RileyLinkServiceData rileyLinkServiceData; @Inject RileyLinkServiceData rileyLinkServiceData;
@Inject ServiceTaskExecutor serviceTaskExecutor; @Inject ServiceTaskExecutor serviceTaskExecutor;
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPCOMM);
RileyLinkService serviceInstance; RileyLinkService serviceInstance;
protected Map<String, List<String>> broadcastIdentifiers = null; protected Map<String, List<String>> broadcastIdentifiers = null;
String deviceSpecificPrefix; String deviceSpecificPrefix;
@ -98,11 +92,11 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
super.onReceive(context, intent); super.onReceive(context, intent);
if (intent == null) { if (intent == null) {
LOG.error("onReceive: received null intent"); aapsLogger.error("onReceive: received null intent");
} else { } else {
String action = intent.getAction(); String action = intent.getAction();
if (action == null) { if (action == null) {
LOG.error("onReceive: null action"); aapsLogger.error("onReceive: null action");
} else { } else {
aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: " + action); aapsLogger.debug(LTag.PUMPBTCOMM, "Received Broadcast: " + action);
@ -112,7 +106,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
!processDeviceSpecificBroadcasts(action, intent) && // !processDeviceSpecificBroadcasts(action, intent) && //
!processApplicationSpecificBroadcasts(action, intent) // !processApplicationSpecificBroadcasts(action, intent) //
) { ) {
LOG.error("Unhandled broadcast: action=" + action); aapsLogger.error("Unhandled broadcast: action=" + action);
} }
} }
} }
@ -176,7 +170,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
} else if (action.equals(RileyLinkConst.Intents.RileyLinkNewAddressSet)) { } else if (action.equals(RileyLinkConst.Intents.RileyLinkNewAddressSet)) {
String RileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); String RileylinkBLEAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
if (RileylinkBLEAddress.equals("")) { if (RileylinkBLEAddress.equals("")) {
LOG.error("No Rileylink BLE Address saved in app"); aapsLogger.error("No Rileylink BLE Address saved in app");
} else { } else {
// showBusy("Configuring Service", 50); // showBusy("Configuring Service", 50);
// rileyLinkBLE.findRileyLink(RileylinkBLEAddress); // rileyLinkBLE.findRileyLink(RileylinkBLEAddress);

View file

@ -4,13 +4,11 @@ import javax.inject.Inject;
import dagger.android.HasAndroidInjector; import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport;
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin; import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventRefreshButtonState;
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService;
/** /**
* Created by geoff on 7/16/16. * Created by geoff on 7/16/16.

View file

@ -20,14 +20,13 @@ import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
*/ */
public class DateTimeUtil { public class DateTimeUtil {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPCOMM);
/** /**
* DateTime is packed as long: yyyymmddHHMMss * DateTime is packed as long: yyyymmddHHMMss
* *
* @param atechDateTime * @param atechDateTime
* @return * @return
*/ */
@Deprecated // use joda instead
public static LocalDateTime toLocalDateTime(long atechDateTime) { public static LocalDateTime toLocalDateTime(long atechDateTime) {
int year = (int) (atechDateTime / 10000000000L); int year = (int) (atechDateTime / 10000000000L);
atechDateTime -= year * 10000000000L; atechDateTime -= year * 10000000000L;
@ -49,8 +48,7 @@ public class DateTimeUtil {
try { try {
return new LocalDateTime(year, month, dayOfMonth, hourOfDay, minute, second); return new LocalDateTime(year, month, dayOfMonth, hourOfDay, minute, second);
} catch (Exception ex) { } catch (Exception ex) {
if (L.isEnabled(L.PUMPCOMM)) //LOG.error("Error creating LocalDateTime from values [atechDateTime={}, year={}, month={}, day={}, hour={}, minute={}, second={}]. Exception: {}", atechDateTime, year, month, dayOfMonth, hourOfDay, minute, second, ex.getMessage());
LOG.error("Error creating LocalDateTime from values [atechDateTime={}, year={}, month={}, day={}, hour={}, minute={}, second={}]. Exception: {}", atechDateTime, year, month, dayOfMonth, hourOfDay, minute, second, ex.getMessage());
//return null; //return null;
throw ex; throw ex;
} }
@ -63,6 +61,7 @@ public class DateTimeUtil {
* @param atechDateTime * @param atechDateTime
* @return * @return
*/ */
@Deprecated // use joda instead
public static GregorianCalendar toGregorianCalendar(long atechDateTime) { public static GregorianCalendar toGregorianCalendar(long atechDateTime) {
int year = (int) (atechDateTime / 10000000000L); int year = (int) (atechDateTime / 10000000000L);
atechDateTime -= year * 10000000000L; atechDateTime -= year * 10000000000L;
@ -84,8 +83,7 @@ public class DateTimeUtil {
try { try {
return new GregorianCalendar(year, month - 1, dayOfMonth, hourOfDay, minute, second); return new GregorianCalendar(year, month - 1, dayOfMonth, hourOfDay, minute, second);
} catch (Exception ex) { } catch (Exception ex) {
if (L.isEnabled(L.PUMPCOMM)) //LOG.error("DateTimeUtil", String.format("Error creating GregorianCalendar from values [atechDateTime=%d, year=%d, month=%d, day=%d, hour=%d, minute=%d, second=%d]", atechDateTime, year, month, dayOfMonth, hourOfDay, minute, second));
LOG.error("DateTimeUtil", String.format("Error creating GregorianCalendar from values [atechDateTime=%d, year=%d, month=%d, day=%d, hour=%d, minute=%d, second=%d]", atechDateTime, year, month, dayOfMonth, hourOfDay, minute, second));
//return null; //return null;
throw ex; throw ex;
} }

View file

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.location.LocationManager; import android.location.LocationManager;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.utils.alertDialogs.OKDialog; import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
@ -44,7 +43,7 @@ public class LocationHelper {
} }
// Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533 // Shamelessly borrowed from http://stackoverflow.com/a/10311877/868533
OKDialog.showConfirmation(parent, MainApp.gs(R.string.location_not_found_title), MainApp.gs(R.string.location_not_found_message), () -> { OKDialog.showConfirmation(parent, parent.getString(R.string.location_not_found_title), parent.getString(R.string.location_not_found_message), () -> {
parent.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)); parent.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}); });
} }

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.pump.medtronic.dialog; package info.nightscout.androidaps.plugins.pump.medtronic.dialog;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -12,10 +11,14 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
/** /**
* Created by andy on 5/19/18. * Created by andy on 5/19/18.
@ -26,7 +29,9 @@ import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
*/ */
// TODO needs to be implemented // TODO needs to be implemented
public class RileyLinkStatusDeviceMedtronic extends Fragment implements RefreshableInterface { public class RileyLinkStatusDeviceMedtronic extends DaggerFragment implements RefreshableInterface {
@Inject ResourceHelper resourceHelper;
// @BindView(R.id.rileylink_history_list) // @BindView(R.id.rileylink_history_list)
ListView listView; ListView listView;
@ -150,7 +155,7 @@ public class RileyLinkStatusDeviceMedtronic extends Fragment implements Refresha
RLHistoryItem item = historyItemList.get(i); RLHistoryItem item = historyItemList.get(i);
viewHolder.itemTime.setText(StringUtil.toDateTimeString(item.getDateTime())); viewHolder.itemTime.setText(StringUtil.toDateTimeString(item.getDateTime()));
viewHolder.itemSource.setText("Riley Link"); // for now viewHolder.itemSource.setText("Riley Link"); // for now
viewHolder.itemDescription.setText(item.getDescription()); viewHolder.itemDescription.setText(item.getDescription(resourceHelper));
return view; return view;
} }