From 302622bf699a05b7dd896ad97c857c4a0562459c Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 25 Dec 2020 15:05:01 +0100 Subject: [PATCH 01/11] Update version for Omnipod This reverts commit 55cc46c4750df89dac581a51b443456aed07e2b8. --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c9e31881d3..af78525894 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -120,7 +120,7 @@ android { targetSdkVersion 28 multiDexEnabled true versionCode 1500 - version "2.7.2-dev" + version "2.8.0-dev-omnipod" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' From fcd3276e47434a38476c42fae0fced0214066907 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 25 Dec 2020 18:43:51 +0100 Subject: [PATCH 02/11] Rework RileyLink scan and add option to remove RileyLink --- .../dependencyInjection/ActivitiesModule.kt | 4 +- medtronic/src/main/res/xml/pref_medtronic.xml | 2 +- omnipod/src/main/res/values/strings.xml | 1 + omnipod/src/main/res/xml/pref_omnipod.xml | 5 +- rileylink/src/main/AndroidManifest.xml | 7 +- ...y.java => RileyLinkBLEConfigActivity.java} | 271 +++++++----------- .../data/encoding/Encoding4b6bAbstract.java | 4 +- .../ble/data/encoding/Encoding4b6bGeoff.java | 4 +- .../ble/data/encoding/Encoding4b6bGo.java | 4 +- .../ble/data/encoding/Encoding4b6bLoop.java | 4 +- .../RileyLinkStatusGeneralFragment.java | 4 +- .../service/data/ServiceTransport.java | 2 +- .../service/tasks/ServiceTaskExecutor.java | 4 +- .../layout/riley_link_ble_config_activity.xml | 69 +++++ .../res/layout/rileylink_scan_activity.xml | 43 --- .../main/res/layout/rileylink_scan_item.xml | 16 +- .../main/res/menu/menu_rileylink_ble_scan.xml | 2 +- rileylink/src/main/res/values/strings.xml | 29 +- 18 files changed, 227 insertions(+), 248 deletions(-) rename rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/{RileyLinkBLEScanActivity.java => RileyLinkBLEConfigActivity.java} (59%) create mode 100644 rileylink/src/main/res/layout/riley_link_ble_config_activity.xml delete mode 100644 rileylink/src/main/res/layout/rileylink_scan_activity.xml diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt index 8edce1ece4..f6790caa25 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt @@ -10,7 +10,7 @@ import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImp import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansLoginActivity import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity -import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity +import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEConfigActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity @@ -33,7 +33,7 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity @ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity @ContributesAndroidInjector abstract fun contributesRileyLinkStatusActivity(): RileyLinkStatusActivity - @ContributesAndroidInjector abstract fun contributesRileyLinkBLEScanActivity(): RileyLinkBLEScanActivity + @ContributesAndroidInjector abstract fun contributesRileyLinkBLEConfigActivity(): RileyLinkBLEConfigActivity @ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity @ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity @ContributesAndroidInjector abstract fun contributesSmsCommunicatorOtpActivity(): SmsCommunicatorOtpActivity diff --git a/medtronic/src/main/res/xml/pref_medtronic.xml b/medtronic/src/main/res/xml/pref_medtronic.xml index 342250d046..78e20e8ef8 100644 --- a/medtronic/src/main/res/xml/pref_medtronic.xml +++ b/medtronic/src/main/res/xml/pref_medtronic.xml @@ -95,7 +95,7 @@ android:key="@string/key_rileylink_mac_address" android:summary="" android:title="RileyLink Configuration"> - + %1$.2f %2$s (%3$s) + RileyLink Configuration Bolus beeps enabled Basal beeps enabled SMB beeps enabled diff --git a/omnipod/src/main/res/xml/pref_omnipod.xml b/omnipod/src/main/res/xml/pref_omnipod.xml index 79a772e94a..853d5eda9e 100644 --- a/omnipod/src/main/res/xml/pref_omnipod.xml +++ b/omnipod/src/main/res/xml/pref_omnipod.xml @@ -7,9 +7,8 @@ - + android:title="@string/omnipod_config_riley_link_configuration"> + diff --git a/rileylink/src/main/AndroidManifest.xml b/rileylink/src/main/AndroidManifest.xml index c603e9e7ef..3236de84bd 100644 --- a/rileylink/src/main/AndroidManifest.xml +++ b/rileylink/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="info.nightscout.androidaps.plugins.pump.common"> @@ -8,12 +8,13 @@ - + - + + filters; - public ListView listBTScan; - public Toolbar toolbarBTScan; - public Context mContext = this; - private BluetoothAdapter mBluetoothAdapter; - private BluetoothLeScanner mLEScanner; - private LeDeviceListAdapter mLeDeviceListAdapter; - private Handler mHandler; - - private String actionTitleStart, actionTitleStop; - private MenuItem menuItem; + private ScanSettings settings; + private List filters; + private ListView deviceList; + private TextView currentlySelectedRileyLink; + private Button buttonRemoveRileyLink; + private Button buttonStartScan; + private Button buttonStopScan; + private BluetoothAdapter bluetoothAdapter; + private BluetoothLeScanner bleScanner; + private LeDeviceListAdapter deviceListAdapter; + private Handler handler; + public boolean scanning; private boolean rlDisconnected; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.rileylink_scan_activity); + setContentView(R.layout.riley_link_ble_config_activity); // Initializes Bluetooth adapter. - mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - mHandler = new Handler(); - - mLeDeviceListAdapter = new LeDeviceListAdapter(); - listBTScan = findViewById(R.id.rileylink_listBTScan); - listBTScan.setAdapter(mLeDeviceListAdapter); - listBTScan.setOnItemClickListener((parent, view, position, id) -> { - + bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); + deviceListAdapter = new LeDeviceListAdapter(); + handler = new Handler(); + currentlySelectedRileyLink = findViewById(R.id.riley_link_ble_config_currently_selected_riley_link); + buttonRemoveRileyLink = findViewById(R.id.riley_link_ble_config_button_remove_riley_link); + buttonStartScan = findViewById(R.id.riley_link_ble_config_scan_start); + buttonStopScan = findViewById(R.id.riley_link_ble_config_button_scan_stop); + deviceList = findViewById(R.id.riley_link_ble_config_scan_device_list); + deviceList.setAdapter(deviceListAdapter); + deviceList.setOnItemClickListener((parent, view, position, id) -> { // stop scanning if still active - if (mScanning) { - mScanning = false; - mLEScanner.stopScan(mScanCallback2); + if (scanning) { + stopLeDeviceScan(); } - TextView textview = view.findViewById(R.id.rileylink_device_address); - String bleAddress = textview.getText().toString(); + String bleAddress = ((TextView) view.findViewById(R.id.riley_link_ble_config_scan_item_device_address)).getText().toString(); sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress); @@ -114,46 +104,45 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { finish(); }); - toolbarBTScan = findViewById(R.id.rileylink_toolbarBTScan); - toolbarBTScan.setTitle(R.string.rileylink_scanner_title); - setSupportActionBar(toolbarBTScan); + buttonStartScan.setOnClickListener(view -> { + // disable currently selected RL, so that we can discover it + rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect, this); + rlDisconnected = true; + + startLeDeviceScan(); + }); + + buttonStopScan.setOnClickListener(view -> stopLeDeviceScan()); + + buttonRemoveRileyLink.setOnClickListener(view -> new AlertDialog.Builder(this) + .setIcon(android.R.drawable.ic_dialog_alert) + .setTitle(getString(R.string.riley_link_ble_config_remove_riley_link_confirmation_title)) + .setMessage(getString(R.string.riley_link_ble_config_remove_riley_link_confirmation)) + .setPositiveButton(getString(R.string.riley_link_common_yes), (dialog, which) -> { + rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect, RileyLinkBLEConfigActivity.this); + sp.remove(RileyLinkConst.Prefs.RileyLinkAddress); + updateCurrentlySelectedRileyLink(); + }) + .setNegativeButton(getString(R.string.riley_link_common_no), null) + .show()); + } + + private void updateCurrentlySelectedRileyLink() { + String address = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); + if (StringUtils.isEmpty(address)) { + currentlySelectedRileyLink.setText(R.string.riley_link_ble_config_no_riley_link_selected); + buttonRemoveRileyLink.setVisibility(View.GONE); + } else { + currentlySelectedRileyLink.setText(address); + buttonRemoveRileyLink.setVisibility(View.VISIBLE); + } } @Override protected void onResume() { super.onResume(); prepareForScanning(); - } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.menu_rileylink_ble_scan, menu); - - actionTitleStart = resourceHelper.gs(R.string.rileylink_scanner_scan_scan); - actionTitleStop = resourceHelper.gs(R.string.rileylink_scanner_scan_stop); - - menuItem = menu.getItem(0); - - menuItem.setTitle(actionTitleStart); - - return true; - } - - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getTitle().equals(actionTitleStart)) { - // disable currently selected RL, so that we can discover it - rileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect, this); - rlDisconnected = true; - - scanLeDevice(true); - return true; - } else if (item.getTitle().equals(actionTitleStop)) { - scanLeDevice(false); - return true; - } else { - return super.onOptionsItemSelected(item); - } + updateCurrentlySelectedRileyLink(); } @Override public void onBackPressed() { @@ -166,41 +155,34 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { @Override protected void onDestroy() { super.onDestroy(); - mScanning = false; - mLEScanner.stopScan(mScanCallback2); + stopLeDeviceScan(); } private void prepareForScanning() { boolean checkOK = blePrecheck.prerequisitesCheck(this); if (checkOK) { - mLEScanner = mBluetoothAdapter.getBluetoothLeScanner(); + bleScanner = bluetoothAdapter.getBluetoothLeScanner(); settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build(); filters = Collections.singletonList(new ScanFilter.Builder().setServiceUuid( ParcelUuid.fromString(GattAttributes.SERVICE_RADIO)).build()); } } - - private final ScanCallback mScanCallback2 = new ScanCallback() { - + private final ScanCallback bleScanCallback = new ScanCallback() { @Override public void onScanResult(int callbackType, final ScanResult scanRecord) { - Log.d(TAG, scanRecord.toString()); runOnUiThread(() -> { if (addDevice(scanRecord)) - mLeDeviceListAdapter.notifyDataSetChanged(); + deviceListAdapter.notifyDataSetChanged(); }); } - @Override public void onBatchScanResults(final List results) { - runOnUiThread(() -> { - boolean added = false; for (ScanResult result : results) { @@ -209,13 +191,11 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { } if (added) - mLeDeviceListAdapter.notifyDataSetChanged(); + deviceListAdapter.notifyDataSetChanged(); }); } - private boolean addDevice(ScanResult result) { - BluetoothDevice device = result.getDevice(); List serviceUuids = result.getScanRecord().getServiceUuids(); @@ -225,12 +205,11 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { } else if (serviceUuids.size() > 1) { Log.v(TAG, "Device " + device.getAddress() + " has too many serviceUuids (Not RileyLink)."); } else { - String uuid = serviceUuids.get(0).getUuid().toString().toLowerCase(); if (uuid.equals(GattAttributes.SERVICE_RADIO)) { Log.i(TAG, "Found RileyLink with address: " + device.getAddress()); - mLeDeviceListAdapter.addDevice(result); + deviceListAdapter.addDevice(result); return true; } else { Log.v(TAG, "Device " + device.getAddress() + " has incorrect uuid (Not RileyLink)."); @@ -240,84 +219,62 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { return false; } - - private String getDeviceDebug(BluetoothDevice device) { - return "BluetoothDevice [name=" + device.getName() + ", address=" + device.getAddress() + // - ", type=" + device.getType(); // + ", alias=" + device.getAlias(); - } - - @Override public void onScanFailed(int errorCode) { Log.e("Scan Failed", "Error Code: " + errorCode); - Toast.makeText(mContext, resourceHelper.gs(R.string.rileylink_scanner_scanning_error, errorCode), + Toast.makeText(RileyLinkBLEConfigActivity.this, resourceHelper.gs(R.string.riley_link_ble_config_scan_error, errorCode), Toast.LENGTH_LONG).show(); } }; - - private void scanLeDevice(final boolean enable) { - - if (mLEScanner == null) + private void startLeDeviceScan() { + if (bleScanner == null) { + aapsLogger.error(LTag.PUMPBTCOMM, "startLeDeviceScan failed: bleScanner is null"); return; - - if (enable) { - - mLeDeviceListAdapter.clear(); - mLeDeviceListAdapter.notifyDataSetChanged(); - - // Stops scanning after a pre-defined scan period. - mHandler.postDelayed(() -> { - - if (mScanning) { - mScanning = false; - mLEScanner.stopScan(mScanCallback2); - aapsLogger.debug("scanLeDevice: Scanning Stop"); - Toast.makeText(mContext, R.string.rileylink_scanner_scanning_finished, Toast.LENGTH_SHORT).show(); - menuItem.setTitle(actionTitleStart); - } - }, SCAN_PERIOD); - - mScanning = true; - mLEScanner.startScan(filters, settings, mScanCallback2); - aapsLogger.debug("scanLeDevice: Scanning Start"); - Toast.makeText(this, R.string.rileylink_scanner_scanning, Toast.LENGTH_SHORT).show(); - - menuItem.setTitle(actionTitleStop); - - } else { - if (mScanning) { - mScanning = false; - mLEScanner.stopScan(mScanCallback2); - - aapsLogger.debug("scanLeDevice: Scanning Stop"); - Toast.makeText(this, R.string.rileylink_scanner_scanning_finished, Toast.LENGTH_SHORT).show(); - - menuItem.setTitle(actionTitleStart); - } } + + deviceListAdapter.clear(); + deviceListAdapter.notifyDataSetChanged(); + + // Stops scanning after a pre-defined scan period. + handler.postDelayed(this::stopLeDeviceScan, SCAN_PERIOD_MILLIS); + + buttonStartScan.setEnabled(false); + buttonStopScan.setVisibility(View.VISIBLE); + + scanning = true; + bleScanner.startScan(filters, settings, bleScanCallback); + aapsLogger.debug(LTag.PUMPBTCOMM, "startLeDeviceScan: Scanning Start"); + Toast.makeText(RileyLinkBLEConfigActivity.this, R.string.riley_link_ble_config_scan_scanning, Toast.LENGTH_SHORT).show(); + } + + private void stopLeDeviceScan() { + if (scanning) { + scanning = false; + bleScanner.stopScan(bleScanCallback); + + aapsLogger.debug(LTag.PUMPBTCOMM, "stopLeDeviceScan: Scanning Stop"); + Toast.makeText(this, R.string.riley_link_ble_config_scan_finished, Toast.LENGTH_SHORT).show(); + } + + buttonStartScan.setEnabled(true); + buttonStopScan.setVisibility(View.GONE); } private class LeDeviceListAdapter extends BaseAdapter { - private final ArrayList mLeDevices; private final Map rileyLinkDevices; private final LayoutInflater mInflator; - String currentlySelectedAddress; - public LeDeviceListAdapter() { super(); mLeDevices = new ArrayList<>(); rileyLinkDevices = new HashMap<>(); - mInflator = RileyLinkBLEScanActivity.this.getLayoutInflater(); - currentlySelectedAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); + mInflator = RileyLinkBLEConfigActivity.this.getLayoutInflater(); } - public void addDevice(ScanResult result) { - if (!mLeDevices.contains(result.getDevice())) { mLeDevices.add(result.getDevice()); } @@ -325,42 +282,36 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { notifyDataSetChanged(); } - public void clear() { mLeDevices.clear(); rileyLinkDevices.clear(); notifyDataSetChanged(); } - @Override public int getCount() { return mLeDevices.size(); } - @Override public Object getItem(int i) { return mLeDevices.get(i); } - @Override public long getItemId(int i) { return i; } - @Override public View getView(int i, View view, ViewGroup viewGroup) { - ViewHolder viewHolder; // General ListView optimization code. if (view == null) { view = mInflator.inflate(R.layout.rileylink_scan_item, null); viewHolder = new ViewHolder(); - viewHolder.deviceAddress = view.findViewById(R.id.rileylink_device_address); - viewHolder.deviceName = view.findViewById(R.id.rileylink_device_name); + viewHolder.deviceAddress = view.findViewById(R.id.riley_link_ble_config_scan_item_device_address); + viewHolder.deviceName = view.findViewById(R.id.riley_link_ble_config_scan_item_device_name); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); @@ -370,15 +321,15 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { String deviceName = device.getName(); if (StringUtils.isBlank(deviceName)) { - deviceName = "RileyLink"; + deviceName = "RileyLink (?)"; } - deviceName += " [" + rileyLinkDevices.get(device).intValue() + "]"; + deviceName += " [" + rileyLinkDevices.get(device) + "]"; + + String currentlySelectedAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, ""); if (currentlySelectedAddress.equals(device.getAddress())) { - // viewHolder.deviceName.setTextColor(getColor(R.color.secondary_text_light)); - // viewHolder.deviceAddress.setTextColor(getColor(R.color.secondary_text_light)); - deviceName += " (" + getResources().getString(R.string.rileylink_scanner_selected_device) + ")"; + deviceName += " (" + getResources().getString(R.string.riley_link_ble_config_scan_selected) + ")"; } viewHolder.deviceName.setText(deviceName); @@ -386,11 +337,9 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { return view; } - } static class ViewHolder { - TextView deviceName; TextView deviceAddress; } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java index 3bab1a6d05..8d4e80d752 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bAbstract.java @@ -23,10 +23,10 @@ public abstract class Encoding4b6bAbstract implements Encoding4b6b { // 21, 49, 50, 35, 52, 37, 38, 22, 26, 25, 42, 11, 44, 13, 14, 28 - public abstract byte[] encode4b6b(byte[] data); + @Override public abstract byte[] encode4b6b(byte[] data); - public abstract byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException; + @Override public abstract byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException; protected short convertUnsigned(byte x) { diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java index 32176040f5..1b0dcb7dc4 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGeoff.java @@ -19,7 +19,7 @@ public class Encoding4b6bGeoff extends Encoding4b6bAbstract { public static final Logger LOG = StacktraceLoggerWrapper.getLogger(Encoding4b6bGeoff.class); - public byte[] encode4b6b(byte[] data) { + @Override public byte[] encode4b6b(byte[] data) { // if ((data.length % 2) != 0) { // LOG.error("Warning: data is odd number of bytes"); // } @@ -77,7 +77,7 @@ public class Encoding4b6bGeoff extends Encoding4b6bAbstract { * @return * @throws NumberFormatException */ - public byte[] decode4b6b(byte[] raw) throws RileyLinkCommunicationException { + @Override public byte[] decode4b6b(byte[] raw) throws RileyLinkCommunicationException { StringBuilder errorMessageBuilder = new StringBuilder(); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java index 3b0152455c..94ae52f788 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bGo.java @@ -20,7 +20,7 @@ public class Encoding4b6bGo extends Encoding4b6bAbstract { private static Map decodeGoMap; - public byte[] encode4b6b(byte[] src) { + @Override public byte[] encode4b6b(byte[] src) { // 2 input bytes produce 3 output bytes. // Odd final input byte, if any, produces 2 output bytes. int n = src.length; @@ -54,7 +54,7 @@ public class Encoding4b6bGo extends Encoding4b6bAbstract { * @param src * @return */ - public byte[] decode4b6b(byte[] src) throws RileyLinkCommunicationException { + @Override public byte[] decode4b6b(byte[] src) throws RileyLinkCommunicationException { int n = src.length; if (decodeGoMap == null) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java index d7a3a5f9d1..8dfaf16b0f 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/encoding/Encoding4b6bLoop.java @@ -33,7 +33,7 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract { * @param data * @return */ - public byte[] encode4b6b(byte[] data) { + @Override public byte[] encode4b6b(byte[] data) { List buffer = new ArrayList(); int bitAccumulator = 0x0; @@ -78,7 +78,7 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract { * @return * @throws RileyLinkCommunicationException */ - public byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException { + @Override public byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException { List buffer = new ArrayList(); int availBits = 0; int bitAccumulator = 0; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java index 309530cfa9..7f905f0a12 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java @@ -78,7 +78,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re refreshData(); } - public void refreshData() { + @Override public void refreshData() { RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice; this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId())); @@ -114,7 +114,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis(); if (lastConnectionTimeMillis == 0) { - this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); + this.lastDeviceContact.setText(resourceHelper.gs(R.string.riley_link_ble_config_connected_never)); } else { this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(lastConnectionTimeMillis))); } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java index c2043708fe..99fa32f5e9 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/data/ServiceTransport.java @@ -135,7 +135,7 @@ public class ServiceTransport extends ServiceMessage { } - public ServiceTransport clone() { + @Override public ServiceTransport clone() { Parcel p = Parcel.obtain(); Parcel p2 = Parcel.obtain(); getMap().writeToParcel(p, 0); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java index 790bfb1535..673e3ae02c 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ServiceTaskExecutor.java @@ -33,7 +33,7 @@ public class ServiceTaskExecutor extends ThreadPoolExecutor { } // FIXME - protected void beforeExecute(Thread t, Runnable r) { + @Override protected void beforeExecute(Thread t, Runnable r) { // This is run on either caller UI thread or Service UI thread. ServiceTask task = (ServiceTask) r; aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task " + task.getClass().getSimpleName()); @@ -43,7 +43,7 @@ public class ServiceTaskExecutor extends ThreadPoolExecutor { // FIXME - protected void afterExecute(Runnable r, Throwable t) { + @Override protected void afterExecute(Runnable r, Throwable t) { // This is run on either caller UI thread or Service UI thread. ServiceTask task = (ServiceTask) r; task.postOp(); diff --git a/rileylink/src/main/res/layout/riley_link_ble_config_activity.xml b/rileylink/src/main/res/layout/riley_link_ble_config_activity.xml new file mode 100644 index 0000000000..f60e1462f2 --- /dev/null +++ b/rileylink/src/main/res/layout/riley_link_ble_config_activity.xml @@ -0,0 +1,69 @@ + + + + + + + + + +