rename nsclientinternal -> nsclient
This commit is contained in:
parent
cbd60cfdbe
commit
22f50198fc
10 changed files with 48 additions and 57 deletions
|
@ -43,7 +43,7 @@ import info.nightscout.androidaps.plugins.Insulin.InsulinOrefRapidActingPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefUltraRapidActingPlugin;
|
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefUltraRapidActingPlugin;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.receivers.AckAlarmReceiver;
|
import info.nightscout.androidaps.plugins.NSClientInternal.receivers.AckAlarmReceiver;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
|
@ -186,7 +186,7 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(WearPlugin.initPlugin(this));
|
pluginsList.add(WearPlugin.initPlugin(this));
|
||||||
pluginsList.add(StatuslinePlugin.initPlugin(this));
|
pluginsList.add(StatuslinePlugin.initPlugin(this));
|
||||||
pluginsList.add(new PersistentNotificationPlugin(this));
|
pluginsList.add(new PersistentNotificationPlugin(this));
|
||||||
pluginsList.add(NSClientInternalPlugin.getPlugin());
|
pluginsList.add(NSClientPlugin.getPlugin());
|
||||||
|
|
||||||
pluginsList.add(sConfigBuilder = ConfigBuilderFragment.getPlugin());
|
pluginsList.add(sConfigBuilder = ConfigBuilderFragment.getPlugin());
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.Careportal.CareportalPlugin;
|
||||||
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefFreePeakPlugin;
|
import info.nightscout.androidaps.plugins.Insulin.InsulinOrefFreePeakPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||||
|
@ -173,7 +173,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginBase.INSULIN);
|
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginBase.INSULIN);
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(NSClientInternalPlugin.getPlugin(), PluginBase.GENERAL);
|
addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginBase.GENERAL);
|
||||||
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginBase.GENERAL);
|
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginBase.GENERAL);
|
||||||
|
|
||||||
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
|
|
|
@ -11,10 +11,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Profile;
|
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.Constraint;
|
import info.nightscout.androidaps.interfaces.Constraint;
|
||||||
|
@ -23,7 +21,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
@ -182,9 +180,9 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginBase.APS))
|
if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginBase.APS))
|
||||||
apsEnabled = true;
|
apsEnabled = true;
|
||||||
|
|
||||||
return new RequirementResult(hasBGData && bgIsAvailableInNS && pumpStatusIsAvailableInNS && NSClientInternalPlugin.getPlugin().hasWritePermission() && LoopPlugin.getPlugin().isEnabled(PluginBase.LOOP) && apsEnabled && vpUploadNeeded,
|
return new RequirementResult(hasBGData && bgIsAvailableInNS && pumpStatusIsAvailableInNS && NSClientPlugin.getPlugin().hasWritePermission() && LoopPlugin.getPlugin().isEnabled(PluginBase.LOOP) && apsEnabled && vpUploadNeeded,
|
||||||
MainApp.gs(R.string.objectives_bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS)
|
MainApp.gs(R.string.objectives_bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS)
|
||||||
+ "\n" + MainApp.gs(R.string.nsclienthaswritepermission) + ": " + yesOrNo(NSClientInternalPlugin.getPlugin().hasWritePermission())
|
+ "\n" + MainApp.gs(R.string.nsclienthaswritepermission) + ": " + yesOrNo(NSClientPlugin.getPlugin().hasWritePermission())
|
||||||
+ (isVirtualPump ? "\n" + MainApp.gs(R.string.virtualpump_uploadstatus_title) + ": " + yesOrNo(vpUploadEnabled) : "")
|
+ (isVirtualPump ? "\n" + MainApp.gs(R.string.virtualpump_uploadstatus_title) + ": " + yesOrNo(vpUploadEnabled) : "")
|
||||||
+ "\n" + MainApp.gs(R.string.objectives_pumpstatusavailableinns) + ": " + yesOrNo(pumpStatusIsAvailableInNS)
|
+ "\n" + MainApp.gs(R.string.objectives_pumpstatusavailableinns) + ": " + yesOrNo(pumpStatusIsAvailableInNS)
|
||||||
+ "\n" + MainApp.gs(R.string.hasbgdata) + ": " + yesOrNo(hasBGData)
|
+ "\n" + MainApp.gs(R.string.hasbgdata) + ": " + yesOrNo(hasBGData)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -34,8 +33,8 @@ import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientU
|
||||||
import info.nightscout.utils.FabricPrivacy;
|
import info.nightscout.utils.FabricPrivacy;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
public class NSClientFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
||||||
private static Logger log = LoggerFactory.getLogger(NSClientInternalFragment.class);
|
private static Logger log = LoggerFactory.getLogger(NSClientFragment.class);
|
||||||
|
|
||||||
private TextView logTextView;
|
private TextView logTextView;
|
||||||
private TextView queueTextView;
|
private TextView queueTextView;
|
||||||
|
@ -58,10 +57,10 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
|
||||||
|
|
||||||
logScrollview = (ScrollView) view.findViewById(R.id.nsclientinternal_logscrollview);
|
logScrollview = (ScrollView) view.findViewById(R.id.nsclientinternal_logscrollview);
|
||||||
autoscrollCheckbox = (CheckBox) view.findViewById(R.id.nsclientinternal_autoscroll);
|
autoscrollCheckbox = (CheckBox) view.findViewById(R.id.nsclientinternal_autoscroll);
|
||||||
autoscrollCheckbox.setChecked(NSClientInternalPlugin.getPlugin().autoscroll);
|
autoscrollCheckbox.setChecked(NSClientPlugin.getPlugin().autoscroll);
|
||||||
autoscrollCheckbox.setOnCheckedChangeListener(this);
|
autoscrollCheckbox.setOnCheckedChangeListener(this);
|
||||||
pausedCheckbox = (CheckBox) view.findViewById(R.id.nsclientinternal_paused);
|
pausedCheckbox = (CheckBox) view.findViewById(R.id.nsclientinternal_paused);
|
||||||
pausedCheckbox.setChecked(NSClientInternalPlugin.getPlugin().paused);
|
pausedCheckbox.setChecked(NSClientPlugin.getPlugin().paused);
|
||||||
pausedCheckbox.setOnCheckedChangeListener(this);
|
pausedCheckbox.setOnCheckedChangeListener(this);
|
||||||
logTextView = (TextView) view.findViewById(R.id.nsclientinternal_log);
|
logTextView = (TextView) view.findViewById(R.id.nsclientinternal_log);
|
||||||
queueTextView = (TextView) view.findViewById(R.id.nsclientinternal_queue);
|
queueTextView = (TextView) view.findViewById(R.id.nsclientinternal_queue);
|
||||||
|
@ -101,11 +100,11 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
|
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_delivernow:
|
case R.id.nsclientinternal_delivernow:
|
||||||
NSClientInternalPlugin.getPlugin().resend("GUI");
|
NSClientPlugin.getPlugin().resend("GUI");
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
|
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_clearlog:
|
case R.id.nsclientinternal_clearlog:
|
||||||
NSClientInternalPlugin.getPlugin().clearLog();
|
NSClientPlugin.getPlugin().clearLog();
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_clearqueue:
|
case R.id.nsclientinternal_clearqueue:
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
|
@ -124,7 +123,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
|
||||||
builder.show();
|
builder.show();
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_showqueue:
|
case R.id.nsclientinternal_showqueue:
|
||||||
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientInternalPlugin.getPlugin().queue().textList()));
|
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList()));
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
|
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -135,14 +134,14 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
|
||||||
switch (buttonView.getId()) {
|
switch (buttonView.getId()) {
|
||||||
case R.id.nsclientinternal_paused:
|
case R.id.nsclientinternal_paused:
|
||||||
SP.putBoolean(R.string.key_nsclientinternal_paused, isChecked);
|
SP.putBoolean(R.string.key_nsclientinternal_paused, isChecked);
|
||||||
NSClientInternalPlugin.getPlugin().paused = isChecked;
|
NSClientPlugin.getPlugin().paused = isChecked;
|
||||||
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
|
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
|
||||||
updateGUI();
|
updateGUI();
|
||||||
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause"));
|
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause"));
|
||||||
break;
|
break;
|
||||||
case R.id.nsclientinternal_autoscroll:
|
case R.id.nsclientinternal_autoscroll:
|
||||||
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);
|
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);
|
||||||
NSClientInternalPlugin.getPlugin().autoscroll = isChecked;
|
NSClientPlugin.getPlugin().autoscroll = isChecked;
|
||||||
updateGUI();
|
updateGUI();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -160,15 +159,15 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
NSClientInternalPlugin.updateLog();
|
NSClientPlugin.getPlugin().updateLog();
|
||||||
logTextView.setText(NSClientInternalPlugin.textLog);
|
logTextView.setText(NSClientPlugin.getPlugin().textLog);
|
||||||
if (NSClientInternalPlugin.getPlugin().autoscroll) {
|
if (NSClientPlugin.getPlugin().autoscroll) {
|
||||||
logScrollview.fullScroll(ScrollView.FOCUS_DOWN);
|
logScrollview.fullScroll(ScrollView.FOCUS_DOWN);
|
||||||
}
|
}
|
||||||
urlTextView.setText(NSClientInternalPlugin.getPlugin().url());
|
urlTextView.setText(NSClientPlugin.getPlugin().url());
|
||||||
Spanned queuetext = Html.fromHtml(MainApp.sResources.getString(R.string.queue) + " <b>" + UploadQueue.size() + "</b>");
|
Spanned queuetext = Html.fromHtml(MainApp.sResources.getString(R.string.queue) + " <b>" + UploadQueue.size() + "</b>");
|
||||||
queueTextView.setText(queuetext);
|
queueTextView.setText(queuetext);
|
||||||
statusTextView.setText(NSClientInternalPlugin.getPlugin().status);
|
statusTextView.setText(NSClientPlugin.getPlugin().status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -31,25 +31,25 @@ import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientServ
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
public class NSClientInternalPlugin implements PluginBase {
|
public class NSClientPlugin implements PluginBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(NSClientInternalPlugin.class);
|
private static Logger log = LoggerFactory.getLogger(NSClientPlugin.class);
|
||||||
|
|
||||||
static NSClientInternalPlugin nsClientInternalPlugin;
|
static NSClientPlugin nsClientPlugin;
|
||||||
|
|
||||||
static public NSClientInternalPlugin getPlugin() {
|
static public NSClientPlugin getPlugin() {
|
||||||
if (nsClientInternalPlugin == null) {
|
if (nsClientPlugin == null) {
|
||||||
nsClientInternalPlugin = new NSClientInternalPlugin();
|
nsClientPlugin = new NSClientPlugin();
|
||||||
}
|
}
|
||||||
return nsClientInternalPlugin;
|
return nsClientPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fragmentEnabled = true;
|
private boolean fragmentEnabled = true;
|
||||||
private boolean fragmentVisible = true;
|
private boolean fragmentVisible = true;
|
||||||
|
|
||||||
static public Handler handler;
|
public Handler handler;
|
||||||
|
|
||||||
private final static List<EventNSClientNewLog> listLog = new ArrayList<>();
|
private final List<EventNSClientNewLog> listLog = new ArrayList<>();
|
||||||
static Spanned textLog = Html.fromHtml("");
|
Spanned textLog = Html.fromHtml("");
|
||||||
|
|
||||||
public boolean paused = false;
|
public boolean paused = false;
|
||||||
boolean autoscroll = true;
|
boolean autoscroll = true;
|
||||||
|
@ -58,13 +58,13 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
|
|
||||||
public NSClientService nsClientService = null;
|
public NSClientService nsClientService = null;
|
||||||
|
|
||||||
NSClientInternalPlugin() {
|
NSClientPlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
paused = SP.getBoolean(R.string.key_nsclientinternal_paused, false);
|
paused = SP.getBoolean(R.string.key_nsclientinternal_paused, false);
|
||||||
autoscroll = SP.getBoolean(R.string.key_nsclientinternal_autoscroll, true);
|
autoscroll = SP.getBoolean(R.string.key_nsclientinternal_autoscroll, true);
|
||||||
|
|
||||||
if (handler == null) {
|
if (handler == null) {
|
||||||
HandlerThread handlerThread = new HandlerThread(NSClientInternalPlugin.class.getSimpleName() + "Handler");
|
HandlerThread handlerThread = new HandlerThread(NSClientPlugin.class.getSimpleName() + "Handler");
|
||||||
handlerThread.start();
|
handlerThread.start();
|
||||||
handler = new Handler(handlerThread.getLooper());
|
handler = new Handler(handlerThread.getLooper());
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFragmentClass() {
|
public String getFragmentClass() {
|
||||||
return NSClientInternalFragment.class.getName();
|
return NSClientFragment.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -201,7 +201,7 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static synchronized void updateLog() {
|
synchronized void updateLog() {
|
||||||
try {
|
try {
|
||||||
StringBuilder newTextLog = new StringBuilder();
|
StringBuilder newTextLog = new StringBuilder();
|
||||||
synchronized (listLog) {
|
synchronized (listLog) {
|
|
@ -48,7 +48,7 @@ public class UploadQueue {
|
||||||
public void run() {
|
public void run() {
|
||||||
log.debug("QUEUE adding: " + dbr.data);
|
log.debug("QUEUE adding: " + dbr.data);
|
||||||
MainApp.getDbHelper().create(dbr);
|
MainApp.getDbHelper().create(dbr);
|
||||||
NSClientInternalPlugin plugin = MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
NSClientPlugin plugin = NSClientPlugin.getPlugin();
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
plugin.resend("newdata");
|
plugin.resend("newdata");
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,13 @@ import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.DbRequest;
|
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.AlarmAck;
|
import info.nightscout.androidaps.plugins.NSClientInternal.data.AlarmAck;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
@ -32,8 +26,8 @@ public class AckAlarmReceiver extends BroadcastReceiver {
|
||||||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
||||||
AckAlarmReceiver.class.getSimpleName());
|
AckAlarmReceiver.class.getSimpleName());
|
||||||
NSClientInternalPlugin nsClientInternalPlugin = MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
NSClientPlugin nsClientPlugin = MainApp.getSpecificPlugin(NSClientPlugin.class);
|
||||||
if (!nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
|
if (!nsClientPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SP.getBoolean(R.string.key_ns_noupload, false)) {
|
if (SP.getBoolean(R.string.key_ns_noupload, false)) {
|
||||||
|
@ -53,7 +47,7 @@ public class AckAlarmReceiver extends BroadcastReceiver {
|
||||||
ack.group = bundles.getString("group");
|
ack.group = bundles.getString("group");
|
||||||
ack.silenceTime = bundles.getLong("silenceTime");
|
ack.silenceTime = bundles.getLong("silenceTime");
|
||||||
|
|
||||||
NSClientService nsClientService = nsClientInternalPlugin.nsClientService;
|
NSClientService nsClientService = nsClientPlugin.nsClientService;
|
||||||
if (nsClientService != null)
|
if (nsClientService != null)
|
||||||
nsClientService.sendAlarmAck(ack);
|
nsClientService.sendAlarmAck(ack);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.DbRequest;
|
import info.nightscout.androidaps.db.DbRequest;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastTreatment;
|
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastTreatment;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -105,8 +105,8 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldUpload() {
|
public boolean shouldUpload() {
|
||||||
NSClientInternalPlugin nsClientInternalPlugin = MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
NSClientPlugin nsClientPlugin = MainApp.getSpecificPlugin(NSClientPlugin.class);
|
||||||
return nsClientInternalPlugin.isEnabled(PluginBase.GENERAL) && !SP.getBoolean(R.string.key_ns_noupload, false);
|
return nsClientPlugin.isEnabled(PluginBase.GENERAL) && !SP.getBoolean(R.string.key_ns_noupload, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genereateTreatmentOfflineBroadcast(DbRequest request) {
|
public void genereateTreatmentOfflineBroadcast(DbRequest request) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
||||||
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
import info.nightscout.androidaps.events.EventConfigBuilderChange;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.acks.NSAddAck;
|
import info.nightscout.androidaps.plugins.NSClientInternal.acks.NSAddAck;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.acks.NSAuthAck;
|
import info.nightscout.androidaps.plugins.NSClientInternal.acks.NSAuthAck;
|
||||||
|
@ -180,7 +180,7 @@ public class NSClientService extends Service {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatusEvent(EventConfigBuilderChange ev) {
|
public void onStatusEvent(EventConfigBuilderChange ev) {
|
||||||
if (nsEnabled != MainApp.getSpecificPlugin(NSClientInternalPlugin.class).isEnabled(PluginBase.GENERAL)) {
|
if (nsEnabled != MainApp.getSpecificPlugin(NSClientPlugin.class).isEnabled(PluginBase.GENERAL)) {
|
||||||
latestDateInReceivedData = 0;
|
latestDateInReceivedData = 0;
|
||||||
destroy();
|
destroy();
|
||||||
initialize();
|
initialize();
|
||||||
|
@ -202,7 +202,7 @@ public class NSClientService extends Service {
|
||||||
nsAPIhashCode = Hashing.sha1().hashString(nsAPISecret, Charsets.UTF_8).toString();
|
nsAPIhashCode = Hashing.sha1().hashString(nsAPISecret, Charsets.UTF_8).toString();
|
||||||
|
|
||||||
MainApp.bus().post(new EventNSClientStatus("Initializing"));
|
MainApp.bus().post(new EventNSClientStatus("Initializing"));
|
||||||
if (MainApp.getSpecificPlugin(NSClientInternalPlugin.class).paused) {
|
if (MainApp.getSpecificPlugin(NSClientPlugin.class).paused) {
|
||||||
MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "paused"));
|
MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "paused"));
|
||||||
MainApp.bus().post(new EventNSClientStatus("Paused"));
|
MainApp.bus().post(new EventNSClientStatus("Paused"));
|
||||||
} else if (!nsEnabled) {
|
} else if (!nsEnabled) {
|
||||||
|
@ -313,7 +313,7 @@ public class NSClientService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readPreferences() {
|
public void readPreferences() {
|
||||||
nsEnabled = MainApp.getSpecificPlugin(NSClientInternalPlugin.class).isEnabled(PluginBase.GENERAL);
|
nsEnabled = MainApp.getSpecificPlugin(NSClientPlugin.class).isEnabled(PluginBase.GENERAL);
|
||||||
nsURL = SP.getString(R.string.key_nsclientinternal_url, "");
|
nsURL = SP.getString(R.string.key_nsclientinternal_url, "");
|
||||||
nsAPISecret = SP.getString(R.string.key_nsclientinternal_api_secret, "");
|
nsAPISecret = SP.getString(R.string.key_nsclientinternal_api_secret, "");
|
||||||
nsDevice = SP.getString("careportal_enteredby", "");
|
nsDevice = SP.getString("careportal_enteredby", "");
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalFragment">
|
tools:context="info.nightscout.androidaps.plugins.NSClientInternal.NSClientFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue