Merge branch 'watchfaces' into dev
This commit is contained in:
commit
07c1084287
|
@ -75,6 +75,7 @@ android {
|
||||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||||
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
||||||
buildConfigField "boolean", "CLOSEDLOOP", "true"
|
buildConfigField "boolean", "CLOSEDLOOP", "true"
|
||||||
|
buildConfigField "boolean", "G5UPLOADER", "false"
|
||||||
}
|
}
|
||||||
openloop {
|
openloop {
|
||||||
dimension "standard"
|
dimension "standard"
|
||||||
|
@ -87,6 +88,7 @@ android {
|
||||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||||
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
||||||
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
||||||
|
buildConfigField "boolean", "G5UPLOADER", "false"
|
||||||
}
|
}
|
||||||
pumpcontrol {
|
pumpcontrol {
|
||||||
dimension "standard"
|
dimension "standard"
|
||||||
|
@ -99,6 +101,7 @@ android {
|
||||||
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
buildConfigField "boolean", "PUMPDRIVERS", "true"
|
||||||
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
||||||
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
||||||
|
buildConfigField "boolean", "G5UPLOADER", "false"
|
||||||
}
|
}
|
||||||
nsclient {
|
nsclient {
|
||||||
dimension "standard"
|
dimension "standard"
|
||||||
|
@ -111,6 +114,20 @@ android {
|
||||||
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
||||||
buildConfigField "boolean", "NSCLIENTOLNY", "true"
|
buildConfigField "boolean", "NSCLIENTOLNY", "true"
|
||||||
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
||||||
|
buildConfigField "boolean", "G5UPLOADER", "false"
|
||||||
|
}
|
||||||
|
g5uploader {
|
||||||
|
dimension "standard"
|
||||||
|
resValue "string", "app_name", "NSClient"
|
||||||
|
versionName version + "-nsclient"
|
||||||
|
manifestPlaceholders = [
|
||||||
|
appIcon: "@mipmap/yellowowl"
|
||||||
|
]
|
||||||
|
buildConfigField "boolean", "APS", "false"
|
||||||
|
buildConfigField "boolean", "PUMPDRIVERS", "false"
|
||||||
|
buildConfigField "boolean", "NSCLIENTOLNY", "false"
|
||||||
|
buildConfigField "boolean", "CLOSEDLOOP", "false"
|
||||||
|
buildConfigField "boolean", "G5UPLOADER", "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +178,7 @@ dependencies {
|
||||||
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
||||||
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
||||||
compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar')
|
compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar')
|
||||||
compile ('com.google.android:flexbox:0.3.0') {
|
compile('com.google.android:flexbox:0.3.0') {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
compile('io.socket:socket.io-client:0.8.3') {
|
compile('io.socket:socket.io-client:0.8.3') {
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR" />
|
<action android:name="com.eveningoutpost.dexdrip.NS_EMULATOR" />
|
||||||
<!-- Receiver from glimp -->
|
<!-- Receiver from glimp -->
|
||||||
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
|
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
|
||||||
|
<!-- Receiver from DexcomG5 -->
|
||||||
|
<action android:name="com.dexcom.cgm.DATA" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<!-- Receiver keepalive, scheduled every 30 min -->
|
<!-- Receiver keepalive, scheduled every 30 min -->
|
||||||
|
|
|
@ -4,22 +4,23 @@ package info.nightscout.androidaps;
|
||||||
* Created by mike on 07.06.2016.
|
* Created by mike on 07.06.2016.
|
||||||
*/
|
*/
|
||||||
public class Config {
|
public class Config {
|
||||||
public static int SUPPORTEDNSVERSION = 1000; // 0.10.00
|
public static int SUPPORTEDNSVERSION = 1002; // 0.10.00
|
||||||
|
|
||||||
// MAIN FUCTIONALITY
|
// MAIN FUCTIONALITY
|
||||||
public static final boolean APS = BuildConfig.APS;
|
public static final boolean APS = BuildConfig.APS;
|
||||||
// PLUGINS
|
// PLUGINS
|
||||||
public static final boolean NSCLIENT = BuildConfig.NSCLIENTOLNY;
|
public static final boolean NSCLIENT = BuildConfig.NSCLIENTOLNY;
|
||||||
|
public static final boolean G5UPLOADER = BuildConfig.G5UPLOADER;
|
||||||
|
|
||||||
public static final boolean DANAR = true && BuildConfig.PUMPDRIVERS;
|
public static final boolean DANAR = BuildConfig.PUMPDRIVERS;
|
||||||
|
|
||||||
public static final boolean ACTION = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean ACTION = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
public static final boolean VIRTUALPUMP = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean VIRTUALPUMP = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
public static final boolean MDI = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean MDI = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
public static final boolean OTHERPROFILES = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean OTHERPROFILES = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
public static final boolean SAFETY = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean SAFETY = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
|
|
||||||
public static final boolean SMSCOMMUNICATORENABLED = !BuildConfig.NSCLIENTOLNY;
|
public static final boolean SMSCOMMUNICATORENABLED = !BuildConfig.NSCLIENTOLNY && !BuildConfig.G5UPLOADER;
|
||||||
|
|
||||||
|
|
||||||
public static final boolean detailedLog = true;
|
public static final boolean detailedLog = true;
|
||||||
|
|
|
@ -61,4 +61,5 @@ public class Constants {
|
||||||
|
|
||||||
// Pump
|
// Pump
|
||||||
public static final int PUMP_MAX_CONNECTION_TIME_IN_SECONDS = 60 - 1;
|
public static final int PUMP_MAX_CONNECTION_TIME_IN_SECONDS = 60 - 1;
|
||||||
|
public static final int MIN_WATCHDOG_INTERVAL_IN_SECONDS = 12 * 60;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
case R.id.nav_about:
|
case R.id.nav_about:
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
|
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
|
||||||
builder.setTitle(getString(R.string.app_name) + " " + BuildConfig.VERSION);
|
builder.setTitle(getString(R.string.app_name) + " " + BuildConfig.VERSION);
|
||||||
if (Config.NSCLIENT)
|
if (Config.NSCLIENT|| Config.G5UPLOADER)
|
||||||
builder.setIcon(R.mipmap.yellowowl);
|
builder.setIcon(R.mipmap.yellowowl);
|
||||||
else
|
else
|
||||||
builder.setIcon(R.mipmap.blueowl);
|
builder.setIcon(R.mipmap.blueowl);
|
||||||
|
|
|
@ -64,6 +64,7 @@ import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.SourceDexcomG5.SourceDexcomG5Plugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
||||||
|
@ -144,13 +145,16 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(TreatmentsPlugin.getPlugin());
|
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
if (!Config.NSCLIENT && !Config.G5UPLOADER)
|
||||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||||
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
if (!Config.G5UPLOADER)
|
||||||
if (!Config.NSCLIENT)
|
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
||||||
|
if (!Config.NSCLIENT && !Config.G5UPLOADER)
|
||||||
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
||||||
if (!Config.NSCLIENT)
|
if (!Config.NSCLIENT && !Config.G5UPLOADER)
|
||||||
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
pluginsList.add(SourceGlimpPlugin.getPlugin());
|
||||||
|
if (!Config.NSCLIENT)
|
||||||
|
pluginsList.add(SourceDexcomG5Plugin.getPlugin());
|
||||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||||
pluginsList.add(FoodPlugin.getPlugin());
|
pluginsList.add(FoodPlugin.getPlugin());
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
|
||||||
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.SourceDexcomG5.SourceDexcomG5Plugin;
|
||||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||||
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
||||||
import info.nightscout.utils.LocaleHelper;
|
import info.nightscout.utils.LocaleHelper;
|
||||||
|
@ -126,15 +127,16 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
addPreferencesFromResource(id);
|
addPreferencesFromResource(id);
|
||||||
addPreferencesFromResource(R.xml.pref_advanced);
|
addPreferencesFromResource(R.xml.pref_advanced);
|
||||||
} else {
|
} else {
|
||||||
if (!Config.NSCLIENT) {
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
addPreferencesFromResource(R.xml.pref_password);
|
addPreferencesFromResource(R.xml.pref_password);
|
||||||
}
|
}
|
||||||
addPreferencesFromResource(R.xml.pref_age);
|
addPreferencesFromResource(R.xml.pref_age);
|
||||||
addPreferencesFromResource(R.xml.pref_language);
|
addPreferencesFromResource(R.xml.pref_language);
|
||||||
|
|
||||||
if (!Config.NSCLIENT) {
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
addPreferencesFromResource(R.xml.pref_quickwizard);
|
addPreferencesFromResource(R.xml.pref_quickwizard);
|
||||||
}
|
}
|
||||||
|
addPreferencesFromResourceIfEnabled(SourceDexcomG5Plugin.getPlugin(), PluginBase.BGSOURCE);
|
||||||
addPreferencesFromResourceIfEnabled(CareportalPlugin.getPlugin(), PluginBase.GENERAL);
|
addPreferencesFromResourceIfEnabled(CareportalPlugin.getPlugin(), PluginBase.GENERAL);
|
||||||
addPreferencesFromResourceIfEnabled(SafetyPlugin.getPlugin(), PluginBase.CONSTRAINTS);
|
addPreferencesFromResourceIfEnabled(SafetyPlugin.getPlugin(), PluginBase.CONSTRAINTS);
|
||||||
if (Config.APS) {
|
if (Config.APS) {
|
||||||
|
@ -147,7 +149,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
addPreferencesFromResourceIfEnabled(SensitivityWeightedAveragePlugin.getPlugin(), PluginBase.SENSITIVITY);
|
addPreferencesFromResourceIfEnabled(SensitivityWeightedAveragePlugin.getPlugin(), PluginBase.SENSITIVITY);
|
||||||
addPreferencesFromResourceIfEnabled(SensitivityOref0Plugin.getPlugin(), PluginBase.SENSITIVITY);
|
addPreferencesFromResourceIfEnabled(SensitivityOref0Plugin.getPlugin(), PluginBase.SENSITIVITY);
|
||||||
|
|
||||||
if (!Config.NSCLIENT) {
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
addPreferencesFromResource(R.xml.pref_profile);
|
addPreferencesFromResource(R.xml.pref_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,14 +167,16 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(VirtualPumpPlugin.getPlugin(), PluginBase.PUMP);
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
|
addPreferencesFromResourceIfEnabled(VirtualPumpPlugin.getPlugin(), PluginBase.PUMP);
|
||||||
|
}
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginBase.INSULIN);
|
addPreferencesFromResourceIfEnabled(InsulinOrefFreePeakPlugin.getPlugin(), PluginBase.INSULIN);
|
||||||
|
|
||||||
addPreferencesFromResourceIfEnabled(NSClientInternalPlugin.getPlugin(), PluginBase.GENERAL);
|
addPreferencesFromResourceIfEnabled(NSClientInternalPlugin.getPlugin(), PluginBase.GENERAL);
|
||||||
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginBase.GENERAL);
|
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginBase.GENERAL);
|
||||||
|
|
||||||
if (!Config.NSCLIENT) {
|
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||||
addPreferencesFromResource(R.xml.pref_others);
|
addPreferencesFromResource(R.xml.pref_others);
|
||||||
}
|
}
|
||||||
addPreferencesFromResource(R.xml.pref_advanced);
|
addPreferencesFromResource(R.xml.pref_advanced);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync;
|
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
|
||||||
|
import info.nightscout.androidaps.plugins.SourceDexcomG5.SourceDexcomG5Plugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
import info.nightscout.androidaps.plugins.SourceGlimp.SourceGlimpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
|
||||||
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
|
||||||
|
@ -38,6 +39,7 @@ import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
|
||||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
|
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
|
||||||
import info.nightscout.utils.BundleLogger;
|
import info.nightscout.utils.BundleLogger;
|
||||||
|
import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ public class DataService extends IntentService {
|
||||||
boolean nsClientEnabled = true;
|
boolean nsClientEnabled = true;
|
||||||
boolean mm640gEnabled = false;
|
boolean mm640gEnabled = false;
|
||||||
boolean glimpEnabled = false;
|
boolean glimpEnabled = false;
|
||||||
|
boolean dexcomG5Enabled = false;
|
||||||
|
|
||||||
public DataService() {
|
public DataService() {
|
||||||
super("DataService");
|
super("DataService");
|
||||||
|
@ -64,21 +67,31 @@ public class DataService extends IntentService {
|
||||||
nsClientEnabled = false;
|
nsClientEnabled = false;
|
||||||
mm640gEnabled = false;
|
mm640gEnabled = false;
|
||||||
glimpEnabled = false;
|
glimpEnabled = false;
|
||||||
|
dexcomG5Enabled = false;
|
||||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
|
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
|
||||||
xDripEnabled = false;
|
xDripEnabled = false;
|
||||||
nsClientEnabled = true;
|
nsClientEnabled = true;
|
||||||
mm640gEnabled = false;
|
mm640gEnabled = false;
|
||||||
glimpEnabled = false;
|
glimpEnabled = false;
|
||||||
|
dexcomG5Enabled = false;
|
||||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
|
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) {
|
||||||
xDripEnabled = false;
|
xDripEnabled = false;
|
||||||
nsClientEnabled = false;
|
nsClientEnabled = false;
|
||||||
mm640gEnabled = true;
|
mm640gEnabled = true;
|
||||||
glimpEnabled = false;
|
glimpEnabled = false;
|
||||||
|
dexcomG5Enabled = false;
|
||||||
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
|
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) {
|
||||||
xDripEnabled = false;
|
xDripEnabled = false;
|
||||||
nsClientEnabled = false;
|
nsClientEnabled = false;
|
||||||
mm640gEnabled = false;
|
mm640gEnabled = false;
|
||||||
glimpEnabled = true;
|
glimpEnabled = true;
|
||||||
|
dexcomG5Enabled = false;
|
||||||
|
} else if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceDexcomG5Plugin.class)) {
|
||||||
|
xDripEnabled = false;
|
||||||
|
nsClientEnabled = false;
|
||||||
|
mm640gEnabled = false;
|
||||||
|
glimpEnabled = false;
|
||||||
|
dexcomG5Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfileInterface().getClass().equals(NSProfilePlugin.class);
|
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfileInterface().getClass().equals(NSProfilePlugin.class);
|
||||||
|
@ -99,6 +112,10 @@ public class DataService extends IntentService {
|
||||||
if (glimpEnabled) {
|
if (glimpEnabled) {
|
||||||
handleNewDataFromGlimp(intent);
|
handleNewDataFromGlimp(intent);
|
||||||
}
|
}
|
||||||
|
} else if (Intents.DEXCOMG5_BG.equals(action)) {
|
||||||
|
if (dexcomG5Enabled) {
|
||||||
|
handleNewDataFromDexcomG5(intent);
|
||||||
|
}
|
||||||
} else if (Intents.ACTION_NEW_SGV.equals(action)) {
|
} else if (Intents.ACTION_NEW_SGV.equals(action)) {
|
||||||
// always handle SGV if NS-Client is the source
|
// always handle SGV if NS-Client is the source
|
||||||
if (nsClientEnabled) {
|
if (nsClientEnabled) {
|
||||||
|
@ -187,6 +204,37 @@ public class DataService extends IntentService {
|
||||||
MainApp.getDbHelper().createIfNotExists(bgReading, "GLIMP");
|
MainApp.getDbHelper().createIfNotExists(bgReading, "GLIMP");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleNewDataFromDexcomG5(Intent intent) {
|
||||||
|
// onHandleIntent Bundle{ data => [{"m_time":1511939180,"m_trend":"NotComputable","m_value":335}]; android.support.content.wakelockid => 95; }Bundle
|
||||||
|
|
||||||
|
Bundle bundle = intent.getExtras();
|
||||||
|
if (bundle == null) return;
|
||||||
|
|
||||||
|
BgReading bgReading = new BgReading();
|
||||||
|
|
||||||
|
String data = bundle.getString("data");
|
||||||
|
log.debug("Received Dexcom Data", data);
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONArray jsonArray = new JSONArray(data);
|
||||||
|
log.debug("Received Dexcom Data size:" + jsonArray.length());
|
||||||
|
for(int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
JSONObject json = jsonArray.getJSONObject(i);
|
||||||
|
bgReading.value = json.getInt("m_value");
|
||||||
|
bgReading.direction = json.getString("m_trend");
|
||||||
|
bgReading.date = json.getLong("m_time") * 1000L;
|
||||||
|
bgReading.raw = 0;
|
||||||
|
boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "DexcomG5");
|
||||||
|
if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) {
|
||||||
|
NSUpload.uploadBg(bgReading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleNewDataFromMM640g(Intent intent) {
|
private void handleNewDataFromMM640g(Intent intent) {
|
||||||
Bundle bundle = intent.getExtras();
|
Bundle bundle = intent.getExtras();
|
||||||
if (bundle == null) return;
|
if (bundle == null) return;
|
||||||
|
|
|
@ -45,4 +45,6 @@ public interface Intents {
|
||||||
String ACTION_REMOTE_CALIBRATION = "com.eveningoutpost.dexdrip.NewCalibration";
|
String ACTION_REMOTE_CALIBRATION = "com.eveningoutpost.dexdrip.NewCalibration";
|
||||||
|
|
||||||
String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED";
|
String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED";
|
||||||
|
|
||||||
|
String DEXCOMG5_BG = "com.dexcom.cgm.DATA";
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,9 @@ public class BgReading implements DataPointWithLabelInterface {
|
||||||
direction.compareTo("NOT COMPUTABLE") == 0 ||
|
direction.compareTo("NOT COMPUTABLE") == 0 ||
|
||||||
direction.compareTo("OUT_OF_RANGE") == 0 ||
|
direction.compareTo("OUT_OF_RANGE") == 0 ||
|
||||||
direction.compareTo("OUT OF RANGE") == 0 ||
|
direction.compareTo("OUT OF RANGE") == 0 ||
|
||||||
direction.compareTo("NONE") == 0) {
|
direction.compareTo("NONE") == 0 ||
|
||||||
|
direction.compareTo("NotComputable") == 0
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -343,7 +343,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
}
|
}
|
||||||
// ------------------- BgReading handling -----------------------
|
// ------------------- BgReading handling -----------------------
|
||||||
|
|
||||||
public void createIfNotExists(BgReading bgReading, String from) {
|
public boolean createIfNotExists(BgReading bgReading, String from) {
|
||||||
try {
|
try {
|
||||||
bgReading.date = roundDateToSec(bgReading.date);
|
bgReading.date = roundDateToSec(bgReading.date);
|
||||||
BgReading old = getDaoBgReadings().queryForId(bgReading.date);
|
BgReading old = getDaoBgReadings().queryForId(bgReading.date);
|
||||||
|
@ -351,18 +351,20 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
getDaoBgReadings().create(bgReading);
|
getDaoBgReadings().create(bgReading);
|
||||||
log.debug("BG: New record from: " + from + " " + bgReading.toString());
|
log.debug("BG: New record from: " + from + " " + bgReading.toString());
|
||||||
scheduleBgChange();
|
scheduleBgChange();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
if (!old.isEqual(bgReading)) {
|
if (!old.isEqual(bgReading)) {
|
||||||
|
log.debug("BG: Similiar found: " + old.toString());
|
||||||
old.copyFrom(bgReading);
|
old.copyFrom(bgReading);
|
||||||
getDaoBgReadings().update(old);
|
getDaoBgReadings().update(old);
|
||||||
log.debug("BG: Updating record from: " + from + " " + old.toString());
|
log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
|
||||||
scheduleBgChange();
|
scheduleBgChange();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void scheduleBgChange() {
|
private static void scheduleBgChange() {
|
||||||
|
|
|
@ -93,12 +93,14 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
ConfigBuilderPlugin.getCommandQueue().extendedBolus(finalInsulin, finalDurationInMinutes, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().extendedBolus(finalInsulin, finalDurationInMinutes, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
if (!result.success) {
|
||||||
i.putExtra("soundid", R.raw.boluserror);
|
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||||
i.putExtra("status", result.comment);
|
i.putExtra("soundid", R.raw.boluserror);
|
||||||
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
i.putExtra("status", result.comment);
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||||
MainApp.instance().startActivity(i);
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
MainApp.instance().startActivity(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Answers.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
|
Answers.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.crashlytics.android.Crashlytics;
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
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.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
|
@ -104,7 +105,7 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
|
||||||
butonsLayout.setVisibility(View.VISIBLE);
|
butonsLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BuildConfig.NSCLIENTOLNY)
|
if (Config.NSCLIENT || Config.G5UPLOADER)
|
||||||
statsLayout.setVisibility(View.GONE); // visible on overview
|
statsLayout.setVisibility(View.GONE); // visible on overview
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class CareportalPlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showInList(int type) {
|
public boolean showInList(int type) {
|
||||||
return !Config.NSCLIENT;
|
return !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisibleInTabs(int type) {
|
public boolean isVisibleInTabs(int type) {
|
||||||
return type == CONSTRAINTS && fragmentVisible && !BuildConfig.NSCLIENTOLNY;
|
return type == CONSTRAINTS && fragmentVisible && !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class NSClientInternalPlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showInList(int type) {
|
public boolean showInList(int type) {
|
||||||
return !Config.NSCLIENT;
|
return !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -198,9 +198,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
|
|
||||||
View view;
|
View view;
|
||||||
|
|
||||||
if (MainApp.sResources.getBoolean(R.bool.isTablet) && BuildConfig.NSCLIENTOLNY) {
|
if (MainApp.sResources.getBoolean(R.bool.isTablet) && (Config.NSCLIENT || Config.G5UPLOADER)) {
|
||||||
view = inflater.inflate(R.layout.overview_fragment_nsclient_tablet, container, false);
|
view = inflater.inflate(R.layout.overview_fragment_nsclient_tablet, container, false);
|
||||||
} else if (BuildConfig.NSCLIENTOLNY) {
|
} else if (Config.NSCLIENT || Config.G5UPLOADER) {
|
||||||
view = inflater.inflate(R.layout.overview_fragment_nsclient, container, false);
|
view = inflater.inflate(R.layout.overview_fragment_nsclient, container, false);
|
||||||
shorttextmode = true;
|
shorttextmode = true;
|
||||||
} else if (smallHeight || landscape) {
|
} else if (smallHeight || landscape) {
|
||||||
|
@ -975,7 +975,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units));
|
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units));
|
||||||
tempTargetView.setVisibility(View.VISIBLE);
|
tempTargetView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (Config.NSCLIENT && tempTarget == null) {
|
if ((Config.NSCLIENT || Config.G5UPLOADER) && tempTarget == null) {
|
||||||
tempTargetView.setVisibility(View.GONE);
|
tempTargetView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
if (activeTemp != null) {
|
if (activeTemp != null) {
|
||||||
basalText = activeTemp.toStringFull() + " ";
|
basalText = activeTemp.toStringFull() + " ";
|
||||||
}
|
}
|
||||||
if (Config.NSCLIENT)
|
if (Config.NSCLIENT || Config.G5UPLOADER)
|
||||||
basalText += "(" + DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + " U/h)";
|
basalText += "(" + DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + " U/h)";
|
||||||
else if (pump.getPumpDescription().isTempBasalCapable) {
|
else if (pump.getPumpDescription().isTempBasalCapable) {
|
||||||
basalText += "(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + "U/h)";
|
basalText += "(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + "U/h)";
|
||||||
|
|
|
@ -72,12 +72,12 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(int type) {
|
public boolean isEnabled(int type) {
|
||||||
return type == PROFILE && (Config.NSCLIENT || fragmentEnabled);
|
return type == PROFILE && (Config.NSCLIENT || Config.G5UPLOADER|| fragmentEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisibleInTabs(int type) {
|
public boolean isVisibleInTabs(int type) {
|
||||||
return type == PROFILE && (Config.NSCLIENT || fragmentVisible);
|
return type == PROFILE && (Config.NSCLIENT || Config.G5UPLOADER|| fragmentVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,7 +92,7 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showInList(int type) {
|
public boolean showInList(int type) {
|
||||||
return !Config.NSCLIENT;
|
return !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -124,8 +124,8 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
|
|
||||||
statusView.setVisibility(View.GONE);
|
statusView.setVisibility(View.GONE);
|
||||||
|
|
||||||
boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PUMP);
|
boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class) != null && MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PUMP);
|
||||||
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginBase.PUMP);
|
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginBase.PUMP);
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
||||||
|
|
|
@ -674,7 +674,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
boolean connectionOK = danaRSService.extendedBolus(insulin, durationInHalfHours);
|
boolean connectionOK = danaRSService.extendedBolus(insulin, durationInHalfHours);
|
||||||
if (connectionOK && pump.isExtendedInProgress && Math.abs(pump.extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
|
if (connectionOK && pump.isExtendedInProgress && Math.abs(pump.extendedBolusAbsoluteRate - insulin) < getPumpDescription().extendedBolusStep) {
|
||||||
result.enacted = true;
|
result.enacted = true;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFakingTempsByExtendedBoluses() {
|
public boolean isFakingTempsByExtendedBoluses() {
|
||||||
return Config.NSCLIENT && fromNSAreCommingFakedExtendedBoluses;
|
return (Config.NSCLIENT || Config.G5UPLOADER) && fromNSAreCommingFakedExtendedBoluses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,7 +196,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect(String reason) {
|
public void connect(String reason) {
|
||||||
if (!BuildConfig.NSCLIENTOLNY)
|
if (!Config.NSCLIENT && !Config.G5UPLOADER)
|
||||||
NSUpload.uploadDeviceStatus();
|
NSUpload.uploadDeviceStatus();
|
||||||
lastDataTime = new Date();
|
lastDataTime = new Date();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package info.nightscout.androidaps.plugins.SourceDexcomG5;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 28.11.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
||||||
|
private boolean fragmentEnabled = false;
|
||||||
|
|
||||||
|
private static SourceDexcomG5Plugin plugin = null;
|
||||||
|
|
||||||
|
public static SourceDexcomG5Plugin getPlugin() {
|
||||||
|
if (plugin == null)
|
||||||
|
plugin = new SourceDexcomG5Plugin();
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentClass() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getType() {
|
||||||
|
return PluginBase.BGSOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return MainApp.instance().getString(R.string.DexcomG5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNameShort() {
|
||||||
|
// use long name as fallback (no tabs)
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(int type) {
|
||||||
|
return Config.G5UPLOADER || type == BGSOURCE && fragmentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisibleInTabs(int type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeHidden(int type) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFragment() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showInList(int type) {
|
||||||
|
return !Config.G5UPLOADER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
if (type == BGSOURCE) this.fragmentEnabled = fragmentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPreferencesId() {
|
||||||
|
return R.xml.pref_dexcomg5;
|
||||||
|
}
|
||||||
|
}
|
|
@ -108,7 +108,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showInList(int type) {
|
public boolean showInList(int type) {
|
||||||
return !Config.NSCLIENT;
|
return !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class StatuslinePlugin implements PluginBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showInList(int type) {
|
public boolean showInList(int type) {
|
||||||
return !Config.NSCLIENT;
|
return !Config.NSCLIENT && !Config.G5UPLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.queue;
|
package info.nightscout.androidaps.queue;
|
||||||
|
|
||||||
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
@ -16,6 +17,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 09.11.2017.
|
* Created by mike on 09.11.2017.
|
||||||
|
@ -61,8 +63,27 @@ public class QueueThread extends Thread {
|
||||||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(new PumpEnactResult()));
|
MainApp.bus().post(new EventDismissBolusprogressIfRunning(new PumpEnactResult()));
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.connectiontimedout)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.connectiontimedout)));
|
||||||
pump.stopConnecting();
|
pump.stopConnecting();
|
||||||
queue.clear();
|
|
||||||
return;
|
//BLUETOOTH-WATCHDOG
|
||||||
|
boolean watchdog = SP.getBoolean(R.string.key_btwatchdog, false);
|
||||||
|
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) {
|
||||||
|
log.debug("BT watchdog - toggeling the phonest bluetooth");
|
||||||
|
//write time
|
||||||
|
SP.putLong(R.string.key_btwatchdog_lastbark, System.currentTimeMillis());
|
||||||
|
//toggle BT
|
||||||
|
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
mBluetoothAdapter.disable();
|
||||||
|
SystemClock.sleep(1000);
|
||||||
|
mBluetoothAdapter.enable();
|
||||||
|
SystemClock.sleep(1000);
|
||||||
|
//start over again once after watchdog barked
|
||||||
|
connectionStartTime = System.currentTimeMillis();
|
||||||
|
} else {
|
||||||
|
queue.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pump.isConnected()) {
|
if (!pump.isConnected()) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
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;
|
||||||
|
@ -81,7 +82,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
|
boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
|
||||||
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
|
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
|
||||||
|
|
||||||
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
if (Config.APS && SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
||||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
|
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
|
||||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
|
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
|
||||||
n.soundId = R.raw.alarm;
|
n.soundId = R.raw.alarm;
|
||||||
|
@ -145,4 +146,4 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
|
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
|
||||||
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
|
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.Services.Intents;
|
import info.nightscout.androidaps.Services.Intents;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
import info.nightscout.androidaps.db.ProfileSwitch;
|
import info.nightscout.androidaps.db.ProfileSwitch;
|
||||||
|
@ -383,6 +384,30 @@ public class NSUpload {
|
||||||
DbLogger.dbAdd(intent, data.toString());
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void uploadBg(BgReading reading) {
|
||||||
|
Context context = MainApp.instance().getApplicationContext();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("action", "dbAdd");
|
||||||
|
bundle.putString("collection", "entries");
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
try {
|
||||||
|
data.put("device", "AndroidAPS-DexcomG5");
|
||||||
|
data.put("date", reading.date);
|
||||||
|
data.put("dateString", DateUtil.toISOString(reading.date));
|
||||||
|
data.put("sgv", reading.value);
|
||||||
|
data.put("direction", reading.direction);
|
||||||
|
data.put("type", "sgv");
|
||||||
|
} catch (JSONException e) {
|
||||||
|
log.error("Unhandled exception", e);
|
||||||
|
}
|
||||||
|
bundle.putString("data", data.toString());
|
||||||
|
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||||
|
intent.putExtras(bundle);
|
||||||
|
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||||
|
context.sendBroadcast(intent);
|
||||||
|
DbLogger.dbAdd(intent, data.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public static void uploadAppStart() {
|
public static void uploadAppStart() {
|
||||||
if (SP.getBoolean(R.string.key_ns_logappstartedevent, true)) {
|
if (SP.getBoolean(R.string.key_ns_logappstartedevent, true)) {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
Context context = MainApp.instance().getApplicationContext();
|
||||||
|
|
|
@ -65,7 +65,11 @@ public class SP {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public long getLong(int resourceID, Long defaultValue) {
|
static public long getLong(int resourceID, Long defaultValue) {
|
||||||
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
try {
|
||||||
|
return sharedPreferences.getLong(MainApp.sResources.getString(resourceID), defaultValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public long getLong(String key, Long defaultValue) {
|
static public long getLong(String key, Long defaultValue) {
|
||||||
|
|
|
@ -124,6 +124,16 @@
|
||||||
android:title="@string/do_not_track_profile_switch"
|
android:title="@string/do_not_track_profile_switch"
|
||||||
android:summary="@string/do_not_track_profile_switch_summary"/>
|
android:summary="@string/do_not_track_profile_switch_summary"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/bluetooth">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_btwatchdog"
|
||||||
|
android:title="@string/btwatchdog_title"
|
||||||
|
android:summary="@string/btwatchdog_summary"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
14
app/src/main/res/xml/pref_dexcomg5.xml
Normal file
14
app/src/main/res/xml/pref_dexcomg5.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="danar"
|
||||||
|
android:title="@string/dexcomg5_upload">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_dexcomg5_nsupload"
|
||||||
|
android:title="@string/dexcomg5_nsupload_title" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in a new issue