Merge pull request #10 from MilosKozak/master

update to milos master
This commit is contained in:
AdrianLxM 2016-11-10 17:59:39 +01:00 committed by GitHub
commit 37813861ec
10 changed files with 73 additions and 42 deletions

View file

@ -13,6 +13,7 @@
<uses-permission android:name="android.permission.RECEIVE_MMS" /> <uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.SEND_MMS" /> <uses-permission android:name="android.permission.SEND_MMS" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- To receive data from xdrip. --> <!-- To receive data from xdrip. -->
<uses-permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_BG_ESTIMATE" /> <uses-permission android:name="com.eveningoutpost.dexdrip.permissions.RECEIVE_BG_ESTIMATE" />

View file

@ -87,6 +87,7 @@ public class MainApp extends Application {
MainApp.getConfigBuilder().initialize(); MainApp.getConfigBuilder().initialize();
} }
MainApp.getConfigBuilder().uploadAppStart();
} }
public static Bus bus() { public static Bus bus() {

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TempBasalsInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.DanaR.comm.MsgOcclusion;
import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.DeviceStatus; import info.nightscout.androidaps.plugins.Loop.DeviceStatus;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
@ -900,4 +901,47 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
public void uploadDanaROcclusion() {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Announcement");
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("notes", MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion));
data.put("isAnnouncement", true);
} catch (JSONException e) {
e.printStackTrace();
}
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(), MsgOcclusion.class);
}
public void uploadAppStart() {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Note");
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
} catch (JSONException e) {
e.printStackTrace();
}
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(), ConfigBuilderPlugin.class);
}
} }

View file

@ -602,11 +602,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString()); extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes()); extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes());
extended.put("IsExtended", getTempBasal().isExtended); extended.put("IsExtended", getTempBasal().isExtended);
try {
extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
} catch (Exception e) {}
} }
extended.put("BaseBasalRate", getBaseBasalRate()); extended.put("BaseBasalRate", getBaseBasalRate());
try {
extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
} catch (Exception e) {}
pump.put("battery", battery); pump.put("battery", battery);
pump.put("status", status); pump.put("status", status);
@ -708,7 +708,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
// Reply for sms communicator // Reply for sms communicator
public String shortStatus() { public String shortStatus() {
final DateFormat formatTime = DateFormat.getTimeInstance(DateFormat.SHORT);
String ret = ""; String ret = "";
if (getDanaRPump().lastConnection.getTime() != 0) { if (getDanaRPump().lastConnection.getTime() != 0) {
Long agoMsec = new Date().getTime() - getDanaRPump().lastConnection.getTime(); Long agoMsec = new Date().getTime() - getDanaRPump().lastConnection.getTime();
@ -716,7 +715,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
ret += "LastConn: " + agoMin + " minago\n"; ret += "LastConn: " + agoMin + " minago\n";
} }
if (getDanaRPump().lastBolusTime.getTime() != 0) { if (getDanaRPump().lastBolusTime.getTime() != 0) {
ret += "LastBolus: " + DecimalFormatter.to2Decimal(getDanaRPump().lastBolusAmount) + "U @" + formatTime.format(getDanaRPump().lastBolusTime) + "\n"; ret += "LastBolus: " + DecimalFormatter.to2Decimal(getDanaRPump().lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", getDanaRPump().lastBolusTime) + "\n";
} }
if (isRealTempBasalInProgress()) { if (isRealTempBasalInProgress()) {
ret += "Temp: " + getRealTempBasal().toString() + "\n"; ret += "Temp: " + getRealTempBasal().toString() + "\n";

View file

@ -34,28 +34,7 @@ public class MsgOcclusion extends MessageBase {
MsgBolusStop.stopped = true; MsgBolusStop.stopped = true;
bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion); bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion);
MainApp.bus().post(bolusingEvent); MainApp.bus().post(bolusingEvent);
sendToNSClient(); MainApp.getConfigBuilder().uploadDanaROcclusion();
} }
public void sendToNSClient() {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
JSONObject data = new JSONObject();
try {
data.put("eventType", "Announcement");
data.put("created_at", DateUtil.toISOString(new Date()));
data.put("notes", MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion));
data.put("isAnnouncement", true);
} catch (JSONException e) {
e.printStackTrace();
}
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(), MsgOcclusion.class);
}
} }

View file

@ -12,6 +12,7 @@ import android.os.HandlerThread;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -421,6 +422,7 @@ public class OverviewFragment extends Fragment {
apsModeView.setOnLongClickListener(new View.OnLongClickListener() { apsModeView.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (activeloop == null){ if (activeloop == null){
log.error("no active loop?"); log.error("no active loop?");
return true; return true;

View file

@ -121,7 +121,7 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface {
queryBuilderExt.orderBy("timeIndex", false); queryBuilderExt.orderBy("timeIndex", false);
Where whereExt = queryBuilderExt.where(); Where whereExt = queryBuilderExt.where();
whereExt.eq("isExtended", true); whereExt.eq("isExtended", true);
queryBuilderExt.limit(5L); queryBuilderExt.limit(30L);
PreparedQuery<TempBasal> preparedQueryExt = queryBuilderExt.prepare(); PreparedQuery<TempBasal> preparedQueryExt = queryBuilderExt.prepare();
extendedBoluses = dao.query(preparedQueryExt); extendedBoluses = dao.query(preparedQueryExt);

View file

@ -336,6 +336,9 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
battery.put("percent", batteryPercent); battery.put("percent", batteryPercent);
status.put("status", "normal"); status.put("status", "normal");
extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION); extended.put("Version", BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION);
try {
extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile());
} catch (Exception e) {}
TempBasal tb; TempBasal tb;
if ((tb = getTempBasal()) != null) { if ((tb = getTempBasal()) != null) {
status.put("tempbasalpct", tb.percent); status.put("tempbasalpct", tb.percent);

View file

@ -6,7 +6,7 @@
<string name="treatmentssafety_maxcarbs_title">최대 허용 탄수화물 [g]</string> <string name="treatmentssafety_maxcarbs_title">최대 허용 탄수화물 [g]</string>
<string name="nav_preferences">설정</string> <string name="nav_preferences">설정</string>
<string name="nav_refreshtreatments">NS로부터 Treatments 새로고침</string> <string name="nav_refreshtreatments">NS에서 Treatments 새로고침</string>
<string name="nav_backup">백업</string> <string name="nav_backup">백업</string>
<string name="nav_test_alert">테스트 알람</string> <string name="nav_test_alert">테스트 알람</string>
<string name="nav_resetdb">데이터베이스 초기화</string> <string name="nav_resetdb">데이터베이스 초기화</string>
@ -154,7 +154,7 @@
<string name="careportal_cgmsensorinsert">CGM Sensor Insert</string> <string name="careportal_cgmsensorinsert">CGM Sensor Insert</string>
<string name="careportal_cgmsensorstart">CGM Sensor Start</string> <string name="careportal_cgmsensorstart">CGM Sensor Start</string>
<string name="careportal_insulincartridgechange">Insulin Cartridge Change</string> <string name="careportal_insulincartridgechange">Insulin Cartridge Change</string>
<string name="careportal_profileswitch">Profile Switch</string> <string name="careportal_profileswitch">프로파일 변경</string>
<string name="careportal_snackbolus">Snack Bolus</string> <string name="careportal_snackbolus">Snack Bolus</string>
<string name="careportal_mealbolus">Meal Bolus</string> <string name="careportal_mealbolus">Meal Bolus</string>
<string name="careportal_correctionbolus">Correction Bolus</string> <string name="careportal_correctionbolus">Correction Bolus</string>
@ -242,9 +242,9 @@
<string name="waitingforpumpresult">결과 기다리는 중</string> <string name="waitingforpumpresult">결과 기다리는 중</string>
<string name="smscommunicator_allowednumbers">허가된 전화번호</string> <string name="smscommunicator_allowednumbers">허가된 전화번호</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string> <string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
<string name="smscommunicator_bolusreplywithcode" formatted="false">To deliver bolus %.2fU reply with code %s</string> <string name="smscommunicator_bolusreplywithcode" formatted="false">식사주입 %.2fU 을 실행하려면 %s 를 입력하고 답장하세요</string>
<string name="bolusfailed">식사주입 실패</string> <string name="bolusfailed">식사주입 실패</string>
<string name="bolusdelivered" formatted="false">식사주입 %.2fU 성공적으로 전송됨</string> <string name="bolusdelivered" formatted="false">Bolus %.2fU delivered successfully</string>
<string name="bolusdelivering" formatted="false">%.2fU 주입중</string> <string name="bolusdelivering" formatted="false">%.2fU 주입중</string>
<string name="smscommunicator_remotecommandsallowed">SMS 원격 명령 사용하기</string> <string name="smscommunicator_remotecommandsallowed">SMS 원격 명령 사용하기</string>
<string name="remotebolusnotallowed">원격 식사주입 허용되지 않음</string> <string name="remotebolusnotallowed">원격 식사주입 허용되지 않음</string>
@ -307,19 +307,19 @@
<string name="youareonallowedlimit">허용된 제한값에 도달하였습니다</string> <string name="youareonallowedlimit">허용된 제한값에 도달하였습니다</string>
<string name="openapsma_target_bg">계산을 위한 목표 혈당 값</string> <string name="openapsma_target_bg">계산을 위한 목표 혈당 값</string>
<string name="noprofileselected">프로파일이 선택되지 않았습니다</string> <string name="noprofileselected">프로파일이 선택되지 않았습니다</string>
<string name="smscommunicator_loophasbeendisabled">Loop has been disabled</string> <string name="smscommunicator_loophasbeendisabled">Loop가 중지되었습니다.</string>
<string name="smscommunicator_loophasbeenenabled">Loop has been enabled</string> <string name="smscommunicator_loophasbeenenabled">Loop가 실행되었습니다.</string>
<string name="smscommunicator_loopisdisabled">Loop is disabled</string> <string name="smscommunicator_loopisdisabled">Loop가 중지중입니다.</string>
<string name="smscommunicator_loopisenabled">Loop is enabled</string> <string name="smscommunicator_loopisenabled">Loop가 실행중입니다.</string>
<string name="openapsma_valueoutofrange" formatted="false">값 %s 은 하드리밋(Hard Limit)를 벗어났습니다</string> <string name="openapsma_valueoutofrange" formatted="false">값 %s 은 하드리밋(Hard Limit)를 벗어났습니다</string>
<string name="remotebasalnotallowed">Remote basal setting is not allowed</string> <string name="remotebasalnotallowed">원격 기초주입설정이 허가되지 않았습니다</string>
<string name="smscommunicator_basalreplywithcode" formatted="false">To start basal %.2fU/h reply with code %s</string> <string name="smscommunicator_basalreplywithcode" formatted="false">기초주입 %.2fU/h 을 실행하려면 %s 를 입력하고 답장하세요</string>
<string name="smscommunicator_tempbasalset" formatted="false">Temp basal %.2fU/h for %d min started successfully</string> <string name="smscommunicator_tempbasalset" formatted="false">Temp basal %.2fU/h for %d min started successfully</string>
<string name="smscommunicator_tempbasalfailed">Temp basal start failed</string> <string name="smscommunicator_tempbasalfailed">임시기초주입이 실패하였습니다</string>
<string name="smscommunicator_basalstopreplywithcode" formatted="false">To stop temp basal reply with code %s</string> <string name="smscommunicator_basalstopreplywithcode" formatted="false">임시기초주입을 중지하려면 %s 를 입력하고 답장하세요</string>
<string name="smscommunicator_tempbasalcanceled">Temp basal canceled</string> <string name="smscommunicator_tempbasalcanceled">Temp basal canceled</string>
<string name="smscommunicator_tempbasalcancelfailed">Canceling temp basal failed</string> <string name="smscommunicator_tempbasalcancelfailed">임시기초주입 취소가 실패하였습니다</string>
<string name="smscommunicator_unknowncommand">Uknonwn command or wrong reply</string> <string name="smscommunicator_unknowncommand">알려지지 않은 명령이거나 잘못된 답장입니다</string>
<string name="quickwizard">퀵마법사</string> <string name="quickwizard">퀵마법사</string>
<string name="quickwizardsettings">퀵마법사 설정</string> <string name="quickwizardsettings">퀵마법사 설정</string>
@ -332,4 +332,5 @@
<string name="mealbolus">Meal</string> <string name="mealbolus">Meal</string>
<string name="correctionbous">Corr</string> <string name="correctionbous">Corr</string>
<string name="ko_lang">한국어</string> <string name="ko_lang">한국어</string>
<string name="actions">액션</string>
</resources> </resources>

View file

@ -335,5 +335,6 @@
<string name="correctionbous">Corr</string> <string name="correctionbous">Corr</string>
<string name="ko_lang">Korean</string> <string name="ko_lang">Korean</string>
<string name="actions">Actions</string> <string name="actions">Actions</string>
<string name="androidaps_start">AndroidAPS started</string>
</resources> </resources>