- changed build file

- some changes to RileyLinkBLE to handle displaying Error
- loadSessionState from util used
- remove driver specific identifier functionality from RileyLinkService
This commit is contained in:
Andy Rozman 2020-05-09 12:03:17 +01:00
parent e2e4c6a17f
commit d177e08355
5 changed files with 14 additions and 46 deletions

View file

@ -139,8 +139,8 @@ android {
// OMNIPOD: Keep track of what commit from the main repository we're on, these fields aren't actually used anywhere // OMNIPOD: Keep track of what commit from the main repository we're on, these fields aren't actually used anywhere
buildConfigField "String", "DEV_VERSION", '"2.6.5-dev"' buildConfigField "String", "DEV_VERSION", '"2.6.5-dev"'
buildConfigField "String", "DEV_VERSION_COMMIT", '"b87155ead499167b3d42a73e3daf808494f10a2d"' buildConfigField "String", "DEV_VERSION_COMMIT", '"cf291b3adc2a8df06fd99220b59b500298c8e56f"'
buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"24.4.2020"' // 24th April buildConfigField "String", "DEV_VERSION_COMMIT_DATE", '"6.5.2020"' // 6th May
ndk { ndk {
moduleName "BleCommandUtil" moduleName "BleCommandUtil"

View file

@ -152,8 +152,8 @@ public class RileyLinkBLE {
} else if ((newState == BluetoothProfile.STATE_CONNECTING) || // } else if ((newState == BluetoothProfile.STATE_CONNECTING) || //
(newState == BluetoothProfile.STATE_DISCONNECTING)) { (newState == BluetoothProfile.STATE_DISCONNECTING)) {
// aapsLogger.debug(LTag.PUMPBTCOMM,"We are in {} state.", status == BluetoothProfile.STATE_CONNECTING ? "Connecting" : aapsLogger.debug(LTag.PUMPBTCOMM,"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, context); rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnected, context);
if (manualDisconnect) if (manualDisconnect)
@ -243,8 +243,6 @@ public class RileyLinkBLE {
if (rileyLinkFound) { if (rileyLinkFound) {
mIsConnected = true; mIsConnected = true;
rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkReady, context); rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkReady, context);
// RileyLinkUtil.sendNotification(new
// ServiceNotification(RileyLinkConst.Intents.RileyLinkReady), null);
} else { } else {
mIsConnected = false; mIsConnected = false;
rileyLinkServiceData.setServiceState(RileyLinkServiceState.RileyLinkError, rileyLinkServiceData.setServiceState(RileyLinkServiceState.RileyLinkError,
@ -273,7 +271,6 @@ public class RileyLinkBLE {
if (isAnyRileyLinkServiceFound(serviceI)) { if (isAnyRileyLinkServiceFound(serviceI)) {
return true; return true;
} }
} }
} }
@ -433,6 +430,7 @@ public class RileyLinkBLE {
// Catch if the service is not supported by the BLE device // Catch if the service is not supported by the BLE device
rval.resultCode = BLECommOperationResult.RESULT_NONE; rval.resultCode = BLECommOperationResult.RESULT_NONE;
aapsLogger.error(LTag.PUMPBTCOMM, "BT Device not supported"); aapsLogger.error(LTag.PUMPBTCOMM, "BT Device not supported");
rileyLinkServiceData.setServiceState(RileyLinkServiceState.BluetoothError, RileyLinkError.NoBluetoothAdapter);
// TODO: 11/07/2016 UI update for user // TODO: 11/07/2016 UI update for user
} else { } else {
BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID) BluetoothGattCharacteristic chara = bluetoothConnectionGatt.getService(serviceUUID)

View file

@ -114,21 +114,6 @@ public abstract class RileyLinkService extends DaggerService {
} }
/**
* Prefix for Device specific broadcast identifier prefix (for example MSG_PUMP_ for pump or
* MSG_POD_ for Omnipod)
*
* @return
*/
public abstract String getDeviceSpecificBroadcastsIdentifierPrefix();
public abstract boolean handleDeviceSpecificBroadcasts(Intent intent);
public abstract void registerDeviceSpecificBroadcasts(IntentFilter intentFilter);
public abstract RileyLinkCommunicationManager getDeviceCommunicationManager(); public abstract RileyLinkCommunicationManager getDeviceCommunicationManager();
// Here is where the wake-lock begins: // Here is where the wake-lock begins:

View file

@ -34,7 +34,7 @@ public class RileyLinkServiceData {
public RileyLinkError rileyLinkError; public RileyLinkError rileyLinkError;
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted; public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
public RileyLinkFirmwareVersion firmwareVersion; public RileyLinkFirmwareVersion firmwareVersion;
public RileyLinkTargetFrequency rileyLinkTargetFrequency; public RileyLinkTargetFrequency rileyLinkTargetFrequency; // TODO this might not be correct place
public String rileylinkAddress; public String rileylinkAddress;
long lastTuneUpTime = 0L; long lastTuneUpTime = 0L;
@ -45,7 +45,7 @@ public class RileyLinkServiceData {
// radio version // radio version
public RileyLinkFirmwareVersion versionCC110; public RileyLinkFirmwareVersion versionCC110;
public RileyLinkTargetDevice targetDevice; public RileyLinkTargetDevice targetDevice; // TODO this might not be correct place
// Medtronic Pump // Medtronic Pump
public String pumpID; public String pumpID;

View file

@ -115,12 +115,13 @@ public class RileyLinkOmnipodService extends RileyLinkService {
PodSessionState podState = null; PodSessionState podState = null;
if (sp.contains(OmnipodConst.Prefs.PodState) && omnipodUtil.getPodSessionState() == null) { if (sp.contains(OmnipodConst.Prefs.PodState) && omnipodUtil.getPodSessionState() == null) {
try { try {
Gson gson = omnipodUtil.getGsonInstance(); omnipodUtil.loadSessionState();
String storedPodState = sp.getString(OmnipodConst.Prefs.PodState, ""); // Gson gson = omnipodUtil.getGsonInstance();
aapsLogger.info(LTag.PUMPCOMM, "PodSessionState-SP: loaded from SharedPreferences: " + storedPodState); // String storedPodState = sp.getString(OmnipodConst.Prefs.PodState, "");
podState = gson.fromJson(storedPodState, PodSessionState.class); // aapsLogger.info(LTag.PUMPCOMM, "PodSessionState-SP: loaded from SharedPreferences: " + storedPodState);
podState.injectDaggerClass(injector); // podState = gson.fromJson(storedPodState, PodSessionState.class);
omnipodUtil.setPodSessionState(podState); // podState.injectDaggerClass(injector);
// omnipodUtil.setPodSessionState(podState);
} catch (Exception ex) { } catch (Exception ex) {
aapsLogger.error(LTag.PUMPCOMM, "Could not deserialize Pod state", ex); aapsLogger.error(LTag.PUMPCOMM, "Could not deserialize Pod state", ex);
} }
@ -178,22 +179,6 @@ public class RileyLinkOmnipodService extends RileyLinkService {
} }
@Override
public String getDeviceSpecificBroadcastsIdentifierPrefix() {
return null;
}
public boolean handleDeviceSpecificBroadcasts(Intent intent) {
return false;
}
@Override
public void registerDeviceSpecificBroadcasts(IntentFilter intentFilter) {
}
public boolean verifyConfiguration() { public boolean verifyConfiguration() {
try { try {
omnipodPumpStatus.errorDescription = "-"; omnipodPumpStatus.errorDescription = "-";