sync profile to pump

This commit is contained in:
Milos Kozak 2017-01-28 23:45:14 +01:00
parent b9b9e21dcb
commit 3f90ad6a5c
10 changed files with 41 additions and 30 deletions

View file

@ -92,7 +92,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResource(R.xml.pref_openapsma);
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS))
addPreferencesFromResource(R.xml.pref_openapsama);
addPreferencesFromResource(R.xml.pref_nightscout);
addPreferencesFromResource(R.xml.pref_profile);
if (Config.DANAR) {
DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);

View file

@ -11,8 +11,10 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -24,10 +26,12 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.DanaR.DanaRFragment;
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService;
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.ToastUtils;
public class KeepAliveReceiver extends BroadcastReceiver {
@ -64,6 +68,14 @@ public class KeepAliveReceiver extends BroadcastReceiver {
t.start();
}
}
PumpInterface pump = MainApp.getConfigBuilder();
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
if (pump != null && profile != null) {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
if (SP.getBoolean("syncprofiletopump", false)) {
pump.setNewBasalProfile(profile);
}
}
wl.release();
}

View file

@ -205,7 +205,7 @@
<string name="end_user_license_agreement_i_understand">РАЗБИРАМ И СЕ СЪГЛАСЯВАМ</string>
<string name="language">Език</string>
<string name="save">Сигурност</string>
<string name="syncprofiletopump_title">Синхронизирай помпата с профила в Nightscout</string>
<string name="syncprofiletopump_title">Синхронизирай помпата с профила</string>
<string name="nobtadapter">Няма bluetooth адаптер</string>
<string name="nightscout">Nightscout</string>
<string name="dismiss">Разбрах</string>

View file

@ -202,7 +202,7 @@
<string name="disconnected">Odpojeno</string>
<string name="danar_bt_name_title">DanaR Bluetooth zařízení</string>
<string name="danar_pump_settings">DanaR nastavení</string>
<string name="syncprofiletopump_title">Synchronizovat NS profil do pumpy</string>
<string name="syncprofiletopump_title">Synchronizovat profil do pumpy</string>
<string name="nightscout">Nightscout</string>
<string name="absolute">Absolutní</string>
<string name="comment">Komentář</string>

View file

@ -235,7 +235,7 @@
<string name="hoursago">vor h </string>
<string name="smscommunicator">SMS Kommunikator</string>
<string name="smscommunicator_allowednumbers">erlaubte Telefonnummern</string>
<string name="syncprofiletopump_title">Nightscout Profil zur Pumpe synchronisieren</string>
<string name="syncprofiletopump_title">Profil zur Pumpe synchronisieren</string>
<string name="waitingforpumpresult">auf Pumpenergebnis warten</string>
<string name="nobtadapter">Kein Bluetoothadapter gefunden</string>
<string name="smscommunicator_remotebolusnotallowed">Remote Bolus nicht erlaubt</string>

View file

@ -209,7 +209,7 @@
<string name="connecting">Conectando</string>
<string name="connected">Conectado</string>
<string name="disconnected">Desconectado</string>
<string name="syncprofiletopump_title">Sincronizar perfil NS a bomba</string>
<string name="syncprofiletopump_title">Sincronizar perfil a bomba</string>
<string name="danar_pump_settings">Ajustes de la bomba DanaR</string>
<string name="nightscout">Nightscout</string>
<string name="end_user_license_agreement">Acuerdo de licencia de usuario final</string>

View file

@ -211,7 +211,7 @@
<string name="connecting">연결중</string>
<string name="connected">연결됨</string>
<string name="disconnected">연결 끊김</string>
<string name="syncprofiletopump_title">NS 프로파일을 펌프에 동기화하기</string>
<string name="syncprofiletopump_title">프로파일을 펌프에 동기화하기</string>
<string name="danar_pump_settings">다나R 펌프 설정</string>
<string name="nightscout">Nightscout</string>
<string name="end_user_license_agreement">End User License Agreement</string>

View file

@ -220,7 +220,7 @@
<string name="connecting">Connecting</string>
<string name="connected">Connected</string>
<string name="disconnected">Disconnected</string>
<string name="syncprofiletopump_title">Sync Nightscout profile to pump</string>
<string name="syncprofiletopump_title">Sync profile to pump</string>
<string name="danar_pump_settings">DanaR pump settings</string>
<string name="nightscout">Nightscout</string>
<string name="end_user_license_agreement">End User License Agreement</string>
@ -454,4 +454,5 @@
<string name="advancedsettings_title">Advanced Settings</string>
<string name="virtualpump_firmware_label">Firmware:</string>
<string formatted="false" name="danar_model">Model: %02X Protocol: %02X Code: %02X</string>
<string name="profile">Profile</string>
</resources>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="nigthscout"
android:title="@string/nightscout">
android:key="profile"
android:title="@string/profile">
<SwitchPreference
android:defaultValue="false"

View file

@ -43,13 +43,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/fullDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/assets" type="java-test-resource" />
@ -58,6 +51,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testFullDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/full/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/full/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/full/assets" type="java-resource" />
@ -106,14 +106,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@ -122,8 +114,17 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.3.0/jars" />
@ -133,15 +134,12 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/ustwo-clockwise-debug/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
@ -155,4 +153,4 @@
<orderEntry type="library" exported="" name="play-services-base-7.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
</component>
</module>
</module>