Also store and show RileyLink name
This commit is contained in:
parent
e9e6f962d3
commit
4ab0eab4a8
13 changed files with 73 additions and 68 deletions
|
@ -96,8 +96,9 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
||||||
|
|
||||||
setPumpIDString(sp.getString(MedtronicConst.Prefs.PumpSerial, "000000"));
|
setPumpIDString(sp.getString(MedtronicConst.Prefs.PumpSerial, "000000"));
|
||||||
|
|
||||||
// get most recently used RileyLink address
|
// get most recently used RileyLink address and name
|
||||||
rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||||
|
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "");
|
||||||
|
|
||||||
rfspy.startReader();
|
rfspy.startReader();
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
||||||
rileyLinkServiceData.targetDevice = RileyLinkTargetDevice.Omnipod;
|
rileyLinkServiceData.targetDevice = RileyLinkTargetDevice.Omnipod;
|
||||||
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod;
|
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod;
|
||||||
|
|
||||||
rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
rileyLinkServiceData.rileyLinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||||
|
rileyLinkServiceData.rileyLinkName = sp.getString(RileyLinkConst.Prefs.RileyLinkName, "");
|
||||||
|
|
||||||
rfspy.startReader();
|
rfspy.startReader();
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
private ScanSettings settings;
|
private ScanSettings settings;
|
||||||
private List<ScanFilter> filters;
|
private List<ScanFilter> filters;
|
||||||
private ListView deviceList;
|
private ListView deviceList;
|
||||||
private TextView currentlySelectedRileyLink;
|
private TextView currentlySelectedRileyLinkName;
|
||||||
|
private TextView currentlySelectedRileyLinkAddress;
|
||||||
private Button buttonRemoveRileyLink;
|
private Button buttonRemoveRileyLink;
|
||||||
private Button buttonStartScan;
|
private Button buttonStartScan;
|
||||||
private Button buttonStopScan;
|
private Button buttonStopScan;
|
||||||
|
@ -81,7 +82,8 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
deviceListAdapter = new LeDeviceListAdapter();
|
deviceListAdapter = new LeDeviceListAdapter();
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
currentlySelectedRileyLink = findViewById(R.id.riley_link_ble_config_currently_selected_riley_link);
|
currentlySelectedRileyLinkName = findViewById(R.id.riley_link_ble_config_currently_selected_riley_link_name);
|
||||||
|
currentlySelectedRileyLinkAddress = findViewById(R.id.riley_link_ble_config_currently_selected_riley_link_address);
|
||||||
buttonRemoveRileyLink = findViewById(R.id.riley_link_ble_config_button_remove_riley_link);
|
buttonRemoveRileyLink = findViewById(R.id.riley_link_ble_config_button_remove_riley_link);
|
||||||
buttonStartScan = findViewById(R.id.riley_link_ble_config_scan_start);
|
buttonStartScan = findViewById(R.id.riley_link_ble_config_scan_start);
|
||||||
buttonStopScan = findViewById(R.id.riley_link_ble_config_button_scan_stop);
|
buttonStopScan = findViewById(R.id.riley_link_ble_config_button_scan_stop);
|
||||||
|
@ -94,8 +96,10 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
String bleAddress = ((TextView) view.findViewById(R.id.riley_link_ble_config_scan_item_device_address)).getText().toString();
|
String bleAddress = ((TextView) view.findViewById(R.id.riley_link_ble_config_scan_item_device_address)).getText().toString();
|
||||||
|
String deviceName = ((TextView) view.findViewById(R.id.riley_link_ble_config_scan_item_device_name)).getText().toString();
|
||||||
|
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
||||||
|
sp.putString(RileyLinkConst.Prefs.RileyLinkName, deviceName);
|
||||||
|
|
||||||
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||||
rileyLinkPump.getRileyLinkService().verifyConfiguration(true); // force reloading of address to assure that the RL gets reconnected (even if the address didn't change)
|
rileyLinkPump.getRileyLinkService().verifyConfiguration(true); // force reloading of address to assure that the RL gets reconnected (even if the address didn't change)
|
||||||
|
@ -130,11 +134,15 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
private void updateCurrentlySelectedRileyLink() {
|
private void updateCurrentlySelectedRileyLink() {
|
||||||
String address = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
String address = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||||
if (StringUtils.isEmpty(address)) {
|
if (StringUtils.isEmpty(address)) {
|
||||||
currentlySelectedRileyLink.setText(R.string.riley_link_ble_config_no_riley_link_selected);
|
currentlySelectedRileyLinkName.setText(R.string.riley_link_ble_config_no_riley_link_selected);
|
||||||
|
currentlySelectedRileyLinkAddress.setVisibility(View.GONE);
|
||||||
buttonRemoveRileyLink.setVisibility(View.GONE);
|
buttonRemoveRileyLink.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
currentlySelectedRileyLink.setText(address);
|
currentlySelectedRileyLinkAddress.setVisibility(View.VISIBLE);
|
||||||
buttonRemoveRileyLink.setVisibility(View.VISIBLE);
|
buttonRemoveRileyLink.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
currentlySelectedRileyLinkName.setText(sp.getString(RileyLinkConst.Prefs.RileyLinkName, "RileyLink (?)"));
|
||||||
|
currentlySelectedRileyLinkAddress.setText(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +316,7 @@ public class RileyLinkBLEConfigActivity extends NoSplashAppCompatActivity {
|
||||||
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.riley_link_ble_config_scan_item, null);
|
||||||
viewHolder = new ViewHolder();
|
viewHolder = new ViewHolder();
|
||||||
viewHolder.deviceAddress = view.findViewById(R.id.riley_link_ble_config_scan_item_device_address);
|
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);
|
viewHolder.deviceName = view.findViewById(R.id.riley_link_ble_config_scan_item_device_name);
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class RileyLinkConst {
|
||||||
//public static final String PrefPrefix = "pref_rileylink_";
|
//public static final String PrefPrefix = "pref_rileylink_";
|
||||||
//public static final String RileyLinkAddress = PrefPrefix + "mac_address"; // pref_rileylink_mac_address
|
//public static final String RileyLinkAddress = PrefPrefix + "mac_address"; // pref_rileylink_mac_address
|
||||||
public static final int RileyLinkAddress = R.string.key_rileylink_mac_address;
|
public static final int RileyLinkAddress = R.string.key_rileylink_mac_address;
|
||||||
|
public static final int RileyLinkName = R.string.key_rileylink_name;
|
||||||
public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime";
|
public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime";
|
||||||
public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency";
|
public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency";
|
||||||
public static final int Encoding = R.string.key_medtronic_encoding;
|
public static final int Encoding = R.string.key_medtronic_encoding;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.ThreadUtil;
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 5/26/16.
|
* Created by geoff on 5/26/16.
|
||||||
|
@ -46,6 +47,7 @@ public class RileyLinkBLE {
|
||||||
@Inject AAPSLogger aapsLogger;
|
@Inject AAPSLogger aapsLogger;
|
||||||
@Inject RileyLinkServiceData rileyLinkServiceData;
|
@Inject RileyLinkServiceData rileyLinkServiceData;
|
||||||
@Inject RileyLinkUtil rileyLinkUtil;
|
@Inject RileyLinkUtil rileyLinkUtil;
|
||||||
|
@Inject SP sp;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final boolean gattDebugEnabled = true;
|
private final boolean gattDebugEnabled = true;
|
||||||
|
@ -393,8 +395,11 @@ public class RileyLinkBLE {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Gatt Connected.");
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Gatt Connected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
rileyLinkServiceData.rileylinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
rileyLinkServiceData.rileyLinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
||||||
rileyLinkServiceData.rileyLinkName = bluetoothConnectionGatt.getDevice().getName();
|
rileyLinkServiceData.rileyLinkName = bluetoothConnectionGatt.getDevice().getName();
|
||||||
|
|
||||||
|
// Update stored name upon connecting (also for backwards compatibility for device where a name was not yet stored)
|
||||||
|
sp.putString(RileyLinkConst.Prefs.RileyLinkName, rileyLinkServiceData.rileyLinkName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -19,29 +18,18 @@ import javax.inject.Inject;
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.R;
|
import info.nightscout.androidaps.plugins.pump.common.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.service.RileyLinkServiceData;
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
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;
|
|
||||||
@Inject RileyLinkServiceData rileyLinkServiceData;
|
|
||||||
|
|
||||||
TextView connectionStatus;
|
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||||
TextView configuredAddress;
|
|
||||||
TextView connectedDevice;
|
|
||||||
TextView connectionError;
|
|
||||||
|
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
|
||||||
private FloatingActionButton floatingActionButton;
|
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
/**
|
/**
|
||||||
* The {@link ViewPager} that will host the section contents.
|
* The {@link ViewPager} that will host the section contents.
|
||||||
*/
|
*/
|
||||||
private ViewPager mViewPager;
|
private ViewPager viewPager;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -52,36 +40,28 @@ public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
|
||||||
// primary sections of the activity.
|
// primary sections of the activity.
|
||||||
|
|
||||||
// Set up the ViewPager with the sections adapter.
|
// Set up the ViewPager with the sections adapter.
|
||||||
mViewPager = findViewById(R.id.rileylink_settings_container);
|
viewPager = findViewById(R.id.rileylink_settings_container);
|
||||||
// mViewPager.setAdapter(mSectionsPagerAdapter);
|
// mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||||
setupViewPager(mViewPager);
|
setupViewPager();
|
||||||
|
|
||||||
tabLayout = findViewById(R.id.rileylink_settings_tabs);
|
tabLayout = findViewById(R.id.rileylink_settings_tabs);
|
||||||
tabLayout.setupWithViewPager(mViewPager);
|
tabLayout.setupWithViewPager(viewPager);
|
||||||
|
|
||||||
floatingActionButton = findViewById(R.id.rileylink_settings_fab);
|
FloatingActionButton floatingActionButton = findViewById(R.id.rileylink_settings_fab);
|
||||||
floatingActionButton.setOnClickListener(v -> {
|
floatingActionButton.setOnClickListener(v -> {
|
||||||
|
|
||||||
RefreshableInterface selectableInterface = (RefreshableInterface) mSectionsPagerAdapter
|
RefreshableInterface selectableInterface = (RefreshableInterface) sectionsPagerAdapter
|
||||||
.getItem(tabLayout.getSelectedTabPosition());
|
.getItem(tabLayout.getSelectedTabPosition());
|
||||||
selectableInterface.refreshData();
|
selectableInterface.refreshData();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.connectionStatus = findViewById(R.id.rls_t1_connection_status);
|
|
||||||
this.configuredAddress = findViewById(R.id.rls_t1_configured_address);
|
|
||||||
this.connectedDevice = findViewById(R.id.rls_t1_connected_device);
|
|
||||||
this.connectionError = findViewById(R.id.rls_t1_connection_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupViewPager(ViewPager pager) {
|
public void setupViewPager() {
|
||||||
|
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||||
|
|
||||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
sectionsPagerAdapter.addFragment(new RileyLinkStatusGeneralFragment(), resourceHelper.gs(R.string.rileylink_settings_tab1));
|
||||||
|
sectionsPagerAdapter.addFragment(new RileyLinkStatusHistoryFragment(), resourceHelper.gs(R.string.rileylink_settings_tab2));
|
||||||
mSectionsPagerAdapter.addFragment(new RileyLinkStatusGeneralFragment(), resourceHelper.gs(R.string.rileylink_settings_tab1));
|
viewPager.setAdapter(sectionsPagerAdapter);
|
||||||
mSectionsPagerAdapter.addFragment(new RileyLinkStatusHistoryFragment(), resourceHelper.gs(R.string.rileylink_settings_tab2));
|
|
||||||
//mSectionsPagerAdapter.addFragment(new RileyLinkStatusDevice(), "Medtronic");
|
|
||||||
|
|
||||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,32 +74,27 @@ public class RileyLinkStatusActivity extends NoSplashAppCompatActivity {
|
||||||
List<String> fragmentTitle = new ArrayList<>();
|
List<String> fragmentTitle = new ArrayList<>();
|
||||||
int lastSelectedPosition = 0;
|
int lastSelectedPosition = 0;
|
||||||
|
|
||||||
|
|
||||||
public SectionsPagerAdapter(FragmentManager fm) {
|
public SectionsPagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
this.lastSelectedPosition = position;
|
this.lastSelectedPosition = position;
|
||||||
return fragmentList.get(position);
|
return fragmentList.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
// Show 3 total pages.
|
// Show 3 total pages.
|
||||||
return fragmentList.size();
|
return fragmentList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addFragment(Fragment fragment, String title) {
|
public void addFragment(Fragment fragment, String title) {
|
||||||
this.fragmentList.add(fragment);
|
this.fragmentList.add(fragment);
|
||||||
this.fragmentTitle.add(title);
|
this.fragmentTitle.add(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getPageTitle(int position) {
|
public CharSequence getPageTitle(int position) {
|
||||||
return fragmentTitle.get(position);
|
return fragmentTitle.get(position);
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
|
|
||||||
private TextView connectionStatus;
|
private TextView connectionStatus;
|
||||||
private TextView configuredAddress;
|
private TextView configuredRileyLinkAddress;
|
||||||
private TextView connectedRileyLinkName;
|
private TextView configuredRileyLinkName;
|
||||||
private TextView connectedDevice;
|
private TextView connectedDevice;
|
||||||
private TextView connectionError;
|
private TextView connectionError;
|
||||||
private TextView deviceType;
|
private TextView deviceType;
|
||||||
|
@ -63,8 +63,8 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
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.configuredRileyLinkAddress = getActivity().findViewById(R.id.rls_t1_configured_riley_link_address);
|
||||||
this.connectedRileyLinkName = getActivity().findViewById(R.id.rls_t1_connected_riley_link_name);
|
this.configuredRileyLinkName = getActivity().findViewById(R.id.rls_t1_configured_riley_link_name);
|
||||||
this.connectedDevice = getActivity().findViewById(R.id.rls_t1_connected_device);
|
this.connectedDevice = getActivity().findViewById(R.id.rls_t1_connected_device);
|
||||||
this.connectionError = getActivity().findViewById(R.id.rls_t1_connection_error);
|
this.connectionError = getActivity().findViewById(R.id.rls_t1_connection_error);
|
||||||
this.deviceType = getActivity().findViewById(R.id.rls_t1_device_type);
|
this.deviceType = getActivity().findViewById(R.id.rls_t1_device_type);
|
||||||
|
@ -85,8 +85,8 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
||||||
|
|
||||||
// BS FIXME rileyLinkServiceData is injected so I suppose it cannot be null?
|
// BS FIXME rileyLinkServiceData is injected so I suppose it cannot be null?
|
||||||
if (rileyLinkServiceData != null) {
|
if (rileyLinkServiceData != null) {
|
||||||
this.configuredAddress.setText(StringUtils.isEmpty(rileyLinkServiceData.rileylinkAddress) ? PLACEHOLDER : rileyLinkServiceData.rileylinkAddress);
|
this.configuredRileyLinkAddress.setText(StringUtils.isEmpty(rileyLinkServiceData.rileyLinkAddress) ? PLACEHOLDER : rileyLinkServiceData.rileyLinkAddress);
|
||||||
this.connectedRileyLinkName.setText(StringUtils.isEmpty(rileyLinkServiceData.rileyLinkName) ? PLACEHOLDER : rileyLinkServiceData.rileyLinkName);
|
this.configuredRileyLinkName.setText(StringUtils.isEmpty(rileyLinkServiceData.rileyLinkName) ? PLACEHOLDER : rileyLinkServiceData.rileyLinkName);
|
||||||
this.connectionError.setText(rileyLinkServiceData.rileyLinkError == null ? //
|
this.connectionError.setText(rileyLinkServiceData.rileyLinkError == null ? //
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
: resourceHelper.gs(rileyLinkServiceData.rileyLinkError.getResourceId(targetDevice)));
|
: resourceHelper.gs(rileyLinkServiceData.rileyLinkError.getResourceId(targetDevice)));
|
||||||
|
|
|
@ -154,19 +154,19 @@ public abstract class RileyLinkService extends DaggerService {
|
||||||
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkInitializing);
|
rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.RileyLinkInitializing);
|
||||||
|
|
||||||
if (rileyLinkBLE.isConnected()) {
|
if (rileyLinkBLE.isConnected()) {
|
||||||
if (deviceAddress.equals(rileyLinkServiceData.rileylinkAddress)) {
|
if (deviceAddress.equals(rileyLinkServiceData.rileyLinkAddress)) {
|
||||||
aapsLogger.info(LTag.PUMPBTCOMM, "No change to RL address. Not reconnecting.");
|
aapsLogger.info(LTag.PUMPBTCOMM, "No change to RL address. Not reconnecting.");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.warn(LTag.PUMPBTCOMM, "Disconnecting from old RL (" + rileyLinkServiceData.rileylinkAddress
|
aapsLogger.warn(LTag.PUMPBTCOMM, "Disconnecting from old RL (" + rileyLinkServiceData.rileyLinkAddress
|
||||||
+ "), reconnecting to new: " + deviceAddress);
|
+ "), reconnecting to new: " + deviceAddress);
|
||||||
|
|
||||||
rileyLinkBLE.disconnect();
|
rileyLinkBLE.disconnect();
|
||||||
// prolly need to shut down listening thread too?
|
// prolly need to shut down listening thread too?
|
||||||
// SP.putString(MedtronicConst.Prefs.RileyLinkAddress, deviceAddress);
|
// SP.putString(MedtronicConst.Prefs.RileyLinkAddress, deviceAddress);
|
||||||
|
|
||||||
rileyLinkServiceData.rileylinkAddress = deviceAddress;
|
rileyLinkServiceData.rileyLinkAddress = deviceAddress;
|
||||||
rileyLinkBLE.findRileyLink(rileyLinkServiceData.rileylinkAddress);
|
rileyLinkBLE.findRileyLink(rileyLinkServiceData.rileyLinkAddress);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -229,7 +229,7 @@ public abstract class RileyLinkService extends DaggerService {
|
||||||
|
|
||||||
if (rileyLinkBLE.isConnected()) {
|
if (rileyLinkBLE.isConnected()) {
|
||||||
rileyLinkBLE.disconnect();
|
rileyLinkBLE.disconnect();
|
||||||
rileyLinkServiceData.rileylinkAddress = null;
|
rileyLinkServiceData.rileyLinkAddress = null;
|
||||||
rileyLinkServiceData.rileyLinkName = null;
|
rileyLinkServiceData.rileyLinkName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class RileyLinkServiceData {
|
||||||
private long lastServiceStateChange = 0L;
|
private long lastServiceStateChange = 0L;
|
||||||
public RileyLinkFirmwareVersion firmwareVersion; // here we have "compatibility level" version
|
public RileyLinkFirmwareVersion firmwareVersion; // here we have "compatibility level" version
|
||||||
public RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
public RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
||||||
public String rileylinkAddress;
|
public String rileyLinkAddress;
|
||||||
public String rileyLinkName;
|
public String rileyLinkName;
|
||||||
long lastTuneUpTime = 0L;
|
long lastTuneUpTime = 0L;
|
||||||
public Double lastGoodFrequency;
|
public Double lastGoodFrequency;
|
||||||
|
|
|
@ -16,14 +16,27 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/riley_link_ble_config_currently_selected_riley_link"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/riley_link_ble_config_currently_selected_riley_link_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="10dp"
|
android:paddingStart="10dp"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/riley_link_ble_config_currently_selected_riley_link_address"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/riley_link_ble_config_button_remove_riley_link"
|
android:id="@+id/riley_link_ble_config_button_remove_riley_link"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_weight="35"
|
android:layout_weight="35"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/rileylink_configured_address" />
|
android:text="@string/rileylink_configured_riley_link_address" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rls_t1_configured_address"
|
android:id="@+id/rls_t1_configured_riley_link_address"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
|
@ -69,10 +69,10 @@
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_weight="35"
|
android:layout_weight="35"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/rileylink_connected_riley_link_name" />
|
android:text="@string/rileylink_configured_riley_link_name" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/rls_t1_connected_riley_link_name"
|
android:id="@+id/rls_t1_configured_riley_link_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
<string name="medtronic_pump_status">Pump Status</string>
|
<string name="medtronic_pump_status">Pump Status</string>
|
||||||
<string name="title_activity_rileylink_settings">RileyLink Settings</string>
|
<string name="title_activity_rileylink_settings">RileyLink Settings</string>
|
||||||
<string name="rileylink_title">RileyLink</string>
|
<string name="rileylink_title">RileyLink</string>
|
||||||
<string name="rileylink_configured_address">Configured Address:</string>
|
<string name="rileylink_configured_riley_link_address">Configured RileyLink Address:</string>
|
||||||
|
<string name="rileylink_configured_riley_link_name">Configured RileyLink Name:</string>
|
||||||
<string name="rileylink_connected_device">Connected Device:</string>
|
<string name="rileylink_connected_device">Connected Device:</string>
|
||||||
<string name="rileylink_connection_status">Connection Status:</string>
|
<string name="rileylink_connection_status">Connection Status:</string>
|
||||||
<string name="rileylink_connection_error">Connection Error:</string>
|
<string name="rileylink_connection_error">Connection Error:</string>
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
<string name="rileylink_last_used_frequency">Last Used Frequency:</string>
|
<string name="rileylink_last_used_frequency">Last Used Frequency:</string>
|
||||||
<string name="rileylink_last_device_contact">Last Device Contact:</string>
|
<string name="rileylink_last_device_contact">Last Device Contact:</string>
|
||||||
<string name="rileylink_firmware_version">Firmware Version:</string>
|
<string name="rileylink_firmware_version">Firmware Version:</string>
|
||||||
<string name="rileylink_connected_riley_link_name">Connected RileyLink Name:</string>
|
|
||||||
<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>
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@
|
||||||
<string name="key_medtronic_pump_encoding_4b6b_rileylink" translatable="false">medtronic_pump_encoding_4b6b_rileylink</string>
|
<string name="key_medtronic_pump_encoding_4b6b_rileylink" translatable="false">medtronic_pump_encoding_4b6b_rileylink</string>
|
||||||
|
|
||||||
<string name="key_rileylink_mac_address" translatable="false">pref_rileylink_mac_address</string>
|
<string name="key_rileylink_mac_address" translatable="false">pref_rileylink_mac_address</string>
|
||||||
|
<string name="key_rileylink_name" translatable="false">pref_rileylink_name</string>
|
||||||
<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>
|
||||||
|
|
Loading…
Reference in a new issue