Remove redundant code and improve comment

This commit is contained in:
Bart Sopers 2020-12-25 02:17:43 +01:00
parent f596348d85
commit 33297ae4cf
3 changed files with 1 additions and 16 deletions

View file

@ -108,7 +108,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress); sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump(); RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump();
rileyLinkPump.getRileyLinkService().verifyConfiguration(true); // force reloading of address rileyLinkPump.getRileyLinkService().verifyConfiguration(true); // force reloading of address to assure that the RL gets reconnected (even if the address didn't change)
rileyLinkPump.triggerPumpConfigurationChangedEvent(); rileyLinkPump.triggerPumpConfigurationChangedEvent();
finish(); finish();

View file

@ -112,18 +112,6 @@ public class RFSpy {
reader.newDataIsAvailable(); reader.newDataIsAvailable();
} }
public String getBleDeviceName() {
BLECommOperationResult result = rileyLinkBle.readCharacteristic_blocking(UUID.fromString(GattAttributes.SERVICE_GAP), UUID.fromString(GattAttributes.CHARA_GAP_NAME));
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
String value = new String(result.value);
aapsLogger.debug(LTag.PUMPBTCOMM, "BLE device name: {}", value);
return value;
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "getBleDeviceName failed with code: " + result.resultCode);
return null;
}
}
public Integer getBatteryLevel() { public Integer getBatteryLevel() {
BLECommOperationResult result = rileyLinkBle.readCharacteristic_blocking(batteryServiceUUID, batteryLevelUUID); BLECommOperationResult result = rileyLinkBle.readCharacteristic_blocking(batteryServiceUUID, batteryLevelUUID);
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) { if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {

View file

@ -152,9 +152,6 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
String bleVersion = rileyLinkService.rfspy.getBLEVersionCached(); String bleVersion = rileyLinkService.rfspy.getBLEVersionCached();
RileyLinkFirmwareVersion rlVersion = rileyLinkServiceData.firmwareVersion; RileyLinkFirmwareVersion rlVersion = rileyLinkServiceData.firmwareVersion;
rileyLinkServiceData.rileyLinkName = rileyLinkService.rfspy.getBleDeviceName();
aapsLogger.debug(LTag.PUMPBTCOMM, "BLE device name: {}", rileyLinkServiceData.rileyLinkName);
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): " + bleVersion); aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy version (BLE113): " + bleVersion);
rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion; rileyLinkService.rileyLinkServiceData.versionBLE113 = bleVersion;