Distinguish between configured and connected device for Medtronic in RileyLink fragment
This commit is contained in:
parent
647c0ea74a
commit
f1bb85eafa
4 changed files with 80 additions and 35 deletions
|
@ -9,8 +9,7 @@ import info.nightscout.androidaps.plugins.pump.common.R;
|
|||
|
||||
public enum RileyLinkTargetDevice {
|
||||
MedtronicPump(R.string.rileylink_target_device_medtronic, true), //
|
||||
Omnipod(R.string.rileylink_target_device_omnipod, false), //
|
||||
;
|
||||
Omnipod(R.string.rileylink_target_device_omnipod, false);
|
||||
|
||||
private final int resourceId;
|
||||
private final boolean tuneUpEnabled;
|
||||
|
|
|
@ -45,8 +45,10 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
private TextView configuredRileyLinkName;
|
||||
private TextView batteryLevel;
|
||||
private TextView connectionError;
|
||||
private View connectedDeviceDetails;
|
||||
private TextView deviceType;
|
||||
private TextView deviceModel;
|
||||
private TextView configuredDeviceModel;
|
||||
private TextView connectedDeviceModel;
|
||||
private TextView serialNumber;
|
||||
private TextView pumpFrequency;
|
||||
private TextView lastUsedFrequency;
|
||||
|
@ -59,16 +61,18 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
this.connectionStatus = getActivity().findViewById(R.id.rls_t1_connection_status);
|
||||
this.configuredRileyLinkAddress = getActivity().findViewById(R.id.rls_t1_configured_riley_link_address);
|
||||
this.configuredRileyLinkName = getActivity().findViewById(R.id.rls_t1_configured_riley_link_name);
|
||||
this.batteryLevel = getActivity().findViewById(R.id.rls_t1_battery_level);
|
||||
this.connectionError = getActivity().findViewById(R.id.rls_t1_connection_error);
|
||||
this.connectedDeviceDetails = getActivity().findViewById(R.id.rls_t1_connected_device_details);
|
||||
this.deviceType = getActivity().findViewById(R.id.rls_t1_device_type);
|
||||
this.deviceModel = getActivity().findViewById(R.id.rls_t1_device_model);
|
||||
this.configuredDeviceModel = getActivity().findViewById(R.id.rls_t1_configured_device_model);
|
||||
this.connectedDeviceModel = getActivity().findViewById(R.id.rls_t1_connected_device_model);
|
||||
this.serialNumber = getActivity().findViewById(R.id.rls_t1_serial_number);
|
||||
this.pumpFrequency = getActivity().findViewById(R.id.rls_t1_pump_frequency);
|
||||
this.lastUsedFrequency = getActivity().findViewById(R.id.rls_t1_last_used_frequency);
|
||||
|
@ -98,18 +102,24 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
|
|||
Optional.ofNullable(rileyLinkServiceData.versionBLE113).orElse(PLACEHOLDER), Optional.ofNullable(rileyLinkServiceData.versionCC110).orElse(PLACEHOLDER)));
|
||||
}
|
||||
|
||||
RileyLinkPumpDevice pumpPlugin = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||
RileyLinkPumpInfo pumpInfo = pumpPlugin.getPumpInfo();
|
||||
this.deviceType.setText(rileyLinkServiceData.targetDevice.getResourceId());
|
||||
this.deviceModel.setText(pumpInfo.getConnectedDeviceModel());
|
||||
this.serialNumber.setText(pumpInfo.getConnectedDeviceSerialNumber());
|
||||
this.pumpFrequency.setText(pumpInfo.getPumpFrequency());
|
||||
RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||
RileyLinkPumpInfo rileyLinkPumpInfo = rileyLinkPumpDevice.getPumpInfo();
|
||||
this.deviceType.setText(targetDevice.getResourceId());
|
||||
if (targetDevice == RileyLinkTargetDevice.MedtronicPump) {
|
||||
this.connectedDeviceDetails.setVisibility(View.VISIBLE);
|
||||
this.configuredDeviceModel.setText(activePlugin.getActivePump().getPumpDescription().pumpType.getDescription());
|
||||
this.connectedDeviceModel.setText(rileyLinkPumpInfo.getConnectedDeviceModel());
|
||||
} else {
|
||||
this.connectedDeviceDetails.setVisibility(View.GONE);
|
||||
}
|
||||
this.serialNumber.setText(rileyLinkPumpInfo.getConnectedDeviceSerialNumber());
|
||||
this.pumpFrequency.setText(rileyLinkPumpInfo.getPumpFrequency());
|
||||
|
||||
if (rileyLinkServiceData.lastGoodFrequency != null) {
|
||||
this.lastUsedFrequency.setText(resourceHelper.gs(R.string.rileylink_pump_frequency_value, rileyLinkServiceData.lastGoodFrequency));
|
||||
}
|
||||
|
||||
long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis();
|
||||
long lastConnectionTimeMillis = rileyLinkPumpDevice.getLastConnectionTimeMillis();
|
||||
if (lastConnectionTimeMillis == 0) {
|
||||
this.lastDeviceContact.setText(resourceHelper.gs(R.string.riley_link_ble_config_connected_never));
|
||||
} else {
|
||||
|
|
|
@ -234,35 +234,70 @@
|
|||
android:textAlignment="center" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rls_t1_connected_device_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_weight="35"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/rileylink_device_model" />
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rls_t1_device_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="65"
|
||||
<TextView
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_weight="35"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/rileylink_configured_device_model" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rls_t1_configured_device_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="65"
|
||||
android:gravity="center_vertical"
|
||||
android:text=" "
|
||||
android:textAlignment="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text=" "
|
||||
android:textAlignment="center" />
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_weight="35"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/rileylink_connected_device_model" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rls_t1_connected_device_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="65"
|
||||
android:gravity="center_vertical"
|
||||
android:text=" "
|
||||
android:textAlignment="center" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
<string name="rileylink_connection_error">Connection Error:</string>
|
||||
<string name="rileylink_device">Device</string>
|
||||
<string name="rileylink_device_type">Device Type:</string>
|
||||
<string name="rileylink_device_model">Device Model:</string>
|
||||
<string name="rileylink_configured_device_model">Configured Device Model:</string>
|
||||
<string name="rileylink_connected_device_model">Connected Device Model:</string>
|
||||
<string name="rileylink_last_used_frequency">Last Used Frequency:</string>
|
||||
<string name="rileylink_last_device_contact">Last Device Contact:</string>
|
||||
<string name="rileylink_firmware_version">Firmware Version:</string>
|
||||
|
@ -70,7 +71,7 @@
|
|||
|
||||
<!-- RileyLink - Common -->
|
||||
<string name="rileylink_target_device_medtronic">Medtronic Pump</string>
|
||||
<string name="rileylink_target_device_omnipod">Omnipod</string>
|
||||
<string name="rileylink_target_device_omnipod">Omnipod (Eros)</string>
|
||||
<string name="riley_link_common_yes">Yes</string>
|
||||
<string name="riley_link_common_no">No</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue