Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
158724aea1
6 changed files with 33 additions and 14 deletions
|
@ -196,7 +196,6 @@ dependencies {
|
|||
implementation "com.jjoe64:graphview:4.0.1"
|
||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'com.google.android.gms:play-services-wearable:10.2.1'
|
||||
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
|
||||
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
}
|
||||
|
||||
boolean isCommand(String command, String number) {
|
||||
switch(command.toUpperCase()) {
|
||||
switch (command.toUpperCase()) {
|
||||
case "BG":
|
||||
case "LOOP":
|
||||
case "TREATMENTS":
|
||||
|
@ -760,11 +760,18 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
void sendSMS(Sms sms) {
|
||||
SmsManager smsManager = SmsManager.getDefault();
|
||||
sms.text = stripAccents(sms.text);
|
||||
if (sms.text.length() > 140) sms.text = sms.text.substring(0, 139);
|
||||
|
||||
try {
|
||||
if (L.isEnabled(L.SMS))
|
||||
log.debug("Sending SMS to " + sms.phoneNumber + ": " + sms.text);
|
||||
if (sms.text.getBytes().length <= 140)
|
||||
smsManager.sendTextMessage(sms.phoneNumber, null, sms.text, null, null);
|
||||
else {
|
||||
ArrayList<String> parts = smsManager.divideMessage(sms.text);
|
||||
smsManager.sendMultipartTextMessage(sms.phoneNumber, null, parts,
|
||||
null, null);
|
||||
}
|
||||
|
||||
messages.add(sms);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.gs(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
||||
|
|
|
@ -625,10 +625,12 @@ public class ActionStringHandler {
|
|||
}
|
||||
generateTempTarget(duration, low, high);
|
||||
} else if ("wizard2".equals(act[0])) {
|
||||
if (lastBolusWizard != null) {
|
||||
//use last calculation as confirmed string matches
|
||||
|
||||
doBolus(lastBolusWizard.calculatedTotalInsulin, lastBolusWizard.carbs);
|
||||
lastBolusWizard = null;
|
||||
}
|
||||
} else if ("bolus".equals(act[0])) {
|
||||
double insulin = SafeParse.stringToDouble(act[1]);
|
||||
int carbs = SafeParse.stringToInt(act[2]);
|
||||
|
|
|
@ -482,6 +482,8 @@ public class WatchUpdaterService extends WearableListenerService implements Goog
|
|||
|
||||
for (; runningTime < now; runningTime += 5 * 60 * 1000) {
|
||||
Profile profileTB = ProfileFunctions.getInstance().getProfile(runningTime);
|
||||
if (profileTB == null)
|
||||
return;
|
||||
//basal rate
|
||||
endBasalValue = profile.getBasal(runningTime);
|
||||
if (endBasalValue != beginBasalValue) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import info.nightscout.androidaps.interfaces.InsulinInterface;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||
import info.nightscout.androidaps.interfaces.PluginType;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
|
@ -187,6 +188,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
if (insulinInterface == null)
|
||||
return total;
|
||||
|
||||
PumpInterface pumpInterface = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||
if (pumpInterface == null)
|
||||
return total;
|
||||
|
||||
double dia = profile.getDia();
|
||||
|
||||
synchronized (treatments) {
|
||||
|
@ -210,7 +215,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
}
|
||||
}
|
||||
|
||||
if (!ConfigBuilderPlugin.getPlugin().getActivePump().isFakingTempsByExtendedBoluses())
|
||||
if (!pumpInterface.isFakingTempsByExtendedBoluses())
|
||||
synchronized (extendedBoluses) {
|
||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||
ExtendedBolus e = extendedBoluses.get(pos);
|
||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
|||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusprogressIfRunning;
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||
import info.nightscout.androidaps.utils.SP;
|
||||
import info.nightscout.androidaps.utils.T;
|
||||
|
||||
/**
|
||||
* Created by mike on 09.11.2017.
|
||||
|
@ -28,9 +29,8 @@ public class QueueThread extends Thread {
|
|||
|
||||
private CommandQueue queue;
|
||||
|
||||
private long lastCommandTime = 0;
|
||||
private boolean connectLogged = false;
|
||||
public boolean waitingForDisconnect = false;
|
||||
boolean waitingForDisconnect = false;
|
||||
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
|
||||
|
@ -41,14 +41,17 @@ public class QueueThread extends Thread {
|
|||
Context context = MainApp.instance().getApplicationContext();
|
||||
if (context != null) {
|
||||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
if (powerManager != null)
|
||||
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:QueueThread");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void run() {
|
||||
mWakeLock.acquire();
|
||||
if (mWakeLock != null)
|
||||
mWakeLock.acquire(T.mins(10).msecs());
|
||||
MainApp.bus().post(new EventQueueChanged());
|
||||
long lastCommandTime;
|
||||
long connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
|
@ -72,7 +75,7 @@ public class QueueThread extends Thread {
|
|||
|
||||
//BLUETOOTH-WATCHDOG
|
||||
boolean watchdog = SP.getBoolean(R.string.key_btwatchdog, false);
|
||||
long last_watchdog = SP.getLong(R.string.key_btwatchdog_lastbark, 0l);
|
||||
long last_watchdog = SP.getLong(R.string.key_btwatchdog_lastbark, 0L);
|
||||
watchdog = watchdog && System.currentTimeMillis() - last_watchdog > (Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000);
|
||||
if (watchdog) {
|
||||
if (L.isEnabled(L.PUMPQUEUE))
|
||||
|
@ -170,6 +173,7 @@ public class QueueThread extends Thread {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
if (mWakeLock != null)
|
||||
mWakeLock.release();
|
||||
if (L.isEnabled(L.PUMPQUEUE))
|
||||
log.debug("thread end");
|
||||
|
|
Loading…
Reference in a new issue