GUI tweaking, small fixes
This commit is contained in:
parent
7f4888978e
commit
04994924c5
6 changed files with 676 additions and 602 deletions
|
@ -58,6 +58,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
TextView firmwareView;
|
TextView firmwareView;
|
||||||
TextView basalStepView;
|
TextView basalStepView;
|
||||||
TextView bolusStepView;
|
TextView bolusStepView;
|
||||||
|
TextView serialNumberView;
|
||||||
Button viewProfileButton;
|
Button viewProfileButton;
|
||||||
Button historyButton;
|
Button historyButton;
|
||||||
Button statsButton;
|
Button statsButton;
|
||||||
|
@ -106,6 +107,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
||||||
basalStepView = (TextView) view.findViewById(R.id.danar_basalstep);
|
basalStepView = (TextView) view.findViewById(R.id.danar_basalstep);
|
||||||
bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep);
|
bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep);
|
||||||
|
serialNumberView = (TextView) view.findViewById(R.id.danar_serialnumber);
|
||||||
|
|
||||||
|
|
||||||
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -242,6 +244,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
}
|
}
|
||||||
basalStepView.setText("" + pump.basalStep);
|
basalStepView.setText("" + pump.basalStep);
|
||||||
bolusStepView.setText("" + pump.bolusStep);
|
bolusStepView.setText("" + pump.bolusStep);
|
||||||
|
serialNumberView.setText("" + pump.serialNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class DanaRS_Packet_General_Initial_Screen_Information extends DanaRS_Pac
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
pump.maxDailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
pump.maxDailyTotalUnits = (int) (byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d);
|
||||||
|
|
||||||
dataIndex += dataSize;
|
dataIndex += dataSize;
|
||||||
dataSize = 2;
|
dataSize = 2;
|
||||||
|
|
|
@ -64,6 +64,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Se
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Stop;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Stop;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Get_Pump_Check;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Get_Shipping_Information;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Get_Shipping_Information;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Initial_Screen_Information;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Initial_Screen_Information;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_History_;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_History_;
|
||||||
|
@ -141,7 +142,8 @@ public class DanaRSService extends Service {
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
if (danaRPump.lastSettingsRead.getTime() + 60 * 60 * 1000L < now.getTime() || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
if (danaRPump.lastSettingsRead.getTime() + 60 * 60 * 1000L < now.getTime() || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
||||||
sendMessage(new DanaRS_Packet_General_Get_Shipping_Information());
|
sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
|
||||||
|
sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
||||||
sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
||||||
sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
|
sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
|
||||||
sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // bolusStep, maxBolus
|
sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // bolusStep, maxBolus
|
||||||
|
@ -259,6 +261,7 @@ public class DanaRSService extends Service {
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||||
sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(percent, durationInHours));
|
sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(percent, durationInHours));
|
||||||
|
SystemClock.sleep(200);
|
||||||
sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||||
loadEvents();
|
loadEvents();
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -283,6 +286,7 @@ public class DanaRSService extends Service {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||||
sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus(insulin, durationInHalfHours));
|
sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus(insulin, durationInHalfHours));
|
||||||
|
SystemClock.sleep(200);
|
||||||
sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||||
loadEvents();
|
loadEvents();
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -626,6 +630,7 @@ public class DanaRSService extends Service {
|
||||||
|
|
||||||
while (isProcessing) {
|
while (isProcessing) {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
byte[] inputBuffer = null;
|
||||||
synchronized (readBuffer) {
|
synchronized (readBuffer) {
|
||||||
// Find packet start [A5 A5]
|
// Find packet start [A5 A5]
|
||||||
if (bufferLength >= 6) {
|
if (bufferLength >= 6) {
|
||||||
|
@ -655,10 +660,8 @@ public class DanaRSService extends Service {
|
||||||
packetIsValid = true;
|
packetIsValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (packetIsValid) {
|
||||||
if (packetIsValid) {
|
inputBuffer = new byte[length + 7];
|
||||||
byte[] inputBuffer = new byte[length + 7];
|
|
||||||
synchronized (readBuffer) {
|
|
||||||
// copy packet to input buffer
|
// copy packet to input buffer
|
||||||
System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7);
|
System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7);
|
||||||
// Cut off the message from readBuffer
|
// Cut off the message from readBuffer
|
||||||
|
@ -669,8 +672,10 @@ public class DanaRSService extends Service {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
bufferLength -= (length + 7);
|
bufferLength -= (length + 7);
|
||||||
|
// now we have encrypted packet in inputBuffer
|
||||||
}
|
}
|
||||||
// now we have encrypted packet in inputBuffer
|
}
|
||||||
|
if (packetIsValid) {
|
||||||
try {
|
try {
|
||||||
// decrypt the packet
|
// decrypt the packet
|
||||||
inputBuffer = BleCommandUtil.getInstance().getDecryptedPacket(inputBuffer);
|
inputBuffer = BleCommandUtil.getInstance().getDecryptedPacket(inputBuffer);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
|
@ -381,7 +381,7 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/overview_accepttempbutton"
|
android:id="@+id/overview_accepttempbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="3dp"
|
android:layout_marginBottom="3dp"
|
||||||
android:layout_marginTop="3dp"
|
android:layout_marginTop="3dp"
|
||||||
|
|
|
@ -719,5 +719,6 @@
|
||||||
<string name="bolusspeed">Bolus speed</string>
|
<string name="bolusspeed">Bolus speed</string>
|
||||||
<string name="key_danars_bolusspeed">danars_bolusspeed</string>
|
<string name="key_danars_bolusspeed">danars_bolusspeed</string>
|
||||||
<string name="danar_setbasalstep001">Set basal step to 0.01 U/h</string>
|
<string name="danar_setbasalstep001">Set basal step to 0.01 U/h</string>
|
||||||
|
<string name="serialnumber">Serial number</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue