This commit is contained in:
Milos Kozak 2020-04-25 09:23:19 +02:00
parent 8db0dbd78d
commit e8f69fc1c0
28 changed files with 236 additions and 195 deletions

View file

@ -32,6 +32,8 @@ import info.nightscout.androidaps.plugins.insulin.InsulinFragment
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
import info.nightscout.androidaps.plugins.pump.combo.ComboFragment import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment
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
@ -113,4 +115,7 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesWizardInfoDialog(): WizardInfoDialog @ContributesAndroidInjector abstract fun contributesWizardInfoDialog(): WizardInfoDialog
@ContributesAndroidInjector abstract fun contributesPasswordCheck(): PasswordCheck @ContributesAndroidInjector abstract fun contributesPasswordCheck(): PasswordCheck
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusGeneral(): RileyLinkStatusGeneralFragment
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusHistoryFragment(): RileyLinkStatusHistoryFragment
} }

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.dependencyInjection
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBluetoothStateReceiver import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBluetoothStateReceiver
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBroadcastReceiver
import info.nightscout.androidaps.receivers.* import info.nightscout.androidaps.receivers.*
@Module @Module
@ -17,4 +18,6 @@ abstract class ReceiversModule {
@ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver @ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver
@ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver @ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver
@ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver @ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver
@ContributesAndroidInjector abstract fun contributesRileyLinkBroadcastReceiver(): RileyLinkBroadcastReceiver
} }

View file

@ -60,6 +60,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
@Inject SP sp; @Inject SP sp;
@Inject RxBusWrapper rxBus; @Inject RxBusWrapper rxBus;
@Inject ResourceHelper resourceHelper; @Inject ResourceHelper resourceHelper;
@Inject RileyLinkUtil rileyLinkUtil;
private static final int PERMISSION_REQUEST_COARSE_LOCATION = 30241; // arbitrary. private static final int PERMISSION_REQUEST_COARSE_LOCATION = 30241; // arbitrary.
private static final int REQUEST_ENABLE_BT = 30242; // arbitrary private static final int REQUEST_ENABLE_BT = 30242; // arbitrary
@ -108,7 +109,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress); sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
RileyLinkUtil.getRileyLinkSelectPreference().setSummary(bleAddress); rileyLinkUtil.getRileyLinkSelectPreference().setSummary(bleAddress);
MedtronicPumpStatus pumpStatus = MedtronicUtil.getPumpStatus(); MedtronicPumpStatus pumpStatus = MedtronicUtil.getPumpStatus();
pumpStatus.verifyConfiguration(); // force reloading of address pumpStatus.verifyConfiguration(); // force reloading of address
@ -189,7 +190,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
} }
// disable currently selected RL, so that we can discover it // disable currently selected RL, so that we can discover it
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect); rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect);
} }

View file

@ -55,8 +55,8 @@ public abstract class RileyLinkCommunicationManager {
public RileyLinkCommunicationManager(Context context, RFSpy rfspy) { public RileyLinkCommunicationManager(Context context, RFSpy rfspy) {
this.context = context; this.context = context;
this.rfspy = rfspy; this.rfspy = rfspy;
this.rileyLinkServiceData = RileyLinkUtil.getRileyLinkServiceData(); this.rileyLinkServiceData = RileyLinkUtil.getInstance().getRileyLinkServiceData();
RileyLinkUtil.setRileyLinkCommunicationManager(this); RileyLinkUtil.getInstance().setRileyLinkCommunicationManager(this);
configurePumpSpecificSettings(); configurePumpSpecificSettings();
} }
@ -178,7 +178,7 @@ public abstract class RileyLinkCommunicationManager {
public double tuneForDevice() { public double tuneForDevice() {
return scanForDevice(RileyLinkUtil.getRileyLinkTargetFrequency().getScanFrequencies()); return scanForDevice(RileyLinkUtil.getInstance().getRileyLinkTargetFrequency().getScanFrequencies());
} }
@ -192,7 +192,7 @@ public abstract class RileyLinkCommunicationManager {
*/ */
public boolean isValidFrequency(double frequency) { public boolean isValidFrequency(double frequency) {
double[] scanFrequencies = RileyLinkUtil.getRileyLinkTargetFrequency().getScanFrequencies(); double[] scanFrequencies = RileyLinkUtil.getInstance().getRileyLinkTargetFrequency().getScanFrequencies();
if (scanFrequencies.length == 1) { if (scanFrequencies.length == 1) {
return RileyLinkUtil.isSame(scanFrequencies[0], frequency); return RileyLinkUtil.isSame(scanFrequencies[0], frequency);

View file

@ -5,8 +5,7 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger; import org.jetbrains.annotations.NotNull;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -15,9 +14,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import info.nightscout.androidaps.logging.L; import javax.annotation.Nonnull;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import javax.inject.Inject;
import info.nightscout.androidaps.plugins.bus.RxBus; import javax.inject.Singleton;
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.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.encoding.Encoding4b6b; 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.data.encoding.Encoding4b6bGeoff;
@ -42,143 +45,160 @@ import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDe
* Created by andy on 17/05/2018. * Created by andy on 17/05/2018.
*/ */
@Singleton
public class RileyLinkUtil { public class RileyLinkUtil {
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMP); protected List<RLHistoryItem> historyRileyLink = new ArrayList<>();
protected static List<RLHistoryItem> historyRileyLink = new ArrayList<>(); protected RileyLinkCommunicationManager rileyLinkCommunicationManager;
protected static RileyLinkCommunicationManager rileyLinkCommunicationManager;
static ServiceTask currentTask; static ServiceTask currentTask;
private static Context context; private RileyLinkBLE rileyLinkBLE;
private static RileyLinkBLE rileyLinkBLE; private RileyLinkServiceData rileyLinkServiceData;
private static RileyLinkServiceData rileyLinkServiceData; private RileyLinkService rileyLinkService;
private static RileyLinkService rileyLinkService; private RileyLinkTargetFrequency rileyLinkTargetFrequency;
private static RileyLinkTargetFrequency rileyLinkTargetFrequency;
private static RileyLinkTargetDevice targetDevice; private RileyLinkTargetDevice targetDevice;
private static RileyLinkEncodingType encoding; private RileyLinkEncodingType encoding;
private static RileyLinkSelectPreference rileyLinkSelectPreference; private RileyLinkSelectPreference rileyLinkSelectPreference;
private static Encoding4b6b encoding4b6b; private Encoding4b6b encoding4b6b;
private static RileyLinkFirmwareVersion firmwareVersion; private RileyLinkFirmwareVersion firmwareVersion;
public static void setContext(Context contextIn) { @NotNull private final Context context;
RileyLinkUtil.context = contextIn; @NotNull private final AAPSLogger aapsLogger;
@Nonnull private final RxBusWrapper rxBus;
@Inject
public RileyLinkUtil(
Context context,
AAPSLogger aapsLogger,
RxBusWrapper rxBus
) {
this.context = context;
this.aapsLogger = aapsLogger;
this.rxBus = rxBus;
instance = this;
} }
private static RileyLinkUtil instance;
public static RileyLinkEncodingType getEncoding() { // TODO: replace by injection
@Deprecated
public static RileyLinkUtil getInstance() {
if (instance == null) throw new IllegalStateException("RileyLinkUtil not initialized");
return instance;
}
public RileyLinkEncodingType getEncoding() {
return encoding; return encoding;
} }
public static void setEncoding(RileyLinkEncodingType encoding) { public void setEncoding(RileyLinkEncodingType encoding) {
RileyLinkUtil.encoding = encoding; this.encoding = encoding;
if (encoding == RileyLinkEncodingType.FourByteSixByteLocal) { if (encoding == RileyLinkEncodingType.FourByteSixByteLocal) {
RileyLinkUtil.encoding4b6b = new Encoding4b6bGeoff(); this.encoding4b6b = new Encoding4b6bGeoff();
} }
} }
public static void sendBroadcastMessage(String message) { public void sendBroadcastMessage(String message) {
if (context != null) { Intent intent = new Intent(message);
Intent intent = new Intent(message); LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
LocalBroadcastManager.getInstance(RileyLinkUtil.context).sendBroadcast(intent);
}
} }
public static void setServiceState(RileyLinkServiceState newState) { public void setServiceState(RileyLinkServiceState newState) {
setServiceState(newState, null); setServiceState(newState, null);
} }
public static RileyLinkError getError() { public RileyLinkError getError() {
if (RileyLinkUtil.rileyLinkServiceData != null) if (rileyLinkServiceData != null)
return RileyLinkUtil.rileyLinkServiceData.errorCode; return rileyLinkServiceData.errorCode;
else else
return null; return null;
} }
public static RileyLinkServiceState getServiceState() { public RileyLinkServiceState getServiceState() {
return workWithServiceState(null, null, false); return workWithServiceState(null, null, false);
} }
public static void setServiceState(RileyLinkServiceState newState, RileyLinkError errorCode) { public void setServiceState(RileyLinkServiceState newState, RileyLinkError errorCode) {
workWithServiceState(newState, errorCode, true); workWithServiceState(newState, errorCode, true);
} }
private static synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState, private synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState,
RileyLinkError errorCode, boolean set) { RileyLinkError errorCode, boolean set) {
if (set) { if (set) {
RileyLinkUtil.rileyLinkServiceData.serviceState = newState; rileyLinkServiceData.serviceState = newState;
RileyLinkUtil.rileyLinkServiceData.errorCode = errorCode; rileyLinkServiceData.errorCode = errorCode;
if (L.isEnabled(L.PUMP)) aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: "
LOG.info("RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name());
+ errorCode.name());
RileyLinkUtil.historyRileyLink.add(new RLHistoryItem(RileyLinkUtil.rileyLinkServiceData.serviceState, historyRileyLink.add(new RLHistoryItem(rileyLinkServiceData.serviceState,
RileyLinkUtil.rileyLinkServiceData.errorCode, targetDevice)); rileyLinkServiceData.errorCode, targetDevice));
RxBus.Companion.getINSTANCE().send(new EventMedtronicDeviceStatusChange(newState, errorCode)); rxBus.send(new EventMedtronicDeviceStatusChange(newState, errorCode));
return null; return null;
} else { } else {
return (RileyLinkUtil.rileyLinkServiceData == null || RileyLinkUtil.rileyLinkServiceData.serviceState == null) ? // return (rileyLinkServiceData == null || rileyLinkServiceData.serviceState == null) ? //
RileyLinkServiceState.NotStarted RileyLinkServiceState.NotStarted
: RileyLinkUtil.rileyLinkServiceData.serviceState; : rileyLinkServiceData.serviceState;
} }
} }
public static RileyLinkBLE getRileyLinkBLE() { public RileyLinkBLE getRileyLinkBLE() {
return RileyLinkUtil.rileyLinkBLE; return rileyLinkBLE;
} }
public static void setRileyLinkBLE(RileyLinkBLE rileyLinkBLEIn) { public void setRileyLinkBLE(RileyLinkBLE rileyLinkBLEIn) {
RileyLinkUtil.rileyLinkBLE = rileyLinkBLEIn; rileyLinkBLE = rileyLinkBLEIn;
} }
public static RileyLinkServiceData getRileyLinkServiceData() { public RileyLinkServiceData getRileyLinkServiceData() {
return RileyLinkUtil.rileyLinkServiceData; return rileyLinkServiceData;
} }
public static void setRileyLinkServiceData(RileyLinkServiceData rileyLinkServiceData) { public void setRileyLinkServiceData(RileyLinkServiceData rileyLinkServiceData) {
RileyLinkUtil.rileyLinkServiceData = rileyLinkServiceData; this.rileyLinkServiceData = rileyLinkServiceData;
} }
public static boolean hasPumpBeenTunned() { public boolean hasPumpBeenTunned() {
return RileyLinkUtil.rileyLinkServiceData.tuneUpDone; return rileyLinkServiceData.tuneUpDone;
} }
public static RileyLinkService getRileyLinkService() { public RileyLinkService getRileyLinkService() {
return RileyLinkUtil.rileyLinkService; return rileyLinkService;
} }
public static void setRileyLinkService(RileyLinkService rileyLinkService) { public void setRileyLinkService(RileyLinkService rileyLinkService) {
RileyLinkUtil.rileyLinkService = rileyLinkService; this.rileyLinkService = rileyLinkService;
} }
public static RileyLinkCommunicationManager getRileyLinkCommunicationManager() { public RileyLinkCommunicationManager getRileyLinkCommunicationManager() {
return RileyLinkUtil.rileyLinkCommunicationManager; return rileyLinkCommunicationManager;
} }
public static void setRileyLinkCommunicationManager(RileyLinkCommunicationManager rileyLinkCommunicationManager) { void setRileyLinkCommunicationManager(RileyLinkCommunicationManager rileyLinkCommunicationManager) {
RileyLinkUtil.rileyLinkCommunicationManager = rileyLinkCommunicationManager; this.rileyLinkCommunicationManager = rileyLinkCommunicationManager;
} }
@ -222,13 +242,13 @@ public class RileyLinkUtil {
} }
public static RileyLinkTargetFrequency getRileyLinkTargetFrequency() { public RileyLinkTargetFrequency getRileyLinkTargetFrequency() {
return RileyLinkUtil.rileyLinkTargetFrequency; return rileyLinkTargetFrequency;
} }
public static void setRileyLinkTargetFrequency(RileyLinkTargetFrequency rileyLinkTargetFrequency) { public void setRileyLinkTargetFrequency(RileyLinkTargetFrequency rileyLinkTargetFrequency) {
RileyLinkUtil.rileyLinkTargetFrequency = rileyLinkTargetFrequency; this.rileyLinkTargetFrequency = rileyLinkTargetFrequency;
} }
@ -286,44 +306,42 @@ public class RileyLinkUtil {
} }
public static List<RLHistoryItem> getRileyLinkHistory() { public List<RLHistoryItem> getRileyLinkHistory() {
return historyRileyLink; return historyRileyLink;
} }
public static RileyLinkTargetDevice getTargetDevice() { public RileyLinkTargetDevice getTargetDevice() {
return targetDevice; return targetDevice;
} }
public static void setTargetDevice(RileyLinkTargetDevice targetDevice) { public void setTargetDevice(RileyLinkTargetDevice targetDevice) {
RileyLinkUtil.targetDevice = targetDevice; this.targetDevice = targetDevice;
} }
public static void setRileyLinkSelectPreference(RileyLinkSelectPreference rileyLinkSelectPreference) { public void setRileyLinkSelectPreference(RileyLinkSelectPreference rileyLinkSelectPreference) {
this.rileyLinkSelectPreference = rileyLinkSelectPreference;
RileyLinkUtil.rileyLinkSelectPreference = rileyLinkSelectPreference;
} }
public static RileyLinkSelectPreference getRileyLinkSelectPreference() { public RileyLinkSelectPreference getRileyLinkSelectPreference() {
return rileyLinkSelectPreference; return rileyLinkSelectPreference;
} }
public static Encoding4b6b getEncoding4b6b() { public Encoding4b6b getEncoding4b6b() {
return RileyLinkUtil.encoding4b6b; return encoding4b6b;
} }
public static void setFirmwareVersion(RileyLinkFirmwareVersion firmwareVersion) { public void setFirmwareVersion(RileyLinkFirmwareVersion firmwareVersion) {
RileyLinkUtil.firmwareVersion = firmwareVersion; this.firmwareVersion = firmwareVersion;
} }
public static RileyLinkFirmwareVersion getFirmwareVersion() { public RileyLinkFirmwareVersion getFirmwareVersion() {
return firmwareVersion; return firmwareVersion;
} }
} }

View file

@ -90,7 +90,7 @@ public class RFSpy {
public void initializeRileyLink() { public void initializeRileyLink() {
bleVersion = getVersion(); bleVersion = getVersion();
firmwareVersion = getFirmwareVersion(); firmwareVersion = getFirmwareVersion();
RileyLinkUtil.setFirmwareVersion(firmwareVersion); RileyLinkUtil.getInstance().setFirmwareVersion(firmwareVersion);
} }
@ -289,7 +289,7 @@ public class RFSpy {
this.currentFrequencyMHz = freqMHz; this.currentFrequencyMHz = freqMHz;
configureRadioForRegion(RileyLinkUtil.getRileyLinkTargetFrequency()); configureRadioForRegion(RileyLinkUtil.getInstance().getRileyLinkTargetFrequency());
} }
@ -396,7 +396,7 @@ public class RFSpy {
if (resp.isOK()) { if (resp.isOK()) {
reader.setRileyLinkEncodingType(encoding); reader.setRileyLinkEncodingType(encoding);
RileyLinkUtil.setEncoding(encoding); RileyLinkUtil.getInstance().setEncoding(encoding);
} }
return resp; return resp;

View file

@ -142,7 +142,7 @@ public class RileyLinkBLE {
if (newState == BluetoothProfile.STATE_CONNECTED) { if (newState == BluetoothProfile.STATE_CONNECTED) {
if (status == BluetoothGatt.GATT_SUCCESS) { if (status == BluetoothGatt.GATT_SUCCESS) {
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothConnected); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.Intents.BluetoothConnected);
} else { } else {
if (isLogEnabled()) if (isLogEnabled())
LOG.debug("BT State connected, GATT status {} ({})", status, getGattStatusMessage(status)); LOG.debug("BT State connected, GATT status {} ({})", status, getGattStatusMessage(status));
@ -153,7 +153,7 @@ public class RileyLinkBLE {
// LOG.debug("We are in {} state.", status == BluetoothProfile.STATE_CONNECTING ? "Connecting" : // LOG.debug("We are in {} state.", status == BluetoothProfile.STATE_CONNECTING ? "Connecting" :
// "Disconnecting"); // "Disconnecting");
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) { } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnected); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnected);
if (manualDisconnect) if (manualDisconnect)
close(); close();
LOG.warn("RileyLink Disconnected."); LOG.warn("RileyLink Disconnected.");
@ -240,19 +240,19 @@ public class RileyLinkBLE {
if (rileyLinkFound) { if (rileyLinkFound) {
mIsConnected = true; mIsConnected = true;
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkReady); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkReady);
// RileyLinkUtil.sendNotification(new // RileyLinkUtil.sendNotification(new
// ServiceNotification(RileyLinkConst.Intents.RileyLinkReady), null); // ServiceNotification(RileyLinkConst.Intents.RileyLinkReady), null);
} else { } else {
mIsConnected = false; mIsConnected = false;
RileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkError, RileyLinkUtil.getInstance().setServiceState(RileyLinkServiceState.RileyLinkError,
RileyLinkError.DeviceIsNotRileyLink); RileyLinkError.DeviceIsNotRileyLink);
} }
} else { } else {
if (isLogEnabled()) if (isLogEnabled())
LOG.debug("onServicesDiscovered " + getGattStatusMessage(status)); LOG.debug("onServicesDiscovered " + getGattStatusMessage(status));
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkGattFailed); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkGattFailed);
} }
} }
}; };

View file

@ -57,7 +57,7 @@ public class SendAndListen extends RileyLinkCommand {
// If firmware version is not set (error reading version from device, shouldn't happen), // If firmware version is not set (error reading version from device, shouldn't happen),
// we will default to version 2 // we will default to version 2
boolean isPacketV2 = RileyLinkUtil.getFirmwareVersion() != null ? RileyLinkUtil.getFirmwareVersion() boolean isPacketV2 = RileyLinkUtil.getInstance().getFirmwareVersion() != null ? RileyLinkUtil.getInstance().getFirmwareVersion()
.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher) : true; .isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher) : true;
ArrayList<Byte> bytes = new ArrayList<Byte>(); ArrayList<Byte> bytes = new ArrayList<Byte>();

View file

@ -17,7 +17,7 @@ public class SetPreamble extends RileyLinkCommand {
super(); super();
// this command was not supported before 2.0 // this command was not supported before 2.0
if (!RileyLinkUtil.getFirmwareVersion().isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) { if (!RileyLinkUtil.getInstance().getFirmwareVersion().isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) {
throw new NotImplementedException("Old firmware does not support SetPreamble command"); throw new NotImplementedException("Old firmware does not support SetPreamble command");
} }

View file

@ -33,7 +33,7 @@ public class RadioPacket {
public byte[] getEncoded() { public byte[] getEncoded() {
switch (RileyLinkUtil.getEncoding()) { switch (RileyLinkUtil.getInstance().getEncoding()) {
case Manchester: { // We have this encoding in RL firmware case Manchester: { // We have this encoding in RL firmware
return pkt; return pkt;
} }
@ -41,7 +41,7 @@ public class RadioPacket {
case FourByteSixByteLocal: { case FourByteSixByteLocal: {
byte[] withCRC = getWithCRC(); byte[] withCRC = getWithCRC();
byte[] encoded = RileyLinkUtil.getEncoding4b6b().encode4b6b(withCRC); byte[] encoded = RileyLinkUtil.getInstance().getEncoding4b6b().encode4b6b(withCRC);
return ByteUtil.concat(encoded, (byte)0); return ByteUtil.concat(encoded, (byte)0);
} }
@ -50,7 +50,7 @@ public class RadioPacket {
} }
default: default:
throw new NotImplementedException(("Encoding not supported: " + RileyLinkUtil.getEncoding().toString())); throw new NotImplementedException(("Encoding not supported: " + RileyLinkUtil.getInstance().getEncoding().toString()));
} }
} }

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data;
import org.apache.commons.lang3.NotImplementedException; import org.apache.commons.lang3.NotImplementedException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
@ -75,8 +74,8 @@ public class RadioResponse {
} }
byte[] encodedPayload; byte[] encodedPayload;
if (RileyLinkFirmwareVersion.isSameVersion(RileyLinkUtil.getRileyLinkServiceData().versionCC110, if (RileyLinkFirmwareVersion.isSameVersion(RileyLinkUtil.getInstance().getRileyLinkServiceData().versionCC110,
RileyLinkFirmwareVersion.Version2)) { RileyLinkFirmwareVersion.Version2)) {
encodedPayload = ByteUtil.substring(rxData, 3, rxData.length - 3); encodedPayload = ByteUtil.substring(rxData, 3, rxData.length - 3);
rssi = rxData[1]; rssi = rxData[1];
responseNumber = rxData[2]; responseNumber = rxData[2];
@ -92,23 +91,23 @@ public class RadioResponse {
// well, for non-radio commands we shouldn't even reach this point // well, for non-radio commands we shouldn't even reach this point
// but getVersion is kind of exception // but getVersion is kind of exception
if (command != null && // if (command != null && //
command.getCommandType() != RileyLinkCommandType.SendAndListen) { command.getCommandType() != RileyLinkCommandType.SendAndListen) {
decodedOK = true; decodedOK = true;
decodedPayload = encodedPayload; decodedPayload = encodedPayload;
return; return;
} }
switch (RileyLinkUtil.getEncoding()) { switch (RileyLinkUtil.getInstance().getEncoding()) {
case Manchester: case Manchester:
case FourByteSixByteRileyLink: { case FourByteSixByteRileyLink: {
decodedOK = true; decodedOK = true;
decodedPayload = encodedPayload; decodedPayload = encodedPayload;
} }
break; break;
case FourByteSixByteLocal: { case FourByteSixByteLocal: {
byte[] decodeThis = RileyLinkUtil.getEncoding4b6b().decode4b6b(encodedPayload); byte[] decodeThis = RileyLinkUtil.getInstance().getEncoding4b6b().decode4b6b(encodedPayload);
if (decodeThis != null && decodeThis.length > 2) { if (decodeThis != null && decodeThis.length > 2) {
decodedOK = true; decodedOK = true;
@ -118,17 +117,17 @@ public class RadioResponse {
byte calculatedCRC = CRC.crc8(decodedPayload); byte calculatedCRC = CRC.crc8(decodedPayload);
if (receivedCRC != calculatedCRC) { if (receivedCRC != calculatedCRC) {
LOG.error(String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x", LOG.error(String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x",
calculatedCRC, receivedCRC)); calculatedCRC, receivedCRC));
} }
} else { } else {
throw new RileyLinkCommunicationException(RileyLinkBLEError.TooShortOrNullResponse); throw new RileyLinkCommunicationException(RileyLinkBLEError.TooShortOrNullResponse);
} }
} }
break; break;
default: default:
throw new NotImplementedException("this {" + RileyLinkUtil.getEncoding().toString() throw new NotImplementedException("this {" + RileyLinkUtil.getInstance().getEncoding().toString()
+ "} encoding is not supported"); + "} encoding is not supported");
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
decodedOK = false; decodedOK = false;

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class RileyLinkStatusActivity extends NoSplashAppCompatActivity { public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
@Inject ResourceHelper resourceHelper; @Inject ResourceHelper resourceHelper;
@Inject RileyLinkUtil rileyLinkUtil;
TextView connectionStatus; TextView connectionStatus;
TextView configuredAddress; TextView configuredAddress;
@ -76,7 +77,7 @@ public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
this.connectedDevice = findViewById(R.id.rls_t1_connected_device); this.connectedDevice = findViewById(R.id.rls_t1_connected_device);
this.connectionError = findViewById(R.id.rls_t1_connection_error); this.connectionError = findViewById(R.id.rls_t1_connection_error);
rileyLinkServiceData = RileyLinkUtil.getRileyLinkServiceData(); rileyLinkServiceData = rileyLinkUtil.getRileyLinkServiceData();
// // 7-12 // // 7-12
// int[] ids = {R.id.rls_t1_tv02, R.id.rls_t1_tv03, R.id.rls_t1_tv04, R.id.rls_t1_tv05, R.id.rls_t1_tv07, // // int[] ids = {R.id.rls_t1_tv02, R.id.rls_t1_tv03, R.id.rls_t1_tv04, R.id.rls_t1_tv05, R.id.rls_t1_tv07, //
@ -114,8 +115,8 @@ public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mSectionsPagerAdapter.addFragment(new RileyLinkStatusGeneral(), resourceHelper.gs(R.string.rileylink_settings_tab1)); mSectionsPagerAdapter.addFragment(new RileyLinkStatusGeneralFragment(), resourceHelper.gs(R.string.rileylink_settings_tab1));
mSectionsPagerAdapter.addFragment(new RileyLinkStatusHistory(), resourceHelper.gs(R.string.rileylink_settings_tab2)); mSectionsPagerAdapter.addFragment(new RileyLinkStatusHistoryFragment(), resourceHelper.gs(R.string.rileylink_settings_tab2));
//mSectionsPagerAdapter.addFragment(new RileyLinkStatusDevice(), "Medtronic"); //mSectionsPagerAdapter.addFragment(new RileyLinkStatusDevice(), "Medtronic");
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.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;
@ -11,6 +10,9 @@ import org.joda.time.LocalDateTime;
import java.util.Locale; import java.util.Locale;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
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;
@ -27,7 +29,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
* Created by andy on 5/19/18. * Created by andy on 5/19/18.
*/ */
public class RileyLinkStatusGeneral extends Fragment implements RefreshableInterface { public class RileyLinkStatusGeneralFragment extends DaggerFragment implements RefreshableInterface {
@Inject RileyLinkUtil rileyLinkUtil;
TextView connectionStatus; TextView connectionStatus;
TextView configuredAddress; TextView configuredAddress;
@ -58,7 +62,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
rileyLinkServiceData = RileyLinkUtil.getRileyLinkServiceData(); rileyLinkServiceData = rileyLinkUtil.getRileyLinkServiceData();
this.connectionStatus = getActivity().findViewById(R.id.rls_t1_connection_status); this.connectionStatus = getActivity().findViewById(R.id.rls_t1_connection_status);
this.configuredAddress = getActivity().findViewById(R.id.rls_t1_configured_address); this.configuredAddress = getActivity().findViewById(R.id.rls_t1_configured_address);
@ -93,12 +97,12 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
public void refreshData() { public void refreshData() {
RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice(); RileyLinkTargetDevice targetDevice = rileyLinkUtil.getTargetDevice();
if (RileyLinkUtil.getServiceState()==null) if (rileyLinkUtil.getServiceState() == null)
this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice))); this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice)));
else else
this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice))); this.connectionStatus.setText(MainApp.gs(rileyLinkUtil.getServiceState().getResourceId(targetDevice)));
if (rileyLinkServiceData != null) { if (rileyLinkServiceData != null) {
this.configuredAddress.setText(rileyLinkServiceData.rileylinkAddress); this.configuredAddress.setText(rileyLinkServiceData.rileylinkAddress);
@ -109,7 +113,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110; RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110;
if (firmwareVersion==null) { if (firmwareVersion == null) {
this.firmwareVersion.setText("BLE113: -\nCC110: -"); this.firmwareVersion.setText("BLE113: -\nCC110: -");
} else { } else {
this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + // this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + //

View file

@ -12,6 +12,9 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
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.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
@ -23,7 +26,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
* Created by andy on 5/19/18. * Created by andy on 5/19/18.
*/ */
public class RileyLinkStatusHistory extends Fragment implements RefreshableInterface { public class RileyLinkStatusHistoryFragment extends DaggerFragment implements RefreshableInterface {
@Inject RileyLinkUtil rileyLinkUtil;
RecyclerView recyclerView; RecyclerView recyclerView;
RecyclerViewAdapter recyclerViewAdapter; RecyclerViewAdapter recyclerViewAdapter;
@ -59,8 +64,8 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter
@Override @Override
public void refreshData() { public void refreshData() {
if (RileyLinkUtil.getRileyLinkHistory()!=null) { if (rileyLinkUtil.getRileyLinkHistory()!=null) {
recyclerViewAdapter.addItemsAndClean(RileyLinkUtil.getRileyLinkHistory()); recyclerViewAdapter.addItemsAndClean(rileyLinkUtil.getRileyLinkHistory());
} }
} }

View file

@ -15,6 +15,7 @@ import javax.inject.Inject
class RileyLinkBluetoothStateReceiver : DaggerBroadcastReceiver() { class RileyLinkBluetoothStateReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var rileyLinkUtil: RileyLinkUtil
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent) super.onReceive(context, intent)
@ -27,7 +28,7 @@ class RileyLinkBluetoothStateReceiver : DaggerBroadcastReceiver() {
BluetoothAdapter.STATE_ON -> { BluetoothAdapter.STATE_ON -> {
aapsLogger.debug("RileyLinkBluetoothStateReceiver: Bluetooth back on. Sending broadcast to RileyLink Framework") aapsLogger.debug("RileyLinkBluetoothStateReceiver: Bluetooth back on. Sending broadcast to RileyLink Framework")
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothReconnected) rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.BluetoothReconnected)
} }
} }
} }

View file

@ -5,20 +5,22 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service;
*/ */
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject;
import dagger.android.DaggerBroadcastReceiver;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; 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;
@ -31,14 +33,17 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTask;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
/** /**
* I added this class outside of RileyLinkService, because for now it's very important part of RL framework and * I added this class outside of RileyLinkService, because for now it's very important part of RL framework and
* where we get a lot of problems. Especially merging between AAPS and RileyLinkAAPS. I might put it back at * where we get a lot of problems. Especially merging between AAPS and RileyLinkAAPS. I might put it back at
* later time * later time
*/ */
public class RileyLinkBroadcastReceiver extends BroadcastReceiver { public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
@Inject RileyLinkUtil rileyLinkUtil;
@Inject SP sp;
private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPCOMM); private static final Logger LOG = StacktraceLoggerWrapper.getLogger(L.PUMPCOMM);
@ -88,6 +93,7 @@ public class RileyLinkBroadcastReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
if (intent == null) { if (intent == null) {
LOG.error("onReceive: received null intent"); LOG.error("onReceive: received null intent");
@ -135,10 +141,9 @@ public class RileyLinkBroadcastReceiver extends BroadcastReceiver {
if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnected)) { if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnected)) {
if (BluetoothAdapter.getDefaultAdapter().isEnabled()) { if (BluetoothAdapter.getDefaultAdapter().isEnabled()) {
RileyLinkUtil rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable);
.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.RileyLinkUnreachable);
} else { } else {
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled);
} }
return true; return true;
@ -166,14 +171,14 @@ public class RileyLinkBroadcastReceiver extends BroadcastReceiver {
LOG.debug("RfSpy Radio version (CC110): " + rlVersion.name()); LOG.debug("RfSpy Radio version (CC110): " + rlVersion.name());
this.serviceInstance.rileyLinkServiceData.versionCC110 = rlVersion; this.serviceInstance.rileyLinkServiceData.versionCC110 = rlVersion;
ServiceTask task = new InitializePumpManagerTask(RileyLinkUtil.getTargetDevice()); ServiceTask task = new InitializePumpManagerTask(rileyLinkUtil.getTargetDevice());
ServiceTaskExecutor.startTask(task); ServiceTaskExecutor.startTask(task);
if (isLoggingEnabled()) if (isLoggingEnabled())
LOG.info("Announcing RileyLink open For business"); LOG.info("Announcing RileyLink open For business");
return true; return true;
} 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"); LOG.error("No Rileylink BLE Address saved in app");
} else { } else {

View file

@ -25,8 +25,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
import static info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil.getRileyLinkCommunicationManager;
/** /**
* Created by andy on 5/6/18. * Created by andy on 5/6/18.
* Split from original file and renamed. * Split from original file and renamed.
@ -36,6 +34,7 @@ public abstract class RileyLinkService extends DaggerService {
@Inject protected AAPSLogger aapsLogger; @Inject protected AAPSLogger aapsLogger;
@Inject protected SP sp; @Inject protected SP sp;
@Inject protected Context context; @Inject protected Context context;
@Inject protected RileyLinkUtil rileyLinkUtil;
public RileyLinkBLE rileyLinkBLE; // android-bluetooth management public RileyLinkBLE rileyLinkBLE; // android-bluetooth management
@ -50,9 +49,8 @@ public abstract class RileyLinkService extends DaggerService {
super.onCreate(); super.onCreate();
//LOG.debug("onCreate"); //LOG.debug("onCreate");
RileyLinkUtil.setContext(this.context); rileyLinkUtil.setRileyLinkService(this);
RileyLinkUtil.setRileyLinkService(this); rileyLinkUtil.setEncoding(getEncoding());
RileyLinkUtil.setEncoding(getEncoding());
initRileyLinkServiceData(); initRileyLinkServiceData();
mBroadcastReceiver = new RileyLinkBroadcastReceiver(this, this.context); mBroadcastReceiver = new RileyLinkBroadcastReceiver(this, this.context);
@ -134,27 +132,26 @@ public abstract class RileyLinkService extends DaggerService {
// We've received a service startCommand, we grab the lock. // We've received a service startCommand, we grab the lock.
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
RileyLinkUtil.setContext(getApplicationContext());
return (START_STICKY); return (START_STICKY);
} }
public boolean bluetoothInit() { public boolean bluetoothInit() {
aapsLogger.debug(LTag.PUMPCOMM, "bluetoothInit: attempting to get an adapter"); aapsLogger.debug(LTag.PUMPCOMM, "bluetoothInit: attempting to get an adapter");
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothInitializing); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothInitializing);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter == null) { if (bluetoothAdapter == null) {
aapsLogger.error("Unable to obtain a BluetoothAdapter."); aapsLogger.error("Unable to obtain a BluetoothAdapter.");
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.NoBluetoothAdapter); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.NoBluetoothAdapter);
} else { } else {
if (!bluetoothAdapter.isEnabled()) { if (!bluetoothAdapter.isEnabled()) {
aapsLogger.error("Bluetooth is not enabled."); aapsLogger.error("Bluetooth is not enabled.");
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.BluetoothDisabled);
} else { } else {
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothReady); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothReady);
return true; return true;
} }
} }
@ -167,11 +164,11 @@ public abstract class RileyLinkService extends DaggerService {
public boolean reconfigureRileyLink(String deviceAddress) { public boolean reconfigureRileyLink(String deviceAddress) {
if (rileyLinkBLE == null) { if (rileyLinkBLE == null) {
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothInitializing); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothInitializing);
return false; return false;
} }
RileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkInitializing); rileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkInitializing);
if (rileyLinkBLE.isConnected()) { if (rileyLinkBLE.isConnected()) {
if (deviceAddress.equals(rileyLinkServiceData.rileylinkAddress)) { if (deviceAddress.equals(rileyLinkServiceData.rileylinkAddress)) {
@ -192,10 +189,10 @@ public abstract class RileyLinkService extends DaggerService {
} else { } else {
aapsLogger.debug(LTag.PUMPCOMM, "Using RL " + deviceAddress); aapsLogger.debug(LTag.PUMPCOMM, "Using RL " + deviceAddress);
if (RileyLinkUtil.getServiceState() == RileyLinkServiceState.NotStarted) { if (rileyLinkUtil.getServiceState() == RileyLinkServiceState.NotStarted) {
if (!bluetoothInit()) { if (!bluetoothInit()) {
aapsLogger.error("RileyLink can't get activated, Bluetooth is not functioning correctly. {}", aapsLogger.error("RileyLink can't get activated, Bluetooth is not functioning correctly. {}",
RileyLinkUtil.getError() != null ? RileyLinkUtil.getError().name() : "Unknown error (null)"); rileyLinkUtil.getError() != null ? rileyLinkUtil.getError().name() : "Unknown error (null)");
return false; return false;
} }
} }
@ -214,7 +211,7 @@ public abstract class RileyLinkService extends DaggerService {
// FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc. // FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc.
public void doTuneUpDevice() { public void doTuneUpDevice() {
RileyLinkUtil.setServiceState(RileyLinkServiceState.TuneUpDevice); rileyLinkUtil.setServiceState(RileyLinkServiceState.TuneUpDevice);
MedtronicUtil.setPumpDeviceState(PumpDeviceState.Sleeping); MedtronicUtil.setPumpDeviceState(PumpDeviceState.Sleeping);
double lastGoodFrequency = 0.0d; double lastGoodFrequency = 0.0d;
@ -239,11 +236,10 @@ public abstract class RileyLinkService extends DaggerService {
if (newFrequency == 0.0d) { if (newFrequency == 0.0d) {
// error tuning pump, pump not present ?? // error tuning pump, pump not present ??
RileyLinkUtil rileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkError.TuneUpOfDeviceFailed);
.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkError.TuneUpOfDeviceFailed);
} else { } else {
getRileyLinkCommunicationManager().clearNotConnectedCount(); rileyLinkUtil.getRileyLinkCommunicationManager().clearNotConnectedCount();
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady); rileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady);
} }
} }
@ -255,7 +251,7 @@ public abstract class RileyLinkService extends DaggerService {
rileyLinkServiceData.rileylinkAddress = null; rileyLinkServiceData.rileylinkAddress = null;
} }
RileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothReady); rileyLinkUtil.setServiceState(RileyLinkServiceState.BluetoothReady);
} }

View file

@ -23,8 +23,8 @@ public class DiscoverGattServicesTask extends ServiceTask {
public void run() { public void run() {
if (needToConnect) if (needToConnect)
RileyLinkUtil.getRileyLinkBLE().connectGatt(); RileyLinkUtil.getInstance().getRileyLinkBLE().connectGatt();
RileyLinkUtil.getRileyLinkBLE().discoverServices(); RileyLinkUtil.getInstance().getRileyLinkBLE().discoverServices();
} }
} }

View file

@ -1,9 +1,6 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks;
import android.util.Log;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
@ -13,7 +10,6 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
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.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.util.MedtronicConst;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
/** /**
@ -43,42 +39,42 @@ public class InitializePumpManagerTask extends ServiceTask {
double lastGoodFrequency = 0.0d; double lastGoodFrequency = 0.0d;
if (RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency==null) { if (RileyLinkUtil.getInstance().getRileyLinkServiceData().lastGoodFrequency == null) {
lastGoodFrequency = SP.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d); lastGoodFrequency = SP.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d);
lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d; lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d;
RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency = lastGoodFrequency; RileyLinkUtil.getInstance().getRileyLinkServiceData().lastGoodFrequency = lastGoodFrequency;
// if (RileyLinkUtil.getRileyLinkTargetFrequency() == null) { // if (RileyLinkUtil.getRileyLinkTargetFrequency() == null) {
// String pumpFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency, null); // String pumpFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency, null);
// } // }
} else { } else {
lastGoodFrequency = RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency; lastGoodFrequency = RileyLinkUtil.getInstance().getRileyLinkServiceData().lastGoodFrequency;
} }
if ((lastGoodFrequency > 0.0d) if ((lastGoodFrequency > 0.0d)
&& RileyLinkUtil.getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) { && RileyLinkUtil.getInstance().getRileyLinkCommunicationManager().isValidFrequency(lastGoodFrequency)) {
RileyLinkUtil.setServiceState(RileyLinkServiceState.RileyLinkReady); RileyLinkUtil.getInstance().setServiceState(RileyLinkServiceState.RileyLinkReady);
if (L.isEnabled(L.PUMPCOMM)) if (L.isEnabled(L.PUMPCOMM))
LOG.info("Setting radio frequency to {} MHz", lastGoodFrequency); LOG.info("Setting radio frequency to {} MHz", lastGoodFrequency);
RileyLinkUtil.getRileyLinkCommunicationManager().setRadioFrequencyForPump(lastGoodFrequency); RileyLinkUtil.getInstance().getRileyLinkCommunicationManager().setRadioFrequencyForPump(lastGoodFrequency);
boolean foundThePump = RileyLinkUtil.getRileyLinkCommunicationManager().tryToConnectToDevice(); boolean foundThePump = RileyLinkUtil.getInstance().getRileyLinkCommunicationManager().tryToConnectToDevice();
if (foundThePump) { if (foundThePump) {
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorReady); RileyLinkUtil.getInstance().setServiceState(RileyLinkServiceState.PumpConnectorReady);
} else { } else {
RileyLinkUtil.setServiceState(RileyLinkServiceState.PumpConnectorError, RileyLinkUtil.getInstance().setServiceState(RileyLinkServiceState.PumpConnectorError,
RileyLinkError.NoContactWithDevice); RileyLinkError.NoContactWithDevice);
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
} }
} else { } else {
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump); RileyLinkUtil.getInstance().sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
} }
} }
} }

View file

@ -19,7 +19,7 @@ public class RileyLinkSelectPreference extends Preference {
super(context); super(context);
setInitialSummaryValue(); setInitialSummaryValue();
MedtronicUtil.setRileyLinkSelectPreference(this); MedtronicUtil.getInstance().setRileyLinkSelectPreference(this);
} }
@ -27,7 +27,7 @@ public class RileyLinkSelectPreference extends Preference {
super(context, attrs); super(context, attrs);
setInitialSummaryValue(); setInitialSummaryValue();
MedtronicUtil.setRileyLinkSelectPreference(this); MedtronicUtil.getInstance().setRileyLinkSelectPreference(this);
} }

View file

@ -57,6 +57,7 @@ class MedtronicFragment : DaggerFragment() {
@Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin
@Inject lateinit var warnColors: WarnColors @Inject lateinit var warnColors: WarnColors
@Inject lateinit var rileyLinkUtil: RileyLinkUtil
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -173,10 +174,10 @@ class MedtronicFragment : DaggerFragment() {
private fun setDeviceStatus() { private fun setDeviceStatus() {
val pumpStatus: MedtronicPumpStatus = MedtronicUtil.getPumpStatus() val pumpStatus: MedtronicPumpStatus = MedtronicUtil.getPumpStatus()
pumpStatus.rileyLinkServiceState = checkStatusSet(pumpStatus.rileyLinkServiceState, pumpStatus.rileyLinkServiceState = checkStatusSet(pumpStatus.rileyLinkServiceState,
RileyLinkUtil.getServiceState()) as RileyLinkServiceState? rileyLinkUtil.getServiceState()) as RileyLinkServiceState?
val resourceId = pumpStatus.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump) val resourceId = pumpStatus.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump)
val rileyLinkError = RileyLinkUtil.getError() val rileyLinkError = rileyLinkUtil.getError()
medtronic_rl_status.text = medtronic_rl_status.text =
when { when {
pumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) pumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
@ -187,7 +188,7 @@ class MedtronicFragment : DaggerFragment() {
} }
medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE) medtronic_rl_status.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
pumpStatus.rileyLinkError = checkStatusSet(pumpStatus.rileyLinkError, RileyLinkUtil.getError()) as RileyLinkError? pumpStatus.rileyLinkError = checkStatusSet(pumpStatus.rileyLinkError, rileyLinkUtil.getError()) as RileyLinkError?
medtronic_errors.text = medtronic_errors.text =
pumpStatus.rileyLinkError?.let { pumpStatus.rileyLinkError?.let {

View file

@ -53,6 +53,7 @@ import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract;
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.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
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.service.tasks.ResetRileyLinkConfigurationTask; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
@ -95,6 +96,7 @@ import static info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUt
public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInterface { public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInterface {
private final SP sp; private final SP sp;
private final RileyLinkUtil rileyLinkUtil;
protected static MedtronicPumpPlugin plugin = null; protected static MedtronicPumpPlugin plugin = null;
private RileyLinkMedtronicService medtronicService; private RileyLinkMedtronicService medtronicService;
@ -125,7 +127,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
ActivePluginProvider activePlugin, ActivePluginProvider activePlugin,
SP sp, SP sp,
CommandQueueProvider commandQueue, CommandQueueProvider commandQueue,
FabricPrivacy fabricPrivacy FabricPrivacy fabricPrivacy,
RileyLinkUtil rileyLinkUtil
) { ) {
super(new PluginDescription() // super(new PluginDescription() //
@ -139,7 +142,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
); );
this.plugin = this; this.plugin = this;
this.rxBus = rxBus; this.rileyLinkUtil = rileyLinkUtil;
this.sp = sp; this.sp = sp;
displayConnectionMessages = false; displayConnectionMessages = false;
@ -177,7 +180,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
medtronicUIComm = new MedtronicUIComm(aapsLogger, rxBus, getResourceHelper()); medtronicUIComm = new MedtronicUIComm(aapsLogger, rxBus, getResourceHelper(), rileyLinkUtil);
medtronicHistoryData = new MedtronicHistoryData(aapsLogger, sp, activePlugin); medtronicHistoryData = new MedtronicHistoryData(aapsLogger, sp, activePlugin);
} }

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
public class MedtronicUIComm { public class MedtronicUIComm {
private final AAPSLogger aapsLogger; private final AAPSLogger aapsLogger;
private final RileyLinkUtil rileyLinkUtil;
MedtronicCommunicationManager mcmInstance = null; MedtronicCommunicationManager mcmInstance = null;
MedtronicUIPostprocessor uiPostprocessor; MedtronicUIPostprocessor uiPostprocessor;
@ -23,9 +24,11 @@ public class MedtronicUIComm {
public MedtronicUIComm( public MedtronicUIComm(
AAPSLogger aapsLogger, AAPSLogger aapsLogger,
RxBusWrapper rxBus, RxBusWrapper rxBus,
ResourceHelper resourceHelper ResourceHelper resourceHelper,
RileyLinkUtil rileyLinkUtil
) { ) {
this.aapsLogger = aapsLogger; this.aapsLogger = aapsLogger;
this.rileyLinkUtil = rileyLinkUtil;
uiPostprocessor = new MedtronicUIPostprocessor(aapsLogger, rxBus, resourceHelper); uiPostprocessor = new MedtronicUIPostprocessor(aapsLogger, rxBus, resourceHelper);
} }
@ -108,6 +111,6 @@ public class MedtronicUIComm {
public void startTunning() { public void startTunning() {
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump); rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.IPC.MSG_PUMP_tunePump);
} }
} }

View file

@ -69,7 +69,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP;
public class MedtronicHistoryData { public class MedtronicHistoryData {
private static AAPSLogger aapsLogger; private AAPSLogger aapsLogger;
private SP sp; private SP sp;
private ActivePluginProvider activePlugin; private ActivePluginProvider activePlugin;
@ -138,7 +138,7 @@ public class MedtronicHistoryData {
} }
private static void showLogs(String header, String data) { private void showLogs(String header, String data) {
if (header != null) { if (header != null) {
aapsLogger.debug(LTag.PUMP, header); aapsLogger.debug(LTag.PUMP, header);
} }

View file

@ -211,7 +211,7 @@ public class MedtronicPumpStatus extends PumpStatus {
: RileyLinkTargetFrequency.Medtronic_WorldWide; : RileyLinkTargetFrequency.Medtronic_WorldWide;
if (targetFrequency != newTargetFrequency) { if (targetFrequency != newTargetFrequency) {
RileyLinkUtil.setRileyLinkTargetFrequency(newTargetFrequency); RileyLinkUtil.getInstance().setRileyLinkTargetFrequency(newTargetFrequency);
targetFrequency = newTargetFrequency; targetFrequency = newTargetFrequency;
targetFrequencyChanged = true; targetFrequencyChanged = true;
} }
@ -311,12 +311,12 @@ public class MedtronicPumpStatus extends PumpStatus {
} }
if (rileyLinkAddressChanged) { if (rileyLinkAddressChanged) {
MedtronicUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet); MedtronicUtil.getInstance().sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkNewAddressSet);
rileyLinkAddressChanged = false; rileyLinkAddressChanged = false;
} }
if (encodingChanged) { if (encodingChanged) {
RileyLinkUtil.getRileyLinkService().changeRileyLinkEncoding(encodingType); RileyLinkUtil.getInstance().getRileyLinkService().changeRileyLinkEncoding(encodingType);
encodingChanged = false; encodingChanged = false;
} }
} }

View file

@ -87,8 +87,8 @@ public class RileyLinkMedtronicService extends RileyLinkService {
rileyLinkServiceData = new RileyLinkServiceData(RileyLinkTargetDevice.MedtronicPump); rileyLinkServiceData = new RileyLinkServiceData(RileyLinkTargetDevice.MedtronicPump);
RileyLinkUtil.setRileyLinkServiceData(rileyLinkServiceData); rileyLinkUtil.setRileyLinkServiceData(rileyLinkServiceData);
RileyLinkUtil.setTargetDevice(RileyLinkTargetDevice.MedtronicPump); rileyLinkUtil.setTargetDevice(RileyLinkTargetDevice.MedtronicPump);
setPumpIDString(sp.getString(MedtronicConst.Prefs.PumpSerial, "000000")); setPumpIDString(sp.getString(MedtronicConst.Prefs.PumpSerial, "000000"));
@ -99,7 +99,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
rfspy = new RFSpy(rileyLinkBLE); rfspy = new RFSpy(rileyLinkBLE);
rfspy.startReader(); rfspy.startReader();
RileyLinkUtil.setRileyLinkBLE(rileyLinkBLE); rileyLinkUtil.setRileyLinkBLE(rileyLinkBLE);
// init rileyLinkCommunicationManager // init rileyLinkCommunicationManager
medtronicCommunicationManager = new MedtronicCommunicationManager(context, rfspy); medtronicCommunicationManager = new MedtronicCommunicationManager(context, rfspy);
@ -177,7 +177,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
// PumpInterface - REMOVE // PumpInterface - REMOVE
public boolean isInitialized() { public boolean isInitialized() {
return RileyLinkServiceState.isReady(RileyLinkUtil.getRileyLinkServiceData().serviceState); return RileyLinkServiceState.isReady(rileyLinkUtil.getRileyLinkServiceData().serviceState);
} }

View file

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneral"> tools:context=".plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusGeneralFragment">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistory"> tools:context=".plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusHistoryFragment">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"