Rework RileyLink scan and add option to remove RileyLink
This commit is contained in:
parent
302622bf69
commit
fcd3276e47
|
@ -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.openhumans.OpenHumansLoginActivity
|
||||||
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
||||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity
|
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.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity
|
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity
|
import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity
|
||||||
|
@ -33,7 +33,7 @@ abstract class ActivitiesModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity
|
@ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity
|
@ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusActivity(): RileyLinkStatusActivity
|
@ContributesAndroidInjector abstract fun contributesRileyLinkStatusActivity(): RileyLinkStatusActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesRileyLinkBLEScanActivity(): RileyLinkBLEScanActivity
|
@ContributesAndroidInjector abstract fun contributesRileyLinkBLEConfigActivity(): RileyLinkBLEConfigActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity
|
@ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
|
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesSmsCommunicatorOtpActivity(): SmsCommunicatorOtpActivity
|
@ContributesAndroidInjector abstract fun contributesSmsCommunicatorOtpActivity(): SmsCommunicatorOtpActivity
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
android:key="@string/key_rileylink_mac_address"
|
android:key="@string/key_rileylink_mac_address"
|
||||||
android:summary=""
|
android:summary=""
|
||||||
android:title="RileyLink Configuration">
|
android:title="RileyLink Configuration">
|
||||||
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<string name="omnipod_overview_last_bolus_value" translatable="false">%1$.2f %2$s (%3$s)</string>
|
<string name="omnipod_overview_last_bolus_value" translatable="false">%1$.2f %2$s (%3$s)</string>
|
||||||
|
|
||||||
<!-- Omnipod - Preferences -->
|
<!-- Omnipod - Preferences -->
|
||||||
|
<string name="omnipod_config_riley_link_configuration">RileyLink Configuration</string>
|
||||||
<string name="omnipod_config_bolus_beeps_enabled">Bolus beeps enabled</string>
|
<string name="omnipod_config_bolus_beeps_enabled">Bolus beeps enabled</string>
|
||||||
<string name="omnipod_config_basal_beeps_enabled">Basal beeps enabled</string>
|
<string name="omnipod_config_basal_beeps_enabled">Basal beeps enabled</string>
|
||||||
<string name="omnipod_config_smb_beeps_enabled">SMB beeps enabled</string>
|
<string name="omnipod_config_smb_beeps_enabled">SMB beeps enabled</string>
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
<Preference
|
<Preference
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:key="@string/key_rileylink_mac_address"
|
android:key="@string/key_rileylink_mac_address"
|
||||||
android:summary=""
|
android:title="@string/omnipod_config_riley_link_configuration">
|
||||||
android:title="RileyLink Configuration">
|
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
|
||||||
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="info.nightscout.androidaps.plugins.pump.common" >
|
package="info.nightscout.androidaps.plugins.pump.common">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
@ -8,12 +8,13 @@
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<activity android:name=".dialog.RileyLinkBLEScanActivity">
|
<activity android:name=".dialog.RileyLinkBLEConfigActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
<action android:name="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEConfigActivity" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".hw.rileylink.dialog.RileyLinkStatusActivity"
|
android:name=".hw.rileylink.dialog.RileyLinkStatusActivity"
|
||||||
android:label="@string/title_activity_rileylink_settings"
|
android:label="@string/title_activity_rileylink_settings"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.dialog;
|
package info.nightscout.androidaps.plugins.pump.common.dialog;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.le.BluetoothLeScanner;
|
import android.bluetooth.le.BluetoothLeScanner;
|
||||||
|
@ -7,23 +8,19 @@ import android.bluetooth.le.ScanCallback;
|
||||||
import android.bluetooth.le.ScanFilter;
|
import android.bluetooth.le.ScanFilter;
|
||||||
import android.bluetooth.le.ScanResult;
|
import android.bluetooth.le.ScanResult;
|
||||||
import android.bluetooth.le.ScanSettings;
|
import android.bluetooth.le.ScanSettings;
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.ParcelUuid;
|
import android.os.ParcelUuid;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -37,7 +34,7 @@ import javax.inject.Inject;
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.R;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
|
||||||
|
@ -48,62 +45,55 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
// IMPORTANT: This activity needs to be called from RileyLinkSelectPreference (see pref_medtronic.xml as example)
|
// IMPORTANT: This activity needs to be called from RileyLinkSelectPreference (see pref_medtronic.xml as example)
|
||||||
public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
|
|
||||||
@Inject AAPSLogger aapsLogger;
|
@Inject AAPSLogger aapsLogger;
|
||||||
@Inject SP sp;
|
@Inject SP sp;
|
||||||
@Inject RxBusWrapper rxBus;
|
|
||||||
@Inject ResourceHelper resourceHelper;
|
@Inject ResourceHelper resourceHelper;
|
||||||
@Inject BlePreCheck blePrecheck;
|
@Inject BlePreCheck blePrecheck;
|
||||||
@Inject RileyLinkUtil rileyLinkUtil;
|
@Inject RileyLinkUtil rileyLinkUtil;
|
||||||
@Inject ActivePluginProvider activePlugin;
|
@Inject ActivePluginProvider activePlugin;
|
||||||
|
|
||||||
private static final int PERMISSION_REQUEST_COARSE_LOCATION = 30241; // arbitrary.
|
private static final String TAG = "RileyLinkBLEConfigActivity";
|
||||||
private static final int REQUEST_ENABLE_BT = 30242; // arbitrary
|
private static final long SCAN_PERIOD_MILLIS = 15_000;
|
||||||
|
|
||||||
private static final String TAG = "RileyLinkBLEScanActivity";
|
private ScanSettings settings;
|
||||||
|
private List<ScanFilter> filters;
|
||||||
// Stops scanning after 30 seconds.
|
private ListView deviceList;
|
||||||
private static final long SCAN_PERIOD = 30000;
|
private TextView currentlySelectedRileyLink;
|
||||||
public boolean mScanning;
|
private Button buttonRemoveRileyLink;
|
||||||
public ScanSettings settings;
|
private Button buttonStartScan;
|
||||||
public List<ScanFilter> filters;
|
private Button buttonStopScan;
|
||||||
public ListView listBTScan;
|
private BluetoothAdapter bluetoothAdapter;
|
||||||
public Toolbar toolbarBTScan;
|
private BluetoothLeScanner bleScanner;
|
||||||
public Context mContext = this;
|
private LeDeviceListAdapter deviceListAdapter;
|
||||||
private BluetoothAdapter mBluetoothAdapter;
|
private Handler handler;
|
||||||
private BluetoothLeScanner mLEScanner;
|
|
||||||
private LeDeviceListAdapter mLeDeviceListAdapter;
|
|
||||||
private Handler mHandler;
|
|
||||||
|
|
||||||
private String actionTitleStart, actionTitleStop;
|
|
||||||
private MenuItem menuItem;
|
|
||||||
|
|
||||||
|
public boolean scanning;
|
||||||
private boolean rlDisconnected;
|
private boolean rlDisconnected;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.rileylink_scan_activity);
|
setContentView(R.layout.riley_link_ble_config_activity);
|
||||||
|
|
||||||
// Initializes Bluetooth adapter.
|
// Initializes Bluetooth adapter.
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
mHandler = new Handler();
|
deviceListAdapter = new LeDeviceListAdapter();
|
||||||
|
handler = new Handler();
|
||||||
mLeDeviceListAdapter = new LeDeviceListAdapter();
|
currentlySelectedRileyLink = findViewById(R.id.riley_link_ble_config_currently_selected_riley_link);
|
||||||
listBTScan = findViewById(R.id.rileylink_listBTScan);
|
buttonRemoveRileyLink = findViewById(R.id.riley_link_ble_config_button_remove_riley_link);
|
||||||
listBTScan.setAdapter(mLeDeviceListAdapter);
|
buttonStartScan = findViewById(R.id.riley_link_ble_config_scan_start);
|
||||||
listBTScan.setOnItemClickListener((parent, view, position, id) -> {
|
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
|
// stop scanning if still active
|
||||||
if (mScanning) {
|
if (scanning) {
|
||||||
mScanning = false;
|
stopLeDeviceScan();
|
||||||
mLEScanner.stopScan(mScanCallback2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView textview = view.findViewById(R.id.rileylink_device_address);
|
String bleAddress = ((TextView) view.findViewById(R.id.riley_link_ble_config_scan_item_device_address)).getText().toString();
|
||||||
String bleAddress = textview.getText().toString();
|
|
||||||
|
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
||||||
|
|
||||||
|
@ -114,46 +104,45 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
toolbarBTScan = findViewById(R.id.rileylink_toolbarBTScan);
|
buttonStartScan.setOnClickListener(view -> {
|
||||||
toolbarBTScan.setTitle(R.string.rileylink_scanner_title);
|
// disable currently selected RL, so that we can discover it
|
||||||
setSupportActionBar(toolbarBTScan);
|
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() {
|
@Override protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
prepareForScanning();
|
prepareForScanning();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
updateCurrentlySelectedRileyLink();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onBackPressed() {
|
@Override public void onBackPressed() {
|
||||||
|
@ -166,41 +155,34 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
|
|
||||||
@Override protected void onDestroy() {
|
@Override protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mScanning = false;
|
stopLeDeviceScan();
|
||||||
mLEScanner.stopScan(mScanCallback2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareForScanning() {
|
private void prepareForScanning() {
|
||||||
boolean checkOK = blePrecheck.prerequisitesCheck(this);
|
boolean checkOK = blePrecheck.prerequisitesCheck(this);
|
||||||
|
|
||||||
if (checkOK) {
|
if (checkOK) {
|
||||||
mLEScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
bleScanner = bluetoothAdapter.getBluetoothLeScanner();
|
||||||
settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
|
settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
|
||||||
filters = Collections.singletonList(new ScanFilter.Builder().setServiceUuid(
|
filters = Collections.singletonList(new ScanFilter.Builder().setServiceUuid(
|
||||||
ParcelUuid.fromString(GattAttributes.SERVICE_RADIO)).build());
|
ParcelUuid.fromString(GattAttributes.SERVICE_RADIO)).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ScanCallback bleScanCallback = new ScanCallback() {
|
||||||
private final ScanCallback mScanCallback2 = new ScanCallback() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScanResult(int callbackType, final ScanResult scanRecord) {
|
public void onScanResult(int callbackType, final ScanResult scanRecord) {
|
||||||
|
|
||||||
Log.d(TAG, scanRecord.toString());
|
Log.d(TAG, scanRecord.toString());
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (addDevice(scanRecord))
|
if (addDevice(scanRecord))
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
deviceListAdapter.notifyDataSetChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBatchScanResults(final List<ScanResult> results) {
|
public void onBatchScanResults(final List<ScanResult> results) {
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
|
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
|
|
||||||
for (ScanResult result : results) {
|
for (ScanResult result : results) {
|
||||||
|
@ -209,13 +191,11 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added)
|
if (added)
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
deviceListAdapter.notifyDataSetChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean addDevice(ScanResult result) {
|
private boolean addDevice(ScanResult result) {
|
||||||
|
|
||||||
BluetoothDevice device = result.getDevice();
|
BluetoothDevice device = result.getDevice();
|
||||||
|
|
||||||
List<ParcelUuid> serviceUuids = result.getScanRecord().getServiceUuids();
|
List<ParcelUuid> serviceUuids = result.getScanRecord().getServiceUuids();
|
||||||
|
@ -225,12 +205,11 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
} else if (serviceUuids.size() > 1) {
|
} else if (serviceUuids.size() > 1) {
|
||||||
Log.v(TAG, "Device " + device.getAddress() + " has too many serviceUuids (Not RileyLink).");
|
Log.v(TAG, "Device " + device.getAddress() + " has too many serviceUuids (Not RileyLink).");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String uuid = serviceUuids.get(0).getUuid().toString().toLowerCase();
|
String uuid = serviceUuids.get(0).getUuid().toString().toLowerCase();
|
||||||
|
|
||||||
if (uuid.equals(GattAttributes.SERVICE_RADIO)) {
|
if (uuid.equals(GattAttributes.SERVICE_RADIO)) {
|
||||||
Log.i(TAG, "Found RileyLink with address: " + device.getAddress());
|
Log.i(TAG, "Found RileyLink with address: " + device.getAddress());
|
||||||
mLeDeviceListAdapter.addDevice(result);
|
deviceListAdapter.addDevice(result);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Device " + device.getAddress() + " has incorrect uuid (Not RileyLink).");
|
Log.v(TAG, "Device " + device.getAddress() + " has incorrect uuid (Not RileyLink).");
|
||||||
|
@ -240,84 +219,62 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getDeviceDebug(BluetoothDevice device) {
|
|
||||||
return "BluetoothDevice [name=" + device.getName() + ", address=" + device.getAddress() + //
|
|
||||||
", type=" + device.getType(); // + ", alias=" + device.getAlias();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScanFailed(int errorCode) {
|
public void onScanFailed(int errorCode) {
|
||||||
Log.e("Scan Failed", "Error Code: " + 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();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void startLeDeviceScan() {
|
||||||
private void scanLeDevice(final boolean enable) {
|
if (bleScanner == null) {
|
||||||
|
aapsLogger.error(LTag.PUMPBTCOMM, "startLeDeviceScan failed: bleScanner is null");
|
||||||
if (mLEScanner == null)
|
|
||||||
return;
|
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 class LeDeviceListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private final ArrayList<BluetoothDevice> mLeDevices;
|
private final ArrayList<BluetoothDevice> mLeDevices;
|
||||||
private final Map<BluetoothDevice, Integer> rileyLinkDevices;
|
private final Map<BluetoothDevice, Integer> rileyLinkDevices;
|
||||||
private final LayoutInflater mInflator;
|
private final LayoutInflater mInflator;
|
||||||
String currentlySelectedAddress;
|
|
||||||
|
|
||||||
|
|
||||||
public LeDeviceListAdapter() {
|
public LeDeviceListAdapter() {
|
||||||
super();
|
super();
|
||||||
mLeDevices = new ArrayList<>();
|
mLeDevices = new ArrayList<>();
|
||||||
rileyLinkDevices = new HashMap<>();
|
rileyLinkDevices = new HashMap<>();
|
||||||
mInflator = RileyLinkBLEScanActivity.this.getLayoutInflater();
|
mInflator = RileyLinkBLEConfigActivity.this.getLayoutInflater();
|
||||||
currentlySelectedAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addDevice(ScanResult result) {
|
public void addDevice(ScanResult result) {
|
||||||
|
|
||||||
if (!mLeDevices.contains(result.getDevice())) {
|
if (!mLeDevices.contains(result.getDevice())) {
|
||||||
mLeDevices.add(result.getDevice());
|
mLeDevices.add(result.getDevice());
|
||||||
}
|
}
|
||||||
|
@ -325,42 +282,36 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
mLeDevices.clear();
|
mLeDevices.clear();
|
||||||
rileyLinkDevices.clear();
|
rileyLinkDevices.clear();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return mLeDevices.size();
|
return mLeDevices.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getItem(int i) {
|
public Object getItem(int i) {
|
||||||
return mLeDevices.get(i);
|
return mLeDevices.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int i) {
|
public long getItemId(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||||
|
|
||||||
ViewHolder viewHolder;
|
ViewHolder viewHolder;
|
||||||
// General ListView optimization code.
|
// General ListView optimization code.
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
view = mInflator.inflate(R.layout.rileylink_scan_item, null);
|
view = mInflator.inflate(R.layout.rileylink_scan_item, null);
|
||||||
viewHolder = new ViewHolder();
|
viewHolder = new ViewHolder();
|
||||||
viewHolder.deviceAddress = view.findViewById(R.id.rileylink_device_address);
|
viewHolder.deviceAddress = view.findViewById(R.id.riley_link_ble_config_scan_item_device_address);
|
||||||
viewHolder.deviceName = view.findViewById(R.id.rileylink_device_name);
|
viewHolder.deviceName = view.findViewById(R.id.riley_link_ble_config_scan_item_device_name);
|
||||||
view.setTag(viewHolder);
|
view.setTag(viewHolder);
|
||||||
} else {
|
} else {
|
||||||
viewHolder = (ViewHolder) view.getTag();
|
viewHolder = (ViewHolder) view.getTag();
|
||||||
|
@ -370,15 +321,15 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
String deviceName = device.getName();
|
String deviceName = device.getName();
|
||||||
|
|
||||||
if (StringUtils.isBlank(deviceName)) {
|
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())) {
|
if (currentlySelectedAddress.equals(device.getAddress())) {
|
||||||
// viewHolder.deviceName.setTextColor(getColor(R.color.secondary_text_light));
|
deviceName += " (" + getResources().getString(R.string.riley_link_ble_config_scan_selected) + ")";
|
||||||
// viewHolder.deviceAddress.setTextColor(getColor(R.color.secondary_text_light));
|
|
||||||
deviceName += " (" + getResources().getString(R.string.rileylink_scanner_selected_device) + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
viewHolder.deviceName.setText(deviceName);
|
viewHolder.deviceName.setText(deviceName);
|
||||||
|
@ -386,11 +337,9 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity {
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ViewHolder {
|
static class ViewHolder {
|
||||||
|
|
||||||
TextView deviceName;
|
TextView deviceName;
|
||||||
TextView deviceAddress;
|
TextView deviceAddress;
|
||||||
}
|
}
|
|
@ -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
|
// 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) {
|
protected short convertUnsigned(byte x) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class Encoding4b6bGeoff extends Encoding4b6bAbstract {
|
||||||
public static final Logger LOG = StacktraceLoggerWrapper.getLogger(Encoding4b6bGeoff.class);
|
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) {
|
// if ((data.length % 2) != 0) {
|
||||||
// LOG.error("Warning: data is odd number of bytes");
|
// LOG.error("Warning: data is odd number of bytes");
|
||||||
// }
|
// }
|
||||||
|
@ -77,7 +77,7 @@ public class Encoding4b6bGeoff extends Encoding4b6bAbstract {
|
||||||
* @return
|
* @return
|
||||||
* @throws NumberFormatException
|
* @throws NumberFormatException
|
||||||
*/
|
*/
|
||||||
public byte[] decode4b6b(byte[] raw) throws RileyLinkCommunicationException {
|
@Override public byte[] decode4b6b(byte[] raw) throws RileyLinkCommunicationException {
|
||||||
|
|
||||||
StringBuilder errorMessageBuilder = new StringBuilder();
|
StringBuilder errorMessageBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Encoding4b6bGo extends Encoding4b6bAbstract {
|
||||||
private static Map<Short, Short> decodeGoMap;
|
private static Map<Short, Short> decodeGoMap;
|
||||||
|
|
||||||
|
|
||||||
public byte[] encode4b6b(byte[] src) {
|
@Override public byte[] encode4b6b(byte[] src) {
|
||||||
// 2 input bytes produce 3 output bytes.
|
// 2 input bytes produce 3 output bytes.
|
||||||
// Odd final input byte, if any, produces 2 output bytes.
|
// Odd final input byte, if any, produces 2 output bytes.
|
||||||
int n = src.length;
|
int n = src.length;
|
||||||
|
@ -54,7 +54,7 @@ public class Encoding4b6bGo extends Encoding4b6bAbstract {
|
||||||
* @param src
|
* @param src
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public byte[] decode4b6b(byte[] src) throws RileyLinkCommunicationException {
|
@Override public byte[] decode4b6b(byte[] src) throws RileyLinkCommunicationException {
|
||||||
int n = src.length;
|
int n = src.length;
|
||||||
|
|
||||||
if (decodeGoMap == null)
|
if (decodeGoMap == null)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract {
|
||||||
* @param data
|
* @param data
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public byte[] encode4b6b(byte[] data) {
|
@Override public byte[] encode4b6b(byte[] data) {
|
||||||
|
|
||||||
List<Byte> buffer = new ArrayList<Byte>();
|
List<Byte> buffer = new ArrayList<Byte>();
|
||||||
int bitAccumulator = 0x0;
|
int bitAccumulator = 0x0;
|
||||||
|
@ -78,7 +78,7 @@ public class Encoding4b6bLoop extends Encoding4b6bAbstract {
|
||||||
* @return
|
* @return
|
||||||
* @throws RileyLinkCommunicationException
|
* @throws RileyLinkCommunicationException
|
||||||
*/
|
*/
|
||||||
public byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException {
|
@Override public byte[] decode4b6b(byte[] data) throws RileyLinkCommunicationException {
|
||||||
List<Byte> buffer = new ArrayList<Byte>();
|
List<Byte> buffer = new ArrayList<Byte>();
|
||||||
int availBits = 0;
|
int availBits = 0;
|
||||||
int bitAccumulator = 0;
|
int bitAccumulator = 0;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
refreshData();
|
refreshData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshData() {
|
@Override public void refreshData() {
|
||||||
RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice;
|
RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice;
|
||||||
|
|
||||||
this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId()));
|
this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId()));
|
||||||
|
@ -114,7 +114,7 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
|
|
||||||
long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis();
|
long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis();
|
||||||
if (lastConnectionTimeMillis == 0) {
|
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 {
|
} else {
|
||||||
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(lastConnectionTimeMillis)));
|
this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(lastConnectionTimeMillis)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class ServiceTransport extends ServiceMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ServiceTransport clone() {
|
@Override public ServiceTransport clone() {
|
||||||
Parcel p = Parcel.obtain();
|
Parcel p = Parcel.obtain();
|
||||||
Parcel p2 = Parcel.obtain();
|
Parcel p2 = Parcel.obtain();
|
||||||
getMap().writeToParcel(p, 0);
|
getMap().writeToParcel(p, 0);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ServiceTaskExecutor extends ThreadPoolExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
// 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.
|
// This is run on either caller UI thread or Service UI thread.
|
||||||
ServiceTask task = (ServiceTask) r;
|
ServiceTask task = (ServiceTask) r;
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task " + task.getClass().getSimpleName());
|
aapsLogger.debug(LTag.PUMPBTCOMM, "About to run task " + task.getClass().getSimpleName());
|
||||||
|
@ -43,7 +43,7 @@ public class ServiceTaskExecutor extends ThreadPoolExecutor {
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
// 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.
|
// This is run on either caller UI thread or Service UI thread.
|
||||||
ServiceTask task = (ServiceTask) r;
|
ServiceTask task = (ServiceTask) r;
|
||||||
task.postOp();
|
task.postOp();
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<!-- Currently selected RileyLink -->
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.AppCompat.Title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/riley_link_ble_config_scan_currently_selected_riley_link" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/riley_link_ble_config_currently_selected_riley_link"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/riley_link_ble_config_button_remove_riley_link"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/riley_link_ble_config_remove_riley_link"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- RileyLink scan -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.AppCompat.Title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/riley_link_ble_config_scan_title" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/riley_link_ble_config_scan_start"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/riley_link_ble_config_button_scan_start" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/riley_link_ble_config_button_scan_stop"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/riley_link_ble_config_scan_stop"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- RileyLink scan results -->
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/riley_link_ble_config_scan_device_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context="com.gxwtech.roundtrip2.RileyLinkScan">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:elevation="0dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/rileylink_toolbarBTScan"
|
|
||||||
android:minHeight="?attr/actionBarSize"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"></androidx.appcompat.widget.Toolbar>
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingTop="?attr/actionBarSize">
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:id="@+id/rileylink_listBTScan"
|
|
||||||
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
|
|
@ -1,22 +1,22 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="32dp">
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rileylink_device_name"
|
android:id="@+id/riley_link_ble_config_scan_item_device_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="24dp"
|
android:textSize="16sp" />
|
||||||
|
|
||||||
android:text="name" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rileylink_device_address"
|
android:id="@+id/riley_link_ble_config_scan_item_device_address"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12dp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -6,5 +6,5 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/rileylink_miScan"
|
android:id="@+id/rileylink_miScan"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:title="@string/rileylink_scanner_scan_scan"></item>
|
android:title="@string/riley_link_ble_config_button_scan_start"></item>
|
||||||
</menu>
|
</menu>
|
|
@ -1,17 +1,18 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- RL BLE Scanning -->
|
<!-- RL BLE Config -->
|
||||||
<string name="rileylink_scanner_scan_scan">SCAN</string>
|
<string name="riley_link_ble_config_button_scan_start">Scan</string>
|
||||||
<string name="rileylink_scanner_scan_stop">STOP</string>
|
<string name="riley_link_ble_config_scan_stop">Stop</string>
|
||||||
<string name="rileylink_scanner_selected_device">Selected</string>
|
<string name="riley_link_ble_config_scan_selected">Selected</string>
|
||||||
<string name="rileylink_scanner_title">RileyLink Scan</string>
|
<string name="riley_link_ble_config_scan_title">RileyLink Scan</string>
|
||||||
<string name="location_yes">Enable</string>
|
<string name="riley_link_ble_config_scan_scanning">Scanning</string>
|
||||||
<string name="location_no">No</string>
|
<string name="riley_link_ble_config_scan_finished">Scanning finished</string>
|
||||||
<string name="rileylink_scanner_scanning">Scanning</string>
|
<string name="riley_link_ble_config_scan_error">Scanning error: %1$d</string>
|
||||||
<string name="rileylink_scanner_scanning_finished">Scanning finished</string>
|
<string name="riley_link_ble_config_connected_never">Never</string>
|
||||||
<string name="rileylink_scanner_scanning_error">Scanning error: %1$d</string>
|
<string name="riley_link_ble_config_scan_currently_selected_riley_link">Currently Selected RileyLink</string>
|
||||||
<string name="common_never">Never</string>
|
<string name="riley_link_ble_config_remove_riley_link">Remove</string>
|
||||||
|
<string name="riley_link_ble_config_remove_riley_link_confirmation">Are you sure that you want to remove your RileyLink?</string>
|
||||||
|
|
||||||
<!-- RL Status Page -->
|
<!-- RL Status Page -->
|
||||||
<string name="rileylink_settings_tab1">Settings</string>
|
<string name="rileylink_settings_tab1">Settings</string>
|
||||||
|
@ -34,7 +35,6 @@
|
||||||
<string name="rileylink_pump_serial_number">Pump Serial Number:</string>
|
<string name="rileylink_pump_serial_number">Pump Serial Number:</string>
|
||||||
<string name="rileylink_pump_frequency">Pump Frequency:</string>
|
<string name="rileylink_pump_frequency">Pump Frequency:</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- RL State -->
|
<!-- RL State -->
|
||||||
<string name="rileylink_state_bt_init">Bluetooth Initializing…</string>
|
<string name="rileylink_state_bt_init">Bluetooth Initializing…</string>
|
||||||
<string name="rileylink_state_bt_error">Bluetooth Error</string>
|
<string name="rileylink_state_bt_error">Bluetooth Error</string>
|
||||||
|
@ -67,6 +67,10 @@
|
||||||
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
|
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
|
||||||
|
|
||||||
<string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string>
|
<string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string>
|
||||||
|
<string name="riley_link_common_yes">Yes</string>
|
||||||
|
<string name="riley_link_common_no">No</string>
|
||||||
|
<string name="riley_link_ble_config_remove_riley_link_confirmation_title">Remove RileyLink</string>
|
||||||
|
<string name="riley_link_ble_config_no_riley_link_selected">No RileyLink selected</string>
|
||||||
|
|
||||||
<plurals name="duration_days">
|
<plurals name="duration_days">
|
||||||
<item quantity="one">%1$d day</item>
|
<item quantity="one">%1$d day</item>
|
||||||
|
@ -77,5 +81,4 @@
|
||||||
<item quantity="other">%1$d hours</item>
|
<item quantity="other">%1$d hours</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue